query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Get a RUM application.
|
def get_rum_application(id, opts = {})
data, _status_code, _headers = get_rum_application_with_http_info(id, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_rum_applications(opts = {})\n data, _status_code, _headers = get_rum_applications_with_http_info(opts)\n data\n end",
"def app\n App.load(self.app_id)\n end",
"def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end",
"def roby_app\n @roby_app ||= interface.app\n end",
"def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend",
"def app_by_id(id)\n get(\"/apps/#{id}\")\n end",
"def app(name=nil)\n if @app.nil? && name.nil? && Remotely.apps.size == 1\n name = Remotely.apps.first.first\n end\n\n (name and @app = name) or @app\n end",
"def get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end",
"def get_opsworks_app\n data = opsworks_client.describe_apps(app_ids: [app_id])\n if !(data[:apps] && data[:apps].count == 1)\n raise Error, \"App #{app_id} not found.\", error.backtrace\n end\n data[:apps].first\n end",
"def get_applications\n http_get_request(Scalarium.applications_url)\n end",
"def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end",
"def get id\n apps.select do |app|\n app.id == id\n end.first\n end",
"def default_app()\n @apps[0]\n end",
"def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end",
"def get_rum_application_with_http_info(id, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_application ...'\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 RUMAPI.get_rum_application\"\n end\n # resource path\n local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/'))\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\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMApplicationResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_rum_application,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#get_rum_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def app\n defined?(@app) ? @app : build_app\n end",
"def application\n [email protected]? && @modes.has_key?(@settings[:mode]) ? @modes[@settings[:mode]][:app] : \"unknown\"\n end",
"def application\n return @application\n end",
"def application\n Application.new self[:application]\n end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\n end",
"def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\n end",
"def app(id_or_name_or_package_id)\n all_available_apps.find do |app|\n [app.name, app.id, app.package_id].include?(id_or_name_or_package_id)\n end\n end",
"def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end",
"def application\n # If we have a doorkeeper_token, derive the Application from it.\n # If not, we're in case #1 above and the Application should be nil.\n @application ||= @doorkeeper_token.try(:application)\n end",
"def application\n @env.fetch( :application, \"N/A\" )\n end",
"def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end",
"def app_for(name)\n app_name = app?(name) ? name : \"all\"\n\n @apps[name] ||= App.new(app_name, @roots)\n end",
"def fetch_app_by_id(id)\n page = request(app_url,{:id => id})\n raise StoreRequestError unless page.code == \"200\"\n plist = Plist::parse_xml(page.body)\n return nil if plist[\"status-code\"]\n app = App.new(plist[\"item-metadata\"])\n end",
"def get_application_version()\n res = search(\"/ApplicationStatus\")\n root = JSON.parse(res.xmldata)\n\n if ! root.has_key? 'application'\n return nil\n end\n application = root[\"application\"]\n if ! application.has_key? 'user'\n return nil\n end\n user = application[\"user\"]\n if ! user.has_key? 'version'\n return nil\n end\n return user[\"version\"]\n end",
"def app\n @options[:app]\n end",
"def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end",
"def get_rum_applications_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_applications ...'\n end\n # resource path\n local_var_path = '/api/v2/rum/applications'\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\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMApplicationsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_rum_applications,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#get_rum_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"def app\n @app\n end",
"def app data={}\n get '/app', data\n end",
"def app\n path = File.expand_path('../config.ru', File.dirname(__FILE__))\n @app ||= Rack::Builder.parse_file(path).first\n end",
"def fetch_app_by_id(id, store='143441')\n page = request(app_url,{:id => id}, store)\n raise StoreRequestError unless page.code == \"200\"\n plist = Plist::parse_xml(page.body)\n return nil if plist[\"status-code\"]\n app = App.new(plist[\"item-metadata\"])\n end",
"def app\n @app ||= Rack::Builder.parse_file(File.join(OpenRecipeApp.root,\"config.ru\"))[0]\n end",
"def application\n self\n end",
"def app\n @app ||= LiuLunch\n end",
"def current_application\n # Get from last year for Postgresql\n @current_application ||= self.applications.current.first\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end",
"def app\n @app ||= begin\n lock!\n to_app\n end\n end",
"def client_app(client_id)\n Doorkeeper::Application.all.find { |app| app.uid == client_id }\n end",
"def applications_list\n get \"applications\"\n end",
"def show\n @application = Application.find(params[:id])\n end",
"def app_with_name name\n AX::Application.new name\n end",
"def set_application\n @application = Oread::Application.find(params[:id])\n end",
"def current_application(request)\n app_selector.call(request, applications)\n end",
"def fetch_user_application\n @user_application = UserApplication.find(params[:id])\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 fetch_app(name)\r\n return name if SAMPLES[name].nil?\r\n \"#{name}/#{SAMPLES[name]}\"\r\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def find_app(what, item, app)\n id = get_id(what, item)\n the_app = get_app(what, app, id)\n raise \"#{what} #{item['text']} app #{app} not found\" unless the_app\n the_app\n end",
"def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def get_room_by_application(company, application_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.get '/messages/v3/' + company + '/rooms/applications/' + application_id, params\n end",
"def get_app_name(app_name)\n app_file = $pkg_dir+\"/\"+app_name.downcase.gsub(/ |-/,'_')+\".rb\"\n if File.exist?(app_file)\n app_name = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_app_name()\")\n else\n app_list = Dir.entries($pkg_dir)\n tmp_name = app_list.grep(/^#{app_name.downcase.gsub(/ |-/,'_')}/)[0]\n if tmp_name\n tmp_name = tmp_name.gsub(/\\.rb/,\"\")\n else\n puts\n end\n if tmp_name =~ /[A-z]/\n if $verbose == 1\n puts \"Application profile \"+app_name+\" not found\"\n puts \"Found profile \"+tmp_name\n end\n app_name = eval(\"get_#{tmp_name.downcase.gsub(/ |-/,'_')}_app_name()\")\n else\n puts \"Application \"+app_name+\" not found\"\n puts\n puts \"Available Applications:\"\n puts\n print_avail_pkgs()\n puts\n exit\n end\n end\n return app_name\nend",
"def set_app\n @app = current_user.apps.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:uid])\n end",
"def get_application(application_id, opts = {})\n data, _status_code, _headers = get_application_with_http_info(application_id, opts)\n data\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 set_application\n @application = Application.where(token: params[:id]).first\n end",
"def current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end",
"def user_apps\n Application.with_user(session[:user_id])\n end",
"def set_app\n @app = App.with_roles(%i[admin notifier], current_user).find(params[:id] || params[:app_id])\n end",
"def app\n app_class.new\n end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file(\"config.ru\").first\nend",
"def main_app\n @main_app\n end",
"def show\n @application = Application.find(params[:id])\n end",
"def oauth_application(token)\n request(\n __method__,\n :get,\n \"#{api_base}/oauth2/applications/@me\",\n Authorization: token\n )\n end",
"def instance(name)\n apps[name] ||= new\n end",
"def instance(name)\n apps[name] ||= new\n end",
"def find_or_create_app(app_name)\n create_app(app_name)\n rescue\n @heroku.app.info(app_name)\n end",
"def app\n @app\n end",
"def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend",
"def show\n @app = App.find_by_id(params[:id])\n if (@app)\n Rabl.render(@app, 'api/apps/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid app\"}\n end\n end",
"def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end",
"def create_rum_application(body, opts = {})\n data, _status_code, _headers = create_rum_application_with_http_info(body, opts)\n data\n end",
"def bot_application\n return unless @type == :bot\n\n response = API.oauth_application(token)\n Application.new(JSON.parse(response), self)\n end",
"def load_app\n require File.expand_path(File.join('config', 'application.rb'))\n @app ||= Rails.application\n end",
"def app_with_pid pid\n AX::Application.new pid\n end",
"def get_app_script\n # App should exist and be accessible\n app = App.accessible_by(@context).find_by_uid(unsafe_params[:id])\n fail \"Invalid app id\" if app.nil?\n\n render plain: app.code\n end",
"def metadata_any_app_get(name)\n app = node.apps.detect {|a| a.metadata?(name) } and app.metadata?(name)\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend",
"def application\n @ref.application.to_ruby\n end",
"def typus_application\n Typus::Configuration.config[name][\"application\"] || \"Unknown\"\n end",
"def resource_application\n return @resource_application\n end",
"def application\n @application ||= parent.application if parent\n end",
"def add_application(appname)\n app = self[appname]\n if !app\n app = Application.new(appname)\n @applications << app\n end\n yield app if block_given?\n return app\n end"
] |
[
"0.68203694",
"0.6739275",
"0.6705859",
"0.66802746",
"0.6674283",
"0.66742724",
"0.66585577",
"0.65514684",
"0.6469167",
"0.6442275",
"0.6401066",
"0.6394888",
"0.6299214",
"0.6255379",
"0.62467337",
"0.62464064",
"0.6245272",
"0.62288606",
"0.6224524",
"0.61448985",
"0.6132679",
"0.61188924",
"0.6112758",
"0.6108075",
"0.6100213",
"0.6097711",
"0.6091087",
"0.6077378",
"0.60651976",
"0.60565025",
"0.60524714",
"0.6042548",
"0.60088015",
"0.60002685",
"0.5971826",
"0.5937885",
"0.5925113",
"0.58942425",
"0.58780366",
"0.58728576",
"0.58636403",
"0.58567154",
"0.58508766",
"0.5842142",
"0.5835994",
"0.582611",
"0.58003134",
"0.5788355",
"0.57829946",
"0.57803166",
"0.5775113",
"0.5764073",
"0.57619745",
"0.5756792",
"0.57420707",
"0.57395345",
"0.5733672",
"0.5733095",
"0.57310575",
"0.57296",
"0.5726945",
"0.5720126",
"0.5720126",
"0.5717524",
"0.5711406",
"0.5706518",
"0.5702425",
"0.5689181",
"0.56881857",
"0.568572",
"0.568426",
"0.5671762",
"0.5667622",
"0.56646425",
"0.565291",
"0.56452954",
"0.5640749",
"0.5640203",
"0.5638985",
"0.5637211",
"0.5622707",
"0.5574981",
"0.5565472",
"0.5563477",
"0.5560608",
"0.55596584",
"0.55596584",
"0.55596584",
"0.55596584",
"0.55596584",
"0.55596584",
"0.55596584",
"0.55596584",
"0.55596584",
"0.5558315",
"0.55577505",
"0.5554977",
"0.5554361",
"0.55538374",
"0.5552815"
] |
0.7070075
|
0
|
Get a RUM application. Get the RUM application with given ID in your organization.
|
def get_rum_application_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_application ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling RUMAPI.get_rum_application"
end
# resource path
local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/'))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'RUMApplicationResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :get_rum_application,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#get_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def app_by_id(id)\n get(\"/apps/#{id}\")\n end",
"def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end",
"def get_rum_application(id, opts = {})\n data, _status_code, _headers = get_rum_application_with_http_info(id, opts)\n data\n end",
"def get id\n apps.select do |app|\n app.id == id\n end.first\n end",
"def fetch_app_by_id(id)\n page = request(app_url,{:id => id})\n raise StoreRequestError unless page.code == \"200\"\n plist = Plist::parse_xml(page.body)\n return nil if plist[\"status-code\"]\n app = App.new(plist[\"item-metadata\"])\n end",
"def get_application(application_id, opts = {})\n data, _status_code, _headers = get_application_with_http_info(application_id, opts)\n data\n end",
"def get_opsworks_app\n data = opsworks_client.describe_apps(app_ids: [app_id])\n if !(data[:apps] && data[:apps].count == 1)\n raise Error, \"App #{app_id} not found.\", error.backtrace\n end\n data[:apps].first\n end",
"def app(id_or_name_or_package_id)\n all_available_apps.find do |app|\n [app.name, app.id, app.package_id].include?(id_or_name_or_package_id)\n end\n end",
"def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end",
"def fetch_app_by_id(id, store='143441')\n page = request(app_url,{:id => id}, store)\n raise StoreRequestError unless page.code == \"200\"\n plist = Plist::parse_xml(page.body)\n return nil if plist[\"status-code\"]\n app = App.new(plist[\"item-metadata\"])\n end",
"def get_room_by_application(company, application_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.get '/messages/v3/' + company + '/rooms/applications/' + application_id, params\n end",
"def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"def get_application(opts = {})\n data, _status_code, _headers = get_application_with_http_info(opts)\n data\n end",
"def get_rum_applications(opts = {})\n data, _status_code, _headers = get_rum_applications_with_http_info(opts)\n data\n end",
"def fetch_user_application\n @user_application = UserApplication.find(params[:id])\n end",
"def show\n @app = App.find_by_id(params[:id])\n if (@app)\n Rabl.render(@app, 'api/apps/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid app\"}\n end\n end",
"def show\n @application = Application.find(params[:id])\n end",
"def app\n App.load(self.app_id)\n end",
"def application(applicant_id)\n request(:get, \"applicant_tracking/applications/#{applicant_id}\")\n end",
"def show\n @application = Application.find(params[:id])\n end",
"def get_rum_applications_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_applications ...'\n end\n # resource path\n local_var_path = '/api/v2/rum/applications'\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\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMApplicationsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_rum_applications,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#get_rum_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_current_application_information\n response = request(\n :oauth2_applications_me, nil,\n :get,\n \"oauth2/applications/@me\"\n )\n Rapture::OauthApplication.from_json(response.body)\n end",
"def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end",
"def get_applications\n http_get_request(Scalarium.applications_url)\n end",
"def oauth_application(token)\n request(\n __method__,\n :get,\n \"#{api_base}/oauth2/applications/@me\",\n Authorization: token\n )\n end",
"def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end",
"def set_application\n @application = Oread::Application.find(params[:id])\n end",
"def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend",
"def set_app\n @app = current_user.apps.find(params[:id])\n end",
"def app(name=nil)\n if @app.nil? && name.nil? && Remotely.apps.size == 1\n name = Remotely.apps.first.first\n end\n\n (name and @app = name) or @app\n end",
"def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def application_id\n @application_id || YodleeApi.application_id\n end",
"def update(id, optional_params = {})\n response = Network.post(['Applications', id], optional_params)\n Application.new(response)\n end",
"def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end",
"def get_application_with_http_info(application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_application ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_application\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_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\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] || 'Application' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\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: ManagementApi#get_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_application\n @application = Application.where(token: params[:id]).first\n end",
"def client_app(client_id)\n Doorkeeper::Application.all.find { |app| app.uid == client_id }\n end",
"def set_application\n @application = current_user.oauth_applications.find(params[:id])\n end",
"def set_application\n @application = current_user.applications.find(params[:id])\n end",
"def show\n @user ||= current_user\n @app = @user.apps.find(params[:id]) \n end",
"def get_app_script\n # App should exist and be accessible\n app = App.accessible_by(@context).find_by_uid(unsafe_params[:id])\n fail \"Invalid app id\" if app.nil?\n\n render plain: app.code\n end",
"def current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end",
"def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end",
"def show\n respond_with @application = Application.find(params[:id])\n end",
"def show\n @app = App.find_by(uid: params[:uid]) \n end",
"def get_vapp(id)\n fog_service_interface.get_vapp(id)\n end",
"def show\n @app = current_user.apps.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def roby_app\n @roby_app ||= interface.app\n end",
"def set_api_application\n @api_application = ApiApplication.find(params[:id])\n end",
"def get_application_command(command_id, server_id: nil)\n resp = if server_id\n API::Application.get_guild_command(@token, profile.id, server_id, command_id)\n else\n API::Application.get_global_command(@token, profile.id, command_id)\n end\n ApplicationCommand.new(JSON.parse(resp), self, server_id)\n end",
"def accounts_account_id_apps_get(account_id, opts = {})\n data, _status_code, _headers = accounts_account_id_apps_get_with_http_info(account_id, opts)\n data\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.with_roles(%i[admin notifier], current_user).find(params[:id] || params[:app_id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def find_app(what, item, app)\n id = get_id(what, item)\n the_app = get_app(what, app, id)\n raise \"#{what} #{item['text']} app #{app} not found\" unless the_app\n the_app\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def get_application_version()\n res = search(\"/ApplicationStatus\")\n root = JSON.parse(res.xmldata)\n\n if ! root.has_key? 'application'\n return nil\n end\n application = root[\"application\"]\n if ! application.has_key? 'user'\n return nil\n end\n user = application[\"user\"]\n if ! user.has_key? 'version'\n return nil\n end\n return user[\"version\"]\n end",
"def application_id\n return @application_id\n end",
"def set_app\n @app = current_user.apps.find(params[:app_id])\n end",
"def get_container_application(container_application_id, opts = {})\n data, _status_code, _headers = get_container_application_with_http_info(container_application_id, opts)\n data\n end",
"def app_id\n @app.id\n end",
"def app\n defined?(@app) ? @app : build_app\n end",
"def show\t\t\n\t\t@app = Application.find_by_id(params[:id])\n\t\t@key = ApiKey.find_by_application_id(@app)\n\t\tis_owner_of_application(@app.developer)\n\tend",
"def applications_list\n get \"applications\"\n end",
"def applications_with_app_id(app_id)\n raise StandardError, 'app_id cannot be null' if app_id.nil?\n return ApplicationsWithAppIdRequestBuilder.new(@path_parameters, @request_adapter, appId)\n end",
"def app data={}\n get '/app', data\n end",
"def show\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobileapp }\n end\n end",
"def delete(id)\n response = Network.delete(['Applications', id])\n Application.new(response)\n end",
"def set_application\n @application = applications_scope.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:uid])\n end",
"def get_app_spec\n # App should exist and be accessible\n app = App.accessible_by(@context).find_by_uid(unsafe_params[:id])\n fail \"Invalid app id\" if app.nil?\n\n render json: { spec: app.spec, assets: app.ordered_assets, packages: app.packages }\n end",
"def set_app\n @app = FortyTwo::App.find(params[:id])\n end",
"def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end"
] |
[
"0.7585172",
"0.75727016",
"0.7501526",
"0.7126829",
"0.6787501",
"0.6715384",
"0.6643006",
"0.6607145",
"0.66043967",
"0.650721",
"0.64870113",
"0.64225805",
"0.64199555",
"0.63546413",
"0.6250305",
"0.61794657",
"0.6168167",
"0.6141745",
"0.61112094",
"0.6073163",
"0.603238",
"0.60075283",
"0.59598666",
"0.5933523",
"0.59260976",
"0.5911227",
"0.5909163",
"0.5900142",
"0.58729243",
"0.5872547",
"0.58602613",
"0.58602285",
"0.5853531",
"0.5847129",
"0.58251166",
"0.5799433",
"0.5795135",
"0.5778289",
"0.576626",
"0.57529044",
"0.5752367",
"0.5748648",
"0.5724964",
"0.5691747",
"0.56887716",
"0.5682623",
"0.5646169",
"0.5644826",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.5622525",
"0.562237",
"0.56023765",
"0.5595569",
"0.5582714",
"0.558133",
"0.558133",
"0.558133",
"0.558133",
"0.558133",
"0.558133",
"0.558133",
"0.558133",
"0.558133",
"0.55777985",
"0.55724466",
"0.55724466",
"0.55724466",
"0.55724466",
"0.5569797",
"0.5557949",
"0.5546074",
"0.5544248",
"0.55374604",
"0.5531226",
"0.5526525",
"0.5516764",
"0.55085933",
"0.549868",
"0.54898155",
"0.5483677",
"0.54719746",
"0.54651386",
"0.54590887",
"0.54343945",
"0.54300404",
"0.53978735",
"0.53976524"
] |
0.6951836
|
4
|
List all the RUM applications.
|
def get_rum_applications(opts = {})
data, _status_code, _headers = get_rum_applications_with_http_info(opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def applications_list\n get \"applications\"\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end",
"def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end",
"def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend",
"def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend",
"def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end",
"def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def get_applications\n http_get_request(Scalarium.applications_url)\n end",
"def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end",
"def index\n if current_user\n @applications = Application.where(user_id: current_user.id)\n else\n redirect_to root_path\n end\n end",
"def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\n end",
"def index\n @apps = Application.order(:name).all\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def index\n @user_applications = UserApplication.all\n end",
"def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end",
"def index\n respond_with @applications = Application.all\n end",
"def index\n set_meta_tags title: 'Collections - Repositories | Admin | Settings'\n # oread_application_ownerships\n @applications = Oread::Application.order(name: :asc)\n end",
"def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend",
"def index\n @mapps = Mapp.all\n end",
"def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end",
"def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end",
"def list\n ridley.environment.all\n end",
"def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend",
"def applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end",
"def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end",
"def applications\n get(PLURAL_PATH, RESOURCE)\n end",
"def list_apps\n render :text => app_configs.keys\n end",
"def index\n @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end",
"def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def index\n if current_user.has_role? :admin\n @applications = Application.all\n else\n redirect_to root_path\n end\n end",
"def show\n @app_resouces = @app_list.app_resouces.all\n end",
"def index\n @applists = Applist.all\n end",
"def index\n @applications = @application_scope\n end",
"def index\n @userapplications = Userapplication.page(params[:page]).per(5)\n end",
"def index\n @mobile_apps = MobileApp.all\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end",
"def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end",
"def get_application_list(opts = {})\n data, _status_code, _headers = get_application_list_with_http_info(opts)\n data\n end",
"def index\n unless params[:user_id].nil?\n user = User.find_by_user_id(params[:user_id]) \n @applications = Application.where(user: user) unless user.nil?\n @applications ||= []\n @applications.each { |a| a.nursery.count_applications(a.date) }\n else\n @applications = Application.all\n end\n end",
"def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end",
"def index\n @registered_apps = RegisteredApp.all\n end",
"def ls\n show_fields = options[:l] ? %w[name appid stateflags sizeondisk] : %w[name]\n output = @apps.map do |id, app|\n app.select{ |field| show_fields.include?(field) }\n end\n\n puts output.map{ |o| o.values.join(\"\\t\")}.join(\"\\n\")\n end",
"def list_by_param(params = {})\n applications = []\n\n res = list_json(params)\n unless res.nil?\n data = res['data']\n\n data.each do |item|\n applications << Application.new(item)\n end\n\n applications\n end\n end",
"def index\n @herga_applications = HergaApplication.all\n end",
"def applications\n return @applications\n end",
"def applications\n return @applications\n end",
"def index\n @activity_applications = ActivityApplication.all\n end",
"def index\n @driver_applications = DriverApplication.all\n end",
"def index\n @apps = Addon.all\n end",
"def all\n @applications = policy_scope(Application)\n all_job_offers\n if params[:status].present?\n @applications = @applications.where(\"status ILIKE ?\", params[:status])\n end\n end",
"def index\n @residential_applications = ResidentialApplication.all\n end",
"def index\n @client_applications = ClientApplication.all\n end",
"def list\n apps = Hermes::Route.list(Hash[options.map{|(k,v)| [k.to_sym,v]}])\n if !apps.empty?\n puts \"Apps:\"\n apps.each do |app|\n puts \" - #{app}\"\n end\n else\n puts \"No apps routed\"\n end\n end",
"def index\n @agent_applications = AgentApplication.all\n end",
"def index\n @jobapplications = Jobapplication.all\n end",
"def apps\n collect\n end",
"def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end",
"def index\n @maapps = Maapp.all\n end",
"def index\n @visa_applications = VisaApplication.all\n end",
"def index\n @apps = @call.app_class.unscoped.all(:order => :id)\n end",
"def index\n @project_applications = ProjectApplication.all\n end",
"def apps(criteria = {})\n all_available_apps.filter_with_criteria(criteria)\n end",
"def index\n @apps = current_user.apps.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @apps }\n end\n end",
"def index\n @job_applications = JobApplication.all\n end",
"def index\n @q = App.ransack(params[:q])\n @apps = @q.result(distinct: true)\n end",
"def applications\n @applications ||= [default_application]\n end",
"def index\n @apps = App.find(:all, :params => {:user_id => current_user.id}).sort { |x,y| x.created_at <=> y.created_at }\n end",
"def index\n @manage_app_versions = Manage::AppVersion.all\n end",
"def index\n @qy_apps = QyApp.all\n end",
"def index\n @merchant_applications = MerchantApplication.all\n end",
"def aps_application_names(start = 0, count = 1)\n a = redis.smembers(:aps_applications)\n return a if count == 0\n a[start..(start + count)] || []\n end",
"def index\n @applications = Application.find(:all,:conditions=>['user_id=?',current_user.id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @applications }\n end\n end",
"def index\n set_records_count_header(filterBySearch(applications_scope))\n @applications = filterBySearch(applications_scope).offset(params[:offset] || 0).limit(params[:limit] || 6)\n render json: @applications.all\n end",
"def apps_by_status(status)\n apps(:status => status)\n end",
"def apps\n @apps.keys\n end",
"def apps_single_app_mode_list\n return @apps_single_app_mode_list\n end",
"def apps\n unless @apps\n load!\n end\n\n @apps\n end",
"def get_rum_applications_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_applications ...'\n end\n # resource path\n local_var_path = '/api/v2/rum/applications'\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\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMApplicationsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_rum_applications,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#get_rum_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def apps\n return @apps\n end",
"def index\n @appList = AppProdu.getAppIdAndNameList current_member.id\n end",
"def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\n end\n end",
"def index\n @appdata = Appdatum.all\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def index\n @task_applications = TaskApplication.all\n end",
"def index\n @desarrollo_apps = DesarrolloApp.all\n end",
"def index\n @test_apps = TestApp.all\n end",
"def index\n @test_apps = TestApp.all\n end"
] |
[
"0.7688058",
"0.71771026",
"0.71689224",
"0.70924443",
"0.70924443",
"0.7086369",
"0.7084254",
"0.7034559",
"0.7034559",
"0.7034559",
"0.7034559",
"0.69031674",
"0.6845617",
"0.68409914",
"0.68332",
"0.67965364",
"0.6757214",
"0.6749461",
"0.66785157",
"0.6670607",
"0.6558551",
"0.6517139",
"0.64929235",
"0.6486729",
"0.64659905",
"0.64452296",
"0.6424817",
"0.6419561",
"0.64157933",
"0.6409246",
"0.6407496",
"0.6405911",
"0.6405217",
"0.6381621",
"0.63500917",
"0.634716",
"0.6342363",
"0.6342363",
"0.6342363",
"0.6342363",
"0.6342363",
"0.633706",
"0.63294643",
"0.6317256",
"0.6306281",
"0.629279",
"0.62742215",
"0.62547076",
"0.624917",
"0.62265754",
"0.6205536",
"0.61996204",
"0.61863816",
"0.61852264",
"0.61742306",
"0.6172605",
"0.61587703",
"0.61472905",
"0.61472905",
"0.61333126",
"0.6132144",
"0.61287403",
"0.6118261",
"0.61148393",
"0.6114829",
"0.6105143",
"0.6100311",
"0.6090227",
"0.6089778",
"0.60695094",
"0.60673916",
"0.6044775",
"0.6011611",
"0.6010202",
"0.598843",
"0.59876126",
"0.59830135",
"0.59826064",
"0.598235",
"0.5961321",
"0.59604084",
"0.5939917",
"0.59351814",
"0.5917876",
"0.5899329",
"0.5896582",
"0.58962977",
"0.58879465",
"0.58877623",
"0.5881306",
"0.58392864",
"0.5832371",
"0.58147436",
"0.5813733",
"0.5805564",
"0.58045036",
"0.5797531",
"0.57937425",
"0.57873213",
"0.57873213"
] |
0.7066129
|
7
|
List all the RUM applications. List all the RUM applications in your organization.
|
def get_rum_applications_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_applications ...'
end
# resource path
local_var_path = '/api/v2/rum/applications'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'RUMApplicationsResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :get_rum_applications,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#get_rum_applications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def applications_list\n get \"applications\"\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def index\n if current_user\n @applications = Application.where(user_id: current_user.id)\n else\n redirect_to root_path\n end\n end",
"def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def get_rum_applications(opts = {})\n data, _status_code, _headers = get_rum_applications_with_http_info(opts)\n data\n end",
"def index\n set_meta_tags title: 'Collections - Repositories | Admin | Settings'\n # oread_application_ownerships\n @applications = Oread::Application.order(name: :asc)\n end",
"def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end",
"def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end",
"def index\n @user_applications = UserApplication.all\n end",
"def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend",
"def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend",
"def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\n end",
"def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end",
"def get_applications\n http_get_request(Scalarium.applications_url)\n end",
"def index\n if current_user.has_role? :admin\n @applications = Application.all\n else\n redirect_to root_path\n end\n end",
"def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end",
"def index\n respond_with @applications = Application.all\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def index\n @apps = Application.order(:name).all\n end",
"def index\n @applications = @application_scope\n end",
"def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend",
"def index\n @residential_applications = ResidentialApplication.all\n end",
"def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end",
"def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end",
"def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end",
"def index\n @mapps = Mapp.all\n end",
"def index\n @mobile_apps = MobileApp.all\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end",
"def index\n @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end",
"def index\n unless params[:user_id].nil?\n user = User.find_by_user_id(params[:user_id]) \n @applications = Application.where(user: user) unless user.nil?\n @applications ||= []\n @applications.each { |a| a.nursery.count_applications(a.date) }\n else\n @applications = Application.all\n end\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end",
"def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"def applications\n get(PLURAL_PATH, RESOURCE)\n end",
"def index\n @userapplications = Userapplication.page(params[:page]).per(5)\n end",
"def app_list\n host_os_family.app_list( self )\n end",
"def index\n @activity_applications = ActivityApplication.all\n end",
"def index\n @merchant_applications = MerchantApplication.all\n end",
"def applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\n end",
"def show\n @app_resouces = @app_list.app_resouces.all\n end",
"def index\n @apps = current_user.apps.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @apps }\n end\n end",
"def index\n @agent_applications = AgentApplication.all\n end",
"def list_apps\n render :text => app_configs.keys\n end",
"def index\n @jobapplications = Jobapplication.all\n end",
"def index\n @applists = Applist.all\n end",
"def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend",
"def all\n @applications = policy_scope(Application)\n all_job_offers\n if params[:status].present?\n @applications = @applications.where(\"status ILIKE ?\", params[:status])\n end\n end",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def index\n @apps = App.all\n end",
"def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end",
"def index\n @applications = Application.find(:all,:conditions=>['user_id=?',current_user.id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @applications }\n end\n end",
"def list\n ridley.environment.all\n end",
"def index\n @herga_applications = HergaApplication.all\n end",
"def index\n @project_applications = ProjectApplication.all\n end",
"def index\n @applications = @opportunity.applications\n end",
"def index\n @membership_applications = MembershipApplication.all\n end",
"def index\n @registered_apps = RegisteredApp.all\n end",
"def index\n @job_applications = JobApplication.all\n end",
"def index\n @maapps = Maapp.all\n end",
"def index\n set_records_count_header(filterBySearch(applications_scope))\n @applications = filterBySearch(applications_scope).offset(params[:offset] || 0).limit(params[:limit] || 6)\n render json: @applications.all\n end",
"def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end",
"def index\n @apps = Addon.all\n end",
"def index\n $lmc_left_menu = \"lmw_all_jobs\"\n $lmc_subleft_menu = \"lmw_job_applications\"\n @user = current_user\n @job_applications_ids = current_user.job_applications.pluck(:job_id)\n @job_applications = Job.where(id: @job_applications_ids).text_search(params[:query], params[:town], params[:status])\n end",
"def index\n @client_applications = ClientApplication.all\n end",
"def index\n @visa_applications = VisaApplication.all\n end",
"def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end",
"def index\n @user_edorg = session[:edOrgId]\n\n load_apps()\n\n # create a list of app auth info including edorgs element, count of authorized edorgs, and app name\n @app_auth_info = []\n user_app_auths = ApplicationAuthorization.findAllInChunks\n user_app_auths.each do |auth|\n info = {}\n app = @apps_map[auth.appId]\n info[:edorg_auth] = auth\n info[:count] = get_edorg_auth_count(auth)\n info[:name] = app ? app.name : ''\n @app_auth_info.push(info)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end",
"def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\n end\n end",
"def index\n jobs = current_user.hr.jobs\n @applications = Array.new\n jobs.each do |job|\n job_faculties_map = Hash.new\n job_faculties_map[job] = Array.new\n if job.faculties.length > 0\n job.faculties.each do |faculty|\n job_faculties_map[job] << faculty\n end\n @applications << job_faculties_map\n end\n end\n @applications\n end",
"def index\n if current_user.role == 'employee'\n @job_applications_made = current_user.employee.job_applications\n else\n @job_applications = JobApplication.all\n end\n end",
"def index\n #@apps = App.all\n name = params[:name]\n platform = params[:platform]\n category = params[:category]\n @apps = App.search(name, platform, category)\n #@apps = App.search(params[:search])\n end",
"def applications\n instantiate_models Application, session.get('operations/application')\n end",
"def index\n @q = App.ransack(params[:q])\n @apps = @q.result(distinct: true)\n end",
"def applications\n return @applications\n end",
"def applications\n return @applications\n end",
"def index\n @job_site_applications = JobSiteApplication.all\n end",
"def index\n @user=current_user\n @jobapplications = @user.jobapplications\n end",
"def index\n @user_accounts_app = User.where(\"role=? and is_register=?\",USER_ROLE, 0).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_account_apps }\n end\n end",
"def index\n @alapps = Alapp.all\n end",
"def list_by_param(params = {})\n applications = []\n\n res = list_json(params)\n unless res.nil?\n data = res['data']\n\n data.each do |item|\n applications << Application.new(item)\n end\n\n applications\n end\n end",
"def index\n @qy_apps = QyApp.all\n end",
"def index\n @apps = @call.app_class.unscoped.all(:order => :id)\n end",
"def index\n @appList = AppProdu.getAppIdAndNameList current_member.id\n end",
"def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end",
"def applications=(value)\n @applications = value\n end",
"def applications=(value)\n @applications = value\n end",
"def get_application_list(opts = {})\n data, _status_code, _headers = get_application_list_with_http_info(opts)\n data\n end",
"def list\n apps = Hermes::Route.list(Hash[options.map{|(k,v)| [k.to_sym,v]}])\n if !apps.empty?\n puts \"Apps:\"\n apps.each do |app|\n puts \" - #{app}\"\n end\n else\n puts \"No apps routed\"\n end\n end",
"def index\n @loan_applications = LoanApplication.all\n end",
"def index\n @app_users = @app.app_users.all\n end",
"def index\n @app_roles = AppRole.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_roles }\n end\n end",
"def index\n @roles = Role.all\n \n respond_to do |format|\n format.html { render :layout => 'application' } # use client application's layout\n format.xml { render :xml => @roles }\n end\n end",
"def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end"
] |
[
"0.7430933",
"0.70224917",
"0.6844486",
"0.6844486",
"0.6844486",
"0.6844486",
"0.6834701",
"0.68186885",
"0.6785698",
"0.67786324",
"0.6703775",
"0.6625048",
"0.660905",
"0.65824676",
"0.65824676",
"0.65735525",
"0.65202856",
"0.6518695",
"0.6516427",
"0.647344",
"0.6444008",
"0.6429744",
"0.63810146",
"0.6372324",
"0.6272665",
"0.62682563",
"0.6257092",
"0.6256965",
"0.62408215",
"0.6237101",
"0.6236691",
"0.62168086",
"0.61766094",
"0.6161275",
"0.6155545",
"0.61535144",
"0.613924",
"0.6137202",
"0.6128056",
"0.612255",
"0.61047393",
"0.60841304",
"0.6075285",
"0.60617995",
"0.60502213",
"0.60352635",
"0.6030121",
"0.6027479",
"0.6026403",
"0.6015295",
"0.6014619",
"0.6014619",
"0.6014619",
"0.6014619",
"0.6014619",
"0.60070646",
"0.6002778",
"0.59883934",
"0.59883595",
"0.59695643",
"0.59610397",
"0.5955839",
"0.5929716",
"0.5878848",
"0.5873712",
"0.58737063",
"0.5841429",
"0.582475",
"0.5802385",
"0.5794691",
"0.57915145",
"0.5787171",
"0.57780904",
"0.57567215",
"0.5756485",
"0.57537055",
"0.57509476",
"0.5748677",
"0.57382375",
"0.57338226",
"0.5727026",
"0.5727026",
"0.5721029",
"0.57186973",
"0.57172704",
"0.57106733",
"0.5709374",
"0.5706183",
"0.56782734",
"0.5677816",
"0.5672285",
"0.56619537",
"0.56619537",
"0.56597",
"0.56544733",
"0.5652908",
"0.564542",
"0.56329477",
"0.56277984",
"0.56270754"
] |
0.592046
|
63
|
Get a list of RUM events.
|
def list_rum_events(opts = {})
data, _status_code, _headers = list_rum_events_with_http_info(opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def event_list\n @_events\n end",
"def event_list\n events_list\n end",
"def events\n @events = registered_application.events.group_by(&:name)\n end",
"def events\n @events ||= []\n @events\n end",
"def events\n object.events.last(10)\n end",
"def events\n data.events\n end",
"def events\n data[\"events\"]\n end",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def events\n return @events\n end",
"def available_events\n\t\treturn current_room.events || []\n\tend",
"def events(iam_role_arn)\n get_item_response = @dynamo.get_item(\n key: {\n 'RoleArn' => iam_role_arn\n },\n table_name: @table_name\n )\n return [] unless get_item_response['item']\n get_item_response['item']['Events']\n end",
"def all(params = {})\n req = WebPay::EventListRequest.create(params)\n raw_response = @client._request(:get, 'events', req)\n WebPay::EventResponseList.new(raw_response)\n end",
"def events\n event_lookup()\n end",
"def events\n event_lookup()\n end",
"def events\n event.user.events.where(:timestamp => beginning...ending)\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def events\n collection(\"events\")\n end",
"def events\n event_enum\n end",
"def events\n event_enum\n end",
"def events\n\t\t\t\treturn @events.values unless (@events.nil?)\n\t\t\t\treturn nil\n\t\t\tend",
"def events\n RoyalEvent::Event.where(\n \"id IN (#{subquery.to_sql})\"\n ).order(default_order)\n end",
"def events\n @finity.events.map { |name, _| name }\n end",
"def events\n Enumerator.new(self,:each_event).to_a\n end",
"def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1 unless new_events.empty? # add 1 ms to avoid dups with GTE filter\n new_events\n rescue => err\n $mw_log.info \"Error capturing events #{err}\"\n []\n end",
"def events\n metadata['events'].sort_by! { |event| event['timestamp'] }\n end",
"def events(service, url, args)\n events = []\n ret = service.send_request(GData4Ruby::Request.new(:get, url, nil, nil, args))\n REXML::Document.new(ret.body).root.elements.each(\"entry\"){}.map do |entry|\n entry = GData4Ruby::Utils.add_namespaces(entry)\n e = GCal4Ruby::Event.new(service)\n if e.load(entry.to_s)\n events << e\n end\n end\n return events\nend",
"def get_events(trace: false, &block)\n r = dropbox_query(query: '2/team_log/get_events', trace: trace)\n r['events'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team_log/get_events/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['events'].each(&block)\n end\n end",
"def events\n return if @events.empty?\n @events.uniq.sort\n end",
"def all_events\n @events = Event.all\n end",
"def events *args\n Xmlstats::Endpoints::Events.fetch *args\n end",
"def upcoming_events(order_by: self.class::START_OLDEST_FIRST,\n status: self.class::ALL)\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/events\",\n object_class: EventbriteSDK::Event,\n key: 'events',\n query: {\n order_by: order_by,\n status: status\n }\n )\n end",
"def fetch_events(app_name, env_name, options={})\n @event_fetched_times += 1\n set_env_ready(app_name, env_name, true) # assume env become ready after it spit out all the events\n\n unless @events # unrestricted mode for testing if no explicit events set\n return [generate_event_from_messages(['Successfully deployed new configuration to environment',\n 'terminateEnvironment completed successfully',\n 'Successfully launched environment',\n 'Completed swapping CNAMEs for environments'\n ], Time.now + @event_fetched_times), nil]\n end\n\n events = @events[env_key(app_name, env_name)][@event_fetched_times - 1]\n\n if options.has_key?(:start_time)\n start_time = Time.parse(options[:start_time])\n events = events.select { |e| e[:event_date] >= start_time }\n end\n\n if limit = options[:max_records]\n events = events[0..limit]\n end\n\n [events, nil]\n end",
"def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end",
"def list_events(criteria = {})\n events(criteria: criteria)\n end",
"def events\n results = @client.execute(\n :api_method => @calendar.events.list,\n :authenticated => false,\n :parameters => {\n 'calendarId' => @config[:calendar_id],\n 'fields' => 'items(start,end,summary)',\n 'singleEvents' => true,\n 'orderBy' => 'startTime',\n 'timeMin' => DateTime.now.to_s,\n 'timeMax' => (DateTime.now + 7).to_s,\n 'q' => 'LIVE'\n }\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end",
"def list_rum_events_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.list_rum_events ...'\n end\n allowable_values = ['timestamp', '-timestamp']\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_limit\"]\" when calling RUMAPI.list_rum_events, must be smaller than or equal to 1000.'\n end\n # resource path\n local_var_path = '/api/v2/rum/events'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?\n query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?\n query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?\n query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMEventsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_rum_events,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#list_rum_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def all_events\n events.keys\n end",
"def listOfEvents\r\n puts (@BetESS.fDisplayEvents)\r\n end",
"def events\n lfm_path = \"artist.getevents&artist=#{@name}\"\n lfm_data = LastFm::fetch_data(lfm_path)\n return Event.create_from_hash(Hash.from_xml(lfm_data)['lfm']['events']['event']) \n end",
"def events\n results = @cal_service.list_events(\n @calendar_id,\n order_by: 'startTime',\n q: 'LIVE',\n single_events: true,\n time_max: (DateTime.now + 7).to_s,\n time_min: DateTime.now.to_s,\n fields: 'items(start,end,summary)',\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def all_events\n @unreads = current_user.unreads\n search_params = params.except(:utf8, :commit, :controller, :action, :page)\n if search_params.present?\n @events = Event.search(search_params, @unreads).order(\"created_at DESC\")\n @events = @events.paginate(:page => params[:page], :per_page => 5)\n else\n @events = Event.all.order(created_at: :desc).paginate(:page => params[:page], :per_page => 5)\n end\n end",
"def index\n @events = Event.last_events(current_user, 3)\n end",
"def list_of_events\n @events = Event.find(:all)\n @report_name = \"List of Events\"\n end",
"def event_all(stack, marker = nil)\n params = marker ? {:marker => marker} : {}\n result = request(\n :path => \"/stacks/#{stack.name}/#{stack.id}/events\",\n :method => :get,\n :expects => 200,\n :params => params\n )\n result.fetch(:body, :events, []).map do |event|\n Stack::Event.new(\n stack,\n :id => event[:id],\n :resource_id => event[:physical_resource_id],\n :resource_name => event[:resource_name],\n :resource_logical_id => event[:logical_resource_id],\n :resource_state => event[:resource_status].downcase.to_sym,\n :resource_status => event[:resource_status],\n :resource_status_reason => event[:resource_status_reason],\n :time => Time.parse(event[:event_time])\n ).valid_state\n end\n end",
"def events(user)\n get(:standard, {:method => \"user.getEvents\", :user => user})\n end",
"def owned_events\n events\n end",
"def events\n @@events\n end",
"def events\n @events ||= user_events.concat(org_events).uniq\n end",
"def events\n @events ||= parsed_json.map do |json_record|\n VoyagerUpdater::Event.new(json_record)\n end\n end",
"def read_event\n self.class.select(\"READ_EVENT(#{self.id})\").all\n end",
"def entries(limit=nil)\n limit ||= -1\n LiveJournal::Request::GetEvents.new(@user, :recent => limit, :strict => false).run\n end",
"def events(count: 150, startId: nil)\n data = get '', resource: 'userEvent', count: count, startId: startId\n data.userEvents\n end",
"def event_all(stack, evt_id = nil)\n evt_id = stack.last_event_token if evt_id\n results = all_result_pages(evt_id, :body,\n \"DescribeStackEventsResponse\", \"DescribeStackEventsResult\",\n \"StackEvents\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n \"Action\" => \"DescribeStackEvents\",\n \"StackName\" => stack.id,\n ),\n )\n end\n events = results.map do |event|\n stack.last_event_token = event[\"NextToken\"] if event[\"NextToken\"]\n Stack::Event.new(\n stack,\n :id => event[\"EventId\"],\n :resource_id => event[\"PhysicalResourceId\"],\n :resource_name => event[\"LogicalResourceId\"],\n :resource_logical_id => event[\"LogicalResourceId\"],\n :resource_state => event[\"ResourceStatus\"].downcase.to_sym,\n :resource_status => event[\"ResourceStatus\"],\n :resource_status_reason => event[\"ResourceStatusReason\"],\n :time => Time.parse(event[\"Timestamp\"]).localtime,\n ).valid_state\n end\n if evt_id\n idx = events.index { |d| d.id == evt_id }\n idx ? events.slice(0, idx) : events\n else\n events\n end\n end",
"def get_events\n # events created by this user\n @my_events = User.find(current_user.id).event_attendants.where('owner = 1')\n\n # events this user has joined\n @joined_events = User.find(current_user.id).event_attendants.where('attendee_status = 3 and owner IS NULL')\n \n # events this user is invited to\n @invited_to_events = User.find(current_user.id).event_attendants.where('attendee_status = 0')\n\n @maybe_events = User.find(current_user.id).event_attendants.where('attendee_status = 2')\n end",
"def events\n requires :label, :application_name\n service.events.all({\n 'ApplicationName' => application_name,\n 'VersionLabel' => label\n })\n end",
"def events\n @events ||= event_finder\n end",
"def get_all_events\n events, cursor = get_paginated_first\n while cursor do\n next_events, cursor = get_paginated_next(cursor: cursor)\n events += next_events\n end\n events\n .map(&:to_i)\n end",
"def find_events(event)\n events = []\n name = event.name\n category = event.category\n description = event.description\n snapshots = find_project_snapshots(event.snapshot_id)\n snapshots.each do |snapshot|\n snapshot.events.reject { |e| e.name!=name || e.category!=category }.each do |event|\n events << event\n end\n end\n events\n end",
"def received_events(user, options={})\n get(\"/users/#{user}/received_events\", options, 3)\n end",
"def list\n events = dir.children\n abort 'No locally recorded events.' if events.empty?\n\n events\n rescue Errno::ENOENT\n raise(WavefrontCli::Exception::SystemError,\n 'There is no event state directory on this host.')\n end",
"def events(param = nil)\n request = new_request Net::HTTP::Report do |request|\n request.body = CalendarQuery.new.event(param).to_xml\n end\n response = perform_request request\n \n events = []\n \n body = Nokogiri::XML.parse(response.body)\n namespaces = { 'dav' => \"DAV:\", 'caldav' => 'urn:ietf:params:xml:ns:caldav' }\n \n body.search(\"./dav:multistatus/dav:response\", namespaces).each do |element|\n calendar_data = element.search(\"./dav:propstat/dav:prop/caldav:calendar-data\", namespaces)\n calendar = Icalendar::Parser.new(calendar_data.text).parse.first\n calendar.events.each do |event|\n event.caldav = {\n :etag => element.search(\"dav:propstat/dav:prop/dav:getetag\", namespaces).text, \n :href => element.search(\"dav:href\", namespaces).text\n }\n events += calendar.events\n end\n end\n \n events\n end",
"def events\n self.class.events\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def show_events\n @events = Event.order(\"created_at\").to_a\n end",
"def all\n @events = Event.order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def events\n Vedeu::Events.registered\n end",
"def upcoming_events\n [] || Event.where('event_start_date > :date AND event_end_date > :date AND status = :status', {date: Time.now.strftime('%Y-%m-%d'), status: Event.statuses.ready}).limit(3)\n end",
"def events(dbname, &block)\n # can't use RestClient.get b/c of :block_response\n RestClient::Request.execute(:method => :get,\n :url => root_url('events', @storage, dbname),\n :headers => {:accept => \"text/event-stream\"},\n :block_response => block, &HANDLE_RESPONSE)\n end",
"def all_custom_events(options = {})\n request_model = @request_model_factory.all_custom_event_request_model(options)\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body)['custom_events'].map do |array|\n Fabricio::Model::CustomEventType.new(array)\n end\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def all_events\n event_types.map { |etype| events(etype) }\n end",
"def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end",
"def my_events\n @events = []\n Event.all.each do |event|\n if (event.creator == current_user.id)\n @events << event\n end\n end\n end",
"def index\n @events = eager_event.all\n end",
"def events\n @events ||= {}\n end",
"def available_events\n events = permitted_events\n if respond_to?(:sort_available_events)\n events = sort_available_events(events)\n end\n events\n end",
"def events\n list = []\n frm.table(:class=>/listHier lines/).rows.each do |row|\n if row.label(:for=>/eventSelected/).exist?\n list << row.label.text\n end\n end\n names = []\n list.uniq!\n list.each do | item |\n name = item[/(?<=\\s).+(?=\\s\\s\\()/]\n names << name\n end\n return names\n end",
"def get_events()\n\t\tevents = []\n\n\t\t@DB[:events].order(:date).each do |event|\n\t\t\tnewTimeslots = []\n\t\t\t@DB[:timeslots].where(parent_table: 'events', parent_id: event[:'id']).each do |timeslot|\n\t\t\t\tnewTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\tend\n\n\t\t\tnewAttendees = []\n\t\t\t@DB[:attendees].where(parent_id: event[:'id']).each do |attendee|\n\t\t\t\tattendeeTimeslots = []\n\t\t\t\t@DB[:timeslots].where(parent_table: 'attendees', parent_id: attendee[:'id']).each do |timeslot|\n\t\t\t\t\tattendeeTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\t\tend\n\n\t\t\t\tnewAttendee = Attendee.new(attendee[:'name'], attendeeTimeslots)\n\t\t\t\tnewAttendees.push(newAttendee)\n\t\t\tend\n\n\t\t\tnewEvent = Event.new(event[:'name'], event[:'description'], newTimeslots, newAttendees, event[:'id'])\n\t\t\tif newEvent.get_date >= @epoch\n\t\t\t\tevents.push(newEvent)\n\t\t\tend\n\t\tend\n\n\t\treturn events\n\tend",
"def get_events\n events = [] \n @log ||= Rails.logger\n Appsterdam::Application.ical_subscriptions.each do |options|\n @log.info \"getting events from #{options[:url]}\"\n components = parse_ical(options[:url])\n events.concat(extract_events(components.first))\n end\n @log.info \"done importing iCal events.\"\n \n events\n end",
"def event_list\n Thread.current[:chef_client_event_list] ||= []\n end",
"def get_events\n events = []\n until ((event = SDL.PollEvent) == nil)\n new_event = Events.match(event)\n if new_event.is_a?(Events::KeyReleased)\n @keys_being_repeated.delete(new_event.key)\n end\n if new_event.is_a?(Events::KeyPressed) and not @keys_being_repeated.include?(new_event.key)\n @keys_being_repeated << new_event.key\n end\n events << new_event\n end\n @keys_being_repeated.each {|num| events << Events::KeyPressed.new(num)}\n events\n end",
"def events\n @events ||= LIFECYCLE_EVENTS.each_with_object({}) { |e, a| a[e] = [] }\n end",
"def events(artist)\n get(:standard, {:method => \"artist.getEvents\", :artist => artist})\n end",
"def events_list(opts = {})\n data, _status_code, _headers = events_list_with_http_info(opts)\n data\n end",
"def events #:nodoc:\n components Icalendar::Vevent\n end",
"def get(name = nil, token = :last, not_found = :wait, found = :return, options = {})\n @raw = send_get_request(@conn, ['/v1/event/list'], options, use_named_parameter('name', name))\n body = JSON.parse(@raw.body)\n # TODO: deal with unknown symbols, invalid indices (find_index will return nil)\n idx = case token\n when :first then 0\n when :last then body.length - 1\n when :next then body.length\n else body.find_index { |e| e['ID'] == token } + 1\n end\n if JSON.parse(@raw.body).count.zero? || idx == body.length\n case not_found\n when :reject\n raise Diplomat::EventNotFound, name\n when :return\n event_name = ''\n event_payload = ''\n event_token = :last\n when :wait\n @raw = wait_for_next_event(['/v1/event/list'], options, use_named_parameter('name', name))\n @raw = parse_body\n # If it's possible for two events to arrive at once,\n # this needs to #find again:\n event = @raw.last\n event_name = event['Name']\n event_payload = Base64.decode64(event['Payload'])\n event_token = event['ID']\n end\n else\n case found\n when :reject\n raise Diplomat::EventAlreadyExits, name\n when :return\n event = body[idx]\n event_name = event['Name']\n event_payload = event['Payload'].nil? ? nil : Base64.decode64(event['Payload'])\n event_token = event['ID']\n end\n end\n\n {\n value: { name: event_name, payload: event_payload },\n token: event_token\n }\n end",
"def all\n ButterSand::Parser.to_array(get(PATH_SAIJI)).map {|event| ButterSand::Event.new(event)}\n end",
"def read_events\n return unless @config.has_key?('events')\n\n @config['events'].each_pair do |event, actions|\n @events[event.to_sym] = Array(actions)\n end\n end",
"def events\n @events ||= RubyEvents::Events.new(self)\n end",
"def list_events\n puts \"Here are the most recent events at the Cuyahoga County Public Library:\"\n all_events = Trendster::Event.all\n all_events.each do |event|\n puts \"#{all_events.index(event) + 1}. #{event.name}\"\n end\n end",
"def events(publisher: nil, keywords: nil, start: nil, ongoing: nil, sort: \"start_time\")\n keywords = keywords.join(\",\") if keywords.is_a?(Array)\n\n result = fetch(\n \"event\",\n # Undocumented `event_type` parameter used at tapahtumat.hel.fi\n event_type: \"general\",\n # Types used at tapahtumat.hel.fi, removes the recurring super events\n # which have their own occurrences for each event day. Otherwise the\n # list might show duplicates during the first occurrence of the event.\n super_event_type: \"umbrella,none\",\n publisher: publisher.presence,\n keyword: keywords.presence,\n start: start.presence,\n all_ongoing_AND: ongoing.presence,\n sort: sort.presence\n )\n return [] unless result\n\n result[\"data\"] || []\n end",
"def event\n fetch('esport.events')\n end",
"def index\n @events = apply_scopes(Event).decorate.group_by(&:date)\n end",
"def get_events\n @doc.css(\"#cal-event-entry\")\n end",
"def events(venue)\n get(:standard, {:method => \"venue.getEvents\", :venue => venue})\n end",
"def index\n @user_events = UserEvent.all\n end",
"def index\n @user_events = UserEvent.all\n end"
] |
[
"0.72163916",
"0.71673846",
"0.71455514",
"0.71312195",
"0.7089489",
"0.70870143",
"0.70684934",
"0.70225304",
"0.6872262",
"0.6821366",
"0.67921853",
"0.6746008",
"0.671455",
"0.67065674",
"0.66975677",
"0.66975677",
"0.6616857",
"0.6608215",
"0.6600963",
"0.6596074",
"0.6596074",
"0.6581664",
"0.6567287",
"0.6553622",
"0.6552629",
"0.6507057",
"0.6506131",
"0.65029895",
"0.648694",
"0.6486902",
"0.647906",
"0.64699394",
"0.6464574",
"0.64295113",
"0.6426922",
"0.6401666",
"0.64012545",
"0.6391784",
"0.6335837",
"0.63350135",
"0.6330911",
"0.632985",
"0.62888515",
"0.62789273",
"0.62717825",
"0.62701464",
"0.6265048",
"0.626331",
"0.6251597",
"0.6240953",
"0.62196773",
"0.6199293",
"0.61958724",
"0.6177308",
"0.61712253",
"0.61654294",
"0.6159498",
"0.6157277",
"0.6143396",
"0.61368906",
"0.6134676",
"0.61314255",
"0.61155665",
"0.61115193",
"0.6099946",
"0.6088996",
"0.6088851",
"0.6087743",
"0.60819215",
"0.606119",
"0.6054543",
"0.60510826",
"0.6049614",
"0.6044977",
"0.6033508",
"0.6010348",
"0.6008943",
"0.5999852",
"0.59995687",
"0.59945893",
"0.59934753",
"0.5983811",
"0.5974611",
"0.59684116",
"0.59624135",
"0.59510624",
"0.59497356",
"0.5943977",
"0.5940359",
"0.5933723",
"0.5915552",
"0.5905391",
"0.59051365",
"0.5903818",
"0.59021413",
"0.58988965",
"0.5889968",
"0.58770126",
"0.5872698",
"0.5872698"
] |
0.7761489
|
0
|
Get a list of RUM events. List endpoint returns events that match a RUM search query. [Results are paginated][1]. Use this endpoint to see your latest RUM events. [1]:
|
def list_rum_events_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.list_rum_events ...'
end
allowable_values = ['timestamp', '-timestamp']
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
end
if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000
fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling RUMAPI.list_rum_events, must be smaller than or equal to 1000.'
end
# resource path
local_var_path = '/api/v2/rum/events'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?
query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?
query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'RUMEventsResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
new_options = opts.merge(
:operation => :list_rum_events,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#list_rum_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_rum_events(opts = {})\n data, _status_code, _headers = list_rum_events_with_http_info(opts)\n data\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def all_events\n @unreads = current_user.unreads\n search_params = params.except(:utf8, :commit, :controller, :action, :page)\n if search_params.present?\n @events = Event.search(search_params, @unreads).order(\"created_at DESC\")\n @events = @events.paginate(:page => params[:page], :per_page => 5)\n else\n @events = Event.all.order(created_at: :desc).paginate(:page => params[:page], :per_page => 5)\n end\n end",
"def all(params = {})\n req = WebPay::EventListRequest.create(params)\n raw_response = @client._request(:get, 'events', req)\n WebPay::EventResponseList.new(raw_response)\n end",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def all\n @events = Event.order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def events *args\n Xmlstats::Endpoints::Events.fetch *args\n end",
"def events\n results = @client.execute(\n :api_method => @calendar.events.list,\n :authenticated => false,\n :parameters => {\n 'calendarId' => @config[:calendar_id],\n 'fields' => 'items(start,end,summary)',\n 'singleEvents' => true,\n 'orderBy' => 'startTime',\n 'timeMin' => DateTime.now.to_s,\n 'timeMax' => (DateTime.now + 7).to_s,\n 'q' => 'LIVE'\n }\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def index\n @events = Event.last_events(current_user, 3)\n end",
"def index\n @events = Event.getRecords(params[:page])\n end",
"def list_of_events\n @events = Event.find(:all)\n @report_name = \"List of Events\"\n end",
"def upcoming_events(order_by: self.class::START_OLDEST_FIRST,\n status: self.class::ALL)\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/events\",\n object_class: EventbriteSDK::Event,\n key: 'events',\n query: {\n order_by: order_by,\n status: status\n }\n )\n end",
"def events(user)\n get(:standard, {:method => \"user.getEvents\", :user => user})\n end",
"def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend",
"def index\n @events = Event.available.page(params[:page])\n end",
"def events\n collection(\"events\")\n end",
"def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end",
"def event_list\n events_list\n end",
"def events\n object.events.last(10)\n end",
"def list_events(criteria = {})\n events(criteria: criteria)\n end",
"def index\n if params[:u]\n @events = User.find(params[:u]).events\n else\n @events = Event.all\n end\n end",
"def index\n if params[:search]\n @events = Event.where(name: params[:search])\n else\n @events = Event.all\n end\n end",
"def index\n # todo implement search and sort and paginate\n @events = Legacy::LegacyEvent.order(\"created_date DESC\").paginate(:page => params[:page])\n end",
"def get(name = nil, token = :last, not_found = :wait, found = :return, options = {})\n @raw = send_get_request(@conn, ['/v1/event/list'], options, use_named_parameter('name', name))\n body = JSON.parse(@raw.body)\n # TODO: deal with unknown symbols, invalid indices (find_index will return nil)\n idx = case token\n when :first then 0\n when :last then body.length - 1\n when :next then body.length\n else body.find_index { |e| e['ID'] == token } + 1\n end\n if JSON.parse(@raw.body).count.zero? || idx == body.length\n case not_found\n when :reject\n raise Diplomat::EventNotFound, name\n when :return\n event_name = ''\n event_payload = ''\n event_token = :last\n when :wait\n @raw = wait_for_next_event(['/v1/event/list'], options, use_named_parameter('name', name))\n @raw = parse_body\n # If it's possible for two events to arrive at once,\n # this needs to #find again:\n event = @raw.last\n event_name = event['Name']\n event_payload = Base64.decode64(event['Payload'])\n event_token = event['ID']\n end\n else\n case found\n when :reject\n raise Diplomat::EventAlreadyExits, name\n when :return\n event = body[idx]\n event_name = event['Name']\n event_payload = event['Payload'].nil? ? nil : Base64.decode64(event['Payload'])\n event_token = event['ID']\n end\n end\n\n {\n value: { name: event_name, payload: event_payload },\n token: event_token\n }\n end",
"def index\n\t\t@events = Event.all\n\tend",
"def index\n\t\t@events = Event.all\n\tend",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend",
"def index\n\t\tsc = sort_column\n\t\t@q = Event.ransack(params[:q])\n\t\t@sort = sc + \" \"\n\t\tif params[:page]\n\t\t\tcookies[:events_page] = {\n\t\t\t\tvalue: params[:page],\n\t\t\t\texpires: 1.day.from_now\n\t\t\t}\n\t\tend\n\t\t@events = @q.result.order(@sort + sort_direction).page(cookies[:events_page]).per_page(20)\n\tend",
"def index\n\t\tcards_per_page = 12\n\n\t\tif params[:tag]\n\t\t\tif user_signed_in? && current_user.has_role?(:admin)\n\t\t\t\t@events = Event.order(\"created_at DESC\").tagged_with(params[:tag]).page(params[:page]).per_page(cards_per_page) || Event.all \n\t\t\telse\n\t\t\t\t@events = Event.where('released_at <= ? AND finish_on >= ? AND published = TRUE', Time.now, Time.now).order(\"created_at DESC\").tagged_with(params[:tag]).page(params[:page]).per_page(cards_per_page) || Event.all \n\t\t\tend\n\t\telse\n\t\t\tif user_signed_in? && current_user.has_role?(:admin)\n\t\t\t\t@events = Event.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page) || Event.all\n\t\t\telse\n\t\t\t\t@events = Event.where('released_at <= ? AND finish_on >= ? AND published = TRUE', Time.now, Time.now).order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page) || Event.all\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend",
"def events(count: 150, startId: nil)\n data = get '', resource: 'userEvent', count: count, startId: startId\n data.userEvents\n end",
"def events(dbname, &block)\n # can't use RestClient.get b/c of :block_response\n RestClient::Request.execute(:method => :get,\n :url => root_url('events', @storage, dbname),\n :headers => {:accept => \"text/event-stream\"},\n :block_response => block, &HANDLE_RESPONSE)\n end",
"def events(param = nil)\n request = new_request Net::HTTP::Report do |request|\n request.body = CalendarQuery.new.event(param).to_xml\n end\n response = perform_request request\n \n events = []\n \n body = Nokogiri::XML.parse(response.body)\n namespaces = { 'dav' => \"DAV:\", 'caldav' => 'urn:ietf:params:xml:ns:caldav' }\n \n body.search(\"./dav:multistatus/dav:response\", namespaces).each do |element|\n calendar_data = element.search(\"./dav:propstat/dav:prop/caldav:calendar-data\", namespaces)\n calendar = Icalendar::Parser.new(calendar_data.text).parse.first\n calendar.events.each do |event|\n event.caldav = {\n :etag => element.search(\"dav:propstat/dav:prop/dav:getetag\", namespaces).text, \n :href => element.search(\"dav:href\", namespaces).text\n }\n events += calendar.events\n end\n end\n \n events\n end",
"def event_list\n @_events\n end",
"def search_events(query, version = DEFAULT_API_VERSION)\n options = {:params => {:q => query},\n :api_version => version}\n api_call(:get, 'events', options)\n end",
"def index\n @events = eager_event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def events\n requires :label, :application_name\n service.events.all({\n 'ApplicationName' => application_name,\n 'VersionLabel' => label\n })\n end",
"def index\n @user_events = UserEvent.all\n end",
"def index\n @user_events = UserEvent.all\n end",
"def index\n @user_events = UserEvent.all\n end",
"def events\n @events = registered_application.events.group_by(&:name)\n end",
"def index\n @events = Event.all()\n end",
"def events\n data.events\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def index\n @events = Event.find(:all) \n end",
"def events\n results = @cal_service.list_events(\n @calendar_id,\n order_by: 'startTime',\n q: 'LIVE',\n single_events: true,\n time_max: (DateTime.now + 7).to_s,\n time_min: DateTime.now.to_s,\n fields: 'items(start,end,summary)',\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def index\n @organizing_future_events = get_user_organizing_future_events\n @attending_future_events = get_user_attending_future_events\n @nearby_events = get_upcoming_nearby_events_within_radius(5)\n end",
"def index\n\t\t#@events = Event.all\n\t\t#params是一個hash key:value#\n\t\t@events = Event.page(params[:page]).per(5)\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.xml { render :xml => @events.to_xml }\n\t\t\tformat.json { render :json => @events.to_json }\n\t\t\tformat.atom { @feed_title = \"My event list\" } #index.atom.builder\n \t\tend\n\tend",
"def search(params = {})\n @client.call(method: :get, path: 'message-events', query_values: params)\n end"
] |
[
"0.75780886",
"0.72380906",
"0.713011",
"0.7118851",
"0.69809484",
"0.68107086",
"0.676955",
"0.6728415",
"0.6693383",
"0.6680425",
"0.6587745",
"0.6545867",
"0.6526493",
"0.6522521",
"0.64968944",
"0.6479987",
"0.64667207",
"0.6457101",
"0.6453949",
"0.6438746",
"0.643305",
"0.64320314",
"0.6429264",
"0.64218545",
"0.6403078",
"0.63857406",
"0.6378713",
"0.63694453",
"0.63694453",
"0.6366946",
"0.6319477",
"0.63147044",
"0.6302029",
"0.63011074",
"0.6295123",
"0.6294846",
"0.62841314",
"0.62811756",
"0.62771004",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62695146",
"0.62682396",
"0.62598544",
"0.62598544",
"0.62598544",
"0.62583965",
"0.6256",
"0.6242881",
"0.6237294",
"0.62361485",
"0.62302953",
"0.6224548",
"0.62206036",
"0.6210765"
] |
0.71137667
|
4
|
Search RUM events. List endpoint returns RUM events that match a RUM search query. [Results are paginated][1]. Use this endpoint to build complex RUM events filtering and search. [1]:
|
def search_rum_events_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.search_rum_events ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.search_rum_events"
end
# resource path
local_var_path = '/api/v2/rum/events/search'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'RUMEventsResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
new_options = opts.merge(
:operation => :search_rum_events,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#search_rum_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all_events\n @unreads = current_user.unreads\n search_params = params.except(:utf8, :commit, :controller, :action, :page)\n if search_params.present?\n @events = Event.search(search_params, @unreads).order(\"created_at DESC\")\n @events = @events.paginate(:page => params[:page], :per_page => 5)\n else\n @events = Event.all.order(created_at: :desc).paginate(:page => params[:page], :per_page => 5)\n end\n end",
"def index\n if params[:search]\n @events = Event.where(name: params[:search])\n else\n @events = Event.all\n end\n end",
"def search(params = {})\n @client.call(method: :get, path: 'message-events', query_values: params)\n end",
"def search_events(query, version = DEFAULT_API_VERSION)\n options = {:params => {:q => query},\n :api_version => version}\n api_call(:get, 'events', options)\n end",
"def index\n @events = Event.all\n if params[:search]\n @events= Event.search(params[:search])\n \n end\n \n end",
"def index\n\t\tsc = sort_column\n\t\t@q = Event.ransack(params[:q])\n\t\t@sort = sc + \" \"\n\t\tif params[:page]\n\t\t\tcookies[:events_page] = {\n\t\t\t\tvalue: params[:page],\n\t\t\t\texpires: 1.day.from_now\n\t\t\t}\n\t\tend\n\t\t@events = @q.result.order(@sort + sort_direction).page(cookies[:events_page]).per_page(20)\n\tend",
"def index\n update_events_hash\n render_or_redirect\n @sort_key = sort_key\n @query_key = query_key\n @events = Event.search_description(@query_key, @sort_key)\n end",
"def index\n if params[:term]\n @events = Event.search_by_date(params[:term])\n if params[:term] == ''\n @events = Event.all.order(:eventDate)\n end\n else\n @events = Event.all.order(eventDate: :desc).page(params[:page]).per_page(15)\n \n end\n end",
"def index\n @events = Event.all\n# if params[:term].present?\n# @events = Eventbrite::Event.search({q: params[:term]}).events\n# else\n# @events = Eventbrite::Event.search({q: 'Miami'}).events\n# end\n # @event = Eventbrite::Event.search({q: 'Community Service'})\n # @events = Eventbrite::Event.search({q: params[:term]}).events\n # @events = Event.all\n # @events = if params[:term]\n # Event.where('name LIKE ?', \"%#{params[:term]}%\")\n # else\n # Event.all\n # end\n\n\n # @events = if params[:term]\n # Event.where('name LIKE ?', \"%#{params[:term]}%\")\n\n\n\n\n end",
"def index\n @events = Event.all\n\t if params[:search]\n\t\t @events = Event.where('lower(name) LIKE ? OR lower(description) LIKE ? OR lower(\"ort\") LIKE ?',\n\t\t\t \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\")\n\t end\n end",
"def list_rum_events(opts = {})\n data, _status_code, _headers = list_rum_events_with_http_info(opts)\n data\n end",
"def list_rum_events_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.list_rum_events ...'\n end\n allowable_values = ['timestamp', '-timestamp']\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_limit\"]\" when calling RUMAPI.list_rum_events, must be smaller than or equal to 1000.'\n end\n # resource path\n local_var_path = '/api/v2/rum/events'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?\n query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?\n query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?\n query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMEventsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_rum_events,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#list_rum_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n session[:event_params] = params if params[:q].present?\n if params[:q].present? || params[:search_flg]\n session_params = ActionController::Parameters.new(session[:event_params])\n @search = Event.ransack(session_params[:q])\n @events = @search.result if session_params[:q].present?\n flash.now[:warning] = '検索結果は0件です。' if session_params[:q].present? && @events.count == 0\n else\n @search = Event.ransack(params[:q])\n @events = @search.result\n end\n end",
"def index\n if params[:field].present? && params[:keyword].present?\n @events = Event.all.where([\"#{params[:field]} like ?\", \"%#{params[:keyword]}%\"]).per_page_kaminari(params[:page]).per(params[:per])\n else\n @events = Event.all.per_page_kaminari(params[:page]).per(params[:per])\n end\n end",
"def index\n @events = Event.paginate_all(params[:page], params[:search], sort_column + ' ' + sort_direction)\n end",
"def index\n\n @events = Event.where(nil)\n\n @events = @events.search(params[:search]) if params[:search].present?\n\n if params[:price_desc]\n @events = @events.ordered_by_price_desc\n elsif params[:price_asc]\n @events = @events.ordered_by_price_asc\n elsif params[:date_asc]\n @events = @events.ordered_by_date_asc\n elsif params[:date_desc]\n @events = @events.ordered_by_date_desc\n end\n\n if current_user && current_user.admin\n @events\n else\n @events = @events.select {|event| !archived_event(event)}\n end\n\n end",
"def index\n # todo implement search and sort and paginate\n @events = Legacy::LegacyEvent.order(\"created_date DESC\").paginate(:page => params[:page])\n end",
"def index\n if params[:search].present?\n search_string = \"%#{params[:search]}%\"\n @events = Event.joins(:taggings, :tags).where([\"events.name LIKE ? OR events.city_name LIKE ? \", search_string, search_string]).page(params[:page]).per(10)\n else\n # @events = Event.recent.page(params[:page]).per(10)\n @events = Event.page(params[:page]).per(10)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def index\n #if show/all?tag=tagName\n if !params[:tag].nil?\n events = Event\n .joins(events_tags: :tag)\n .where(tags: {name: params[:tag]})\n\n if [email protected]?\n events = events.drop(@offset)\n events = events.take(@limit)\n end\n\n response = {offset: @offset,\n limit: @limit,\n count: events.count,\n data: events}\n\n render json: response, include: [:tags, :creator, :position], status: :ok\n\n #if show/all?search=searchQuery\n #search in name or message of the events\n elsif !params[:search].nil?\n\n events = Event.where(\n \"message LIKE ?\n OR name LIKE ?\",\n \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n response = {query: params[:search],\n count: events.count,\n data: events}\n render json: response, include: [:tags, :creator, :position], status: :ok\n\n # show all events\n else\n events = Event.order(\"updated_at DESC\").all\n if !events.nil?\n\n if [email protected]?\n events = events.drop(@offset)\n events = events.take(@limit)\n end\n\n response = {offset: @offset,\n limit: @limit,\n count: events.count,\n data: events}\n render json: response, include: [:tags, :creator, :position], status: :ok\n else\n render json: events.errors, status: :ok\n end\n end\n\n\n end",
"def search\n if params[:query]\n query = \"%#{params[:query].downcase}%\"\n @events = Event.where(\"lower(title) LIKE :query or lower(description) LIKE :query\", :query => query)\n end\n\n respond_to do |format|\n format.html\n format.json { render 'events/index' }\n end\n end",
"def index\n \t\t#@events = Event.all\n#\t\t@events = Event.page(params[:page]).per(5)#for kaminari\n\t\tif params[:keyword]\n\t\t\t@events=Event.where([\"name like ?\",\"%#{params[:keyword]}%\"])\n\t\telse\n\t\t\t@events=Event.all\n\t\tend\n\t\tif params[:order]\n\t\t\tsort_by = (params[:order] == 'name') ? 'name' :\n'id'\n\t\t\t#obj.order won't check input SQL ,should be ensured yourself\n\t\t\t@[email protected](sort_by)\n\t\tend\n\t\t@events = @events.page(params[:page]).per(5)\n\n\t\tRails.logger.debug(\"this is Rails.logger!!\")\n\t\tRails.logger.debug(\"richardyu\": + @events.count)\t\t\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.xml {\n\t\t\t\trender :xml => @events.to_xml\n\t\t\t}\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\t\tformat.atom {\n\t\t\t\t@feed_title = \"My event list\"\n\t\t\t}# atom should use index.atom.builder!!\n\t\tend\t\n\tend",
"def index\n\t\tcards_per_page = 12\n\n\t\tif params[:tag]\n\t\t\tif user_signed_in? && current_user.has_role?(:admin)\n\t\t\t\t@events = Event.order(\"created_at DESC\").tagged_with(params[:tag]).page(params[:page]).per_page(cards_per_page) || Event.all \n\t\t\telse\n\t\t\t\t@events = Event.where('released_at <= ? AND finish_on >= ? AND published = TRUE', Time.now, Time.now).order(\"created_at DESC\").tagged_with(params[:tag]).page(params[:page]).per_page(cards_per_page) || Event.all \n\t\t\tend\n\t\telse\n\t\t\tif user_signed_in? && current_user.has_role?(:admin)\n\t\t\t\t@events = Event.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page) || Event.all\n\t\t\telse\n\t\t\t\t@events = Event.where('released_at <= ? AND finish_on >= ? AND published = TRUE', Time.now, Time.now).order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page) || Event.all\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend",
"def find_events(query)\n event_lookup(\"?q=#{query}\")\n end",
"def find_events(query)\n event_lookup(\"?q=#{query}\")\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def all(params = {})\n req = WebPay::EventListRequest.create(params)\n raw_response = @client._request(:get, 'events', req)\n WebPay::EventResponseList.new(raw_response)\n end",
"def index\r\n q, n = params[:q], params[:n]\r\n \r\n @event_count = Event.count\r\n begin\r\n @limit = Integer(n.to_s)\r\n rescue ArgumentError => e\r\n # in very small repositories, only show 20% of events (mostly for demoing overview timelines)\r\n @limit = [500, @event_count / 5].min\r\n @limit = [25, @limit].max\r\n end\r\n \r\n if q.blank?\r\n @timelines = Timeline.recent(7)\r\n @top_events = Event.where(\"rank > #{RANK_CUTOFF}\").order('rank DESC').limit(@limit).all\r\n else\r\n # TODO. integrate our event / timeline rank value with fulltext hit ranking\r\n @search_term = q\r\n @timelines = Timeline.search(q, :order => 'rank DESC', :limit => 20) \r\n @total_timelines = Timeline.search(q).size\r\n @top_events = Event.search(q, :order => 'rank DESC', :limit => @limit)\r\n @total_events = Event.search(q).size\r\n end\r\n end",
"def search\n if params[:query]\n respond_with Event\n .fulltext_search(params[:query])\n .includes(:categories, :organization, :location)\n else\n Event\n .order(\"updated_at DESC\")\n .includes(:categories, :organization, :location)\n end\n end",
"def all\n @events = Event.order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def index\n if params[:u]\n @events = User.find(params[:u]).events\n else\n @events = Event.all\n end\n end",
"def index\n \n @events = Event.order('created_at desc').page(params[:page]).per(params[:limit] || 10) \n \n if params[:type]\n @events = @events.where('poi_type_id = ?', params[:type])\n end\n \n if params[:search]\n search = \"%\" + params[:search].sub(\" \", \"%\") + \"%\"\n @events = @events.where('title like ? OR title_eu like ?', search, search)\n end\n \n @verfied = Event.where('is_verified = ?', true)\n @top_events = Event.order('rating desc').limit(4)\n @last_events = Event.order('created_at desc').limit(4)\n @next_events = Event.where('ends_at > ?', Time.now).order('starts_at asc').limit(8)\n @last_photos = Photo.where(is_visible_on_index: true).order('created_at desc').limit(8)\n @last_comments = Comment.order('created_at desc').limit(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n per_page = 10\n\torder = params[:sort] || \"time\"\n\tsort_direction = case params[:sort_direction]\n\t\t\t\t\t\twhen \"up\" then \"ASC\"\n\t\t\t\t\t\twhen \"down\" then \"DESC\"\n\t\t\t\t\t\telse \"DESC\"\n\t\t\t\t\t\tend\n\n\t@search_opts = {'sort' => \"time\", 'sort_direction' => \"down\" }.merge params\n\topts = { page: params[:page], per_page: per_page }\n\n\tif params[:sort] == \"companies.name\"\n\t\topts.merge!( { joins: \"LEFT OUTER JOIN companies ON companies.id = indrel_events.company_id\" } )\n\telsif params[:sort] == \"locations.name\"\n\t\topts.merge!( { joins: \"LEFT OUTER JOIN locations ON locations.id = indrel_events.location_id\" } )\n\telsif params[:sort] == \"indrel_event_types.name\"\n\t\topts.merge!( { joins: \"LEFT OUTER JOIN indrel_event_types ON indrel_event_types.id = indrel_events.indrel_event_type_id\" } )\n\tend\n @events = IndrelEvent.order(\"#{order} #{sort_direction}\").paginate opts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @events }\n format.js {\n render partial: 'list'\n }\n end\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def index\n @events = Event.available.page(params[:page])\n end",
"def index\n # @events = @events.where(brand_id: website.brand_id).order(\"post_on DESC\")\n @search = website.brand.events.ransack(params[:q])\n @events = @search.result\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @events }\n end\n end",
"def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend",
"def list_of_events\n @events = Event.find(:all)\n @report_name = \"List of Events\"\n end",
"def list_events(criteria = {})\n events(criteria: criteria)\n end",
"def index\n if params[:tag]\n @events = Event.tagged_with(params[:tag])\n else\n @events = Event.all\n end\n end",
"def index\n @events = Event.getRecords(params[:page])\n end",
"def events *args\n Xmlstats::Endpoints::Events.fetch *args\n end",
"def index\n \tflash[:error]=\"\"\n flash[:alert]=\"\"\n\n logged_in_user = User.find(session[:session_user])\n\n if params[:search]\n \tif(logged_in_user.city_id == 25) #National \n \t\t@events = Event.where(\"event_name LIKE ?\", \"%#{params[:search]}%\")\n @events = @events.paginate(:per_page => 5, :page => params[:page])\n \telse\n \t\t@events = Event.where(:city_id => logged_in_user.city_id).where(\"event_name LIKE ?\", \"%#{params[:search]}%\")\n @events = @events.paginate(:per_page => 5, :page => params[:page])\n \tend\n \n event_count = @events.length\n if event_count < 1\n flash[:alert] = \"No event found\"\n end\n else\n \tif(logged_in_user.city_id == 25) #National\n if (params[:sort] && params[:direction])\n \t\t @events = Event.order(params[:sort] + ' ' + params[:direction])\n @events = @events.paginate(:per_page => 5, :page => params[:page])\n else\n @events = Event.all\n @events = @events.paginate(:per_page => 5, :page => params[:page])\n end\n \telse\n \t\t@events = Event.where(:city_id => logged_in_user.city_id)\n @events = @events.paginate(:per_page => 5, :page => params[:page])\n \tend\n end\n end",
"def events\n requires :label, :application_name\n service.events.all({\n 'ApplicationName' => application_name,\n 'VersionLabel' => label\n })\n end",
"def index\r\n @events = Event.search(params[:search]).paginate(page: params[:page], per_page: 25).order(sort_column + \" \" + sort_direction)\r\n # allows partials to adjust if necessary to render slightly differently if the index or a user's list of events\r\n @index = true\r\n end",
"def index\r\n if params[:page].blank?\r\n session[:search_type] = nil\r\n session[:search_query] = nil\r\n end\r\n\r\n contexts = session[:search_type] == \"all\" ? [\"organization\", \"location\", \"arena\", \"geographic_scope\", \"connection_dialog\", \"affiliation\", \"tag\"] : session[:search_type]\r\n\r\n if session[:search_query].blank?\r\n @events = Event.all \r\n elsif session[:search_type].include?(\"page\") || session[:search_type].include?(\"project\") || session[:search_type] == \"name\"\r\n @events = Event.find(:all, :conditions => [\"#{session[:search_type]} LIKE ?\", \"%#{session[:search_query]}%\"], :include => [:page, {:page => :project}])\r\n elsif session[:search_type] == \"all\"\r\n @events = Event.tagged_with(\"#{session[:search_query]}%\", :any => true)\r\n else\r\n @events = Event.tagged_with(\"#{session[:search_query]}%\", :on => \"#{session[:search_type]}\", :any => true)\r\n end\r\n\r\n @events = @events.paginate(:per_page => session[:per_page], :page => params[:page])\r\n\r\n if request.xhr?\r\n respond_to do |format|\r\n format.js do\r\n render :update do |page|\r\n page.replace_html 'table', :partial => \"list_events\"\r\n end\r\n end\r\n end\r\n end\r\n end",
"def index\n \n\t@events = Event.order(sort_column + \" \" + sort_direction)\n\t#@events = Event.where(deleted: false)\n\t\n\tif params[:name]\n\t\t@events = @events.where(\"name LIKE ?\", \"%#{params[:name]}%\")\n\tend\n\t\n\tif params[:category_id]\n\t\t@events = @events.where(\"category_id = ?\", params[:category_id])\n\tend\n\t\n\tif params[:venue]\n\t\t@events = @events.where(\"venue LIKE ?\", \"%#{params[:venue]}%\")\n\tend\n\t\n\tif params[:from_date]\n day = params[:from_date][\"written_on(3i)\"];\n \n\t if day.length != 0\n if day.length < 2\n day = \"0\" + day\n end\n\n month = params[:from_date][\"written_on(2i)\"];\n if month.length < 2\n month = \"0\" + month\n end\n date_string = params[:from_date][\"written_on(1i)\"] + \"-\" + month + \"-\" + day;\n \n\t\t@events = @events.where(\"from_date >= ?\", date_string)\n end\n end\n\t\n\tif params[:to_date]\n day = params[:to_date][\"written_on(3i)\"];\n \n\t if day.length != 0\n if day.length < 2\n day = \"0\" + day\n end\n\n month = params[:to_date][\"written_on(2i)\"];\n if month.length < 2\n month = \"0\" + month\n end\n date_string = params[:to_date][\"written_on(1i)\"] + \"-\" + month + \"-\" + day;\n \n\t\t@events = @events.where(\"to_date <= ?\", date_string)\n end\n end\n\t\n\t# limit records to 10 per page\n @events = @events.paginate(page: params[:page], per_page: 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.find(:all) \n end",
"def index\n \n respond_to do |format|\n format.json {\n render json: EventDatatable.new(view_context, @current_account.id)\n }\n format.html {\n @events = @current_account.events.where{ (title =~ my{\"%#{params[:search]}%\"} )}\n .order('starts_at desc')\n .page(params[:page])\n .per(10)\n }\n end\n \n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def index\n\t\t#@events = Event.all\n\t\t#params是一個hash key:value#\n\t\t@events = Event.page(params[:page]).per(5)\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.xml { render :xml => @events.to_xml }\n\t\t\tformat.json { render :json => @events.to_json }\n\t\t\tformat.atom { @feed_title = \"My event list\" } #index.atom.builder\n \t\tend\n\tend",
"def index\n\n #events_scope = Event.event_curator_users_filter(params[:curator_filter])\n #events_scope = events_scope.event_curator_users_filter(params[:event_curator_users_filter])\n #events_scope = events_scope.event_curator_users_filter if params[:event_curator_users_filter] == \"1\"\n events_scope = Event.title_search(params[:filter])\n\n if (params[:curator_filter] != nil) && (params[:curator_filter] != \"\")\n events_scope = events_scope.event_curator_users_filter(params[:curator_filter])\n end\n\n if (params[:state_filter] != nil) && (params[:state_filter] != \"\")\n events_scope = events_scope.state_filter(params[:state_filter])\n end\n\n if (params[:date_filter] != nil) && (params[:date_filter] != \"\")\n events_scope = events_scope.date_search(Date.parse(\"01.\" + params[:date_filter]))\n end\n smart_listing_create :events,events_scope, partial: \"events/list\",page_sizes: [20,50,100],\n default_sort: {date_start: \"desc\"}\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n\t\t@events = Event.all\n\tend"
] |
[
"0.72911173",
"0.71306217",
"0.69764805",
"0.6956214",
"0.68302834",
"0.67160755",
"0.6714171",
"0.66890335",
"0.6683445",
"0.6655216",
"0.65698457",
"0.6561368",
"0.6555787",
"0.65485126",
"0.6491471",
"0.64004403",
"0.63939756",
"0.6380674",
"0.6367059",
"0.63666064",
"0.6338889",
"0.63262695",
"0.6301893",
"0.6301893",
"0.6298958",
"0.62716365",
"0.62654173",
"0.6228164",
"0.62117577",
"0.61986816",
"0.6198055",
"0.6178504",
"0.6159162",
"0.61478114",
"0.6147467",
"0.61465174",
"0.6145054",
"0.61361474",
"0.61264896",
"0.6120881",
"0.61122906",
"0.61042976",
"0.61028975",
"0.60990024",
"0.60961723",
"0.60944283",
"0.606309",
"0.60558844",
"0.60494643",
"0.6044659",
"0.60401493",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003757",
"0.6003238"
] |
0.6488923
|
15
|
Update a RUM application.
|
def update_rum_application(id, body, opts = {})
data, _status_code, _headers = update_rum_application_with_http_info(id, body, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_app data={}\n put '/app', data\n end",
"def update!(**args)\n @app = args[:app] if args.key?(:app)\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update \n if @app \n @app.update(app_params)\n\n if @app.valid?\n head :no_content\n else \n head :bad_request\n end\n else \n head :not_found\n end\n end",
"def update\n\n if @app.update_attributes(params[:app])\n respond_to do |format|\n format.html {\n redirect_to app_path(@app), notice: 'app was successfully updated.'\n }\n format.json { render :nothing => true}\n end\n else\n respond_to do |format|\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def update\n @app = App.find(params[:id])\n\n if @app.update(app_params)\n head :no_content\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @application.update(application_params)\n render :show, status: :ok, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end",
"def update\n @app = App.find(params[:uid])\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n requires :label, :application_name\n\n options = {\n 'ApplicationName' => application_name,\n 'Description' => description,\n 'VersionLabel' => label\n }\n options.delete_if {|key, value| value.nil?}\n\n data = service.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']\n merge_attributes(data)\n end",
"def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"def update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_info = args[:app_info] if args.key?(:app_info)\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless admin?\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @application_id = args[:application_id] if args.key?(:application_id)\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n flash[:notice] = 'App was successfully updated.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n end\n \n respond_with @application\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, attributes)\n deprecate # 07/26/2012\n put(\"/apps/#{name}\", :app => attributes).to_s\n end",
"def update\n @application.owner = current_user if @application.owner.blank?\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @app.update(app_params)\n redirect_to @app, notice: 'App was successfully updated.' \n else\n render action: 'edit' \n end\n end",
"def update\n @user_app = UserApp.find(params[:id])\n\n respond_to do |format|\n if @user_app.update_attributes(params[:user_app])\n format.html { redirect_to @user_app, notice: 'User app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n new_name = params[:application][:name].to_s.downcase\n @application.name = params[:application][:name]\n User.edit_app_name(@application.id, new_name) if @application.valid?\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to applications_path, notice: 'Приложение обновлено.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @app\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to root_path, notice: 'Application was successfully submitted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n if @newapp.update_attributes(params[:newapp])\n format.html { redirect_to @newapp, notice: 'Newapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html {\n flash[:success] = 'Application was successfully updated.'\n redirect_to [:admin, @application]\n }\n format.json { head :no_content }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"edit\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_store = args[:app_store] if args.key?(:app_store)\n end",
"def update\n @application = Application.find(params[:id])\n \n respond_to do |format|\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n format.html { redirect_to(@application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, optional_params = {})\n response = Network.post(['Applications', id], optional_params)\n Application.new(response)\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n flash[:success] = 'App was successfully updated.'\n format.html { redirect_to @app }\n format.json { render :show, status: :ok, location: @app }\n else\n flash[:danger] = 'There was a problem updating the App Catalog Page.'\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rum_application_with_http_info(id, body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.update_rum_application ...'\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 RUMAPI.update_rum_application\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling RUMAPI.update_rum_application\"\n end\n # resource path\n local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMApplicationResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :update_rum_application,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#update_rum_application\\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 @application.update(application_params)\n format.html { redirect_to dynamic_url(@application, action: :edit), notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @userapp = Userapp.find(params[:id])\n\n respond_to do |format|\n if @userapp.update_attributes(params[:userapp])\n flash[:notice] = 'Userapp was successfully updated.'\n format.html { redirect_to(@userapp) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @userapp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: \"Application was successfully updated.\" }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_wine_app_description\n set_wine_app_screenshot\n respond_to do |format|\n if @wine_app.update(wine_app_params)\n format.html { redirect_to @wine_app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wine_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @localized_app_name = args[:localized_app_name] if args.key?(:localized_app_name)\n @open_app_url = args[:open_app_url] if args.key?(:open_app_url)\n @package_name = args[:package_name] if args.key?(:package_name)\n end",
"def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:mms_app])\n flash[:notice] = '修改组件成功!'\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n flash[:notice] = '修改组件失败!'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n if @mobileapp.update_attributes(params[:mobileapp])\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, alert: 'Your application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n project.run \"apk update\"\n end",
"def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html {redirect_to @application, notice: 'Application was successfully updated.'}\n format.json {render :show, status: :ok, location: @application}\n else\n format.html {render :edit}\n format.json {render json: @application.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update!(**args)\n @application = args[:application] if args.key?(:application)\n @state_status = args[:state_status] if args.key?(:state_status)\n end",
"def update\n respond_to do |format|\n if @ruby_application.update(ruby_application_params)\n @ruby_application.delay.run_report\n format.html { redirect_to @ruby_application.user, notice: 'Ruby application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ruby_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_install_type = args[:app_install_type] if args.key?(:app_install_type)\n @app_source = args[:app_source] if args.key?(:app_source)\n @app_type = args[:app_type] if args.key?(:app_type)\n @browser_device_count = args[:browser_device_count] if args.key?(:browser_device_count)\n @description = args[:description] if args.key?(:description)\n @disabled = args[:disabled] if args.key?(:disabled)\n @display_name = args[:display_name] if args.key?(:display_name)\n @homepage_uri = args[:homepage_uri] if args.key?(:homepage_uri)\n @os_user_count = args[:os_user_count] if args.key?(:os_user_count)\n @permissions = args[:permissions] if args.key?(:permissions)\n end",
"def update\n respond_to do |format|\n if @herga_application.update(herga_application_params)\n format.html { redirect_to @herga_application, notice: 'Herga application was successfully updated.' }\n format.json { render :show, status: :ok, location: @herga_application }\n else\n format.html { render :edit }\n format.json { render json: @herga_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @add_app = args[:add_app] if args.key?(:add_app)\n @add_pinned_item = args[:add_pinned_item] if args.key?(:add_pinned_item)\n @remove_app = args[:remove_app] if args.key?(:remove_app)\n @remove_pinned_item = args[:remove_pinned_item] if args.key?(:remove_pinned_item)\n end",
"def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end",
"def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: \"Test app was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @registered_app.update(registered_app_params)\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: 'Test app was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_appdata(person_id, appId, key, value)\n @restv9.update_appdata(person_id, appId, key, value)\n end",
"def update!(**args)\n @bundle_identifier = args[:bundle_identifier] if args.key?(:bundle_identifier)\n @localized_app_name = args[:localized_app_name] if args.key?(:localized_app_name)\n @open_app_url = args[:open_app_url] if args.key?(:open_app_url)\n end",
"def update\n if @apparel.empty?()\n json_response({success: false, message: Message.not_found('Apparel record')}, :unprocessable_entity)\n else\n @apparel.update(apparel_params)\n json_response({success: true, message: Message.updated_successfuly('Apparel record')}, :ok)\n end\n end",
"def update!(**args)\n @localized_app_name = args[:localized_app_name] if args.key?(:localized_app_name)\n @package_name = args[:package_name] if args.key?(:package_name)\n end",
"def update!(**args)\n @localized_app_name = args[:localized_app_name] if args.key?(:localized_app_name)\n @package_name = args[:package_name] if args.key?(:package_name)\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to student_url(current_user), notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_app }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_application\n @application = Oread::Application.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @agent_application.update(agent_application_params)\n format.html { redirect_to @agent_application, notice: 'Agent application was successfully updated.' }\n format.json { render :show, status: :ok, location: @agent_application }\n else\n format.html { render :edit }\n format.json { render json: @agent_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_application.update(user_application_params)\n format.html { redirect_to @user_application, notice: 'User application was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_application }\n else\n format.html { render :edit }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n \n respond_to do |format|\n if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def update\n\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to apps_path, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n\n Services::OpenIdConnectionService.new(@app).update \n end",
"def update\n \n #Always get the current time to update\n @driver_application.updated_at = DateTime.current\n \n respond_to do |format|\n if @driver_application.update(driver_application_params)\n format.html { redirect_to @driver_application, notice: 'Driver application was successfully updated.' }\n format.json { render :show, status: :ok, location: @driver_application }\n else\n format.html { render :edit }\n format.json { render json: @driver_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @qy_app.update(qy_app_params)\n format.html { redirect_to @qy_app, notice: 'Qy account was successfully updated.' }\n format.json { render :show, status: :ok, location: @qy_app }\n else\n format.html { render :edit }\n format.json { render json: @qy_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1-merchant', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end",
"def update\n authorize_action_for @app\n\n respond_to do |format|\n if app_params[:android_config].present? && app_params[:android_config][:bundle_id].present?\n if (@app.android_config['bundle_id'] != app_params[:android_config][:bundle_id]) && App.android_bundle_id?(app_params[:android_config][:bundle_id])\n @app.errors.add(:base, 'Android bundle id is invalid or already used')\n end\n end\n\n if app_params[:ios_config].present? && app_params[:ios_config][:bundle_id].present?\n if (@app.ios_config['bundle_id'] != app_params[:ios_config][:bundle_id]) && App.ios_bundle_id?(app_params[:ios_config][:bundle_id])\n @app.errors.add(:base, 'iOS bundle id is invalid or already used')\n end\n end\n\n if [email protected]_messages.present? && @app.update(app_params)\n format.html { redirect_to request.referrer, notice: 'App was successfully updated.' }\n format.json { render json: @app, status: :ok, location: :edit }\n else\n format.html { render :settings }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_type = args[:app_type] if args.key?(:app_type)\n @gsuite_app_type = args[:gsuite_app_type] if args.key?(:gsuite_app_type)\n @id = args[:id] if args.key?(:id)\n end",
"def update\n Puppet.debug \"Attempting to upgrade #{@resource[:name]}\"\n install unless mas_app\n mas('upgrade')\n end",
"def update\n @application = policy_scope(Application).find(params[:id])\n\n @application.schedule_items.clear\n @application.experiences.clear\n @application.roles.clear\n\n policy_scope(Application).update(@application.id, application_params)\n authorize @application\n if params[:application][:decision] == 'update'\n if @application.save\n flash[:notice] = t('.successfully_updated')\n else\n flash[:alert] = t('.not_created')\n end\n elsif params[:decision] == 'accept'\n @application.accept!\n flash[:notice] = t('.accepted')\n elsif params[:decision] == 'reject'\n @application.reject!\n flash[:notice] = t('.rejected')\n else\n flash[:alert] = t('.cant_change_state')\n end\n redirect_to applications_path\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end"
] |
[
"0.75971067",
"0.74355614",
"0.72224873",
"0.72224873",
"0.7185832",
"0.70620316",
"0.7040081",
"0.7024419",
"0.69961953",
"0.6942338",
"0.6870574",
"0.68487716",
"0.6847216",
"0.6823785",
"0.68153256",
"0.68153256",
"0.68069154",
"0.6799347",
"0.6799347",
"0.6799347",
"0.6783762",
"0.6763106",
"0.6744735",
"0.67412734",
"0.67412734",
"0.67412734",
"0.67412734",
"0.67412734",
"0.67134535",
"0.66982573",
"0.66982573",
"0.6695709",
"0.6670377",
"0.6670088",
"0.6664796",
"0.6662326",
"0.66600096",
"0.66583294",
"0.6612905",
"0.6586191",
"0.6565576",
"0.6556143",
"0.65272814",
"0.65251386",
"0.64959496",
"0.6494441",
"0.6479182",
"0.6461942",
"0.64532334",
"0.6426254",
"0.6410833",
"0.64101255",
"0.64101255",
"0.64101255",
"0.64101255",
"0.64101255",
"0.64101255",
"0.6409903",
"0.63957876",
"0.637771",
"0.63771605",
"0.6373457",
"0.63635653",
"0.63572526",
"0.63417757",
"0.6320824",
"0.629773",
"0.62947434",
"0.6294276",
"0.62768584",
"0.6265401",
"0.62652725",
"0.6256254",
"0.623458",
"0.6231725",
"0.62304795",
"0.6225844",
"0.6187602",
"0.618397",
"0.61835223",
"0.61799586",
"0.61799586",
"0.6167478",
"0.61591274",
"0.61565304",
"0.6140267",
"0.6134475",
"0.61240405",
"0.61150485",
"0.610045",
"0.60823995",
"0.6072928",
"0.6060369",
"0.6058799",
"0.604423",
"0.6039506",
"0.603547",
"0.6026247",
"0.6026247",
"0.6026247"
] |
0.72866803
|
2
|
Update a RUM application. Update the RUM application with given ID in your organization.
|
def update_rum_application_with_http_info(id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.update_rum_application ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling RUMAPI.update_rum_application"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.update_rum_application"
end
# resource path
local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/'))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'RUMApplicationResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :update_rum_application,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#update_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_rum_application(id, body, opts = {})\n data, _status_code, _headers = update_rum_application_with_http_info(id, body, opts)\n data\n end",
"def update(id, optional_params = {})\n response = Network.post(['Applications', id], optional_params)\n Application.new(response)\n end",
"def update\n @app = App.find(params[:uid])\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless admin?\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n if @app.update(app_params)\n head :no_content\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n end\n \n respond_with @application\n end",
"def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end",
"def update!(**args)\n @application_id = args[:application_id] if args.key?(:application_id)\n end",
"def update_app data={}\n put '/app', data\n end",
"def update\n if @application.update(application_params)\n render :show, status: :ok, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end",
"def update\n @application = Application.find(params[:id])\n \n respond_to do |format|\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n format.html { redirect_to(@application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html {\n flash[:success] = 'Application was successfully updated.'\n redirect_to [:admin, @application]\n }\n format.json { head :no_content }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"edit\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to root_path, notice: 'Application was successfully submitted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @app.update_attributes(params[:app])\n respond_to do |format|\n format.html {\n redirect_to app_path(@app), notice: 'app was successfully updated.'\n }\n format.json { render :nothing => true}\n end\n else\n respond_to do |format|\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n flash[:notice] = 'App was successfully updated.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n if @app \n @app.update(app_params)\n\n if @app.valid?\n head :no_content\n else \n head :bad_request\n end\n else \n head :not_found\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @application = Application.find(params[:id])\n new_name = params[:application][:name].to_s.downcase\n @application.name = params[:application][:name]\n User.edit_app_name(@application.id, new_name) if @application.valid?\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to applications_path, notice: 'Приложение обновлено.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mobileapp = Mobileapp.find(params[:id])\n \n respond_to do |format|\n if @mobileapp.update_attributes(params[:mobileapp])\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application.owner = current_user if @application.owner.blank?\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_app = UserApp.find(params[:id])\n\n respond_to do |format|\n if @user_app.update_attributes(params[:user_app])\n format.html { redirect_to @user_app, notice: 'User app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to dynamic_url(@application, action: :edit), notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @app\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: \"Application was successfully updated.\" }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @app.update(app_params)\n redirect_to @app, notice: 'App was successfully updated.' \n else\n render action: 'edit' \n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n if @newapp.update_attributes(params[:newapp])\n format.html { redirect_to @newapp, notice: 'Newapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @userapp = Userapp.find(params[:id])\n\n respond_to do |format|\n if @userapp.update_attributes(params[:userapp])\n flash[:notice] = 'Userapp was successfully updated.'\n format.html { redirect_to(@userapp) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @userapp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_appdata(person_id, appId, key, value)\n @restv9.update_appdata(person_id, appId, key, value)\n end",
"def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html {redirect_to @application, notice: 'Application was successfully updated.'}\n format.json {render :show, status: :ok, location: @application}\n else\n format.html {render :edit}\n format.json {render json: @application.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to apps_path, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n\n Services::OpenIdConnectionService.new(@app).update \n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, alert: 'Your application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app = args[:app] if args.key?(:app)\n end",
"def update\n @app_role = AppRole.find(params[:id])\n\n respond_to do |format|\n if @app_role.update_attributes(params[:app_role])\n format.html { redirect_to @app_role, notice: 'App role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app.update(app_params)\n flash[:success] = 'App was successfully updated.'\n format.html { redirect_to @app }\n format.json { render :show, status: :ok, location: @app }\n else\n flash[:danger] = 'There was a problem updating the App Catalog Page.'\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mobile_app.update(mobile_app_params)\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_app }\n else\n format.html { render :edit }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_application\n @application = Oread::Application.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @herga_application.update(herga_application_params)\n format.html { redirect_to @herga_application, notice: 'Herga application was successfully updated.' }\n format.json { render :show, status: :ok, location: @herga_application }\n else\n format.html { render :edit }\n format.json { render json: @herga_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:mms_app])\n flash[:notice] = '修改组件成功!'\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n flash[:notice] = '修改组件失败!'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_application.update(user_application_params)\n format.html { redirect_to @user_application, notice: 'User application was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_application }\n else\n format.html { render :edit }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to student_url(current_user), notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n requires :label, :application_name\n\n options = {\n 'ApplicationName' => application_name,\n 'Description' => description,\n 'VersionLabel' => label\n }\n options.delete_if {|key, value| value.nil?}\n\n data = service.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']\n merge_attributes(data)\n end",
"def update\n respond_to do |format|\n if @residential_application.update(residential_application_params)\n format.html { redirect_to @residential_application, notice: 'Residential application was successfully updated.' }\n format.json { render :show, status: :ok, location: @residential_application }\n else\n format.html { render :edit }\n format.json { render json: @residential_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def update\n respond_to do |format|\n if @agent_application.update(agent_application_params)\n format.html { redirect_to @agent_application, notice: 'Agent application was successfully updated.' }\n format.json { render :show, status: :ok, location: @agent_application }\n else\n format.html { render :edit }\n format.json { render json: @agent_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @registered_app.update(registered_app_params)\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def set_application\n @application = Application.find(params[:id])\n end",
"def update\n @user_account_app = User.find(params[:id])\n\n respond_to do |format|\n if @user_account_app.update_attributes(params[:user_account_app])\n format.html { redirect_to @user_account_app, notice: 'User account app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_account_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_store = args[:app_store] if args.key?(:app_store)\n end",
"def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application = policy_scope(Application).find(params[:id])\n\n @application.schedule_items.clear\n @application.experiences.clear\n @application.roles.clear\n\n policy_scope(Application).update(@application.id, application_params)\n authorize @application\n if params[:application][:decision] == 'update'\n if @application.save\n flash[:notice] = t('.successfully_updated')\n else\n flash[:alert] = t('.not_created')\n end\n elsif params[:decision] == 'accept'\n @application.accept!\n flash[:notice] = t('.accepted')\n elsif params[:decision] == 'reject'\n @application.reject!\n flash[:notice] = t('.rejected')\n else\n flash[:alert] = t('.cant_change_state')\n end\n redirect_to applications_path\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single camp_application based on the id\n camp_application = CampApplication.find_by(id: the_id)\n\n # update it\n if camp_application.update!(\n camp_id: params[:camp_id],\n application_id: params[:application_id]\n )\n render json: camp_application.as_json\n else\n render json: {errors: camp_application.errors.full_messages}\n end\n end",
"def update\n if @apparel.empty?()\n json_response({success: false, message: Message.not_found('Apparel record')}, :unprocessable_entity)\n else\n @apparel.update(apparel_params)\n json_response({success: true, message: Message.updated_successfuly('Apparel record')}, :ok)\n end\n end",
"def update\n authorize_action_for @app\n\n respond_to do |format|\n if app_params[:android_config].present? && app_params[:android_config][:bundle_id].present?\n if (@app.android_config['bundle_id'] != app_params[:android_config][:bundle_id]) && App.android_bundle_id?(app_params[:android_config][:bundle_id])\n @app.errors.add(:base, 'Android bundle id is invalid or already used')\n end\n end\n\n if app_params[:ios_config].present? && app_params[:ios_config][:bundle_id].present?\n if (@app.ios_config['bundle_id'] != app_params[:ios_config][:bundle_id]) && App.ios_bundle_id?(app_params[:ios_config][:bundle_id])\n @app.errors.add(:base, 'iOS bundle id is invalid or already used')\n end\n end\n\n if [email protected]_messages.present? && @app.update(app_params)\n format.html { redirect_to request.referrer, notice: 'App was successfully updated.' }\n format.json { render json: @app, status: :ok, location: :edit }\n else\n format.html { render :settings }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @application_event=ApplicationsEvent.find(params[:applications_event_id])\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n if @applications_application.update_attributes(params[:applications_application])\n format.html { redirect_to @applications_application, notice: 'Applications application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @applications_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @app_type = args[:app_type] if args.key?(:app_type)\n @gsuite_app_type = args[:gsuite_app_type] if args.key?(:gsuite_app_type)\n @id = args[:id] if args.key?(:id)\n end",
"def set_application\n @application = current_user.applications.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: 'Test app was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: \"Test app was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app\n @app = current_user.apps.find(params[:id])\n end",
"def update\n authorize! :update, @dj_application\n\n respond_to do |format|\n if @dj_application.update(dj_application_params)\n format.html { redirect_to @dj_application, notice: 'Dj application was successfully updated.' }\n format.json { render :show, status: :ok, location: @dj_application }\n else\n format.html { render :edit }\n format.json { render json: @dj_application.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.77720004",
"0.72263825",
"0.71447027",
"0.7139714",
"0.71034366",
"0.7075179",
"0.70720214",
"0.7037274",
"0.70340693",
"0.70285535",
"0.7020902",
"0.69945914",
"0.6985224",
"0.69750273",
"0.6965341",
"0.694668",
"0.6928166",
"0.6928166",
"0.69228214",
"0.6905937",
"0.6905937",
"0.6905937",
"0.6905488",
"0.68939745",
"0.68500364",
"0.68500364",
"0.68478477",
"0.6833397",
"0.6785251",
"0.67817646",
"0.6771527",
"0.6763043",
"0.6763043",
"0.66857487",
"0.66784114",
"0.6643604",
"0.6643604",
"0.6643604",
"0.6643604",
"0.6643604",
"0.66237277",
"0.66237277",
"0.66237277",
"0.66237277",
"0.66237277",
"0.66237277",
"0.66147214",
"0.6614006",
"0.660719",
"0.6587443",
"0.65717065",
"0.65685636",
"0.6544082",
"0.6527023",
"0.65122736",
"0.6505077",
"0.6499057",
"0.6492981",
"0.6478155",
"0.64573157",
"0.6444375",
"0.64072627",
"0.63956755",
"0.63921285",
"0.63798547",
"0.6378553",
"0.63693094",
"0.6361279",
"0.6353196",
"0.6351168",
"0.634606",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.63231015",
"0.631201",
"0.631149",
"0.6295364",
"0.6289581",
"0.626183",
"0.6254825",
"0.6251827",
"0.6209936",
"0.62056786",
"0.620529",
"0.6186359",
"0.61851245",
"0.61766064",
"0.6167119"
] |
0.6827842
|
28
|
load money from external file
|
def load_money()
money_val = File.open("money_val.txt")
money = money_val.read.to_i
if money == 0
money = 100
end
money_val.close
return money
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_currencies\n currencies = parse_currency_file(\"currency.json\")\n currencies.merge! parse_currency_file(\"currency_bc.json\")\n end",
"def load!\n money = redis.get('money')\n money && @use_redis ? money_from_json(money) : default_hash\n end",
"def load_contract(path)\n open(path, 'rb') { |f| Universa::Contract.from_packed(f.read) }\n end",
"def load_character account, filename\n end",
"def load(file); end",
"def load_file(file); end",
"def load_file(filename); end",
"def load_file(filename); end",
"def load(file_path); end",
"def load(file_path); end",
"def load(filename)\n end",
"def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end",
"def load_file(path)\n load_string(File.binread(path))\n end",
"def load_incomes(filename)\n File.readlines(filename).map(&:chomp).map(&:to_i)\n end",
"def money(key)\n Money.new @config.fetch(key)\n end",
"def load(filename)\n\t\tend",
"def load( file_path )\n description_found = false\n length_found = 0\n number_of_ratios = 0\n\n @file_path = file_path\n file = File.new( file_path, 'r')\n file.each_line(\"\\n\") do |row|\n\n # cleanse and prepare\n\n row.lstrip!\n row.rstrip!\n row.squeeze!(' ')\n next if row[0] == '!' # ignore comments\n\n unless description_found # description is the first non commented line\n @description = row\n description_found = true\n next\n end\n\n unless number_of_ratios > 0 # total ratios comes next after description is found\n number_of_ratios = row.to_i\n next\n end\n\n # Cents or fraction then process\n\n tokens = row.split(' ')\n if tokens[0].include?('.') # cents\n @cents << tokens[0].to_f\n elsif tokens[0].include?('/') # if fraction then convert to cents\n parts = tokens[0].split('/')\n # cents <== log(n/d) * (1200/log(2))\n @cents << Math.log10( (parts[0].to_f / parts[1].to_f) ) * MiltonsMachine::Core::Constants::CENTS_CONVERSION\n end\n end\n\n end",
"def ytd_load\n Rails.cache.fetch(\"organizations/#{cache_key}/calculations/ytd_load\") do\n ytd_load_cents = \n orders.paid\n .where(starts_on: Date.current.beginning_of_year...Date.current)\n .joins(:codes)\n .group('orders.id')\n .pluck(Arel.sql(\"sum(codes.limit_cents) as order_sum\")).sum\n\n Money.new(ytd_load_cents || 0, \"USD\")\n end\n end",
"def load_file (filename)\n @name = nil\n File.open(filename, mode: 'r').each do |ln|\n flds = ln.split(',')\n if !@name\n @name = flds[0]\n end\n dts = flds[1];\n @obvs << \"#{dts[2..3]}-#{dts[4..5]}-#{dts[6..7]}\"\n @values << flds[2].to_f\n end\n #puts \"load_file: #{@values.size}\"\n end",
"def load(path); end",
"def money; end",
"def load; end",
"def load; end",
"def load; end",
"def load(data)\n end",
"def load_data(date)\n doc = Yajl::Parser.parse(open(rates_source(date)).read)\n\n base_currency = doc['base'] || 'USD'\n\n doc['rates'].each do |currency, rate|\n # Don't use set_rate here, since this method can only be called from\n # get_rate, which already aquired a mutex.\n internal_set_rate(date, base_currency, currency, rate)\n\n end\n\n rescue OpenURI::HTTPError => e\n puts \"couldn't get rate from #{rates_source}\"\n end",
"def money\n Money.from_amount(amount.to_f)\n end",
"def load_rb(filename); end",
"def sum_from_file(filename)\nend",
"def sum_from_file(filename)\nend",
"def price_curve\n load_curve('price.csv')\n end",
"def load_deposit!(txid)\n method_not_implemented\n end",
"def load_file(path)\n load(path)\n end",
"def money(amount, name)\n Currency::Money.new(amount, name)\n end",
"def load_deck\n File.open(File.dirname(__FILE__) + '/deck.txt') do |file|\n begin\n @deck = eval(file.lines.to_a.join('') ).map{ |card| Card.from_hash(card) }\n puts 'deck loaded'\n @deck.each{ |x| puts x.inspect }\n rescue Exception => e\n puts \"got exception #{e.message}\"\n @deck = []\n end\n end\n end",
"def money\n end",
"def load_file(path, name)\n data_file = PStore.new(path)\n data = nil\n data_file.transaction do\n data = data_file[name]\n end\n if data == nil\n data = Array.new\n end\n data\nend",
"def sum_from_file(filename)\n\nend",
"def set_load(point, amount)\n load_curve[point] = amount\n end",
"def load(name); end",
"def load\r\n \r\n end",
"def loadfile(filename)\n file = nil\n open(filename, 'r') do |f|\n file = f.read\n end\n file\nend",
"def import(from_file)\n read_from_excel(from_file, 0) do |extractor|\n ForexPayment.new(issue_date: ImportHelper::to_date(extractor.call(\"B\")), emp_id: extractor.call(\"C\"),\n emp_name: extractor.call(\"D\"), amount: extractor.call(\"E\"), currency: extractor.call(\"F\"),\n travel_date: ImportHelper::to_date(extractor.call(\"G\")), place: extractor.call(\"H\"),\n project: extractor.call(\"I\"), vendor_name: extractor.call(\"J\"),\n card_number: extractor.call(\"K\"), expiry_date: extractor.call(\"L\"),\n office: extractor.call(\"M\"), inr: extractor.call(\"N\")\n )\n end\n end",
"def load_from_file(filename)\n load_from_string(File.read(filename))\n end",
"def load(filename)\n data = Array.new\n f = File.new(filename, \"r\")\n while (line = f.gets())\n nums = line.split(\" \")\n w = Array.new\n p = Array.new\n cnt = 0\n for i in (0..nums.at(1).to_i-1)\n #w.push(bin_round(nums.at(3+2*i).to_i, $roundbits)) #pro aprox alg.\n w.push(nums.at(3+2*i).to_i)\n p.push(nums.at(4+2*i).to_i)\n cnt += 1\n end\n data.push(Batoh.new(w, p, nums.at(2).to_i, Array.new(cnt, 0))) #inverzni pro DP\n end\n #pp data.to_s\n return data\nend",
"def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end",
"def load_data(file)\n return [] unless File.exist?(file)\n @crypto.decrypt(File.open(file, 'rb').read, password: @passphrase).to_s.each_line.to_a\n rescue GPGME::Error::NoData\n []\n end",
"def money(amount)\n Money.new((amount * 100).to_i)\n end",
"def set_money\n @money = Money.find(params[:id])\n end",
"def set_money_arrival_file\n @money_arrival_file = MoneyArrivalFile.find(params[:id])\n end",
"def load_rates(date)\n data = retrieve_rates date\n rate_snapshot = JSON.parse data\n exit 1 unless rate_snapshot['base'].downcase == 'usd' # TODO: better error handling\n\n rate_date = DateTime.strptime(rate_snapshot['timestamp'].to_s, '%s').to_date\n\n upload_usd_rates(rate_date, rate_snapshot['rates'])\n \n puts \"Updated rates for #{rate_date.to_s}\"\nend",
"def load_file_contents(file)\n File.open(file, 'r').read\n end",
"def currency; end",
"def currency; end",
"def money(amount)\n number_to_currency amount.to_s, {:unit => 'R ', :delimiter => ',', :seperator => '.'}\n end",
"def load!; end",
"def load(extended: false)\n (used(extended: extended) / total(extended: extended).to_f).round(2) * 100\n end",
"def load_balance!(currency)\n method_not_implemented\n end",
"def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end",
"def load_file(path)\n send_cmd(\"load #{path}\")\n end",
"def load(file)\n File.open(path(file)).read\n end",
"def load!( file )\n Yell.new Yell::Configuration.load!(file)\n end",
"def fromFile( filename ) \n lines = IO.readlines( filename )\n loadAll( lines )\n end",
"def load(filename)\n json_string = String.new\n File.open(filename, \"r\") { |f| \n json_string += f.read \n }\n @score = JSON.parse json_string \n end",
"def load_file(file_path, status)\n\t\tmodel = Sketchup.active_model\n\t\tSketchup.status_text = 'Importing Seene... (about 1 minute on max quality)'\n\t\t\tstatus = model.start_operation('Import Seene', true)\n\t\t\tbegin\n\t\t\t\tresult = load_file_internal(file_path, status)\n\t\t\trescue Exception => e\n\t\t\t UI.messagebox \"Import failed: \" + e.to_s # + \"\\n\" + e.backtrace\n\t\t\t raise #to display the problem in ruby console as well (should be open)\n\t\t\tend\n\n\t\t\tmodel.commit_operation\n\t\tSketchup.status_text = ''\n\t\treturn result\n end",
"def load\n initialize(File.info(uuid).entity)\n end",
"def from_file(file)\n from_s Utils::read_file file\n end",
"def from_file(file)\n from_s Utils::read_file file\n end",
"def load(filename)\n Format.load(filename)\n end",
"def from_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount / curr\n return total.round(2)\nend",
"def load\n end",
"def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend",
"def import_calc\n import = @quantity * @price * @duty\n end",
"def fetch_price_result file_name\n\t\tdoc = Nokogiri::HTML(open(file_name))\n\n\t\tbook_elems = doc.css('h6.bold')\n\t\tbook_elems.each do |elem|\n\t\t\tif elem.content == \"I'm Booking\"\n\t\t\t\treturn :route_not_supported\n\t\t\tend\n\t\tend\n\n\t\ttables = doc.css('div.ibe_content_select_table')\n\n\t\t#price_str = doc.css('label.medgrey').first.css('div#sidepaneltotalPrice').first.content\n\t\t#puts price_str\n\n\t\tdep_price = fetch_price_from_table tables.first, @departure_date\n\t\tputs \"Dep price : \" + dep_price.to_s\n\n\t\tret_price = nil\n\t\tif \"Return\" == @trip_type_string\n\t\t\tret_price = fetch_price_from_table tables[1], @return_date\n\t\t\tputs \"Ret price : \" + ret_price.to_s\n\t\tend\n\n\t\tif \"OneWay\" == @trip_type_string\n\t\t\tif not dep_price.is_a? Float\n\t\t\t\treturn dep_price\n\t\t\tend\n\t\telsif \"Return\" == @trip_type_string\n\t\t\tif dep_price.is_a? Float and ret_price.is_a? Float\n\t\t\t\tdep_price += ret_price\n\t\t\telse\n\t\t\t\treturn dep_price if not dep_price.is_a? Float\n\t\t\t\treturn ret_price if not dep_price.is_a? Float\n\t\t\tend\n\t\tend\n\n\t\tprice = Price.new(\"Lowest available fare\", \"\", dep_price)\n\n\t\t[[price], \"\", \"\"]\n\tend",
"def bank\n @bank ||= lambda {\n bank = Money::Bank::VariableExchange.new\n bank.import_rates(:json, self.exchange_rate || \"{}\")\n bank\n }.call\n end",
"def money\n Spree::Money.new(amount, { currency: currency })\n end",
"def load_bitbucket()\n JSON.parse(IO.read('db-1.0.json'))\nend",
"def import_countries(file)\n Country.transaction do\n while (line = file.gets)\n next if line.match(/^#/)\n line = line.split(/\\t/)\n \n c = Country.create(\n :iso2 => line[0], :iso3 => line[1], :ison => line[2],\n :name => line[4], :capital => line[5], :area => line[6],\n :continent => line[8], :currency_code => line[10], :currency_name => line[11],\n :phone => line[12], :geoname_id => line[16]\n )\n @@countries[line[0]] = c.id\n end\n end\n end",
"def add_inv inv_file\n self.inventory_database = JSON.parse File.read(inv_file)\n end",
"def load_file_contents(filename)\n File.open(filename).readlines\n end",
"def load_file(file)\n File.open(file, \"r\") { |f| load(f) }\n end",
"def load\n\t\tsource = self.depfile.read\n\t\tself.instance_eval( source, self.depfile.to_s, 1 )\n\tend",
"def load_act_file(path)\n\t\t\t\traise \"act file at path #{path} didn't exist\" unless path.exist?\n\t\t\t\tui.log \"loading acts from #{path}\"\n\n\t\t\t\tfrom_file(path)\n\t\t\tend",
"def import!(path)\n data = self.class.read_text_file(path)\n # Only process 20 data rows now\n # TODO: Remove limit of the number of data rows later\n data = data[0...20]\n total_income = 0\n total_expense = 0\n transactions = []\n # Cache found categories\n categories = {}\n data.each do |d|\n # Find category which transaction belongs to\n category_name = d.delete(:category_name)\n category = categories[category_name] || Category.find_by_name(category_name)\n categories[category_name] = category\n\n # Not support yet creating user's category\n # TODO: Need to allow user to create own category of user\n d.merge! :category => category, :account_id => self.id\n transaction = Transaction.new(d)\n # Not support yet transfer type of transaction\n valid = transaction.valid?\n next if !valid || (valid && transaction.is_transfer?)\n transactions << transaction\n if transaction.is_income?\n total_income += transaction.amount\n else # transaction.is_expense?\n total_expense += transaction.amount\n end\n end\n self.class.transaction do\n transactions.each(&:save!)\n self.update_attributes! :income => total_income, :expense => total_expense\n end\n self\n end",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets)\n file.close()\n return object\nend",
"def load(hash)\n date = hash['time']\n data = hash['Cube']\n data = data.reduce({}) do |hash, element|\n hash[element['currency']] = BigDecimal.new(element['rate'])\n hash\n end\n data['EUR'] = BigDecimal('1.0')\n\n { date => data }\n end",
"def load_data\n @data ||= CSV.read(@file)\n end",
"def load_file(file_path)\n\t\t\tcode = File.open(file_path) { |f| f.read }\n\t\t\trun(code)\n\t\tend",
"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 read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend",
"def load_source!\n @source = load_file_contents\n end",
"def add_money!(json)\n put_inside!(money_from_json(json))\n end",
"def fetch(name)\n file_path = file_for(name)\n return File.read(file_path).strip.to_i if File.exist?(file_path)\n store(name)\n end",
"def load(filename)\n # Note: Must get a first name and last name\n # Note: Phone should be formatted (###) ###-####\n # Note: Assume you'll always have a valid id\n # Return true \n raise \"Not implemented\"\n end",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend",
"def load_voices\n # TODO\n end",
"def money\n to_d.money.to_s\n end",
"def money\n to_d.money.to_s\n end",
"def load_fx_data(feed_uri)\n #Update the local file that datastore.datasource reads from e.g.'http://www.ecb.europa.eu/stats/eurofxref/fx_data.xml'\n fx_data = open(feed_uri) { |f| f.read }\n File.open(@datastore.fx_datasource::FX_DATA, 'w+') { |f| f.puts(fx_data) }\n @datastore.load_fx_rate\n end",
"def us_dollar(cents); end"
] |
[
"0.63752735",
"0.6208907",
"0.619752",
"0.6146132",
"0.5941594",
"0.5880553",
"0.58179224",
"0.58179224",
"0.58148724",
"0.58148724",
"0.56278294",
"0.55781066",
"0.55687886",
"0.556844",
"0.5562873",
"0.55596036",
"0.5544476",
"0.5497189",
"0.5426702",
"0.54199797",
"0.53959125",
"0.53855747",
"0.53855747",
"0.53855747",
"0.53803545",
"0.5364404",
"0.5354349",
"0.53228116",
"0.5315843",
"0.5315843",
"0.5306991",
"0.5298618",
"0.5263648",
"0.52619773",
"0.52566266",
"0.5255965",
"0.52475536",
"0.52203834",
"0.5207704",
"0.52047515",
"0.5176641",
"0.51736933",
"0.5159865",
"0.51576",
"0.5156601",
"0.51427376",
"0.51292163",
"0.5124289",
"0.5124156",
"0.5122831",
"0.5121872",
"0.5114045",
"0.5108243",
"0.5108243",
"0.510582",
"0.5101614",
"0.5100429",
"0.509864",
"0.5087723",
"0.50740516",
"0.5073896",
"0.50717896",
"0.5060169",
"0.505878",
"0.5058644",
"0.50510126",
"0.50465363",
"0.50465363",
"0.5045946",
"0.50440925",
"0.5042541",
"0.50373226",
"0.50340164",
"0.50329185",
"0.503153",
"0.5027615",
"0.50273764",
"0.5023855",
"0.50222796",
"0.502179",
"0.50190794",
"0.50190455",
"0.5017131",
"0.50128734",
"0.50112903",
"0.5005576",
"0.5005423",
"0.50046486",
"0.500177",
"0.5001637",
"0.50000113",
"0.498223",
"0.4963968",
"0.4960456",
"0.49560186",
"0.49502617",
"0.49440923",
"0.49440923",
"0.49421844",
"0.49391523"
] |
0.76896745
|
0
|
Creates Options Hit, Stand, Exit
|
def play_options(prompt)
choices = [
{name: "Hit", value: 1},
{name: "Stand", value: 2},
{name: "Exit", value: 3}
]
chosen_option = prompt.select("What would you like to do?", choices, help_color: :yellow, help: "(Use Keybvoard keys)", show_help: :start, filter: true)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def options_create opts, colors\n\t\t\t\t#todo create, switch\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" create, switch\".colorize(colors[:yellow]) + \n\t\t\t\t\" creates a new list or switches to an existing one\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:create].colorize(colors[:red])\n\t\t\tend",
"def play_options(prompt)\r\n choices = [\r\n {name: \"Hit\", value: 1},\r\n {name: \"Stand\", value: 2},\r\n {name: \"Exit\", value: 3}\r\n ]\r\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keyboard Arrow Keys)\", show_help: :start, filter: true)\r\nend",
"def command_options\n $game_temp.in_game = false\n SceneManager.call(Scene_Options)\n end",
"def command_options\n $game_temp.in_game = false\n SceneManager.call(Scene_Options)\n end",
"def add_options(type, cmd, default_template: 'default')\n cmd_name = cmd.name.to_s\n action = case cmd_name\n when /again/\n 'Repeat'\n when /grep/\n 'Search'\n when /mark/\n 'Flag'\n when /(last|tags|view|on)/\n 'Show'\n else\n cmd_name.capitalize\n end\n\n case type\n when :output_template\n cmd.desc \"Output to export format (#{Doing::Plugins.plugin_names(type: :export)})\"\n cmd.arg_name 'FORMAT'\n cmd.flag %i[o output], type: ExportTemplate\n\n cmd.desc \"Output using a template from configuration\"\n cmd.arg_name 'TEMPLATE_KEY'\n cmd.flag [:config_template], type: TemplateName, default_value: default_template\n\n cmd.desc 'Override output format with a template string containing %placeholders'\n cmd.arg_name 'TEMPLATE_STRING'\n cmd.flag [:template]\n when :output_template_no_defaults\n cmd.desc \"Output to export format (#{Doing::Plugins.plugin_names(type: :export)})\"\n cmd.arg_name 'FORMAT'\n cmd.flag %i[o output]\n\n cmd.desc \"Output using a template from configuration\"\n cmd.arg_name 'TEMPLATE_KEY'\n cmd.flag [:config_template], type: TemplateName\n\n cmd.desc 'Override output format with a template string containing %placeholders'\n cmd.arg_name 'TEMPLATE_STRING'\n cmd.flag [:template]\n when :add_entry\n cmd.desc 'Exclude auto tags and default tags'\n cmd.switch %i[X noauto], default_value: false, negatable: false\n\n cmd.desc 'Include a note'\n cmd.arg_name 'TEXT'\n cmd.flag %i[n note]\n\n cmd.desc 'Prompt for note via multi-line input'\n cmd.switch %i[ask], negatable: false, default_value: false\n\n cmd.desc \"Edit entry with #{Doing::Util.default_editor}\"\n cmd.switch %i[e editor], negatable: false, default_value: false\n\n cmd.desc 'Backdate start date for new entry to date string [4pm|20m|2h|yesterday noon]'\n cmd.arg_name 'DATE_STRING'\n cmd.flag %i[b back started since], type: DateBeginString\n when :finish_entry\n cmd.desc %(Set finish date to specific date/time (natural langauge parsed, e.g. --at=1:30pm).\n Used with --took, backdates start date)\n cmd.arg_name 'DATE_STRING'\n cmd.flag %i[at finished], type: DateEndString\n\n cmd.desc %(\n Start and end times as a date/time range `doing done --from \"1am to 8am\"`.\n Overrides other date flags.\n )\n cmd.arg_name 'TIME_RANGE'\n cmd.flag [:from], must_match: REGEX_RANGE\n\n cmd.desc %(Set completion date to start date plus interval (XX[mhd] or HH:MM).\n If used without the --back option, the start date will be moved back to allow\n the completion date to be the current time.)\n cmd.arg_name 'INTERVAL'\n cmd.flag %i[t took for], type: DateIntervalString\n when :search\n cmd.desc 'Filter entries using a search query, surround with slashes for regex (e.g. \"/query.*/\"),\n start with single quote for exact match (\"\\'query\")'\n cmd.arg_name 'QUERY'\n cmd.flag [:search]\n\n cmd.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'\n cmd.arg_name 'TYPE'\n cmd.flag [:case], must_match: REGEX_CASE,\n default_value: Doing.settings.dig('search', 'case').normalize_case,\n type: CaseSymbol\n\n cmd.desc 'Force exact search string matching (case sensitive)'\n cmd.switch %i[x exact], default_value: Doing.config.exact_match?, negatable: Doing.config.exact_match?\n when :time_display\n cmd.desc 'Show time intervals on @done tasks'\n cmd.switch %i[t times], default_value: true, negatable: true\n\n cmd.desc 'Show elapsed time on entries without @done tag'\n cmd.switch [:duration]\n\n cmd.desc 'Show time totals at the end of output'\n cmd.switch [:totals], default_value: false, negatable: false\n\n cmd.desc 'Sort tags by (name|time)'\n default = Doing.setting('tag_sort').normalize_tag_sort || :name\n cmd.arg_name 'KEY'\n cmd.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol\n\n cmd.desc 'Tag sort direction (asc|desc)'\n cmd.arg_name 'DIRECTION'\n cmd.flag [:tag_order], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol\n\n cmd.desc 'Only show items with recorded time intervals'\n cmd.switch [:only_timed], default_value: false, negatable: false\n when :tag_filter\n cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'\n cmd.arg_name 'TAG'\n cmd.flag [:tag], type: TagArray\n\n cmd.desc 'Perform a tag value query (\"@done > two hours ago\" or \"@progress < 50\").\n May be used multiple times, combined with --bool'\n cmd.arg_name 'QUERY'\n cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY\n\n cmd.desc \"#{action} items that *don't* match search/tag filters\"\n cmd.switch [:not], default_value: false, negatable: false\n\n cmd.desc 'Boolean used to combine multiple tags (AND|OR|NOT). Use PATTERN to parse + and - as booleans'\n cmd.arg_name 'BOOLEAN'\n cmd.flag [:bool], must_match: REGEX_BOOL,\n default_value: :pattern,\n type: BooleanSymbol\n when :tag_filter_no_defaults\n cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'\n cmd.arg_name 'TAG'\n cmd.flag [:tag], type: TagArray\n\n cmd.desc 'Perform a tag value query (\"@done > two hours ago\" or \"@progress < 50\").\n May be used multiple times, combined with --bool'\n cmd.arg_name 'QUERY'\n cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY\n\n cmd.desc \"#{action} items that *don't* match search/tag filters\"\n cmd.switch [:not], negatable: false\n\n cmd.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'\n cmd.arg_name 'BOOLEAN'\n cmd.flag [:bool], must_match: REGEX_BOOL,\n type: BooleanSymbol\n when :time_filter\n cmd.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'\n cmd.arg_name 'TIME_STRING'\n cmd.flag [:before], type: DateEndString\n\n cmd.desc 'View entries after specified time (e.g. 8am, 12:30pm, 15:00)'\n cmd.arg_name 'TIME_STRING'\n cmd.flag [:after], type: DateBeginString\n\n cmd.desc %(\n Time range to show `doing #{cmd.name} --from \"12pm to 4pm\"`\n )\n cmd.arg_name 'TIME_RANGE'\n cmd.flag [:from], type: DateRangeString, must_match: REGEX_TIME_RANGE\n when :date_filter\n if action =~ /Archive/\n cmd.desc 'Archive entries older than date (natural language).'\n else\n cmd.desc \"#{action} entries older than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all\n dates will be included, but entries will be filtered by time of day\"\n end\n cmd.arg_name 'DATE_STRING'\n cmd.flag [:before], type: DateBeginString\n\n if action =~ /Archive/\n cmd.desc 'Archive entries newer than date (natural language).'\n else\n cmd.desc \"#{action} entries newer than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all\n dates will be included, but entries will be filtered by time of day\"\n end\n cmd.arg_name 'DATE_STRING'\n cmd.flag [:after], type: DateEndString\n\n if action =~ /Archive/\n cmd.desc %(\n Date range (natural language) to archive: `doing archive --from \"1/1/21 to 12/31/21\"`.\n )\n else\n cmd.desc %(\n Date range (natural language) to #{action.downcase}, or a single day to filter on.\n To specify a range, use \"to\": `doing #{cmd_name} --from \"monday 8am to friday 5pm\"`.\n\n If values are only time(s) (6am to noon) all dates will be included, but entries will be filtered\n by time of day.\n )\n end\n cmd.arg_name 'DATE_OR_RANGE'\n cmd.flag [:from], type: DateRangeString\n when :save\n cmd.desc 'Save all current command line options as a new view'\n cmd.arg_name 'VIEW_NAME'\n cmd.flag %i[save], type: String\n\n cmd.desc 'Title string to be used for output formats that require it'\n cmd.arg_name 'TITLE'\n cmd.flag %i[title], type: String\n end\nend",
"def menuAOption\n\t\tmenu = @menuStack.pop\n\t\[email protected](menu)\n\t\toption = menu.getOption\n\t\tcase option\n\t\twhen \"Magic\"\n\t\t\[email protected](option)\n\t\t\t@selectMagicBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextMagicSublist, @screen)\n\t\t\[email protected](@selectMagicBox)\n\t\twhen \"Attack\"\n\t\t\[email protected](option) \n\t\t\tif @enemyUnits.length > 1\n\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\[email protected](@selectEnemyBox)\n\t\t\telse\n\t\t\t\tsetCombat\n\t\t\t\[email protected]([@enemyUnits[0]])\n\t\t\tend\n\t\twhen \"Run\"\n\t\t\[email protected](option)\n\t\t\tsetCombat\n\t\twhen \"Item\"\n\t\t\[email protected](option)\n\t\t\t@subMenuIndex = 0\n\t\t\t@selectItemBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextItemSublist, @screen)\n\t\t\[email protected](@selectItemBox)\n\t\telse\n\t\t\tif (option != \"\")\n\t\t\t\tif (option.class < Unit)\n\t\t\t\t\[email protected]([option])\n\t\t\t\t\tsetCombat\n\t\t\t\telse\n\t\t\t\t\ttargetType = option.getTargetType\n\t\t\t\t\tcase targetType\n\t\t\t\t\twhen \"self\"\n\t\t\t\t\t\[email protected](option)\n\t\t\t\t\t\[email protected]([@hero])\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"all\"\n\t\t\t\t\t\[email protected](option)\n\t\t\t\t\t\ttargets = []\n\t\t\t\t\t\[email protected] { |unit| targets.push(unit) }\n\t\t\t\t\t\[email protected](targets)\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"enemy\"\n\t\t\t\t\t\[email protected](option)\n\t\t\t\t\t\tif @enemyUnits.length > 1\n\t\t\t\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t\t\t\[email protected](@selectEnemyBox)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsetCombat\n\t\t\t\t\t\t\[email protected]([@enemyUnits[0]])\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def hike_options\n system 'clear'\n puts \"-----MY HIKES-----\"\n menu = [\"Start New Hike\",\n \"End Hike\",\n \"Edit Hike\",\n \"List All My Hikes\",\n \"Exit\"]\n\n choice = @prompt.select(\"Which option would you like to take?\", menu)\n\n case choice\n when \"Start New Hike\"\n start_hike\n when \"End Hike\"\n end_hike\n when \"Edit Hike\"\n edit_options\n when \"List All My Hikes\"\n list_user_hikes\n end\n\n end",
"def initialize_options\n return if $game_system.options_initialized\n $game_system.options_initialized = true\n for option in H87Options.option_list\n next unless option.for_game?\n option.value = option.default if option.default != nil\n option.toggle if option.type == :bar\n end\n end",
"def run\n welcome\n main_menu_selection #choose to create a character or login to pre-existing character\n player_options #a list of options the selected player from 'selection_menu' can accomplish\nend",
"def main_options\n commands = {\"1\" => \"See all buildings\" ,\n \"2\" => \"Set a unit as rented/avalilable\" ,\n \"3\" => \"Create new Building\",\n \"4\" => \"Exit program\"}\n\n commands.each do |option, description |\n puts \"#{option} - #{description} \"\n end\n print \"\\n:>\"\n gets_chomp(commands)\n end",
"def print_options\n puts '1. Start a new game [new]'\n puts '2. Load a saved game [load]'\n puts '3. Quit the game [quit]'\nend",
"def make_command_list\n add_command(\"Start\", :new_game)\n add_command(\"Continue\", :continue, continue_enabled)\n add_command(\"Quit\", :shutdown)\n end",
"def create_option_window\n @option_window = Window_GameOptions.new(@help_window.y + @help_window.height)\n @option_window.help_window = @help_window\n @option_window.set_handler(:cancel, method(:return_scene))\n @option_window.activate\n end",
"def create_option_window\n @option_window = Window_GameOptions.new(@help_window.y + @help_window.height)\n @option_window.help_window = @help_window\n @option_window.set_handler(:cancel, method(:return_scene))\n @option_window.activate\n end",
"def print_options(type)\n case type\n when 'start_menu'\n type(\"Enter 1 to start a new game.\\n\".green)\n type(\"Enter 2 to load your saved game.\\n\\n\\n\".green)\n entry_prompt\n when 'player_prompt'\n puts \"Enter coordinates (IE: a2) to select a piece.\".green\n puts \"Enter 1 to save you game.\".green\n entry_prompt\n when 'move'\n puts \"Enter coordinates (IE: a4) to select a location.\".green\n puts \"Enter 1 to choose a different piece.\".green\n entry_prompt\n end\n end",
"def create_player_options\n\t\tnames = std_player_names\n\t\tcolours = std_player_colours\n\t\tcontrols = ControlMapper.new.controls()\n\n\t\tfor i in 0...Constants::MAX_PLAYERS\n\t\t\tentry = PlayerEntry.new(@window,\n\t\t\t\t\t\t\t\t\t@main,\n\t\t\t\t\t\t\t\t\t@text_input,\n\t\t\t\t\t\t\t\t\tnames[i], \n\t\t\t\t\t\t\t\t\tcolours[i],\n\t\t\t\t\t\t\t\t\tcontrols[i],\n\t\t\t\t\t\t\t\t \tself)\n\t\t\t\t\t\t\t\t\t \n\t\t\tentry.x = 100\n\t\t\tentry.y = 100 * (i+1)\n\t\t\tadd_component(entry)\n\t\t\t@entries << entry\n\t\tend\n\tend",
"def main_menu\n choice = true\n while choice\n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, or (E)xit \"\n options = gets.chomp.downcase\n\n case options\n when \"c\"\n # runs method create line 101\n create\n when \"l\"\n #runs method list line 144\n list\n when \"u\"\n #runs method update line 161\n update\n when \"d\"\n #runs method delete line 229\n delete\n when \"e\"\n choice = false #exits world\n else\n puts \"Wrong Input. Please input C, L, U, D or E\"\n end\n end\n end",
"def options() end",
"def trail_options\n menu = [\"View All Trails\", \n \"Search for Trail\", \n \"Exit\"]\n system 'clear'\n puts \"------TRAILS------\"\n choice = @prompt.select(\"Which action would you like to take?\", menu)\n case choice\n when \"View All Trails\"\n print_trail_info(Trail.all)\n when \"Search for Trail\"\n search_for_trail(Trail.all)\n end\n @prompt.keypress(\"Press any key to continue\")\nend",
"def create_menu_command\n\t @command_window = Window_MenuCommand.new\n\t @command_window.set_handler(:item, method(:command_item))\n\t @command_window.set_handler(:skill, method(:command_personal))\n\t @command_window.set_handler(:equip, method(:command_personal))\n\t @command_window.set_handler(:status, method(:command_personal))\n\t @command_window.set_handler(:save, method(:command_save))\n\t @command_window.set_handler(:game_end, method(:command_game_end))\n\t @command_window.set_handler(:cancel, method(:return_scene))\t\n\tend",
"def make_your_own\r\n # Arrays of options\r\n menu_1 = [\"Basic Elements\", \"Date/Time Element\", \"Emoji\", \"Other Characters\",\"Edit Prompt Design\", \"I am done!\"]\r\n basic_element = [\"Username\", \"Hostname\", \"Shell\", \"Shell Version\", \"Path to Current Directory\", \"Current Directory\", \"Exit\"]\r\n time_element = [\"Date\", \"24hr Time\", \"12hr Time\", \"Exit\"]\r\n emoji_top = [\"🐰 \",\"🤖 \",\"🔥 \",\"❤️ \",\"🤷 \",\"🎯 \",\"💭 \",\"💯 \",\"🈲 \",\"☠️ \"]\r\n emoji_animal = [\"🙈 \",\"🙉 \",\"🙊 \",\"🦊 \",\"🐶 \",\"🦄 \",\"🐷 \",\"🐼 \",\"🐾 \",\"🐔 \",\"🐉 \",\"🕊️ \"]\r\n emoji_smileys = [\"😁 \",\"🤣 \",\"😎 \",\"😊 \",\"😍 \",\"🤗 \",\"🤩 \",\"🤔 \",\"😝 \",\"🤑 \",\"😤 \",\"😱 \"]\r\n emoji_food = [\"🍋 \",\"🍌 \",\"🥑 \",\"🥦 \",\"🥨 \",\"🍕 \",\"🍱 \",\"🍣 \",\"🎂 \",\"🍦 \",\"🍺 \"]\r\n emoji_travel = [\"⛩️ \",\"🗼 \",\"🗽 \",\"🗿 \",\"🗻 \",\"🎑 \"]\r\n emoji_symbol = [\"☠️ \",\"💘 \",\"💢 \",\"💭 \",\"🀄 \",\"⛔ \",\"♻️ \",\"💯 \",\"🎯 \",\"🈲 \",\"🤷 \",\"🔥 \"]\r\n emoji_menu = [\"Trending [Preview: #{emoji_top.join(\" \")}]\", \"Animals [Preview: #{emoji_animal.join(\" \")}]\", \"Smileys [Preview: #{emoji_smileys.join(\" \")}]\", \"Food [Preview: #{emoji_food.join(\" \")}]\", \"Travel [Preview: #{emoji_travel.join(\" \")}]\", \"Symbol [Preview: #{emoji_symbol.join(\" \")}]\"]\r\n emojis = [emoji_top,emoji_animal,emoji_smileys,emoji_food,emoji_travel,emoji_symbol]\r\n color = [\"Default (White)\", \"Red\", \"Green\", \"Yellow\", \"Blue\", \"Magenta\", \"Cyan\"]\r\n output = []\r\n terminal_code = []\r\n color_menu = \"\"\" (1) Default (White)\r\n (2) #{\"Red\".colorize(:red)}\r\n (3) #{\"Green\".colorize(:green)}\r\n (4) #{\"Yellow\".colorize(:yellow)}\r\n (5) #{\"Blue\".colorize(:blue)}\r\n (6) #{\"Magenta\".colorize(:magenta)}\r\n (7) #{\"Cyan\".colorize(:cyan)}\r\n \"\"\"\r\n divider = \"-\" * 100\r\n remove_elements = ['\\u ','\\h ','\\s ','\\v ','\\w ','\\W ','\\d ','\\A ','\\@ ']\r\n\r\n # Hash for each option\r\n # Hashes for basic_element_2 array\r\n username = {\r\n number: 1,\r\n name: \"Username\",\r\n code: '\\u ',\r\n output: \"user\"\r\n }\r\n\r\n hostname = {\r\n number: 2,\r\n name: \"Hostname\",\r\n code: '\\h ',\r\n output: \"host\"\r\n }\r\n\r\n shell = {\r\n number: 3,\r\n name: \"Shell\",\r\n code: '\\s ',\r\n output: \"bash\"\r\n }\r\n\r\n shell_version = {\r\n number: 4,\r\n name: \"Shell Version\",\r\n code: '\\v ',\r\n output: \"4.2.1\"\r\n }\r\n\r\n path_to_current_dir = {\r\n number: 5,\r\n name: \"Path to Current Directory\",\r\n code: '\\w ',\r\n output: \"~/dir\"\r\n }\r\n\r\n current_dir = {\r\n number: 6,\r\n name: \"Current Directory\",\r\n code: '\\W ',\r\n output: \"dir\"\r\n }\r\n\r\n # Hashes for date_2 array\r\n date = {\r\n number: 1,\r\n name: \"Date\",\r\n code: '\\d ',\r\n output: \"Wed Feb 28\"\r\n }\r\n\r\n time_24hr = {\r\n number: 2,\r\n name: \"24hr Time\",\r\n code: '\\A ',\r\n output: \"16:35\"\r\n }\r\n\r\n time_12hr = {\r\n number: 3,\r\n name: \"12hr Time\",\r\n code: '\\@ ',\r\n output: \"04:35 PM\"\r\n }\r\n\r\n # Hashes for color_2 array\r\n default = {\r\n number: 1,\r\n name: \"Default (White)\",\r\n code: \"\"\r\n }\r\n\r\n red = {\r\n number: 2,\r\n name: \"Red\".colorize(:red),\r\n code: '\\e[31m '\r\n }\r\n\r\n green = {\r\n number: 3,\r\n name: \"Green\".colorize(:green),\r\n code: '\\e[32m '\r\n }\r\n\r\n yellow = {\r\n number: 4,\r\n name: \"Yellow\".colorize(:yellow),\r\n code: '\\e[33m '\r\n }\r\n\r\n blue = {\r\n number: 5,\r\n name: \"Blue\".colorize(:blue),\r\n code: '\\e[34m '\r\n }\r\n\r\n magenta = {\r\n number: 6,\r\n name: \"Magenta\".colorize(:magenta),\r\n code: '\\e[35m '\r\n }\r\n\r\n cyan = {\r\n number: 7,\r\n name: \"Cyan\".colorize(:cyan),\r\n code: '\\e[36m '\r\n }\r\n\r\n # Array for option hashes\r\n basic_element_2 = [username, hostname, shell, shell_version, path_to_current_dir, current_dir]\r\n date_2 = [date, time_24hr, time_12hr]\r\n color_2 = [default, red, green, yellow, blue, magenta, cyan]\r\n\r\n # Start of main codes\r\n selection_1 = 0\r\n system (\"clear\")\r\n until selection_1 == 6 do\r\n puts \"Your new C-Promptz™ is going to look like this...\"\r\n\r\n table = Terminal::Table.new do |t|\r\n t.add_row []\r\n t.add_row [\"#{output.join}\"]\r\n t.add_row []\r\n t.style = {:width => 100, :padding_left => 4}\r\n end\r\n puts table\r\n #puts \"\"\"Terminal C-Promptz™ code:\r\n #{\"----------------------------------------------------------\".colorize(:red)}\r\n #{terminal_code.join}\r\n #{\"----------------------------------------------------------\".colorize(:red)}\r\n #\"\"\"\r\n puts \" \"\r\n puts \"What do you want to add to your C-Promptz™ ? Pick a number!\"\r\n menu_1.each_with_index do |s, index|\r\n print \" \"\r\n print \"(#{index+1}) #{s}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_1 = gets.chomp.to_i\r\n puts divider\r\n \r\n if selection_1 == 1 # Insert basic element\r\n puts \"Please select the element you wants to add to your C-Promptz™.\"\r\n basic_element.each_with_index do |b, index|\r\n print \" \"\r\n print \"(#{index+1}) #{b}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n basic_element_2.each do |key|\r\n if selection_2 == key[:number]\r\n output.push(key[:output])\r\n terminal_code.push(key[:code])\r\n end\r\n end\r\n puts divider\r\n if selection_2 == 7\r\n puts \">\" * 20\r\n elsif selection_2 <= basic_element_2.count\r\n puts \"Any colour preference?\"\r\n puts color_menu\r\n print \"Your selection: \"\r\n selection_3 = gets.chomp.to_i\r\n if selection_3 == 1\r\n output[-1] = output[-1].colorize(:White)\r\n elsif selection_3 == 2\r\n output[-1] = output[-1].colorize(:red)\r\n terminal_code.insert(terminal_code.count-1,'\\e[31m')\r\n elsif selection_3 == 3\r\n output[-1] = output[-1].colorize(:green)\r\n terminal_code.insert(terminal_code.count-1,'\\e[32m')\r\n elsif selection_3 == 4\r\n output[-1] = output[-1].colorize(:yellow)\r\n terminal_code.insert(terminal_code.count-1,'\\e[33m')\r\n elsif selection_3 == 5\r\n output[-1] = output[-1].colorize(:blue)\r\n terminal_code.insert(terminal_code.count-1,'\\e[34m')\r\n elsif selection_3 == 6\r\n output[-1] = output[-1].colorize(:magenta)\r\n terminal_code.insert(terminal_code.count-1,'\\e[35m')\r\n elsif selection_3 == 7\r\n output[-1] = output[-1].colorize(:cyan)\r\n terminal_code.insert(terminal_code.count-1,'\\e[36m')\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n output.pop\r\n sleep 1\r\n end\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 2 # Insert date/time element\r\n puts \"Please select the element you wants to add to your C-Promptz™.\"\r\n time_element.each_with_index do |t, index|\r\n print \" \"\r\n print \"(#{index+1}) #{t}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n date_2.each do |key|\r\n if selection_2 == key[:number]\r\n output.push(key[:output])\r\n terminal_code.push(key[:code])\r\n end\r\n end\r\n if selection_2 == 4 # Exit menu\r\n puts \">\" * 20\r\n elsif selection_2 <= date_2.count \r\n puts \"Any colour preference?\"\r\n puts color_menu\r\n print \"Your selection: \"\r\n selection_3 = gets.chomp.to_i\r\n if selection_3 == 1\r\n output[-1] = output[-1].colorize(:White)\r\n elsif selection_3 == 2\r\n output[-1] = output[-1].colorize(:red)\r\n terminal_code.insert(terminal_code.count-1,'\\e[31m')\r\n elsif selection_3 == 3\r\n output[-1] = output[-1].colorize(:green)\r\n terminal_code.insert(terminal_code.count-1,'\\e[32m')\r\n elsif selection_3 == 4\r\n output[-1] = output[-1].colorize(:yellow)\r\n terminal_code.insert(terminal_code.count-1,'\\e[33m')\r\n elsif selection_3 == 5\r\n output[-1] = output[-1].colorize(:blue)\r\n terminal_code.insert(terminal_code.count-1,'\\e[34m')\r\n elsif selection_3 == 6\r\n output[-1] = output[-1].colorize(:magenta)\r\n terminal_code.insert(terminal_code.count-1,'\\e[35m')\r\n elsif selection_3 == 7\r\n output[-1] = output[-1].colorize(:cyan)\r\n terminal_code.insert(terminal_code.count-1,'\\e[36m')\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n output.pop\r\n sleep 1\r\n end\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 3 # Insert emoji\r\n puts 'Please select the element you wants to add to your C-Promptz™. To exit, input \"x\".'\r\n emoji_menu.each_with_index do |e, index|\r\n print \" \"\r\n print \"(#{index+1}) #{e}\"\r\n puts \" \"\r\n end\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n puts divider\r\n if selection_2 <= emojis.count && selection_2 > 0\r\n puts \"Which emoji are you after?\"\r\n emojis.each_with_index do |e, index|\r\n if selection_2 == (index + 1)\r\n e.each_with_index do |ee, index_1|\r\n print \" \"\r\n print \"(#{index_1+1}) #{ee}\"\r\n puts \" \"\r\n end\r\n end\r\n end\r\n print \"Your selection: \"\r\n selection_3 = gets.chomp.to_i\r\n output.push(emojis[selection_2-1][selection_3-1])\r\n terminal_code.push(emojis[selection_2-1][selection_3-1])\r\n elsif selection_2 == \"x\"\r\n puts \">\" * 20\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n sleep 1\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 4 # Insert self-defined characters\r\n puts 'Please input the characters you wants to add to your C-Promptz™. To exit, put \"x\".'\r\n print \"Your input: \"\r\n selection_2 = gets.chomp\r\n if selection_2 != \"x\" # Exit menu if user put in \"x\"\r\n output.push(selection_2)\r\n terminal_code.push(selection_2)\r\n end\r\n system (\"clear\")\r\n \r\n elsif selection_1 == 5 # Function to remove current design - the only way to edit current design is to remove it and add what you want\r\n puts \"Which element do you want to remove?\"\r\n output.each_with_index do |o, index|\r\n puts \"(#{index+1}) #{o}\"\r\n end\r\n puts \"(x) Exit\"\r\n print \"Your selection: \"\r\n selection_2 = gets.chomp.to_i\r\n if selection_2 <= output.count && selection_2 > 0\r\n diff = terminal_code.count-output.count\r\n if remove_elements.count(terminal_code[selection_2-1+diff]) > 0\r\n terminal_code.delete_at(selection_2-1+diff)\r\n terminal_code.delete_at(selection_2-2+diff)\r\n else\r\n terminal_code.delete_at(selection_2-1+diff)\r\n end\r\n output.delete_at(selection_2-1)\r\n elsif selection_2 == \"x\"\r\n puts \">\" * 20\r\n else\r\n puts \"Invalid selection. Please reselect!\"\r\n end\r\n system (\"clear\")\r\n\r\n elsif selection_1 == 6 # Exit \"Build-Your-Own\" function\r\n if terminal_code.count > 0\r\n terminal_code.push('\\[\\e[m\\]') # Syntax text color white in default\r\n `echo 'PS1=\"#{terminal_code.join}\"' >>~/.bash_profile` # Designed terminal codes added into .bash_profile \r\n #system(\"source ~/.bash_profile\")\r\n puts \" \"\r\n 0.upto(2) do\r\n STDOUT.print \"\\rC-Promptz™ is baking...!\"\r\n sleep 0.4\r\n STDOUT.print \"\\r \" # Send return and six spaces\r\n sleep 0.4\r\n end\r\n puts \"\\rPlease refresh your terminal to use your updated C-Promptz™!\"\r\n puts \" \"\r\n sleep 1\r\n system(\"clear\")\r\n table = Terminal::Table.new do |t|\r\n t.add_row [\" \"]\r\n t.add_row [\"🔥 Certificate of Completion 🔥\".bold]\r\n t.add_row [\" \"]\r\n t.add_separator\r\n t.add_row [\" \"]\r\n t.add_row [\" \"]\r\n t.add_row [\"Congaratulations! You have completed a super cool C-Promptz™!\"]\r\n t.add_row [\" \"]\r\n t.add_row [\"C-Promptz™: [#{output.join}]\"]\r\n t.add_row [\" \"]\r\n t.add_row [\"You are now officially coolzz!\"]\r\n t.add_row [\" \"]\r\n t.style = {:width => 130, :alignment => :center}\r\n end\r\n\r\n puts \" \"\r\n puts table\r\n puts \"\"\"To use your brand new C-Promptz™, simply do one of the below:\r\n (1) Copy and paste 'source ~/.bash_profile' in your terminal\r\n (2) Close and re-open your terminal\"\"\" \r\n sleep 2\r\n end\r\n puts \" \"\r\n puts \"Thanks for using C-Promptz™ - your most trusted Prompt Builder!\"\r\n puts \" \"\r\n else\r\n system(\"clear\")\r\n puts \"Invalid selection. Please reselect!\"\r\n puts \" \"\r\n end\r\n end\r\nend",
"def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end",
"def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end",
"def aOptions(box)\n\t\tcase box\n\t\twhen @test\n\t\t\tchoice = @test.getOption\n\t\t\tif choice == \"Yes\"\n\t\t\t\[email protected]([\"Okay you may resume the game.\", \"Have fun...\"])\n\t\t\telse\n\t\t\t\[email protected]([\"You may continue anyways.\"])\n\t\t\tend\n\t\twhen @text\n\t\t\tif @text.next\n\t\t\t\[email protected](box)\n\t\t\telse\n\t\t\t\t@nextGameState = @map\n\t\t\tend\n\t\tend\n\t\t@redraw = true\n\tend",
"def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend",
"def create_advanced_options\n option_separator\n option_separator 'Advanced options:'\n option_results_archive\n option_run_id\n option_observers\n option_property\n\n option_separator\n option_results_database\n end",
"def create_selection_window\r\r\n @command_window = CSCA_Window_AchievementSelect.new(0,@head_window.height,\r\r\n Graphics.width/2,Graphics.height-@head_window.height-48)\r\r\n @command_window.viewport = @viewport\r\r\n @command_window.help_window = @achievement_window\r\r\n @command_window.set_handler(:cancel, method(:return_scene))\r\r\n @command_window.activate\r\r\n end",
"def setMenu\n\t\t@phase = \"menu\"\n\t\[email protected]([\"What will you do?\"])\n\t\[email protected](@battleOptions)\n\t\t@enemyUnits = @battleManager.enemyUnits\n\t\[email protected] = []\n\tend",
"def finish_commands\n for i in 0..4\n if @mode_rdo[i].selected?\n $glob.game_mode = i - 1\n break\n end \n end\n if $glob.game_mode == -1\n $player = Players.new(Player.new,Player.new)\n else\n $player = Players.new(Player.new,CPU.new)\n end\n if !$player.act_p.human?\n choiced = $player.act_p.turn\n choiced.label_widget.set_markup($player.act_p.mark_markup)\n $player.switch_player\n end\n self.hide\n end",
"def options!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 58)\n\n type = OPTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 592:4: 'options' WS_LOOP '{'\n match(\"options\")\n ws_loop!\n match(?{)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 58)\n\n end",
"def initialize(options = {})\n @command = options[:command]\n super\n self.input = {:up => :up_key, :down => :down_key, :return => :return_key, :escape => lambda { pop_game_state }}\n self.viewport.game_area = [0, 0, 1024, 768]\n end",
"def init # entry method to the CLI \n greeting \n menu_list\n menu_selection\nend",
"def make_option_list\n end",
"def make_option_list\n end",
"def create_mode_options\n option_separator\n option_separator 'Mode specific options:'\n end",
"def initialize(x, y, width, height, depth)\n super(x, y, width, height, depth)\n self.opacity = 0\n self.openness = 0\n @index = -1\n @options = []\n @handler = {}\n @cursor_fix = false\n @cursor_all = false\n create_options\n draw_menu_layers if [email protected]?\n deactivate\n @command = true\n @fade_time = 20\n end",
"def initGameModesMenu\n\t\tmenuUi = MenuUI.new([:timetrial,:ranked, :back], @assets)\n\n\t\tmenuUi.setOnClickEvent(:timetrial){\n\t\t\tdisplay(TimeTrialMode.new(self))\n\t\t\tchangeBackground(\"ecranDeJeu\")\n\t\t}\n\n\t\tmenuUi.setOnClickEvent(:ranked){\n\t\t\tdisplay(@levelsMenu)\n\t\t}\n\n\t\tmenuUi.setOnClickEvent(:back){\n\t\t\tdisplay(@mainMenu)\n\t\t}\n\t\t@gameModesMenu = menuUi\n\tend",
"def main_menu\n puts \"------------------------------------------------------------------------------------------------------\".colorize(:yellow)\n Artii::Base#asciify\n a = Artii::Base.new\n a.asciify(\"Toy Robot Challenge\")\n system(\"clear\")\n puts a.asciify(\"Toy Robot Challenge\").colorize(:red,)\n\n prompt = TTY::Prompt.new\n choices = [\n {name: 'New Game.', value: 1},\n {name: 'Exit.', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n new_game\n when 2\n exit\n end \nend",
"def new_game\n puts \"Start A New Game?\".colorize(:light_magenta,)\n puts \"------------------------------------------------------\".colorize(:yellow)\n prompt = TTY::Prompt.new\n choices = [\n {name: 'Yes', value: 1},\n {name: 'No', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n return execute_game\n when 2\n return main_menu\n end \nend",
"def listOptions\r\n\r\n puts \"Hello. This calculator has the following options.\"\r\n\r\n while (!@check_action)\r\n puts \"\\nChoose what you want to calculate:\"\r\n listMethods\r\n action = gets.chomp.upcase\r\n case action\r\n when \"BMI\"\r\n bodyMassIndex\r\n when \"SPEED\"\r\n mediumSpeed\r\n when \"TRI\"\r\n triangleArea\r\n when \"EXIT\"\r\n @check_action = true\r\n else\r\n puts \"Not a valid entry. Please check again your options.\"\r\n end\r\n end\r\n\r\n puts \"Goodbye.\"\r\n end",
"def dev_commands args\n if args.inputs.keyboard.key_down.m || args.inputs.controller_one.key_down.a\n new_ball args\n end\n\n # commented out because breaks game (type = \"h\")\n # if args.inputs.keyboard.key_down.h || args.inputs.controller_one.key_down.b\n # heavy_ball args\n # end\n\n if args.inputs.keyboard.key_down.one || args.inputs.controller_one.key_down.x\n new_ball1 args\n end\n\n if args.inputs.keyboard.key_down.two || args.inputs.controller_one.key_down.y\n new_ball2 args\n end\n\n if args.inputs.keyboard.key_down.r || args.inputs.controller_one.key_down.start\n reset args\n end\nend",
"def initialize(prompt, options)\n super\n @selected = []\n @help = options.fetch(:help) { HELP }\n @default = options.fetch(:default) { [] }\n end",
"def display_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Add Code'\n menu.choice 'Edit Code'\n menu.choice 'Remove Code'\n menu.choice 'Search'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend",
"def update_command_selection\n if Input.trigger?(Input::B)\n Sound.play_cancel\n $scene = Scene_Map.new\n elsif Input.trigger?(Input::C)\n if $game_party.members.size == 0 and @command_window.index < 4\n Sound.play_buzzer\n return\n elsif $game_system.save_disabled and @command_window.index == 4\n Sound.play_buzzer\n return\n end\n Sound.play_decision\n case @command_window.index\n when 0 # Item\n $scene = Scene_Item.new\n when 1,2,3 # Skill, equipment, status\n start_actor_selection\n when 4 # Save\n $scene = Scene_File.new(true, false, false, 4)\n when 5 # Save\n $scene = Scene_File.new(false, false, false, 5)\n when 6 # End Game\n $scene = Scene_End.new\n end\n end\n end",
"def print_menu_options\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"1) Rename List | 2) Add task \"\n\t\tputs \"3) Complete task | 4) Uncomplete task\"\n\t\tputs \"5) Prioritize task | 6) Normalize task \"\n \t\tputs \"7) Add due date | 8) Remove due date\"\n\t\tputs \"9) Delete task | 0) Exit\"\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"Enter choice: \"\n\t\tchoice = get_choice.to_i\n\t\toptions choice\n\tend",
"def get_options\n options = {}\n options[:commands] = []\n options[:commands] << :add\n options[:commands] << :update\n options[:commands] << :print\n \n options[:tag_file] = File.expand_path('../data/example-tags.xml', File.dirname(__FILE__))\n \n options[:in_path] = File.expand_path('../data/tokyo-drift.flv', File.dirname(__FILE__))\n options[:out_path] = File.expand_path('../data/tokyo-drift-processed.flv', File.dirname(__FILE__))\n \n options[:metadatacreator] = \"inlet media FLVTool2 v1.0.7 - http://www.inlet-media.de/flvtool2\"\n options[:metadata] = {}\n options[:in_pipe] = false\n options[:out_pipe] = false\n options[:simulate] = false\n options[:verbose] = false\n options[:recursive] = false\n options[:preserve] = false\n options[:xml] = false\n options[:compatibility_mode] = false\n options[:in_point] = nil\n options[:out_point] = nil\n options[:keyframe_mode] = false\n options[:tag_number] = nil\n options[:stream_log] = true\n options[:collapse] = false\n \n return options\nend",
"def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend",
"def edit_options\n menu = hike_menu_maker(@current_user.reload.hikes)\n system 'clear'\n puts \"-----MY HIKES-----\"\n if menu.length > 0\n menu[\"Cancel\"] = \"Cancel\"\n choice = @prompt.select(\"Which hike would you like to edit?\", menu)\n edit_hike_menu(choice)\n else\n puts \"You have no saved hikes at this time.\"\n @prompt.keypress(\"Press any key to continue\")\n end\n end",
"def options(choice)\n\t\tif choice == 1\n\t\t\trename_submenu\n\t\telsif choice == 2\n\t\t\tadd_task_submenu\n\t\telsif choice == 3\n\t\t\tcomplete_submenu\n\t\telsif choice == 4\n\t\t\tuncomplete_submenu\n\t\telsif choice == 5\n\t\t\tprioritize_submenu\n\t\telsif choice == 6\n\t\t\tnormalize_submenu\n\t\telsif choice == 7\n\t\t\tdue_date_submenu\n\t\telsif choice == 8\n\t\t\tremove_date_submenu\n\t\telsif choice == 9\n\t\t\tdelete_task_submenu\n\t\telse\n\t\t\tputs \"Enjoy your day\"\n\t\tend\n\tend",
"def start_round\n super\n @game_options_array = ['Skip', 'Take card', 'Open up']\n end",
"def edit_hike_menu(hike_instance)\n menu = [\"Delete\", \"Change Time on Trail\", \"Exit\"]\n system 'clear'\n puts \"-----MY HIKES-----\"\n choice = @prompt.select(\"Which action would you like to take?\", menu)\n case choice\n when \"Delete\"\n delete_hike(hike_instance)\n when \"Change Time on Trail\"\n change_time(hike_instance)\n end\n end",
"def initialize_opts(stop_cmds)\n opts = Trollop::options do\n banner \"Tickspot CLI interface\"\n opt :config, \n \"Path to tickspot-cli config file\", \n :short => \"-c\", \n :default => File.expand_path(\"~/.tickspot-cli\")\n stop_on stop_cmds\n end\n end",
"def create_standard_options\n option_separator\n option_separator 'Standard options:'\n option_config_name\n option_logging\n end",
"def select\n puts\n puts 'Select System:'\n puts 'Phasers, Torpedoes, Shields, Alerts, Engines, Sensors, Exit'\n answer = gets.chomp.downcase\n\n while answer != 'exit'\n\n# Phasers\n if answer.include?('phaser')\n if @phasers\n @phasers = false\n status 'Phasers are Disarmed.'\n else\n @phasers = true\n status 'Phasers are Armed and Ready.'\n end\n\n# Torpedoes\n elsif answer.include?('torpedo')\n\n if @photons\n @photons = false\n status 'Photon Torpedoes are Disarmed.'\n else\n @photons = true\n status 'Photon Torpedoes are Armed and Ready.'\n end\n\n# Shields\n elsif answer.include?('shield')\n\n if @shields\n @shields = false\n status 'Lowering Shields.'\n else\n @shields = true\n status 'Raising Shields.'\n end\n\n# Alerts\n elsif answer.include?('alert')\n alerts = ['no alert', 'yellow alert', 'red alert']\n puts\n puts 'Select Alert Status:'\n puts 'No Alert, Yellow Alert, Red Alert'\n response = gets.chomp.downcase\n\n while !alerts.include?(response)\n puts\n puts 'Command Not Recognized.'.center @lw\n response = gets.chomp.downcase\n end\n\n if response == 'no alert'\n @alert = 'No Alert'\n status 'Alert Status set to No Alert.'\n elsif response == 'yellow alert'\n @alert = ' Yellow Alert'\n status 'Alert Status set to Yellow Alert.'\n elsif response == 'red alert'\n @alert = ' Red Alert'\n status 'Alert Status set to Red Alert.'\n end\n\n# Engines\n elsif answer.include?('engine')\n engines = ['impulse', 'warp']\n puts\n puts 'Select Engine:'\n puts 'Impulse, Warp'\n response2 = gets.chomp.downcase\n\n while !engines.include?(response2)\n puts\n puts 'Command Not Recognized.'.center @lw\n response2 = gets.chomp.downcase\n end\n\n\n# Impulse Engine Selection\n if response2 == 'impulse'\n speed = ['full stop', '1/4', '1/3', '1/2', '2/3', 'full impulse']\n puts\n puts 'Select Impulse Speed:'\n puts 'Full Stop, 1/4, 1/3, 1/2, 2/3, Full Impulse'\n response3 = gets.chomp.downcase\n\n while !speed.include?(response3)\n puts\n puts 'Command Not Recognized.'.center @lw\n response3 = gets.chomp.downcase\n end\n puts\n\n# Impulse Engine Speeds\n if response3 == 'full stop'\n @engines = 'Full Stop'\n status 'Impulse Engines at Full Stop.'\n elsif response3 == '1/4'\n @engines = ' 1/4 Impulse'\n status 'Impulse Engines at 1/4.'\n elsif response3 == '1/3'\n @engines = ' 1/3 Impulse'\n status 'Impulse Engines at 1/3.'\n elsif response3 == '1/2'\n @engines = ' 1/2 Impulse'\n status 'Impulse Engines at 1/2.'\n elsif response3 == '2/3'\n @engines = ' 2/3 Impulse'\n status 'Impulse Engines at 2/3.'\n elsif response3 == 'full impulse'\n @engines = ' Full Impulse'\n status 'Impulse Engines All Ahead Full.'\n end\n\n# Warp Engine Selection\n elsif response2 == 'warp'\n warp = 1..9\n puts\n puts 'Select Warp Speed:'\n puts '1 - 9'\n response4 = gets.chomp.to_i\n\n while !warp.include?(response4)\n puts\n puts 'Command Not Recognized.'.center @lw\n response4 = gets.chomp.to_i\n end\n puts\n\n# Warp Engine Speeds\n @engines = ' Warp ' + response4.to_s\n status ('Warp Engines Engaged.\n Now at Warp ' + response4.to_s + '.')\n end\n\n# Sensors\n elsif answer.include?('sensor')\n sensorlist = ['Geological Scan', 'High Resolution Scan', 'Internal Scan',\n 'Long Range Sensor Scan', 'Magneton Scan', 'Navigational Scan',\n 'Multiphasic Scan', 'Subspace Differential Pulse', 'Inverse Tachyon Pulse']\n puts\n puts 'Select Sensor Array:'\n sensorlist.each do |x|\n puts x\n end\n puts\n response4 = (gets.chomp).split.map(&:capitalize).join(' ')\n\n while !sensorlist.include?(response4)\n puts\n puts 'Command Not Recognized.'.center @lw\n response4 = (gets.chomp).split.map(&:capitalize).join(' ')\n end\n\n if [email protected]?(response4)\n @sensors.push(response4)\n status (response4 + ' Activated.')\n elsif @sensors.include?(response4)\n @sensors.delete(response4)\n status (response4 + ' Deactivated.')\n end\n\n# Else\n else\n puts\n puts 'Command Not Recognized.'.center @lw\n answer = gets.chomp.downcase\n end\n\n end\n exit\n end",
"def options\n new_screen\n puts options_info\n @new_length = options_input\n end",
"def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend",
"def update_command_selection()\n if Input.trigger?(Input::B)\n Sound.play_cancel\n quit_command()\n\n elsif Input.trigger?(Input::C)\n case @command_window.index\n when 8\n if $game_system.outline_enable == nil ||\n $game_system.outline_enable.size == 0\n Sound.play_buzzer\n else\n Sound.play_decision\n in_game_tutorials_command()\n end\n \n when 9\n Sound.play_decision\n command_to_title()\n else\n Sound.play_decision\n option_command()\n end\n end\n \n end",
"def options_menu(noteboard)\n @start_prompt = TTY::Prompt.new\n @start_prompt.select(\"What do you want to do now?\") do |menu|\n menu.choice \"Load existing noteboards\", -> {noteboard_menu}\n menu.choice \"Add new note\", -> {Noteboard.noteboard_add(add_note)}\n menu.choice \"Delete note\", -> {Noteboard.noteboard_delete(delete_note)}\n menu.choice \"Back\", -> {StartMenu.new}\n end\nend",
"def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # Give option\n giv_check = proc { $pokemon_party.pokemon_alive <= 0 || !GameData::Item[item_id].holdable }\n # Unregister / register\n if $bag.shortcuts.include?(item_id)\n reg_id = 14\n reg_meth = method(:unregister_item)\n else\n reg_id = 2\n reg_meth = method(:register_item)\n reg_check = map_usable\n end\n # Throw option\n thr_check = proc { !GameData::Item[item_id].limited }\n # Create the choice\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 0), on_validate: method(:use_item), disable_detect: map_usable)\n .register_choice(text_get(22, 3), on_validate: method(:give_item), disable_detect: giv_check)\n .register_choice(text_get(22, reg_id), on_validate: reg_meth, disable_detect: reg_check)\n .register_choice(text_get(22, 1), on_validate: method(:throw_item), disable_detect: thr_check)\n .register_choice(text_get(22, 7))\n # Show selection : item_name\n @base_ui.show_win_text(parse_text(22, 35, PFM::Text::ITEM2[0] => GameData::Item[item_id].exact_name))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text\n hide_shadow_frame\n end",
"def options\n puts \"Here are your options:\"\n puts \" \"\n puts \"1 : Create a new apartment.\"\n puts \"2 : Create a new person.\"\n puts \"3 : List all appartments in your building.\"\n puts \"4 : List all the people in an apartment.\"\n puts \"5 : Quit\"\n puts \" \"\n puts \"What would you like to? (Type a number)\"\nend",
"def main_menu\n prompt = TTY::Prompt.new(\n active_color: :red,\n symbols: {marker: \"⮊\"},\n quiet: true\n )\n\n puts \"\"\n menu_selection = prompt.select(\"Select an option:\") do |menu|\n menu.choice \"➊ Start a new game\", 1\n menu.choice \"➋ How to play\", 2\n menu.choice \"➌ Display win counts\", 3\n menu.choice \"➍ Exit program\", 4\n end\n\n case menu_selection\n when 1\n start_game\n when 2\n instructions\n when 3\n check_win_history\n when 4\n puts \"\\nThanks for playing\\n\\nGoodbye!\"\n exit\n else\n raise InvalidMenu\n end\n\n rescue InvalidMenu\n puts \"Invalid menu input. Please try again!\"\n retry\n rescue\n puts \"An unexpected error has occured. The program will now exit.\"\nend",
"def <<(options)\n\t\t\t\toptions = [options] if !options.is_a?(Array)\n\n\t\t\t\toptions.each do |option|\n\t\t\t\t\[email protected](msg: \"Every attribute must be an Hash.\", dots: false) if !option.is_a?(Hash)\n\n\t\t\t\t\t# Use symbols for names\n\t\t\t\t\toption[:name] = option[:name].to_sym\n\n\t\t\t\t\t# Add the default type, which is :string\n\t\t\t\t\toption[:type] ||= :string\n\n\t\t\t\t\t# Check if type is valid\n\t\t\t\t\[email protected](msg: \"Invalid option type #{option[:type]} for option #{option[:name]}. Valid type are the following:\\n\\t#{@@valid_types.keys.join(\", \")}.\", dots: false) if !@@valid_types.keys.include?(option[:type])\n\n\t\t\t\t\t# Adjust the default value\n\t\t\t\t\tcase option[:type]\n\t\t\t\t\t\twhen :bool then\n\t\t\t\t\t\t\toption[:default] = false if !option.has_key?(:default)\n\t\t\t\t\t\twhen :action then\n\t\t\t\t\t\t\toption[:required] = false\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\toption[:default] = @@valid_types[option[:type]][1] if !option.has_key?(:default) || !option[:default].is_a?(@@valid_types[option[:type]][0])\n\t\t\t\t\tend\n\n\t\t\t\t\t# Adjust priority\n\t\t\t\t\toption[:priority] = option[:priority].to_s.to_i if !option[:priority].is_a?(Integer)\n\n\t\t\t\t\t# Prepend dashes\n\t\t\t\t\toption[:short] = \"-\" + option[:short] if !option[:short] =~ /^-/\n\t\t\t\t\twhile option[:long] !~ /^--/ do option[:long] = \"-\" + option[:long] end\n\t\t\t\t\[email protected](msg: \"Invalid short form \\\"#{option[:short]}\\\".\", dots: false) if option[:short] !~ /^-[0-9a-z]$/i\n\t\t\t\t\[email protected](msg: \"Invalid long form \\\"#{option[:long]}\\\".\", dots: false) if option[:long] !~ /^--([0-9a-z-]+)$/i\n\n\t\t\t\t\t# Check for choices if the type is choices\n\t\t\t\t\tif option[:type] == :choice then\n\t\t\t\t\t\tif option[:choices] == nil then\n\t\t\t\t\t\t\[email protected](msg: \"Option \\\"#{option[:name]}\\\" of type choice requires a valid choices list (every element should be a regular expression).\")\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\toption[:choices].collect! { |choice| Regexp.new(choice) }\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# Check that action is a block if the type is action\n\t\t\t\t\[email protected](\"Option \\\"#{option[:name]}\\\" of type action requires a action block.\") if option[:type] == :action && (option[:action] == nil || !option[:action].is_a?(Proc.class))\n\n\t\t\t\t\t# Check for uniqueness of option and its forms\n\t\t\t\t\[email protected](\"An option with name \\\"#{option[:name]}\\\" already exists.\", dots: false) if @inserted[:name].include?(option[:name])\n\t\t\t\t\[email protected](\"An option with short or long form \\\"#{option[:short]}\\\" already exists.\", dots: false) if @inserted[:short].include?(option[:short])\n\t\t\t\t\[email protected](\"An option with short or long form \\\"#{option[:long]}\\\" already exists.\", dots: false) if @inserted[:long].include?(option[:long])\n\n\t\t\t\t\t# Save\n\t\t\t\t\t@options[option[:name]] = option\n\t\t\t\t\t@options_map[option[:long]] = option[:name]\n\t\t\t\t\t@inserted[:name].push(option[:name])\n\t\t\t\t\t@inserted[:short].push(option[:short])\n\t\t\t\t\t@inserted[:long].push(option[:long])\n\t\t\t\tend\n\t\t\tend",
"def process_options\n @options.verbose = false if @options.quiet\n @options.player1.collect!{ |x| x.to_sym }\n @options.player2.collect!{ |x| x.to_sym }\n create_players_from_options(@options.player1, @options.player2)\n end",
"def create_option\n puts \"Create new (P)olitician or (V)oter?\".center(80)\n creation_type = verified_answer(gets.chomp.downcase, [\"p\", \"v\"])\n if creation_type.downcase == \"p\"\n puts \"Enter new politician details.\".center(80)\n puts \"NAME:\".center(80)\n new_name = gets.chomp.downcase\n puts \"PARTY AFFILIATION: (R)epublican or (D)emocrat?\".center(80)\n new_party_affiliation = verified_answer(gets.chomp.downcase, [\"d\", \"r\"])\n @politician_directory << Politician.new(new_name, whole_affil(new_party_affiliation))\n list_politicians\n else\n puts \"Enter new voter details.\".center(80)\n puts \"NAME:\".center(80)\n new_name = gets.chomp.downcase\n puts \"\"\"\n POLITICAL VIEW:\n (L)iberal, (C)onservative, (T)ea Party,\n (S)ocialist, or (N)eutral.\"\"\".center(80)\n new_political_view = verified_answer(gets.chomp.downcase, [\"l\", \"c\", \"t\", \"s\", \"n\"])\n @voter_directory << Voter.new(new_name, whole_views(new_political_view))\n list_voters\n end\n puts \"New record created.\".center(80).green\n puts\n end",
"def display_guest_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Search'\n menu.choice 'Favourites'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend",
"def start_menu\n show_instructions\n @player.name = select_player_name\n game_over = false\n until game_over\n puts \"=================================================\"\n puts \"<><>------------ MAIN MENU ------------<><>\"\n puts \"=================================================\"\n game = HangmanGame.new(@player)\n choice = select_game_type\n case choice\n when \"N\"\n puts \"\\nStarting a New Game...\\n \"\n puts \"=================================================\"\n play_game(game)\n when \"L\"\n filename = \"../saved_games/hangman_save.json\"\n if File.exist?(filename)\n game.load_game(filename)\n else\n puts \"\\nSorry, no saved games available. Starting a New Game...\\n \"\n end\n play_game(game)\n when \"C\"\n @player = Player.new(select_player_name)\n when \"Q\"\n puts \"\\nExiting the game...\\n \"\n game_over = true\n else\n puts \"\\nSomehow, an incorrect selection was processed, please try again...\\n \"\n end\n end\n show_game_over\n end",
"def parse_options(args)\n @options = OpenStruct.new\n @options.emacs = !args.delete('--emacs').nil?\n @options.wrap = !args.delete('--wrap').nil?\n @options.inner = !args.delete('--inner').nil?\n @options.jruby = !args.delete('--jruby').nil?\n @options.nojruby = !args.delete('--nojruby').nil?\n @options.action = args[0] || nil\n @options.path = args[1] || File.basename(Dir.pwd + '.rb')\n @options.args = args[2..-1] || []\n end",
"def welcome_menu\n prompt = TTY::Prompt.new\n puts\"( ノ ゚ー゚)ノ☀️ Welcome to Weeb Favorites! ☀️ヽ(゚ー゚ヽ)\"\n new = prompt.select(\"Before making modifications, please create a name:\", [\"Create\", \"View Duo List\", \"Modifications\", \"Exit\"])\n\n case new\n\n when 'Create'\n create\n chosen_char\n\n when 'View Duo List'\n find_all_duo\n\n when 'Modifications'\n mods\n\n when 'Exit'\n close_app \n end \nend",
"def update_command_selection\n if Input.trigger?(Input::B)\n Sound.play_cancel\n $scene = Scene_Map.new\n elsif Input.trigger?(Input::C)\n cwi = @cm_list[@command_window.index]\n if $game_party.members.size == 0 && !CP::MENU_COMMANDS.COMMANDS[cwi].include?(:no1)\n Sound.play_buzzer\n return\n elsif $game_system.save_disabled && CP::MENU_COMMANDS.COMMANDS[cwi].include?(:save)\n Sound.play_buzzer\n return\n end\n Sound.play_decision\n if CP::MENU_COMMANDS.COMMANDS[cwi].size == 2\n $menu_index = @command_window.index\n create_submenu(cwi)\n else\n if CP::MENU_COMMANDS.COMMANDS[cwi][2]\n start_actor_selection\n else\n $menu_index = @command_window.index\n $scene = CP::MENU_COMMANDS.COMMANDS[cwi][1]\n end\n end\n end\n end",
"def assign_all_options_array\n @start_rest_options_array ||= 0.step(3600,5).collect{ |x| [(x > 0 ? sprintf(\"%2s\\'%02.0f\\\"\",x/60, x%60) : '-'), x] }\n @pause_options_array ||= 0.step(1800,5).collect{ |x| [(x > 0 ? sprintf(\"%2s\\'%02.0f\\\"\",x/60, x%60) : '-'), x] }\n #@exercise_options_array ||= [[nil,nil]] + Exercise.to_dropdown()\n @exercise_options_array ||= [[nil,nil]] + Exercise.to_dropdown( nil, :id, :get_friendly_description )\n @step_type_options_array ||= TrainingStepType.to_unsorted_dropdown( nil, :id, :i18n_short )\n @arm_aux_options_array ||= ArmAuxType.to_dropdown( nil, :id, :i18n_description )\n @kick_aux_options_array ||= KickAuxType.to_dropdown( nil, :id, :i18n_description )\n @body_aux_options_array ||= BodyAuxType.to_dropdown( nil, :id, :i18n_description )\n @breath_aux_options_array ||= BreathAuxType.to_dropdown( nil, :id, :i18n_description )\n end",
"def create_option_types\n option_types = @@config[:option_types]\n puts \"Creating Option Types for UrbanAuto site, #{option_types.length} options found to check.\\n\"\n created = 0\n option_types.each_key do |ot|\n if OptionType.find(:first, :conditions => {:name => option_types[ot][:name]}).nil?\n OptionType.create({:name => option_types[ot][:name], :presentation => option_types[ot][:presentation]})\n created += 1\n end\n end\n puts \"Created #{created} Option Types\\n\"\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 create_menu\n h = { f: :create_a_file,\n d: :create_a_dir,\n s: :create_dir_with_selection,\n b: :create_bookmark }\n _, menu_text = menu 'Create Menu', h\nend",
"def add_options; end",
"def game_option(option)\n case option.downcase\n when RULES_GAME_OPTION\n open('game_rules.txt') do |file|\n say file.read.yellow\n end\n ask('Press enter to start the game'.yellow)\n initialize_game\n when START_GAME_OPTION\n say '-------------'\\\n 'starting the game'\\\n '-------------'.green\n show_wait_cursor(3)\n initialize_game\n end\n end",
"def end_options\n abstract!\n end",
"def initialize \n # Create a class variable to hold an instance of each command classes\n @ls_exe = LsExe.new\n @mkdir_exe = MkdirExe.new\n @touch_exe = TouchExe.new\n @exit_exe = ExitExe.new\n\n # Hash to hold each of the supporting classes\n @command_map = {\n 'ls' => @ls_exe,\n 'mkdir' => @mkdir_exe,\n 'touch' => @touch_exe,\n 'exit' => @exit_exe\n }\n\n end",
"def make_command_list\n add_command(Vocab::SKILLS, :skills, main_commands_enabled)\n add_command(Vocab::CAPACITIES, :capacities, main_commands_enabled)\n add_command(Vocab::EQUIP, :equip, main_commands_enabled)\n add_command(Vocab::LEARNING, :learning, main_commands_enabled)\n add_command(Vocab::LIBRAIRIES, :librairies, main_commands_enabled)\n add_command(Vocab::ITEM, :item, main_commands_enabled)\n add_command(Vocab::CRAFTING, :crafting, main_commands_enabled)\n add_command(Vocab::STRATEGY, :strategy, main_commands_enabled)\n add_command(Vocab::COOKING, :cooking, main_commands_enabled)\n add_command(Vocab::SYSTEM, :system, main_commands_enabled)\n end",
"def generate_options(filename, code); end",
"def generate_options(filename, code); end",
"def initialize(x, y, width, height, depth)\n super(x, y, width, height, depth)\n self.opacity = 0\n self.openness = 0\n @index = -1\n @options = []\n @handler = {}\n @cursor_fix = false\n @cursor_all = false\n create_options\n create_contents\n draw_menu_layers\n deactivate\n @command = true\n @fade_time = 20\n end",
"def option_select \n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"What would you like to do? Choose from the options below:\") do |menu|\n menu.choice 'View my favorite players' #MAIN MENU OPTION 1 - SHOWS USER'S FAVORITE PLAYERS\n menu.choice 'Add a new favorite player to my account' #MAIN MENU OPTION 2\n menu.choice 'Delete a favorite player from my account' #MAIN MENU OPTION 3\n menu.choice 'View all fans of a specifc player' #MAIN MENU OPTION 4\n menu.choice 'View favorite players of another fan' #MAIN MENU OPTION 5\n menu.choice 'View players from a specific club' #MAIN MENU OPTION 6\n menu.choice 'View most expensive player from a specifc premier league team' #MAIN MENU OPTION 7\n menu.choice 'I just got a season ticket. Update my club season ticket status.' #MAIN MENU OPTION 8\n menu.choice 'exit' #MAIN MENU OPTION EXIT\n end\n\nend",
"def opt_strt_chk(input)\n until input == 'options' || input == 'start'\n puts \"\\n Type 'options' to go into the options menu or 'start' to begin a new game\"\n input = gets.chomp\n end\n if input == 'options'\n options\n else\n end\n end",
"def set_status_controls\n @control_help_window.add_control(Vocab::EQUIP, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::OPTIMIZE, Input::Keys::X)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)\n end",
"def prepare_options(options)\n options[:id] ||= nil\n options[:name] ||= nil\n options[:slot] ||= nil\n options[:level] ||= 0\n options[:class] ||= nil\n\n options[:level] = options[:level].to_i if options[:level].respond_to? 'to_i'\n\n # Tier 12 378 or 391 token; their level is correct but they have no slot\n if options[:name] =~ /^(.+) of the Fiery (.+)$/\n options[:slot] = determine_token_slot(options[:name])\n end\n\n special_weapon_options(options) if special_weapon_slot?(options[:slot])\n options[:slot] = normalize_slot(options[:slot])\n\n options\n end",
"def menu_options()\n print_message 'Select operation to perform'\n print_message '1. Add'\n print_message '2. Substract'\n print_message '3. Multiply'\n print_message '4. Divide'\n print_message \"Or press 'q' to exit calculator app\"\n end",
"def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend",
"def main_menu\n\tputs \"Welcome to Happitails!\"\n\tputs \"Please choose from the options below\"\n\tputs \"1. Add Animal\"\n\tputs \"2. Create Client\"\n\tputs \"3. Adopt an animal\"\n\tputs \"4. Put animal up for adoption\"\n\tputs \"5. View all animals\"\n\tputs \"6. View all clients\"\n\n\n\t# puts \"Z. SECRET DEBUGGING MODE\"\n\n\tputs \"q. Quit\"\nend",
"def make_option_list\n @data = H87Options.option_list\n end",
"def make_option_list\n @data = H87Options.option_list\n end",
"def generate_menu\n @items = []\n @x = @window.width / 3 + Const::FONT_SMALL_SIZE\n @y = @title_image.height * @img_size_factor + Const::GAME_WIN_GAP\n n_g = proc { @window.state = GameState.new(@window, @window.width / 3, 40) }\n cr_n = proc { @window.state = NetSetupState.new(@window) }\n j_n = proc { @window.state = NetJoinState.new(@window) }\n exit = proc { @window.close }\n @items << MenuItem.new(@window, Const::MENU_NEW, 0, n_g, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_CREATE, 1, cr_n, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_JOIN, 2, j_n, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_QUIT, 3, exit, @font, @x, @y)\n end",
"def commandnewgame_gamedata\r\n # Reset frame count for measuring play time\r\n Graphics.frame_count = 0\r\n # Make each type of game object\r\n $game_temp = Game_Temp.new\r\n $game_system = Game_System.new\r\n $game_switches = Game_Switches.new\r\n $game_variables = Game_Variables.new\r\n $game_self_switches = Game_SelfSwitches.new\r\n $game_screen = Game_Screen.new\r\n $game_actors = Game_Actors.new\r\n $game_party = Game_Party.new\r\n $game_troop = Game_Troop.new\r\n $game_map = Game_Map.new\r\n $game_player = Game_Player.new\r\n end",
"def putOptionsSimple\n puts 'Option 1: Print code'\n puts 'Option 2: Print name'\n puts 'Option 3: Print country'\n puts 'Option 4: Print continent'\n puts 'Option 5: Print Timezone'\n puts 'Option 6: Print Latituted and Longitude'\n puts 'Option 7: Print population'\n puts 'Option 8: Print region'\n puts 'Option 9: List cities within reach'\n puts 'Option 10: Escape'\n \n option = gets\n option = checkEndCon(option.to_i, 1, 10)\n return option\n end",
"def option(short, long, desc = nil, options = {})\n @__options ||= []\n option = Shebang::Option.new(short, long, desc, options)\n\n @__options.push(option)\n end",
"def options(opt); end",
"def options(opt); end",
"def menu_options\n puts \"Good morning, you have two options; you can either\"\n puts \"1. Add students to the directory\\n 2. View a list of students enrolled at Makers Academy\\n 3. Save the list of students to a file\\n 9. Exit the programme.\"\n puts \"Please type the option you would like?\"\nend",
"def initialize( *menu_args )\n\t\t@menu_args = menu_args \n\t\t@quit = @menu_args.length\t# seeing how many options there are in the array \n\tend",
"def command_run_options(c, str_opts)\n c.option '-c', '--categories [string]', String, str_opts.categories\n c.option '-d', '--dl-method [string]', String, str_opts.dl_method\n c.option '-n', '--number [integer]', Integer, str_opts.number\n c.option '-p', '--player [string]', String, str_opts.player\n c.option '-r', '--rng [string]', String, str_opts.rng\n end",
"def help_menu\n\n buffer, window = popup_buffer('help', 44)\n\n buffer[1] = \"--------------------------------------------\"\n buffer[2] = \"--- VimCity Help ---\"\n buffer[3] = \"--------------------------------------------\"\n\n buffer[6] = \" -- while in command mode (default) -- \"\n buffer[7] = \" ? : bring up help menu \"\n buffer[8] = \" h,j,k,l : move cursor \"\n buffer[9] = \" i : place building (enter insert mode) \"\n buffer[10] = \" x : destroy building underneath \"\n buffer[11] = \" cursor \"\n buffer[12] = \" :q : quit game \"\n\n buffer[14] = \" -- while in insert mode -- \"\n buffer[15] = \" p : place building \"\n buffer[16] = \" space : return to command mode \"\n\n buffer[window.height-2] = \"--------------------------------------------\"\n buffer[window.height-1] = \"--- press any key to return ---\"\n buffer[window.height] = \"--------------------------------------------\"\n\n redraw\n wait_for_input([\"any\"])\n quit\n end"
] |
[
"0.62488633",
"0.61966",
"0.6157505",
"0.6157505",
"0.6122708",
"0.6096641",
"0.60453546",
"0.59938914",
"0.5950944",
"0.58911467",
"0.5882152",
"0.58337116",
"0.58092225",
"0.58092225",
"0.57909256",
"0.5786242",
"0.57611465",
"0.5745946",
"0.5703358",
"0.56967336",
"0.5687094",
"0.56745845",
"0.5665825",
"0.56348985",
"0.5634532",
"0.5573311",
"0.5549737",
"0.5537255",
"0.55251557",
"0.5508882",
"0.55025375",
"0.5501196",
"0.54987895",
"0.54987895",
"0.5493227",
"0.5479589",
"0.54750264",
"0.5469985",
"0.5458279",
"0.5457163",
"0.54545796",
"0.54500717",
"0.5446813",
"0.5443736",
"0.54413617",
"0.54355145",
"0.54301405",
"0.5428166",
"0.5422737",
"0.54113966",
"0.53805363",
"0.53563833",
"0.5355874",
"0.535353",
"0.5346676",
"0.53276855",
"0.5309827",
"0.5308557",
"0.53029627",
"0.5284227",
"0.52828175",
"0.5274236",
"0.5271953",
"0.5266944",
"0.5265217",
"0.52633774",
"0.5258302",
"0.52551067",
"0.52490443",
"0.5244376",
"0.52396405",
"0.5239534",
"0.5237513",
"0.5233071",
"0.5228197",
"0.5225754",
"0.51960665",
"0.51924103",
"0.5182505",
"0.5182505",
"0.5181057",
"0.5176468",
"0.5175174",
"0.5174505",
"0.5171119",
"0.51710457",
"0.51598185",
"0.5159439",
"0.51592237",
"0.51592237",
"0.5158811",
"0.5158648",
"0.51577234",
"0.5156204",
"0.51538956",
"0.5153225",
"0.5147223",
"0.51467216",
"0.5145167",
"0.514494"
] |
0.6249847
|
0
|
Collection of all cards (Create all Cards)
|
def create_deck
all_cards = []
# Hearts ♥
all_cards << ace_of_hearts = Ace.new('A', 'hearts', "♥")
all_cards << king_of_hearts = Card.new('K', 'hearts', 10, "♥")
all_cards << queen_of_hearts = Card.new('Q', 'hearts', 10, "♥")
all_cards << jack_of_hearts = Card.new('J', 'hearts', 10, "♥")
all_cards << ten_of_hearts = Card.new('10', 'hearts', 10, "♥")
all_cards << nine_of_hearts = Card.new('9', 'hearts', 9, "♥")
all_cards << eight_of_hearts = Card.new('8', 'hearts', 8, "♥")
all_cards << seven_of_hearts = Card.new('7', 'hearts', 7, "♥")
all_cards << six_of_hearts = Card.new('6', 'hearts', 6, "♥")
all_cards << five_of_hearts = Card.new('5', 'hearts', 5, "♥")
all_cards << four_of_hearts = Card.new('4', 'hearts', 4, "♥")
all_cards << three_of_hearts = Card.new('3', 'hearts', 3, "♥")
all_cards << two_of_hearts = Card.new('2', 'hearts', 2, "♥")
# Spades ♠
all_cards << ace_of_spades = Ace.new('A', 'spades', "♠")
all_cards << king_of_spades = Card.new('K', 'spades', 10, "♠")
all_cards << queen_of_spades = Card.new('Q', 'spades', 10, "♠")
all_cards << jack_of_spades = Card.new('J', 'spades', 10, "♠")
all_cards << ten_of_spades = Card.new('10', 'spades', 10, "♠")
all_cards << nine_of_spades = Card.new('9', 'spades', 9, "♠")
all_cards << eight_of_spades = Card.new('8', 'spades', 8, "♠")
all_cards << seven_of_spades = Card.new('7', 'spades', 7, "♠")
all_cards << six_of_spades = Card.new('6', 'spades', 6, "♠")
all_cards << five_of_spades = Card.new('5', 'spades', 5, "♠")
all_cards << four_of_spades = Card.new('4', 'spades', 4, "♠")
all_cards << three_of_spades = Card.new('3', 'spades', 3, "♠")
all_cards << two_of_spades = Card.new('2', 'spades', 2, "♠")
# Diamonds ♦
all_cards << ace_of_diamonds = Ace.new('A', 'diamonds', "♦")
all_cards << king_of_diamonds = Card.new('K', 'diamonds', 10, "♦")
all_cards << queen_of_diamonds = Card.new('Q', 'diamonds', 10, "♦")
all_cards << jack_of_diamonds = Card.new('J', 'diamonds', 10, "♦")
all_cards << ten_of_diamonds = Card.new('10', 'diamonds', 10, "♦")
all_cards << nine_of_diamonds = Card.new('9', 'diamonds', 9, "♦")
all_cards << eight_of_diamonds = Card.new('8', 'diamonds', 8, "♦")
all_cards << seven_of_diamonds = Card.new('7', 'diamonds', 7, "♦")
all_cards << six_of_diamonds = Card.new('6', 'diamonds', 6, "♦")
all_cards << five_of_diamonds = Card.new('5', 'diamonds', 5, "♦")
all_cards << four_of_diamonds = Card.new('4', 'diamonds', 4, "♦")
all_cards << three_of_diamonds = Card.new('3', 'diamonds', 3, "♦")
all_cards << two_of_diamonds = Card.new('2', 'diamonds', 2, "♦")
# Clubs ♣
all_cards << ace_of_clubs = Ace.new('A', 'clubs', "♣")
all_cards << king_of_clubs = Card.new('K', 'clubs', 10, "♣")
all_cards << queen_of_clubs = Card.new('Q', 'clubs', 10, "♣")
all_cards << jack_of_clubs = Card.new('J', 'clubs', 10, "♣")
all_cards << ten_of_clubs = Card.new('10', 'clubs', 10, "♣")
all_cards << nine_of_clubs = Card.new('9', 'clubs', 9, "♣")
all_cards << eight_of_clubs = Card.new('8', 'clubs', 8, "♣")
all_cards << seven_of_clubs = Card.new('7', 'clubs', 7, "♣")
all_cards << six_of_clubs = Card.new('6', 'clubs', 6, "♣")
all_cards << five_of_clubs = Card.new('5', 'clubs', 5, "♣")
all_cards << four_of_clubs = Card.new('4', 'clubs', 4, "♣")
all_cards << three_of_clubs = Card.new('3', 'clubs', 3, "♣")
all_cards << two_of_clubs = Card.new('2', 'clubs', 2, "♣")
all_cards
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_cards\r\n @cards.each{|e| e.create}\r\n @symbols_card.each{|e| e.create}\r\n @cards_rotated.each{|e| e.create}\r\n end",
"def my_cards\n index = 0\n @my_cards = []\n @suits.each do |suit|\n (1..13).each do |value|\n card = Card.new(value, suit)\n @my_cards.push(card)\n end\n end\n return @my_cards\n end",
"def gen_cards\n # done in a verbose manner so that code is easy to understand\n %w[H D S C].each do |suit|\n @cards.push(Card.new('Ace', suit, 1))\n @cards.push(Card.new('Two', suit, 2))\n @cards.push(Card.new('Three', suit, 3))\n @cards.push(Card.new('Four', suit, 4))\n @cards.push(Card.new('Five', suit, 5))\n @cards.push(Card.new('Six', suit, 6))\n @cards.push(Card.new('Seven', suit, 7))\n @cards.push(Card.new('Eight', suit, 8))\n @cards.push(Card.new('Nine', suit, 9))\n @cards.push(Card.new('Ten', suit, 10))\n @cards.push(Card.new('Jack', suit, 10))\n @cards.push(Card.new('Queen', suit, 10))\n @cards.push(Card.new('King', suit, 10))\n end\n end",
"def cards\n\t\[email protected] do |card|\n\t\t\tputs card.card\n\t\tend\n\tend",
"def each\r\n @card_list.each\r\n end",
"def cards\n @cards ||= Hand.new\n end",
"def cards\n @cards ||= EbanqApi::Cards.new(self)\n end",
"def initialize \r\n @cards = []\r\n\r\n\r\n\r\n # Idiomatic ruby loop\r\n SUITS.each do |suit|\r\n RANKS.each do |rank|\r\n @cards.push(Card.new(rank,suit))\r\n end\r\n end\r\n end",
"def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end",
"def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n data['datosSalidaTarjetas']['tarjetas'].map{ |data| build_card(data) }\n end",
"def each\n @card_list.each\n end",
"def index\n @card_instances = CardInstance.all\n end",
"def index\n @card_instances = CardInstance.all\n end",
"def cards\n @cards\n end",
"def build_deck\n @deck = []\n @decks.times do\n @suits.each { |each_suit| @ranks.each { |each_rank| @deck.push(Card.new(each_rank, each_suit)) } }\n end\n end",
"def populate_deck\n # self.initial_size.times do\n # new_card_class = Card.library.values.sample\n # new_card = new_card_class.new\n # self.cards << new_card\n # end\n 40.times do\n new_card_type = Card.library.values.sample\n new_card = new_card_type.create\n self.cards << new_card\n end\n end",
"def initialize\n @cards = []\n end",
"def initialize\n @cards = []\n\n RANKS.product(SUITS).each do |rank, suit|\n @cards << Card.new(rank, suit)\n end\n end",
"def initialize()\n @cards = []\n end",
"def cards_attributes=(cards)\n @cards = []\n cards.each do |card|\n @cards << Card.new(card)\n end\n end",
"def return(new_cards)\n\n new_cards.each do |card|\n self.deck.push(card)\n end\n\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def initialize()\n # Cards table, containing cards hashes\n setAllCards()\n end",
"def each\r\n @card_list.each{|card| yield card}\r\n end",
"def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end",
"def add_cards(cs)\n\t\tcards.concat cs\n\tend",
"def make_stock_card_deck\n self.stock_cards = StockCard.all\n end",
"def initialize\r\n\t\t@cards =[]\r\n\t\t%w[Spades Hearts Diamonds Clubs].each do |suit|\r\n\t\t\t%w[2 3 4 5 6 7 8 9 10 J Q K A].each do |face_value|\r\n\t\t\t\t@cards << Card.new(suit, face_value)\r\n\t\t\tend\r\n\t\tend\r\n\t\tshuffle!\r\n\tend",
"def create_deck\n deck = Array.new\n for number in 0..2\n for color in 0..2\n for shape in 0..2\n for shade in 0..2\n deck.push(Card.new(number,color,shape,shade))\n end\n end\n end\n end\n return deck\nend",
"def each\n @card_list.each{|card| yield card}\n end",
"def each\n @card_list.each{|card| yield card}\n end",
"def getCardArray()\n\t\treturn @cards\n\tend",
"def index\n @ccards = Ccard.all\n end",
"def cards\n object.game_cards.map do |gc|\n { id: gc.card.id, word: gc.card.word, identity: gc.identity }\n end\n end",
"def index\n @cards = @deck.cards.all\n end",
"def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end",
"def create_standard_deck\n suits = [\"H\",\"D\",\"S\",\"C\"]\n numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13]\n suits.each do |s|\n numbers.each do |n|\n pic_location = Card.get_image(s, n)\n self.cards << Card.create!(suit: s, number: n, location: 'deck', deck_id: self.id, image_location: pic_location)\n end\n end\n self\n end",
"def index\n #@cards = Card.all\n end",
"def get_resource_cards(all=false)\n presenter = ResourcesPresenter.new(@cms_site, all)\n _resources = presenter.resources\n\n _resources[:url] = get_cms_url(_resources[:url])\n _resources[:cards].map! do |c|\n page = c[:page]\n file = cms_fragment_render(:file, page)\n link = cms_fragment_render(:link, page)\n url = file.present? || link.present? ? nil : get_cms_url(page.full_path)\n\n c.merge(\n date: DateTime.parse(cms_fragment_render(:published_date, page)).strftime('%d %B %y'),\n url: url,\n summary: cms_fragment_render(:summary, page),\n fileUrl: file,\n linkUrl: link,\n linktTile: cms_fragment_render(:link_title, page)\n )\n end\n\n @items = _resources\n end",
"def build_card\n @items = game.reset_items\n @card = BingoBuilder::Card.new(@game.title, @game.size)\n add_mandatory_items\n add_discretionary_items\n @card\n end",
"def get_cards\n @doc = Nokogiri::HTML(open(@url))\n card_links = @doc.css(\"div.snap-feat\")\n id = 0\n\n card_links.collect do |card|\n id += 1\n c = Cards::CreditCard.new(card.css(\"h3 a.detail-tog\").text)\n c.id = id\n c.offer = card.css(\"div.wrap div.col p\").first.text\n c.fees = card.css(\".hide .col p\").first.text\n c.credit_needed = card.css(\"a.card-snapshot-credit-tip\").text.strip\n c.href = card.css(\".bot-links a.lrn-more\").attr(\"href\").value\n c.apply_link = card.css(\"div.last div.wrap a\").attr(\"href\").value\n c\n end\n end",
"def createDeck\n deck = []\n for suit in @@cardSuits\n for symbol in @@symbolVals.keys\n if symbol != \"AA\"\n deck << Card.new(symbol, suit)\n end\n end\n end\n\n return deck\n end",
"def initialize\n self.cards = []\n (0..51).each { |i| cards << Card.new(i) }\n self.cards.shuffle! \n end",
"def getCards(aDeck)\n\t\treturn 13.times{self << aDeck.next}\t\n\tend",
"def each() \n @cards.each do |card|\n yield card\n end \n end",
"def index\n @deck_of_cards = DeckOfCard.all\n end",
"def create_deck\r\n all_cards = []\r\n # Hearts ♥\r\n all_cards << ace_of_hearts = Ace.new('A', 'hearts', \"♥\")\r\n all_cards << king_of_hearts = Card.new('K', 'hearts', 10, \"♥\")\r\n all_cards << queen_of_hearts = Card.new('Q', 'hearts', 10, \"♥\")\r\n all_cards << jack_of_hearts = Card.new('J', 'hearts', 10, \"♥\")\r\n all_cards << ten_of_hearts = Card.new('10', 'hearts', 10, \"♥\")\r\n all_cards << nine_of_hearts = Card.new('9', 'hearts', 9, \"♥\")\r\n all_cards << eight_of_hearts = Card.new('8', 'hearts', 8, \"♥\")\r\n all_cards << seven_of_hearts = Card.new('7', 'hearts', 7, \"♥\")\r\n all_cards << six_of_hearts = Card.new('6', 'hearts', 6, \"♥\")\r\n all_cards << five_of_hearts = Card.new('5', 'hearts', 5, \"♥\")\r\n all_cards << four_of_hearts = Card.new('4', 'hearts', 4, \"♥\")\r\n all_cards << three_of_hearts = Card.new('3', 'hearts', 3, \"♥\")\r\n all_cards << two_of_hearts = Card.new('2', 'hearts', 2, \"♥\")\r\n # Spades ♠\r\n all_cards << ace_of_spades = Ace.new('A', 'spades', \"♠\")\r\n all_cards << king_of_spades = Card.new('K', 'spades', 10, \"♠\")\r\n all_cards << queen_of_spades = Card.new('Q', 'spades', 10, \"♠\")\r\n all_cards << jack_of_spades = Card.new('J', 'spades', 10, \"♠\")\r\n all_cards << ten_of_spades = Card.new('10', 'spades', 10, \"♠\")\r\n all_cards << nine_of_spades = Card.new('9', 'spades', 9, \"♠\")\r\n all_cards << eight_of_spades = Card.new('8', 'spades', 8, \"♠\")\r\n all_cards << seven_of_spades = Card.new('7', 'spades', 7, \"♠\")\r\n all_cards << six_of_spades = Card.new('6', 'spades', 6, \"♠\")\r\n all_cards << five_of_spades = Card.new('5', 'spades', 5, \"♠\")\r\n all_cards << four_of_spades = Card.new('4', 'spades', 4, \"♠\")\r\n all_cards << three_of_spades = Card.new('3', 'spades', 3, \"♠\")\r\n all_cards << two_of_spades = Card.new('2', 'spades', 2, \"♠\")\r\n # Diamonds ♦\r\n all_cards << ace_of_diamonds = Ace.new('A', 'diamonds', \"♦\")\r\n all_cards << king_of_diamonds = Card.new('K', 'diamonds', 10, \"♦\")\r\n all_cards << queen_of_diamonds = Card.new('Q', 'diamonds', 10, \"♦\")\r\n all_cards << jack_of_diamonds = Card.new('J', 'diamonds', 10, \"♦\")\r\n all_cards << ten_of_diamonds = Card.new('10', 'diamonds', 10, \"♦\")\r\n all_cards << nine_of_diamonds = Card.new('9', 'diamonds', 9, \"♦\")\r\n all_cards << eight_of_diamonds = Card.new('8', 'diamonds', 8, \"♦\")\r\n all_cards << seven_of_diamonds = Card.new('7', 'diamonds', 7, \"♦\")\r\n all_cards << six_of_diamonds = Card.new('6', 'diamonds', 6, \"♦\")\r\n all_cards << five_of_diamonds = Card.new('5', 'diamonds', 5, \"♦\")\r\n all_cards << four_of_diamonds = Card.new('4', 'diamonds', 4, \"♦\")\r\n all_cards << three_of_diamonds = Card.new('3', 'diamonds', 3, \"♦\")\r\n all_cards << two_of_diamonds = Card.new('2', 'diamonds', 2, \"♦\")\r\n # Clubs ♣\r\n all_cards << ace_of_clubs = Ace.new('A', 'clubs', \"♣\")\r\n all_cards << king_of_clubs = Card.new('K', 'clubs', 10, \"♣\")\r\n all_cards << queen_of_clubs = Card.new('Q', 'clubs', 10, \"♣\")\r\n all_cards << jack_of_clubs = Card.new('J', 'clubs', 10, \"♣\")\r\n all_cards << ten_of_clubs = Card.new('10', 'clubs', 10, \"♣\")\r\n all_cards << nine_of_clubs = Card.new('9', 'clubs', 9, \"♣\")\r\n all_cards << eight_of_clubs = Card.new('8', 'clubs', 8, \"♣\")\r\n all_cards << seven_of_clubs = Card.new('7', 'clubs', 7, \"♣\")\r\n all_cards << six_of_clubs = Card.new('6', 'clubs', 6, \"♣\")\r\n all_cards << five_of_clubs = Card.new('5', 'clubs', 5, \"♣\")\r\n all_cards << four_of_clubs = Card.new('4', 'clubs', 4, \"♣\")\r\n all_cards << three_of_clubs = Card.new('3', 'clubs', 3, \"♣\")\r\n all_cards << two_of_clubs = Card.new('2', 'clubs', 2, \"♣\")\r\n all_cards\r\nend",
"def cards\n @cards ||= @client.resource['creditCards']\n end",
"def each\n @cards.each{|card| yield card}\n end",
"def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend",
"def parse_cards\n cards = []\n card_nodes = search('tr.cardItem')\n card_nodes.each do |card_node|\n card = {}\n card[:name] = name(card_node)\n card[:mana_cost] = mana_cost(card_node)\n card[:cmc] = cmc(card_node)\n card[:rules] = rules(card_node)\n card[:power] = power(card_node)\n card[:toughness] = toughness(card_node)\n card[:set_versions] = set_versions(card_node)\n\n # Supertype, Subtype, P/T, Loyalty, Hand/Life Modifiers, etc are all stored in the same node\n type_data = type_data(card_node)\n card.merge! type_data\n\n cards << card\n p card if DEBUG\n end\n cards\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 initialize(cards = Deck.all_cards)\n @cards = cards\n end",
"def index\n @card_pages = CardPage.all\n end",
"def cards_by_suit\n @cards_by_suit ||= @cards.group_by(&:suit)\n end",
"def initialize(cards)\n @cards = cards\n end",
"def initialize(cards)\n @cards = cards\n end",
"def initialize(cards)\n @cards = cards\n end",
"def index\n @cards = @plan.cards\n @card = Card.new\n end",
"def index\n @cards = @deck.cards\n end",
"def index\n @cards = current_user.cards.ordered_by_created_at\n @new_card = Card.new\n end",
"def initialize\n @cards = []\n symbols = CardSymbols.new\n suits = CardSuits.new\n i = 0\n for suit in suits\n for symbol in symbols.keys\n @cards[i] = Card.new(symbol, suit)\n i += 1\n end\n end\n\n # Very important to do this to child classes\n # TODO: a regular deck = Deck.new returns the new object, but a child's\n # super returns the suits object above (perhaps because it's the first\n # object defined?). I need to go figure out this behavior.\n # TODO: is it good practice to always include the line below to be safe?\n return self\n end",
"def add_card_to_collection\n @collection.cards << Card.find(params[:card_id])\n end",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def add card\r\n @card_list.add card\r\n end",
"def initialize\n @cards = []\n suits = [:hearts, :diamonds, :spades, :clubs]\n suits.each do |suit|\n (2..10).each do |value|\n @cards << Card.new(suit, value)\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |facecard|\n @cards << Card.new(suit, facecard)\n end\n end\n\n def shuffle!\n cards.shuffle!\n end\n\n def empty?\n self.cards.empty?\n end\n\n\nend",
"def initialize_cards\n cards = []\n 4.times { cards += (2..14).to_a }\n cards.sample(52)\n end",
"def add card\n @cards.push card\n end",
"def get_cards(deck)\n\n end",
"def createDeck\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\[email protected]!\t\n\tend",
"def card_factory(unformatted_cards)\n unformatted_cards.each do |hash|\n add_cards_to_deck(Card.new(hash))\n end \n end",
"def initialize(cards = Deck.all_cards)\n end",
"def index\n @m_cards = MCard.all\n end",
"def add_card(card)\n @cards << card\n end",
"def add_card(card)\n @cards << card\n end",
"def add_card(card)\n \t@cards << card\n end",
"def generate_cards\n # no need to assign or return @cards here.\n # switching from .each to .map implictly returns the updated array\n # call the generate_cards during initialize to assign to instance variable\n File.open(@filename).map do |line|\n question = line.split(',')[0]\n answer = line.split(',')[1]\n category = line.split(',')[2].delete(\"\\n\")\n card = Card.new(question, answer, category)\n end\n end",
"def initialize\n @cards = Card::RANKS.product(Card::SUITS).collect { |rank, suit| Card.new(suit, rank) }\n end",
"def add_card(card)\n @cards.push\n end",
"def cards_attributes=(cards)\n @cards = []\n cards.each do |card|\n @cards << PlainCard.new(card)\n end\n check_warnings\n end",
"def return(newcards)\n newcards.each do |newc|\n cards.push(newc)\n end \n end",
"def children\n objs = @carddav_backend.cards(@address_book_info['id'])\n children = []\n objs.each do |obj|\n obj['acl'] = child_acl\n children << Card.new(@carddav_backend, @address_book_info, obj)\n end\n children\n end",
"def initialize\n @cards = SEEDS.map do |seed|\n VALUES.map do |value|\n Card.new(value, seed)\n end\n end\n @cards.flatten!\n @cards.shuffle!\n end",
"def make_cards\n #14 restuarants\n scrape_cards.each do |res|\n binding.pry\n ResInfo::Restaurant.new_from_scraper(res)\n end\n end",
"def initialize(cards)\n @cards = cards\n end",
"def index\n @make_cards = MakeCard.all\n end",
"def index\n @entry_cards = EntryCard.all\n end",
"def index\n @graphic_cards = GraphicCard.all\n end",
"def index\n @user_cards = UserCard.all\n end",
"def index\n @user_cards = UserCard.all\n end",
"def get_cards\n cards = []\n index = 0\n [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11].each do |num|\n 24.times do\n cards[index] = num\n index += 1\n end\n end\n shuffle(cards)\n end",
"def create_deck\n suit_counter = 0\n value_counter = 0\n deck =[]\n until deck.count == (@valid_suits.count * @valid_values.count)\n deck << Card.new(@valid_suits[suit_counter], @valid_values[value_counter])\n value_counter += 1\n value_counter = 0 if (value_counter == @valid_values.count)\n suit_counter += 1 if (deck.count == (suit_counter + 1) * (@valid_values.count))\n end\n deck\n end",
"def get_rounds_cards\n # get all the cards from this round's deck\n @cards = self.deck.cards\n end",
"def newCard\n\t@card = Cards.new\n \[email protected]\n end",
"def return(cards)\n @cards.concat(cards)\n end"
] |
[
"0.7471742",
"0.7357251",
"0.73570734",
"0.71580964",
"0.7126043",
"0.7113201",
"0.709008",
"0.7068963",
"0.70546275",
"0.70480394",
"0.70342565",
"0.6977888",
"0.6977888",
"0.69651055",
"0.692051",
"0.6914167",
"0.6912226",
"0.6899868",
"0.6881599",
"0.6848604",
"0.684584",
"0.68127537",
"0.68127537",
"0.68127537",
"0.68127537",
"0.6801293",
"0.6795346",
"0.67950606",
"0.67933846",
"0.6786503",
"0.6781198",
"0.678091",
"0.6764162",
"0.6764162",
"0.67629975",
"0.6735317",
"0.67061436",
"0.66979104",
"0.66893756",
"0.66883194",
"0.66633284",
"0.66569716",
"0.66435",
"0.66419643",
"0.66373926",
"0.6625856",
"0.66134065",
"0.66099626",
"0.6609671",
"0.6609455",
"0.66010773",
"0.65968025",
"0.6581402",
"0.65811664",
"0.65760046",
"0.6575372",
"0.6571557",
"0.6555866",
"0.6545714",
"0.6545714",
"0.6545714",
"0.6544622",
"0.65363264",
"0.65360945",
"0.65358925",
"0.6534415",
"0.65322185",
"0.65322185",
"0.65322185",
"0.65283465",
"0.6519186",
"0.6517206",
"0.6512913",
"0.6509584",
"0.64979225",
"0.6496033",
"0.64933646",
"0.64907444",
"0.6479826",
"0.6479826",
"0.64789224",
"0.646996",
"0.6452696",
"0.6441811",
"0.64354837",
"0.6428013",
"0.6423304",
"0.6421368",
"0.64081377",
"0.64060175",
"0.64027154",
"0.63541293",
"0.6351078",
"0.6341194",
"0.6341194",
"0.6340814",
"0.63237935",
"0.63198084",
"0.6315755",
"0.6314693"
] |
0.65493244
|
58
|
Given a directory, returns all directories that are immediate children of that directory excluding special directories `.` and `..`.
|
def enumerate_directories(directory)
return directory.
children.
select(&:directory?).
map(&:expand_path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_subdirs(directory)\n Dir.entries(directory).select { |entry|\n entry != '.' and entry != '..' and is_dir?(\"#{directory}/#{entry}\")\n }\n end",
"def dir_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.directory?(File.join(dirname, e))\n }\n end",
"def subdirectories()\n children.select { |c| c.directory? }\n end",
"def all_directories dir\n Dir[\"#{dir}**/\"]\nend",
"def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end",
"def get_files(directory)\n Dir.entries(directory).select { |entry| not is_dir?(\"#{directory}/#{entry}\") }\n end",
"def GetDirectoryTree(baseDirectory, excludePatterns=[], excludeEmpty=false)\n subdirs = [baseDirectory]\n baseDirectory.SubPaths().each do |subPath|\n\tpathExcluded = false\n\n excludePatterns.each do |pattern|\n if(subPath.RelativePath.match(pattern) != nil)\n pathExcluded = true\n break\n end\n end\n\n if(pathExcluded)\n #puts \"Excluding path #{subdirPath}\"\n next\n end\n\n if(subPath.directory?() && !(excludeEmpty && subPath.EmptyDirectory?()))\n\t subTree = GetDirectoryTree(subPath, excludePatterns, excludeEmpty)\t \n\t subdirs = subdirs + subTree\n end\n end\n return subdirs\n end",
"def filter_out_descendants(dirs)\n return dirs if dirs.length < 2\n\n dirs_sorted_by_nparts = dirs.sort_by { |dir| dir.each_filename.to_a.length }\n descendants = []\n\n until dirs_sorted_by_nparts.empty?\n dir = dirs_sorted_by_nparts.shift\n\n dirs_sorted_by_nparts.reject! do |possible_descendant|\n ascendant_of?(dir, possible_descendant) && descendants << possible_descendant\n end\n end\n\n # Array#- preserves order.\n dirs - descendants\n end",
"def subdirectories\n Dir.glob(File.join(base_path, \"*\")).reject { |i| !File.directory?(i) }\n end",
"def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend",
"def get_dirs(dir_path)\n dirs = Array.new\n Dir[dir_path + \"/*\"].each do |i|\n if Dir.exists?(i)\n dirs.push(i) if File.directory?(i)\n # Recursive\n dirs.push(get_dirs(i)) \n end\n end\n dirs.flatten!\n dirs.compact!\n dirs\n end",
"def detected_directories\n sub_directories.reject do |on_disk|\n children.any? { |in_db| in_db.full_path == on_disk }\n end.map do |found|\n children.new(relative_path: found.relative_path_from(disk.path), disk: disk)\n end.each(&:valid?) # build paths\n end",
"def enumerate_files(directory)\n return directory.\n children.\n reject(&:directory?).\n map(&:expand_path)\n end",
"def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end",
"def dir_files(dir)\n Find.find(dir).to_a.reject!{|f| File.directory?(f) }\nend",
"def children(with_directory=true)\n with_directory = false if @path == ['.']\n result = []\n Dir.foreach(to_s) {|e|\n next if e == '.' || e == '..'\n if with_directory\n result << Path::Name.create(@path + [e], absolute?)\n else\n result << Path::Name.new(e)\n end\n }\n result\n end",
"def _directories wd\n $log.debug \" directories got XXX: #{wd} \"\n d = Dir.new(wd)\n ent = d.entries.reject{|e| !File.directory? File.join(wd,e)}\n $log.debug \" directories got XXX: #{ent} \"\n ent.delete(\".\");ent.delete(\"..\")\n return ent\n end",
"def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end",
"def find_valid_dirs\n\t\treturn @dirs.find_all do |dir|\n\t\t\tif dir.tainted?\n\t\t\t\tself.log.info \"Discarding tainted directory entry %p\" % [ dir ]\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tpath = Pathname.new( dir )\n\n\t\t\tif ! path.exist?\n\t\t\t\tself.log.debug \"Discarding non-existant path: %s\" % [ path ]\n\t\t\t\tnext false\n\t\t\telsif ! path.directory?\n\t\t\t\tself.log.debug \"Discarding non-directory: %s\" % [ path ]\n\t\t\t\tnext false\n\t\t\telsif ! path.readable?\n\t\t\t\tself.log.debug \"Discarding unreadable directory: %s\" % [ path ]\n\t\t\t\tnext false\n\t\t\telsif( (path.stat.mode & 0002).nonzero? )\n\t\t\t\tself.log.debug \"Discarding world-writable directory: %s\" % [ path ]\n\t\t\t\tnext false\n\t\t\tend\n\t\t\t\n\t\t\ttrue\n\t\tend.map {|pn| pn.to_s }\n\tend",
"def dirs_from(dir)\r\n unless @dirs[dir].key?(:recursive_dirs)\r\n ensure_dir_data(dir)\r\n recursive_dirs = {}\r\n @dirs[dir][:dirs].keys.each do |subdir|\r\n full_subdir = \"#{dir}/#{subdir}\"\r\n recursive_dirs[full_subdir] = nil\r\n recursive_dirs.merge!(Hash[dirs_from(full_subdir).map { |subsubdir| [subsubdir, nil] }])\r\n end\r\n @dirs[dir][:recursive_dirs] = recursive_dirs\r\n end\r\n @dirs[dir][:recursive_dirs].keys\r\n end",
"def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend",
"def file_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.file?(File.join(dirname,e))\n }\n end",
"def non_dir_files(path)\n `find -L #{path}`\n .split\n .map { |f| Pathname.new(f) }\n .reject { |f| f.directory? }\n .map { |f| f.relative_path_from(path) }\nend",
"def dirs_until_dodona_dir\n dir = @pwd\n children = [dir]\n loop do\n return [] if dir.root?\n return children if dir == @dodona_dir\n children.unshift dir\n dir = dir.parent\n end\n end",
"def list_directory(directory)\n return if directory == nil\n \n repo = File.join(path, directory)\n return unless File.directory?(repo) \n \n Dir.chdir(repo)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end",
"def descendants\n self.subfolders.collect do |s|\n [s] + s.descendants\n end.flatten\n end",
"def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend",
"def children( with_directory = ( self != '.' ) )\n ( Dir.entries( expand_tilde ) - DOTS ).map do | entry |\n with_directory ? join( entry ) : self.class.new( entry )\n end\n end",
"def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list files, false, @options.exclude\n end",
"def get_directories_absolute_paths path\n dir_list = Dir[\"#{path}/*/\"]\n \n #Remove unnecessary directories\n dir_list.delete(File.join(path, \".\"))\n dir_list.delete(File.join(path, \"..\"))\n \n dir_list\n end",
"def recursive_subdirectory_ids\n if self.root?\n CfsDirectory.where(root_cfs_directory_id: self.id).ids\n else\n ids = [self.id]\n while true\n new_ids = (CfsDirectory.non_roots.where(parent_id: ids).ids << self.id).sort\n return new_ids if ids == new_ids\n ids = new_ids\n end\n end\n end",
"def GetDirectoryTreeFromRelativeBase(baseDirectory, excludePatterns=[], excludeEmpty=false)\n tree = GetDirectoryPathsFromRelativeBase(baseDirectory)\n tree.pop() # remove the base directory which is added again in the GetDirectoryTree call\n \n tree.concat(GetDirectoryTree(baseDirectory, excludePatterns, excludeEmpty))\n \n return tree\n end",
"def relative_dir_files(directory)\n files = Dir[\"#{file_root(directory)}/**/*\"]\n files.map! { |file| file.gsub(/#{file_root}/, '') }\n end",
"def dirglob(dir='')\n pattern = dir.sub(/\\/+$/, ?/) + ?*\n files = []\n dirs = []\n Dir[pattern].flat_map do |f|\n if File.directory?(f)\n f = f.sub(/\\/*$/, ?/)\n dirs += ['', f] + dirglob(f)\n else\n files << f\n end\n end\n files + dirs\nend",
"def list_directories\n Dir.chdir(path)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end",
"def files(directory)\n files_list = Dir[directory + '/*']\n files = []\n\n files_list.each do |file|\n if File.directory?(file)\n dir_files = files(file)\n dir_files.each { |f| files << f }\n end\n files << file\n end\n files\n end",
"def leaves\n result = children.where(is_dir: false).to_a\n dirs = children.where(is_dir: true).to_a\n while dirs.size > 0\n child = dirs.pop\n dirs += child.children.where(is_dir: true)\n result += child.children.where(is_dir: false)\n end\n result\n end",
"def blacklisted_dir_entries\n %w[. ..]\n end",
"def each_directory_in_tree(include_self: true)\n self.directories_in_tree(include_self: include_self).find_each do |directory|\n yield directory\n end\n end",
"def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end",
"def exclude_dir\n @exclude_dirs.map { |p| Pathname.new(path) + p }.select(&:exist?)\n end",
"def scan_sub_dirs_in_path(path)\n puts 'Scanning destination directories'\n Dir.chdir(path)\n sub_dirs = Dir['*'].select { |o| File.directory?(o) }\n Dir.chdir(root_dir)\n sub_dirs\nend",
"def descendants\n _descendants = children(true)\n children.each do |child|\n _descendants = _descendants + child.descendants\n end\n _descendants\n end",
"def get_directory_files(directory, verbose_flag=false)\n exists = File.directory?(directory)\n if exists\n files = Dir[\"#{directory}/*\"] # grab all the files inside that directory\n return files\n else\n puts \"Unable to find a directory at #{directory}\" if verbose_flag\n return nil\n end\nend",
"def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend",
"def directories\n directory.directoires\n end",
"def all_files_under(path, &ignore)\n path = Pathname(path)\n\n if path.directory?\n path.children.flat_map do |child|\n all_files_under(child, &ignore)\n end.compact\n elsif path.file?\n if block_given? && ignore.call(path)\n []\n else\n [path]\n end\n else\n []\n end\n end",
"def get_files_in_path(path)\n puts \"Scanning for files in directory: #{path}\"\n Dir.entries(path).reject { |f| File.directory? f }\nend",
"def files_from(dir)\r\n unless @dirs[dir].key?(:recursive_files)\r\n ensure_dir_data(dir)\r\n recursive_files = Hash[@dirs[dir][:files].keys.map { |file| [\"#{dir}/#{file}\", nil] }]\r\n @dirs[dir][:dirs].keys.each do |subdir|\r\n recursive_files.merge!(Hash[files_from(\"#{dir}/#{subdir}\").map { |file| [file, nil] }])\r\n end\r\n @dirs[dir][:recursive_files] = recursive_files\r\n end\r\n @dirs[dir][:recursive_files].keys\r\n end",
"def getDirs dir\n\t\tFind.find(dir)\t\n\tend",
"def get_level_children(dirname,level) #:nodoc:\n dir_children = full_entries(dirname)\n @level_children += dir_children\n if level < @max_level\n dir_children.each {|e|\n if File.directory?(e)\n get_level_children(e,level + 1)\n end\n }\n end\n end",
"def get_directory_list( dirname, pattern )\n res = []\n begin\n Dir.foreach( dirname ) do |f|\n if pattern.match( f )\n res << f\n end\n end\n rescue => e\n end\n\n return res.sort { |x, y| directory_sort_order( x, y ) }\n end",
"def files(dir)\n Dir[dir + '/**/*'].reject do |filename|\n File.directory?(filename) ||\n filename =~ /(~|\\.orig|\\.rej|\\.bak)$/\n end\n end",
"def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end",
"def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end",
"def delete_empty_directories(dir)\n return if File.realpath(dir) == File.realpath(@root_path)\n if Dir.entries(dir).reject{ |f| EXCLUDED_DIRS.include?(f) }.empty?\n Dir.delete(dir) rescue nil\n delete_empty_directories(File.dirname(dir))\n end\n end",
"def code_files_in_recursive(some_dir, extensions)\n raise ArgumentError, 'some_dir is not a Pathname' unless some_dir.is_a? Pathname\n return [] unless some_dir.exist? && some_dir.directory?\n\n Find.find(some_dir).map { |p| Pathname.new(p) }.select(&:directory?).map { |d| code_files_in(d, extensions) }.flatten\n end",
"def get_subdir_pages( directory )\n Dir[ File.join( directory, \"*.src\" ) ] - Dir[ File.join( directory, \"index.src\" ) ]\n end",
"def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end",
"def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end",
"def list(path, recursive=true, dirs=false)\n # TODO : this might need to be changed as it returns dir and contents\n # if there are contents\n nodes = []\n prune = recursive ? nil : 2\n @content_tree.with_subtree(path, nil, prune, dirs) do |node|\n nodes << node.path\n end\n nodes.sort.uniq\n end",
"def descendants\n children + children.map(&:descendants).flatten\n end",
"def get_dir_entries_recursively(dir, entry_path, ignore_entries, replace_path = nil)\n replace_path = dir.clone if replace_path.nil?\n (Dir.entries(dir) - %w(. ..)).map { |v| File.join(dir, v) }.select { |path| filter_entries path, FileEntryType::FILE, ignore_entries }.map { |path|\n if File.directory? path\n get_dir_entries_recursively(path, entry_path, ignore_entries, replace_path)\n else\n entry_path_in_zip = (entry_path.nil? ? path : path.sub(replace_path, entry_path)).gsub(/^[\\/\\\\]+/, \"\")\n FileEntry.new(path, false, entry_path_in_zip)\n end\n }\n end",
"def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end",
"def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end",
"def list_files( dir = directory )\n Dir.entries(directory).tap do |files|\n files.delete('.')\n files.delete('..')\n end\n end",
"def descendants\n node, nodes = self, []\n node.children.each { |child|\n # Check for circular dependenciess\n if !nodes.include?(child)\n nodes += [child]\n nodes += child.descendants\n end\n } unless node.children.empty?\n nodes\n end",
"def directory_has_children? dir\n (Dir.entries(dir) - ['.', '..']).size > 0\n end",
"def all_files_in_dir(p_dir)\n [File.join(p_dir, \"**\", \"*\"), File.join(p_dir, \"**\", \".*\")]\n end",
"def files(directory)\n pwd = Dir.pwd\n Dir.chdir(directory)\n files = []\n @relevant_type.each do |file_type|\n files += Dir.glob(\"**/*.#{file_type}\")\n end\n exclude_files(files, pwd)\n end",
"def get_root_keys_from_directory(directory)\n @logger.debug(\"Getting Root Keys in %s\" % directory)\n keys = []\n crawl_hiera_directory(directory).each{ |f|\n @logger.debug(\"Found file %s\" % f)\n get_root_keys_from_file(f).each{ |k| keys << k }\n }\n return keys\n end",
"def entries_at_depth(path, depth)\n entries = [path]\n current_depth = 0\n while current_depth <= depth\n entries.map! do |ent|\n if ::File.directory?(ent)\n Dir.entries(ent).select {|e| e != '.' && e != '..' }.map {|e| ::File.join(ent, e) }\n else\n []\n end\n end\n entries.flatten!\n current_depth += 1\n end\n entries\n end",
"def lsdir(dirpath = nil)\n dirpath << '/' unless dirpath.nil? || dirpath.end_with?('/')\n offset = dirpath.nil? ? 0 : dirpath.length\n bucket.as_tree(:prefix => dirpath).children.select(&:branch?).map{|f| f.prefix[offset..-1]}\n end",
"def files(recurse)\n if recurse\n Dir['**/*'].select { |f| File.file?(f) }\n else\n Dir.entries(Dir.pwd).select { |f| File.file? f }\n end\n end",
"def descendants\n node, nodes = self, []\n node.children.each { |child|\n # Check for circular dependencies\n if !nodes.include?(child)\n nodes += [child]\n nodes += child.descendants\n end\n } unless node.children.empty?\n nodes\n end",
"def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end",
"def watch_recursive(dir)\n if watch dir\n # if watch current directory succeeded, then continue watching the sub-directories\n Dir.glob(File.join(dir, \"*/\"), File::FNM_DOTMATCH).each do|subdir|\n name = File.basename(subdir)\n next if name == \"..\" or name == \".\"\n watch_recursive subdir\n end\n end\n end",
"def filtered_entries\n return [] unless exists?\n\n @filtered_entries ||=\n Dir.chdir(directory) do\n entry_filter.filter(entries).reject do |f|\n path = collection_dir(f)\n File.directory?(path) || entry_filter.symlink?(f)\n end\n end\n end",
"def dirs(path)\n ary = Dir.entries(path).collect do |f|\n d(f, path)\n end\n ary.delete(nil)\n ary\n end",
"def directories\n return @expanded_dirs if @expanded_dirs\n\n raw_dirs = File.readlines(settings.check_dirs).map(&:chomp)\n simple_dirs = raw_dirs.reject{ |line| line.empty? || line.start_with?('#') }\n expanded_dirs = simple_dirs.map do |line|\n expanded = Dir.glob(line)\n if expanded.empty?\n # return original line for error reporting\n line\n else\n # only return directories\n expanded.select{ |dir| File.directory?(dir) }\n end\n end\n @expanded_dirs = expanded_dirs.flatten.sort_by(&:downcase)\n end",
"def file_list(full_directory_path)\r\n path = File.join(full_directory_path, '*')\r\n Dir[path].reject { |fn| File.directory?(fn) || File.basename(fn) == @folder_config }\r\n end",
"def list_all_files_in_dir(target)\n all = Pathname.new(target).children\n dirs = all.select { |c| c.directory? }\n dirs.each do |d|\n Puppet.debug(\"Ignoring directory #{d.to_s}\")\n end\n all.select { |c| c.file? }\n end",
"def entries\n ::Dir.entries(path) - ['.', '..']\n end",
"def GetLevelDirs()\n directories = Dir.entries($level_folder)\n\n for i in 0...directories.length do\n\n if not directories[i].include? \".\" then\n $current_folder = $level_folder + directories[i] + \"/\"\n GetLevels($current_folder)\n end\n\n end\n\nend",
"def dir(directory)\n if session.type == 'meterpreter'\n return session.fs.dir.entries(directory)\n end\n\n if session.platform == 'windows'\n return session.shell_command_token(\"dir #{directory}\").split(/[\\r\\n]+/)\n end\n\n if command_exists?('ls')\n return session.shell_command_token(\"ls #{directory}\").split(/[\\r\\n]+/)\n end\n\n # Result on systems without ls command\n if directory[-1] != '/'\n directory = directory + \"/\"\n end\n result = []\n data = session.shell_command_token(\"for fn in #{directory}*; do echo $fn; done\")\n parts = data.split(\"\\n\")\n parts.each do |line|\n line = line.split(\"/\")[-1]\n result.insert(-1, line)\n end\n\n result\n end",
"def read_dirs(indir)\n @all_files = []\n Dir.chdir(indir)\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n\n @all_files = Dir.glob(\"**/*\").select { |f| File.file? f }\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n all_dirs.each do |subdir|\n read_dir(subdir)\n end\n end",
"def descendants\n \t\tres=children\n \t\tchildren.each {|c| res += c.descendants}\n \t\treturn res.uniq\n \tend",
"def read_directories(dir = \"\")\n base = site.in_source_dir(dir)\n\n return unless File.directory?(base)\n\n dot_dirs = []\n dot_pages = []\n dot_static_files = []\n\n dot = Dir.chdir(base) { filter_entries(Dir.entries(\".\"), base) }\n dot.each do |entry|\n file_path = @site.in_source_dir(base, entry)\n if File.directory?(file_path)\n dot_dirs << entry\n elsif Utils.has_yaml_header?(file_path)\n dot_pages << entry\n else\n dot_static_files << entry\n end\n end\n\n retrieve_posts(dir)\n retrieve_dirs(base, dir, dot_dirs)\n retrieve_pages(dir, dot_pages)\n retrieve_static_files(dir, dot_static_files)\n end",
"def collect_in_dir directory, recursive = true\n if not File.readable? directory\n puts \"#{directory} not readable. Skipping.\" if @verbose\n else\n directory += \"/\" if not directory.end_with? \"/\"\n if File.directory? directory\n files = Dir.entries directory\n files.reject! {|d| d.match /^\\.{1,2}$/} # ignore parent and self links\n files.map! { |f| directory + f }\n files.each do |fname|\n if File.directory?(fname) and recursive\n collect_in_dir fname\n elsif not File.readable? fname\n puts \"#{fname} not readable.Skipping.\" if @verbose\n elsif File.file? fname and File.extname(fname) == @extension # if no directory\n pkg_info = parse_pkg fname\n @files[fname] = pkg_info if pkg_info\n end\n end\n end\n end\n end",
"def scan_dir (dirname)\n log \"*** Inspect: \" + dirname\n Dir.foreach(dirname) do |filename|\n path_cand = File.join(dirname , filename)\n if File.directory?(path_cand)\n #exams directories\n if (filename != \".\" && filename != \"..\")\n unless @filter_dir.index(filename)\n #directory not filtered\n @explore_dir.push(path_cand)\n @dir_list << path_cand\n end\n end\n else\n # file to be listed\n unless file_is_filtered?(path_cand)\n # file is not filtered\n @result_list.push(path_cand)\n end\n end #file.directory?\n end\n next_dir = @explore_dir.pop\n scan_dir(next_dir) if next_dir \n end",
"def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\n end",
"def ls(directory)\n out = []\n tmp = cmd_exec(\"ls -a -m #{directory}\")\n tmp = session.remove_colors(tmp)\n if tmp\n tmp.delete!(\"\\r\")\n tmp.delete!(\"\\n\")\n tmp.split(/,\\s{0,1}/).each do |f|\n next if f.empty?\n next if f == './'\n next if f == '../'\n next if f == '.'\n next if f == '..'\n out << f\n end\n end\n out\n end",
"def safeGlob(dir,wildcard)\n ret = []\n afterChdir = false\n begin\n Dir.chdir(dir) {\n afterChdir = true\n Dir.glob(wildcard) { |f| ret.push(dir+\"/\"+f) }\n }\n rescue Errno::ENOENT\n raise if afterChdir\n end\n if block_given?\n ret.each { |f| yield(f) }\n end\n return (block_given?) ? nil : ret\nend",
"def filter_dir_list!(dir_list, filter = nil)\n filter ||= [ /^(\\.)+$/, # . and ..\n /^\\.(.)*/ # beginning with .\n ]\n dir_list.delete_if { |element| match_filter?(element, filter) }\n end",
"def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end",
"def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end",
"def read_directories(dir = \"\")\n base = site.in_source_dir(dir)\n\n return unless File.directory?(base)\n\n entries_dirs = []\n entries_pages = []\n entries_static_files = []\n\n entries = Dir.chdir(base) { filter_entries(Dir.entries(\".\"), base) }\n entries.each do |entry|\n file_path = @site.in_source_dir(base, entry)\n if File.directory?(file_path)\n entries_dirs << entry\n elsif Utils.has_yaml_header?(file_path) || Utils.has_rbfm_header?(file_path)\n entries_pages << entry\n else\n entries_static_files << entry\n end\n end\n\n retrieve_dirs(dir, entries_dirs)\n retrieve_pages(dir, entries_pages)\n retrieve_static_files(dir, entries_static_files)\n end",
"def directory_contents(directory)\n return Dir.glob(File.join(directory, '*'))\n end",
"def scan_dir (dirname)\n log \"*** Inspect: \" + dirname\n Dir.foreach(dirname) do |filename|\n path_cand = File.join(dirname , filename)\n if File.directory?(path_cand)\n #exams directories\n if (filename != \".\" && filename != \"..\")\n unless @filter_dir.index(filename)\n #directory not filtered\n @explore_dir.push(path_cand)\n @dir_list << path_cand\n end\n end\n else\n # file to be listed\n unless file_is_filtered?(path_cand)\n # file is not filtered\n #p path_cand\n if file_has_admitted_extension?(path_cand)\n @result_list.push(path_cand)\n end\n end\n end #file.directory?\n end\n next_dir = @explore_dir.pop\n scan_dir(next_dir) if next_dir \n end",
"def _potential_directories\n dirs = []\n dirs << _vim_user_dir\n dirs << _vim_system_dir\n return dirs.compact.map { |dir| File.expand_path(dir) }\n end"
] |
[
"0.7638104",
"0.70057476",
"0.67189044",
"0.6481939",
"0.64345044",
"0.61306983",
"0.612973",
"0.60767",
"0.60660934",
"0.6062486",
"0.6051012",
"0.60124105",
"0.5933177",
"0.58806175",
"0.5877884",
"0.58656883",
"0.5864012",
"0.58394295",
"0.58172023",
"0.5800595",
"0.5796326",
"0.577745",
"0.5752995",
"0.5746644",
"0.5741687",
"0.5702827",
"0.5694849",
"0.5689672",
"0.56873953",
"0.56443787",
"0.5638947",
"0.56102765",
"0.5575497",
"0.5553868",
"0.5543308",
"0.5526494",
"0.5526178",
"0.5521908",
"0.5501325",
"0.5466224",
"0.5440221",
"0.53981745",
"0.5386638",
"0.53807825",
"0.53769565",
"0.53742146",
"0.536746",
"0.5341266",
"0.53371704",
"0.53185195",
"0.5308454",
"0.5297363",
"0.52955437",
"0.5294018",
"0.5291274",
"0.52733713",
"0.52661264",
"0.52537507",
"0.5237585",
"0.5237585",
"0.5234368",
"0.52312756",
"0.5221814",
"0.5213423",
"0.5213423",
"0.52126426",
"0.520558",
"0.5200337",
"0.51903677",
"0.51754117",
"0.5157305",
"0.51568824",
"0.51563823",
"0.51558024",
"0.5150462",
"0.5150362",
"0.51461184",
"0.5137549",
"0.51239824",
"0.5120828",
"0.51080465",
"0.51073354",
"0.51053596",
"0.5098685",
"0.5081772",
"0.507998",
"0.5067851",
"0.5061713",
"0.50578535",
"0.5042819",
"0.50380665",
"0.5037547",
"0.50315",
"0.50278693",
"0.5021762",
"0.50197256",
"0.5007492",
"0.49879414",
"0.4977285",
"0.4976624"
] |
0.648601
|
3
|
Given a directory, returns all files that are immediate children of that directory excluding directories.
|
def enumerate_files(directory)
return directory.
children.
reject(&:directory?).
map(&:expand_path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_files(directory)\n Dir.entries(directory).select { |entry| not is_dir?(\"#{directory}/#{entry}\") }\n end",
"def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end",
"def get_subdirs(directory)\n Dir.entries(directory).select { |entry|\n entry != '.' and entry != '..' and is_dir?(\"#{directory}/#{entry}\")\n }\n end",
"def file_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.file?(File.join(dirname,e))\n }\n end",
"def dir_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.directory?(File.join(dirname, e))\n }\n end",
"def dir_files(dir)\n Find.find(dir).to_a.reject!{|f| File.directory?(f) }\nend",
"def files(directory)\n files_list = Dir[directory + '/*']\n files = []\n\n files_list.each do |file|\n if File.directory?(file)\n dir_files = files(file)\n dir_files.each { |f| files << f }\n end\n files << file\n end\n files\n end",
"def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list files, false, @options.exclude\n end",
"def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend",
"def enumerate_directories(directory)\n return directory.\n children.\n select(&:directory?).\n map(&:expand_path)\n end",
"def all_files_under(path, &ignore)\n path = Pathname(path)\n\n if path.directory?\n path.children.flat_map do |child|\n all_files_under(child, &ignore)\n end.compact\n elsif path.file?\n if block_given? && ignore.call(path)\n []\n else\n [path]\n end\n else\n []\n end\n end",
"def all_directories dir\n Dir[\"#{dir}**/\"]\nend",
"def get_files_in_path(path)\n puts \"Scanning for files in directory: #{path}\"\n Dir.entries(path).reject { |f| File.directory? f }\nend",
"def subdirectories()\n children.select { |c| c.directory? }\n end",
"def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend",
"def non_dir_files(path)\n `find -L #{path}`\n .split\n .map { |f| Pathname.new(f) }\n .reject { |f| f.directory? }\n .map { |f| f.relative_path_from(path) }\nend",
"def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend",
"def files(dir)\n Dir[dir + '/**/*'].reject do |filename|\n File.directory?(filename) ||\n filename =~ /(~|\\.orig|\\.rej|\\.bak)$/\n end\n end",
"def files_from(dir)\r\n unless @dirs[dir].key?(:recursive_files)\r\n ensure_dir_data(dir)\r\n recursive_files = Hash[@dirs[dir][:files].keys.map { |file| [\"#{dir}/#{file}\", nil] }]\r\n @dirs[dir][:dirs].keys.each do |subdir|\r\n recursive_files.merge!(Hash[files_from(\"#{dir}/#{subdir}\").map { |file| [file, nil] }])\r\n end\r\n @dirs[dir][:recursive_files] = recursive_files\r\n end\r\n @dirs[dir][:recursive_files].keys\r\n end",
"def relative_dir_files(directory)\n files = Dir[\"#{file_root(directory)}/**/*\"]\n files.map! { |file| file.gsub(/#{file_root}/, '') }\n end",
"def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end",
"def files(directory)\n pwd = Dir.pwd\n Dir.chdir(directory)\n files = []\n @relevant_type.each do |file_type|\n files += Dir.glob(\"**/*.#{file_type}\")\n end\n exclude_files(files, pwd)\n end",
"def files(recurse)\n if recurse\n Dir['**/*'].select { |f| File.file?(f) }\n else\n Dir.entries(Dir.pwd).select { |f| File.file? f }\n end\n end",
"def all_files_in_dir(p_dir)\n [File.join(p_dir, \"**\", \"*\"), File.join(p_dir, \"**\", \".*\")]\n end",
"def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end",
"def files\n\t\t# if the directory doesn't exist, we bail out with a nil\n\t\treturn nil unless File.directory? dir\n\t\t\n\t\tf = Dir.entries(dir)\n\t\tf.delete(\".\")\n\t\tf.delete(\"..\")\n\n\t\treturn f\n\tend",
"def list_all_files_in_dir(target)\n all = Pathname.new(target).children\n dirs = all.select { |c| c.directory? }\n dirs.each do |d|\n Puppet.debug(\"Ignoring directory #{d.to_s}\")\n end\n all.select { |c| c.file? }\n end",
"def list_files( dir = directory )\n Dir.entries(directory).tap do |files|\n files.delete('.')\n files.delete('..')\n end\n end",
"def get_directory_files(directory, verbose_flag=false)\n exists = File.directory?(directory)\n if exists\n files = Dir[\"#{directory}/*\"] # grab all the files inside that directory\n return files\n else\n puts \"Unable to find a directory at #{directory}\" if verbose_flag\n return nil\n end\nend",
"def find_files_in_dir dir\n unless dir.exist?\n warn \"Can't find files in dir %s as it doesn't exist!\",\n dir.relative_path_from(project.path + '..').to_s\n return []\n end\n Dir.chdir dir do\n Dir['**/*'].map { |path| Pathname(path) }\n end\n end",
"def directory_contents(directory)\n return Dir.glob(File.join(directory, '*'))\n end",
"def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end",
"def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\n end",
"def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end",
"def files_in(dir)\n Dir.chdir(dir) do\n Dir.glob('**/*').select { |f| File.file?(f) }\n end\nend",
"def files()\n children.select { |c| c.file? }\n end",
"def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend",
"def file_list(full_directory_path)\r\n path = File.join(full_directory_path, '*')\r\n Dir[path].reject { |fn| File.directory?(fn) || File.basename(fn) == @folder_config }\r\n end",
"def list_files_in_directory(dir, options)\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list options, files, false, options.exclude\n end",
"def list_files_in_directory(dir, options)\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list options, files, false, options.exclude\n end",
"def list_directory(directory)\n return if directory == nil\n \n repo = File.join(path, directory)\n return unless File.directory?(repo) \n \n Dir.chdir(repo)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end",
"def get_dir_entries_recursively(dir, entry_path, ignore_entries, replace_path = nil)\n replace_path = dir.clone if replace_path.nil?\n (Dir.entries(dir) - %w(. ..)).map { |v| File.join(dir, v) }.select { |path| filter_entries path, FileEntryType::FILE, ignore_entries }.map { |path|\n if File.directory? path\n get_dir_entries_recursively(path, entry_path, ignore_entries, replace_path)\n else\n entry_path_in_zip = (entry_path.nil? ? path : path.sub(replace_path, entry_path)).gsub(/^[\\/\\\\]+/, \"\")\n FileEntry.new(path, false, entry_path_in_zip)\n end\n }\n end",
"def dirglob(dir='')\n pattern = dir.sub(/\\/+$/, ?/) + ?*\n files = []\n dirs = []\n Dir[pattern].flat_map do |f|\n if File.directory?(f)\n f = f.sub(/\\/*$/, ?/)\n dirs += ['', f] + dirglob(f)\n else\n files << f\n end\n end\n files + dirs\nend",
"def children( with_directory = ( self != '.' ) )\n ( Dir.entries( expand_tilde ) - DOTS ).map do | entry |\n with_directory ? join( entry ) : self.class.new( entry )\n end\n end",
"def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end",
"def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end",
"def process_directory(dir, files, rec)\n dir.children(true).each do |f|\n # ignore sub-directories\n if f.directory?\n if rec == false\n next\n else\n process_directory(f.expand_path, files, rec)\n end\n end\n process_file(f.expand_path, files)\n end\n end",
"def collect_in_dir directory, recursive = true\n if not File.readable? directory\n puts \"#{directory} not readable. Skipping.\" if @verbose\n else\n directory += \"/\" if not directory.end_with? \"/\"\n if File.directory? directory\n files = Dir.entries directory\n files.reject! {|d| d.match /^\\.{1,2}$/} # ignore parent and self links\n files.map! { |f| directory + f }\n files.each do |fname|\n if File.directory?(fname) and recursive\n collect_in_dir fname\n elsif not File.readable? fname\n puts \"#{fname} not readable.Skipping.\" if @verbose\n elsif File.file? fname and File.extname(fname) == @extension # if no directory\n pkg_info = parse_pkg fname\n @files[fname] = pkg_info if pkg_info\n end\n end\n end\n end\n end",
"def detected_directories\n sub_directories.reject do |on_disk|\n children.any? { |in_db| in_db.full_path == on_disk }\n end.map do |found|\n children.new(relative_path: found.relative_path_from(disk.path), disk: disk)\n end.each(&:valid?) # build paths\n end",
"def list_files_in_directory(dir, options)\n normalized_file_list(options, Dir.glob(File.join(dir, \"*\")), false, options.exclude)\n end",
"def code_files_in_recursive(some_dir, extensions)\n raise ArgumentError, 'some_dir is not a Pathname' unless some_dir.is_a? Pathname\n return [] unless some_dir.exist? && some_dir.directory?\n\n Find.find(some_dir).map { |p| Pathname.new(p) }.select(&:directory?).map { |d| code_files_in(d, extensions) }.flatten\n end",
"def children(with_directory=true)\n with_directory = false if @path == ['.']\n result = []\n Dir.foreach(to_s) {|e|\n next if e == '.' || e == '..'\n if with_directory\n result << Path::Name.create(@path + [e], absolute?)\n else\n result << Path::Name.new(e)\n end\n }\n result\n end",
"def get_files_in(directory_name, options = {})\n options = {\n :traverse => false,\n :full_paths => true\n }.merge(options)\n \n ## If directory name is not absolute, go one-up to what should\n ## be the root directory of the app. (I.e. We're in ROOT/helpers.)\n path = directory_name =~ /^\\// ? directory_name : File.join(File.dirname(__FILE__), '..', directory_name)\n \n pattern = options[:traverse] ? \"/**/*.rb\" : \"/*.rb\"\n files = Dir[path + pattern].select { |e| e =~ /^.+\\.rb$/ }\n\n if options[:full_paths]\n files\n else\n files.map { |file| file.match(/\\/([A-Za-z0-9_]+\\.rb)$/)[1] }\n end\n end",
"def subdirectories\n Dir.glob(File.join(base_path, \"*\")).reject { |i| !File.directory?(i) }\n end",
"def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend",
"def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end",
"def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end",
"def existing_files\n existing_dirs.each do |dir|\n Find.find(dir) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == '.'\n # Don't look any further into directories that start with a dot.\n Find.prune\n else\n next\n end\n elsif block_given?\n yield path\n end\n end\n end\n end",
"def find_files(path)\r\n Dir.entries(path).reject {|f| f =~ /^\\./} || Array.new\r\nend",
"def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end",
"def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end",
"def filter_out_descendants(dirs)\n return dirs if dirs.length < 2\n\n dirs_sorted_by_nparts = dirs.sort_by { |dir| dir.each_filename.to_a.length }\n descendants = []\n\n until dirs_sorted_by_nparts.empty?\n dir = dirs_sorted_by_nparts.shift\n\n dirs_sorted_by_nparts.reject! do |possible_descendant|\n ascendant_of?(dir, possible_descendant) && descendants << possible_descendant\n end\n end\n\n # Array#- preserves order.\n dirs - descendants\n end",
"def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end",
"def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end",
"def entries\n ::Dir.entries(path) - ['.', '..']\n end",
"def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end",
"def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end",
"def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end",
"def get_subdir_pages( directory )\n Dir[ File.join( directory, \"*.src\" ) ] - Dir[ File.join( directory, \"index.src\" ) ]\n end",
"def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end",
"def each_directory_in_tree(include_self: true)\n self.directories_in_tree(include_self: include_self).find_each do |directory|\n yield directory\n end\n end",
"def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end",
"def files(rootDir)\n Dir.foreach(rootDir) do |dir|\n if dir != \".\" && dir != \"..\"\n puts \"Processing \" + dir\n Dir.foreach(rootDir + \"/\" + dir) do |file|\n if file != \".\" && file != \"..\"\n open(rootDir + \"/\" + dir + \"/\" + file) do |f|\n yield(f)\n end\n end\n end\n end\n end\nend",
"def read_dirs(indir)\n @all_files = []\n Dir.chdir(indir)\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n\n @all_files = Dir.glob(\"**/*\").select { |f| File.file? f }\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n all_dirs.each do |subdir|\n read_dir(subdir)\n end\n end",
"def FindFilesInDirectory(includePatterns, excludePatterns, directory)\n files = [] \n #puts \"Searching files in '#{directory}'\"\n #puts \"Include patterns: #{includePatterns}\"\n\n if(!File.readable?(directory.AbsolutePath()))\n return files\n end\n \n testPath = directory.RelativePath()\n excludePatterns.each do |pattern|\n\tif(testPath.match(pattern) != nil)\n\t #puts \"Excluding file '#{entryPath}' based on pattern '#{pattern}'\"\n\t return files\n\tend\n end\n \n directory.SubPaths().each do |subPath|\n\n if(subPath.directory?())\n files = files + FindFilesInDirectory(includePatterns, excludePatterns, subPath)\n else\n entryIsExcluded = false\n\n\t testPath = subPath.RelativePath()\n\n excludePatterns.each do |pattern|\n if(testPath.match(pattern) != nil)\n\t #puts \"Excluding file '#{entryPath}' based on pattern '#{pattern}'\"\n entryIsExcluded = true\n break\n end\n end\n\n if(entryIsExcluded)\n next\n end\n\n entryMatches = false\n\n\t #puts \"Checking entry #{testPath} for inclusion\"\n includePatterns.each do |pattern|\n\t #puts \"Trying pattern #{pattern}\"\n if(testPath.match(pattern) != nil)\n\t #puts \"Including file '#{entryPath}' based on pattern '#{pattern}'\"\n entryMatches = true\n break\n end\n end\n\n if(entryMatches)\n files = files + [subPath]\n end\n end\n end\n\n return files\n end",
"def recursive_subdirectory_ids\n if self.root?\n CfsDirectory.where(root_cfs_directory_id: self.id).ids\n else\n ids = [self.id]\n while true\n new_ids = (CfsDirectory.non_roots.where(parent_id: ids).ids << self.id).sort\n return new_ids if ids == new_ids\n ids = new_ids\n end\n end\n end",
"def get_root_keys_from_directory(directory)\n @logger.debug(\"Getting Root Keys in %s\" % directory)\n keys = []\n crawl_hiera_directory(directory).each{ |f|\n @logger.debug(\"Found file %s\" % f)\n get_root_keys_from_file(f).each{ |k| keys << k }\n }\n return keys\n end",
"def include_directory(dir)\n files = []\n \n if defined? @@directory\n # \n # Do we have an absolute path?\n #\n dir = File.join(@@directory, dir) if '/' != dir[0,1]\n end\n \n #\n # Resolve the filename.\n #\n dir = File.expand_path(dir)\n\n #\n # Exceptions are caught by #include_file\n #\n Dir.glob(dir).sort.each do |entry|\n #file = File.join(dir,entry)\n #pp file\n #next unless File.file?(file)\n\n self.include(entry)\n end\n\n self\n end",
"def get_files_in_dir(path)\n Dir[\"#{path}*\"].sort! { |e1, e2| stringnum_comparison(e1, e2) }\n end",
"def files_in(dir)\r\n ensure_dir_data(dir)\r\n @dirs[dir][:files].keys\r\n end",
"def filtered_entries\n return [] unless exists?\n\n @filtered_entries ||=\n Dir.chdir(directory) do\n entry_filter.filter(entries).reject do |f|\n path = collection_dir(f)\n File.directory?(path) || entry_filter.symlink?(f)\n end\n end\n end",
"def scan_dir (dirname)\n log \"*** Inspect: \" + dirname\n Dir.foreach(dirname) do |filename|\n path_cand = File.join(dirname , filename)\n if File.directory?(path_cand)\n #exams directories\n if (filename != \".\" && filename != \"..\")\n unless @filter_dir.index(filename)\n #directory not filtered\n @explore_dir.push(path_cand)\n @dir_list << path_cand\n end\n end\n else\n # file to be listed\n unless file_is_filtered?(path_cand)\n # file is not filtered\n @result_list.push(path_cand)\n end\n end #file.directory?\n end\n next_dir = @explore_dir.pop\n scan_dir(next_dir) if next_dir \n end",
"def files\n\t\t# if the directory doesn't exist, we bail out with a nil\n\t\treturn nil unless File.directory? dir\n\t\t\n\t\tf = Dir.entries(dir)\n\t\tf.delete(\".\")\n\t\tf.delete(\"..\")\n f.delete(\".DS_Store\")\n\n\t\treturn f\n\tend",
"def dir(directory)\n if session.type == 'meterpreter'\n return session.fs.dir.entries(directory)\n end\n\n if session.platform == 'windows'\n return session.shell_command_token(\"dir #{directory}\").split(/[\\r\\n]+/)\n end\n\n if command_exists?('ls')\n return session.shell_command_token(\"ls #{directory}\").split(/[\\r\\n]+/)\n end\n\n # Result on systems without ls command\n if directory[-1] != '/'\n directory = directory + \"/\"\n end\n result = []\n data = session.shell_command_token(\"for fn in #{directory}*; do echo $fn; done\")\n parts = data.split(\"\\n\")\n parts.each do |line|\n line = line.split(\"/\")[-1]\n result.insert(-1, line)\n end\n\n result\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def get_dirs(dir_path)\n dirs = Array.new\n Dir[dir_path + \"/*\"].each do |i|\n if Dir.exists?(i)\n dirs.push(i) if File.directory?(i)\n # Recursive\n dirs.push(get_dirs(i)) \n end\n end\n dirs.flatten!\n dirs.compact!\n dirs\n end",
"def files(dir = nil)\n return Fileset.from_glob(dir) unless dir.nil?\n input_files\n end",
"def find_sauce_files(cwd=@opts[:basedir], depth=@opts[:search_depth], file_ext=@opts[:sauce_file_extension])\n files = []\n (0..depth).each do |i|\n prefix = \"*/\"*i\n files << Dir.glob(File.join(cwd, \"#{prefix}*#{file_ext}\"))\n end\n return files.flatten.uniq\n end",
"def scan_dir (dirname)\n log \"*** Inspect: \" + dirname\n Dir.foreach(dirname) do |filename|\n path_cand = File.join(dirname , filename)\n if File.directory?(path_cand)\n #exams directories\n if (filename != \".\" && filename != \"..\")\n unless @filter_dir.index(filename)\n #directory not filtered\n @explore_dir.push(path_cand)\n @dir_list << path_cand\n end\n end\n else\n # file to be listed\n unless file_is_filtered?(path_cand)\n # file is not filtered\n #p path_cand\n if file_has_admitted_extension?(path_cand)\n @result_list.push(path_cand)\n end\n end\n end #file.directory?\n end\n next_dir = @explore_dir.pop\n scan_dir(next_dir) if next_dir \n end",
"def walk\n FileTreeProfiler.monitor_report(:profile, :dir, path)\n @children = []\n Dir.foreach(path) do |entry|\n next if (entry == '..' || entry == '.')\n full_path = ::File.join(path, entry)\n if ::File.directory?(full_path)\n children.push DirFile.new(self, entry)\n else\n children.push DataFile.new(self, entry)\n end\n end\n end",
"def files\n @files = Dir.entries(@path)\n @files.delete_if {|file| file == \".\" || file == \"..\"}\n end",
"def exclude_dir\n @exclude_dirs.map { |p| Pathname.new(path) + p }.select(&:exist?)\n end",
"def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', 'mets.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end",
"def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end",
"def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end",
"def watch_recursive(dir)\n if watch dir\n # if watch current directory succeeded, then continue watching the sub-directories\n Dir.glob(File.join(dir, \"*/\"), File::FNM_DOTMATCH).each do|subdir|\n name = File.basename(subdir)\n next if name == \"..\" or name == \".\"\n watch_recursive subdir\n end\n end\n end",
"def files_in_directory name, glob = '**' / '*'\n Dir[path / name / glob]\n end",
"def scan_sub_dirs_in_path(path)\n puts 'Scanning destination directories'\n Dir.chdir(path)\n sub_dirs = Dir['*'].select { |o| File.directory?(o) }\n Dir.chdir(root_dir)\n sub_dirs\nend",
"def entries_at_depth(path, depth)\n entries = [path]\n current_depth = 0\n while current_depth <= depth\n entries.map! do |ent|\n if ::File.directory?(ent)\n Dir.entries(ent).select {|e| e != '.' && e != '..' }.map {|e| ::File.join(ent, e) }\n else\n []\n end\n end\n entries.flatten!\n current_depth += 1\n end\n entries\n end",
"def get_files (path, files_found) \n\t\tif File.directory? path\n\t\t\tDir.foreach path do |file| \n\t\t\t\tif (!EXCLUDED_FILES.include? file)\n\t\t\t\t\tget_files(path+file, files_found) \n\t\t\t\tend\n\t\t\tend\n\t\telsif File.file? path\n\t\t\tfiles_found << path\n\t\tend\n\tend"
] |
[
"0.74780506",
"0.7093621",
"0.70213926",
"0.6992802",
"0.6954193",
"0.68545866",
"0.6846414",
"0.6688498",
"0.6684306",
"0.6555964",
"0.6532517",
"0.6527787",
"0.6489764",
"0.64504623",
"0.6418011",
"0.63843364",
"0.63359874",
"0.6319954",
"0.6315337",
"0.6298193",
"0.6272499",
"0.6267949",
"0.62466776",
"0.6218401",
"0.62064564",
"0.61329865",
"0.61255443",
"0.6120598",
"0.6118979",
"0.6117528",
"0.606873",
"0.60559857",
"0.6040234",
"0.6032521",
"0.601523",
"0.600048",
"0.59954333",
"0.59792733",
"0.59213036",
"0.59213036",
"0.59150964",
"0.5906464",
"0.5900129",
"0.5892333",
"0.5891082",
"0.58779645",
"0.58748263",
"0.58683425",
"0.5864776",
"0.58645475",
"0.5855346",
"0.5843646",
"0.58402175",
"0.5829292",
"0.5811634",
"0.5784813",
"0.57796985",
"0.575721",
"0.57540053",
"0.57500225",
"0.5720319",
"0.57012415",
"0.5692393",
"0.5692393",
"0.5683855",
"0.5683463",
"0.5683463",
"0.56760657",
"0.5660677",
"0.5658481",
"0.565714",
"0.5636769",
"0.5597138",
"0.55923426",
"0.55832446",
"0.5581889",
"0.5574589",
"0.5573209",
"0.5571421",
"0.55653566",
"0.5556352",
"0.5545105",
"0.55414236",
"0.551903",
"0.55092585",
"0.55079716",
"0.55076",
"0.54982656",
"0.54895735",
"0.5489001",
"0.54822177",
"0.5480104",
"0.5475644",
"0.5464707",
"0.54563856",
"0.54546",
"0.544588",
"0.54426426",
"0.5435539",
"0.5431556"
] |
0.7309401
|
1
|
Make a stab at determining if the file specified is a shell program by seeing if it has a shebang line.
|
def is_shell_program?(path)
magic_word = File.open(path, 'r', { :encoding => 'ASCII-8BIT' }) do |fh|
fh.read(2)
end
return magic_word == '#!'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_shell_script?(path)\n File.open(path) do |f|\n f.read(9) == \"#!/bin/sh\"\n end\n end",
"def shebang?(match)\n shebang =~ /\\b#{match}(\\s|$)/ ? true : false\n end",
"def shebang_line=(_arg0); end",
"def is_executable?(file)\n mime = `file -b --mime-type #{file}`\n mime.start_with?('application/x-executable')\n end",
"def shebang_line; end",
"def is_program?(p)\n programs = `ls /bin`.split(\"\\n\") + `ls /usr/bin`.split(\"\\n\")\n programs += [\"cd\"] # fun fact: cd is hard-coded into your shell\n programs.include?(p)\nend",
"def check_for_executable; end",
"def executable?() end",
"def is_a_program( s )\n case ARCH\n when 'w32'\n nil\n else\n ( system \"which #{s} >/dev/null 2>&1\" ) ? 1 : nil\n end\nend",
"def exec_exixts?(name)\n `which #{name}`.start_with?('/')\n end",
"def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end",
"def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end",
"def executable_real?() end",
"def client_is_zypp?\n File.stat(\"/usr/bin/zypper\").executable?\nend",
"def find_shell_wrapper_or_executable prog\n @bindir.each do |dir|\n fname = File.join(dir, \"#{prog}.sh\")\n\n# $stderr.print \"Checking '#{fname}'\\n\"\n\n return fname if File.executable_real? fname\n end\n\n return find_executable(prog)\n end",
"def fix_shebang(path)\n tmpfile = path + '.tmp'\n begin\n #XXX: needed at all?\n # it seems that FileUtils doesn't expose its default output\n # @fileutils_output = $stderr\n # we might want to allow this to be redirected.\n $stderr.puts \"shebang:open #{tmpfile}\" if @options.verbose\n unless @options.noop\n File.open(path) do |r|\n File.open(tmpfile, 'w', 0755) do |w|\n first = r.gets\n return unless SHEBANG_RE =~ first\n ruby = File.join(::RbConfig::CONFIG['bindir'],::RbConfig::CONFIG['ruby_install_name'])\n ruby << ::RbConfig::CONFIG['EXEEXT']\n #w.print first.sub(SHEBANG_RE, '#!' + RbConfig::CONFIG['ruby-prog'])\n w.print first.sub(SHEBANG_RE, '#!' + ruby)\n w.write r.read\n end\n end\n end\n FileUtils.mv(tmpfile, path, :verbose => @options.verbose,\n :noop => @options.noop)\n ensure\n FileUtils.rm_f(tmpfile, :verbose => @options.verbose,\n :noop => @options.noop)\n end\n end",
"def isExecutable(cmd)\n\treturn File.executable? cmd\nend",
"def whence_file(prog_script)\n if prog_script.index(File::SEPARATOR)\n # Don't search since this name has path separator components\n return prog_script\n end\n for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do\n prog_script_try = File.join(dirname, prog_script)\n return prog_script_try if File.exist?(prog_script_try)\n end\n # Failure\n return prog_script\nend",
"def check_source!\n raise \"#{@source_path} is not readable\" unless @source_path.readable?\n output = %x[ruby -c #{@source_path} 2>&1]\n raise \"#{@source_path} is not valid ruby:\\n#{output}\" unless $?.success?\n true\n end",
"def check_script(path)\n binary=path.split(' ')[0]\n raise \"#{path} does not exist\" unless File.exist? binary\n raise \"#{path} is not executable\" unless File.executable? binary\n path\n end",
"def executable?\n ::File.executable?(@path)\n end",
"def whence_file(prog_script)\n if prog_script.index(File::SEPARATOR)\n # Don't search since this name has path separator components\n return prog_script\n end\n for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do\n prog_script_try = File.join(dirname, prog_script)\n return prog_script_try if File.readable?(prog_script_try)\n end\n # Failure\n return prog_script\n end",
"def shell_is_valid?(shell_path)\n return false if shell_path.nil? || !File.exist?(shell_path)\n # AIX is the only OS that has the concept of 'approved shells'\n return true unless platform_family?('aix')\n\n begin\n File.open('/etc/security/login.cfg') do |f|\n f.each_line do |l|\n l.match(/^\\s*shells\\s*=\\s*(.*)/) do |m|\n return true if m[1].split(/\\s*,\\s*/).any? { |entry| entry.eql? shell_path }\n end\n end\n end\n rescue\n return false\n end\n\n false\n end",
"def valid_command_path?(path)\n File.exist?(path) && File.executable?(path)\n end",
"def _shebang\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 _tmp = scan(/\\A(?-mix:.*?$)/)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_shebang unless _tmp\n return _tmp\n end",
"def program_in_path?(program)\n # Scan path to find the executable\n # Do this to help the user get a better error message.\n envpath = ENV[\"PATH\"].split(\":\")\n return envpath.select { |p| File.executable?(File.join(p, program)) }.any?\n end",
"def command?(name)\n !which(name).nil?\nend",
"def assert_program_presence!(name)\n sh(['which', name], echo: false, output: false)\n rescue\n raise \"Failed to find required program: #{name}\"\n end",
"def needs_strip(file)\n extension = File.extname file\n\n return false if File.symlink?(file)\n\n # Executable on linux\n if !OS.windows? && File.executable?(file)\n\n _status, output = runOpen3CaptureOutput 'file', file\n\n return true if output =~ /.*not\\sstripped.*/i\n end\n\n return true if extension =~ /\\.a/ || extension =~ /\\.so(\\.[\\d\\.]+)?/\n\n false\nend",
"def executable_exists?(executable_handle)\n %x[which #{executable_handle} 2>/dev/null][0] == \"/\"\n end",
"def shell_command?(variable)\n variable =~ /^`.*`$/m\n end",
"def virtual_file?(name)\n [\"(irb)\", \"-e\", \"(byebug)\", \"(eval)\"].include?(name)\n end",
"def file?(path)\n eval(FILE_CHECK, binding, __FILE__, FILE_CHECK_LINE)\n nil\nend",
"def command?(name)\n `which #{name}`\n $?.success?\nend",
"def command?(name)\n `which #{name}`\n $?.success?\nend",
"def programChecker(cmd)\n if which(cmd).nil?\n abort(\"EXITING: Please install #{cmd} before continuing\")\n end\nend",
"def shell?\n false\n end",
"def executable?; true; end",
"def executable?; true; end",
"def __valid_executable?(filename, &block)\n is_executable =\n if __transport_connection\n __transport_connection.file(filename).stat[:mode] & 1 && !__transport_connection.file(filename).directory?\n else\n File.executable?(filename) && !File.directory?(filename)\n end\n return false unless is_executable\n\n block ? yield(filename) : true\n end",
"def whichfile(cmd)\n\n Chef::Log.debug(\"Executing which #{cmd}\")\n\n shell = Mixlib::ShellOut.new(\"which \" + cmd, :env => { 'PATH' => '/usr/bin:/usr/local/bin:/bin' })\n shell.run_command\n\n unless shell.exitstatus == 0\n return false\n else\n return true\n end\nend",
"def executable?(path)\n raise \"`executable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"test -x '#{path}' && echo true\").to_s.include? 'true'\n end",
"def executable?\n true\n end",
"def zypper?\n File.executable? '/usr/bin/zypper'\n end",
"def has_executable_in_path(command_name)\n return nil != find_executable_in_path(command_name)\n end",
"def bash_on_windows?; end",
"def os_command?(str)\n str.start_with?('grep ', 'which ') or # common commands\n str.include?('|') or # probably a pipe, could be alternation\n str.match(/^[\\w]+$/) or # command name only\n str.match(/ --?[a-z]/i) # command-line flag\n end",
"def have_command?(command)\n # May be shell-dependent, OS-dependent\n # Kernel#system does not raise Errno::ENOENT when running under the Bundler\n !`which #{command}`.empty?\n end",
"def require_executable(name)\n print \"Checking for #{name}... \"\n\n exists = false\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |directory|\n path = File.join(directory, name)\n\n if File.executable?(path)\n exists = true\n break\n end\n end\n\n if exists\n puts 'yes'\n else\n abort 'no'\n end\n end",
"def has_executable?(executable)\n begin\n self.connection.execute(%{which #{executable.shellescape} && test -x `which #{executable.shellescape}`})\n return true\n rescue Rye::Err\n return false\n end\n end",
"def valid_argv?\n ARGV[0] && ARGV.all? { |arg| /.+:.+/ =~ arg }\nend",
"def executable?\n sort == ::EXECUTABLE\n end",
"def stdlib_path?(file); end",
"def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end",
"def git_hook_needed?\n !File.executable?(@git_hook_path) || !File.read(@git_hook_path).match(/#{@pf_git_hook_name} \\$1/) || !pf_git_hook_valid?\n end",
"def detect\n File.exist?('/tmp/ruby')\n end",
"def in_path?(name)\n (`which #{name}`).to_s.strip.size > 0\n end",
"def command?(command)\n ENV['PATH'].split(':').any? do |directory|\n File.exists?(File.join(directory, command))\n end\nend",
"def ghostscript_srsly?\n ARGV.include? '--with-ghostscript'\nend",
"def command?(name)\n !which(name).nil?\n end",
"def gzip_cmd\n if !`which /bin/gzip`.empty?\n \"/bin/gzip\"\n elsif !`which gzip`.empty?\n \"gzip\"\n end\nend",
"def shell?\n @type == :shell\n end",
"def command?(name)\n !which(name).nil?\n end",
"def bin_accessible?(bin)\n `env PATH=#{env_path.shellescape} which #{bin.to_s.shellescape}` != ''\n end",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def has_scaleway_cmdline?\n if file_exist?(\"/proc/cmdline\") && file_read(\"/proc/cmdline\").include?(\"scaleway\")\n logger.trace(\"Plugin Scaleway: has_scaleway_cmdline? == true\")\n return true\n end\n logger.trace(\"Plugin Scaleway: has_scaleway_cmdline? == false\")\n false\n end",
"def invalid_script?\n return false if syntax_valid?(File.read(program))\n\n print_error(\"The script has incorrect syntax\")\n true\n end",
"def exec_exist?(*args)\n require \"tty-which\"\n TTY::Which.exist?(*args)\n end",
"def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end",
"def which(cmd)\n\tpaths = ENV[\"PATH\"].split(\":\")\n\tpaths.push(\"/usr/local/bin\", \"/usr/bin\", \"/bin\").uniq!\n\tpaths.each do |dir|\n\t\tfile = dir + \"/\" + cmd\n\t\tif File.file?(file) and File.executable?(file)\n\t\t\treturn true end\n\tend\n\treturn\nend",
"def executable?\n @executable\n end",
"def got_hpricot? # ERGO help tests pass without it\n require 'hpricot'\n return true\nrescue MissingSourceFile\n return false\nend",
"def shell_command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any?{|d| File.exists? File.join(d, command) }\n end",
"def check_run_type(file_line)\n if !file_line.nil?\n command = file_line\n else\n print '> '\n command = gets\n end\n command.split\n end",
"def shebang=(val)\n if %w(all ruby never).include?(val)\n @shebang = val\n else\n raise SetupError, \"bad config: use SHEBANG=(all|ruby|never) [#{val}]\"\n end\n end",
"def detect_script!\n @coffeescript = coffeescript_available?\n end",
"def shabang_or_fallback(interpreter)\n if interpreter == \"/bin/bash\"\n Chef::Log.warn(\"Yum executable interpreter is /bin/bash. Falling back to default python.\")\n \"/usr/bin/python\"\n else\n interpreter\n end\n end",
"def no_script?\n return false unless $ARGV.empty?\n\n print_error(\"You must specify a program to debug\")\n true\n end",
"def was_required?(file)\n rex = Regexp.new(\"/#{Regexp.quote(file)}\\.(so|o|sl|rb)?\")\n $LOADED_FEATURES.find { |f| f =~ rex }\nend",
"def os_command?(str)\n str.start_with?('grep ', 'net ', 'which ') or # common commands\n str.include?('|') or # a pipe, could be alternation\n str.include?('/') or # file path delimiter\n str.match(/^[\\w]+$/) or # command name only\n str.match(/ --?[a-z]/i) # command-line flag\n end",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def main\n loop do\n # current path used for readline\n cmdline = Readline.readline(\"#{shell_format} \", true)\n break if %w[exit quit q].include?(cmdline)\n\n Readline::HISTORY.pop if %W[hist #{''}].include?(cmdline)\n check_type_of_command(cmdline)\n end\nend",
"def check(exec, name, url, install=nil)\n return unless `which #{exec}`.empty?\n \n puts \"#{name} not found. (#{url})\"\n puts \"\\nInstall via:\\n#{install}\" if install\n\n exit(1)\nend",
"def is_file_input?(command_line_arguments)\n\t\tcommand_line_arguments.any?\n\tend",
"def is_source? filename\n filename.downcase.end_with?('.c') ||\n filename.downcase.end_with?('.cc') ||\n filename.downcase.end_with?('.cpp') ||\n is_assembly?(filename)\n end",
"def php?\n ::FileTest.exist?('/usr/bin/php')\n end",
"def php?\n ::FileTest.exist?('/usr/bin/php')\n end",
"def detect_main_file\n file, js_files = nil, app_files_matching_patterns\n\n if js_files.length == 1\n file = js_files.first\n else\n # We need to make this smarter, and then allow client to choose or\n # send us a hint.\n\n ['server.js', 'app.js', 'index.js', 'main.js', 'application.js'].each do |fname|\n file = fname if js_files.include? fname\n end\n end\n\n # TODO - Currently staging exceptions are not handled well.\n # Convert to using exit status and return value on a case-by-case basis.\n raise \"Unable to determine Node.js startup command\" unless file\n file\n end",
"def phantomjs_bin_valid?(bin)\n if bin && !bin.empty?\n version = `#{ bin } --version`\n\n if version\n # Remove all but version, e.g. from '1.5 (development)'\n cleaned_version = version.match(/(\\d\\.)*(\\d)/)\n\n if cleaned_version\n if Gem::Version.new(cleaned_version[0]) < Gem::Version.new('1.3.0')\n ::Guard::Jasmine::Formatter.error \"PhantomJS executable at #{ bin } must be at least version 1.3.0\"\n else\n true\n end\n else\n ::Guard::Jasmine::Formatter.error \"PhantomJS reports unknown version format: #{ version }\"\n end\n else\n ::Guard::Jasmine::Formatter.error \"PhantomJS executable doesn't exist at #{ bin }\"\n end\n else\n ::Guard::Jasmine::Formatter.error \"PhantomJS executable couldn't be auto detected.\"\n end\n end",
"def command_exist?(command)\r\n basename = File.basename(command)\r\n path = +\"\"\r\n print \"Checking #{basename}: \"\r\n begin\r\n if open(\"| which #{command} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n elsif open(\"| which #{basename} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n else\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n rescue StandardError\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n end",
"def shexit(shell)\n return true if shell == 0\n return false if shell == 1\nend",
"def coffeescript_file?\n ext == \".coffee\"\n end",
"def coffeescript_file?\n extname == \".coffee\"\n end",
"def check_file_context(target)\n file = target.eval('__FILE__')\n file == Pry.eval_path || (file !~ /(\\(.*\\))|<.*>/ && file != '' && file != '-e')\n end",
"def user_executable?(mode)\n mode & 00100 == 00100\n end"
] |
[
"0.7438066",
"0.66542697",
"0.6593862",
"0.6586622",
"0.65706366",
"0.6393383",
"0.62673575",
"0.6255626",
"0.6248323",
"0.622831",
"0.6008073",
"0.6004686",
"0.5996074",
"0.5994553",
"0.5962212",
"0.595634",
"0.5934821",
"0.59273785",
"0.5914567",
"0.5894363",
"0.58910656",
"0.5883078",
"0.5879319",
"0.582384",
"0.5801509",
"0.5799174",
"0.57875097",
"0.57156086",
"0.56705236",
"0.56702363",
"0.56629425",
"0.56600076",
"0.5655337",
"0.56491613",
"0.56491613",
"0.5644042",
"0.5641956",
"0.56373024",
"0.56373024",
"0.5627048",
"0.5610988",
"0.560966",
"0.55957884",
"0.559534",
"0.55933094",
"0.5587291",
"0.55847895",
"0.55739796",
"0.5571069",
"0.55518305",
"0.55508",
"0.55439323",
"0.55386406",
"0.55336",
"0.55279756",
"0.5525785",
"0.552139",
"0.5520679",
"0.5510913",
"0.55047095",
"0.5503478",
"0.5497735",
"0.5494612",
"0.5487389",
"0.54347676",
"0.54347676",
"0.5432395",
"0.542736",
"0.54211456",
"0.54209495",
"0.5415661",
"0.54007435",
"0.5398831",
"0.5396152",
"0.5387992",
"0.5384199",
"0.5362857",
"0.5354376",
"0.5351932",
"0.5351125",
"0.53501445",
"0.5344985",
"0.5344985",
"0.5344985",
"0.5344985",
"0.5344985",
"0.5341997",
"0.5335635",
"0.53186846",
"0.531661",
"0.53159374",
"0.53159374",
"0.5314111",
"0.53029",
"0.52658147",
"0.525714",
"0.52566665",
"0.52519894",
"0.5250986",
"0.5239176"
] |
0.7823547
|
0
|
Options include: +path+ : the URI path to listen to (defaults to '/stream') +keepalive_timeout+ : the timeout in seconds between keepalive comments (defaults to 20) +namespace+ : a namespace used as prefix for redis pubsub channels +allowed_channels+ : an array with allowed channel names a proc that takes a Rack::Request and returns an array of allowed channels for that particular request +on_register+ : a Proc that takes a Sse::Connection as argument and is called right after a connection is initiated. +on_unregister+ : a Proc that takes a Sse::Connection as argument and is called right after a connection is initiated. The same Sse::Connection object will be passed to the on_register and on_unregister callbacks. You can for example use the +connection.data+ attribute to store an identifier.
|
def initialize(app = nil, options = {})
@app = app
@options = {
path: '/stream',
namespace: '',
keepalive_timeout: 20
}.merge(options)
@subscription_map = {}
EventMachine::next_tick { setup_redis }
EventMachine::next_tick { setup_keepalive }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n response.stream.write \"data: \"+data+\"\\n\\n\"\n end\n end\n\n rescue IOError \n # Client disconnected\n ensure \n response.stream.close\n end",
"def subscription(options = {})\n\t\t\t# provide the client with another (i.e. the external address) if given\n\t\t\tsub = {server: config[:server_external] || config[:server], timestamp: (Time.now.to_f * 1000).round}.merge(options)\n\t\t\tsub[:signature] = Digest::SHA1.hexdigest([config[:secret_token], sub[:channel], sub[:timestamp]].join)\n\t\t\tsub\n\t\tend",
"def events\n response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)\n room_id = params[:room_id]\n sse = Streamer::SSE.new(response.stream) # Opens server sent event stream\n redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread\n # --- Adds all the subscription events for each room --- \n redis.subscribe([\"add_song_#{room_id}\", \"add_user_#{room_id}\", \"change_song_#{room_id}\", \"remove_user_#{room_id}\", \"like_or_dislike_#{room_id}\", \"add_message_#{room_id}\", \"heart\"]) do |on|\n on.message do |event, data|\n \tif event == \"add_song_#{room_id}\" # For the add song subscription\n \t\tsse.write(data, event: \"add_song_#{room_id}\")\n \telsif event == \"add_user_#{room_id}\" # For the add user subscription\n \tsse.write(data, event: \"add_user_#{room_id}\")\n elsif event == \"change_song_#{room_id}\" # For the change song subscription\n \tsse.write(data, event: \"change_song_#{room_id}\")\n elsif event == \"remove_user_#{room_id}\" # For the remove user subscription\n \tsse.write(data, event: \"remove_user_#{room_id}\")\n elsif event == \"like_or_dislike_#{room_id}\" # For the like/dislike subscription\n \tsse.write(data, event: \"like_or_dislike_#{room_id}\")\n elsif event == \"add_message_#{room_id}\" # For the add message subscription\n \tsse.write(data, event: \"add_message_#{room_id}\")\n elsif event == \"heart\" # For the heartbeat subscription\n \tsse.write(data, event: \"heart\")\n \tend\n end\n end\n # --- end ---\n rescue IOError\n # Client disconnected\n redis.quit\n sse.close\n response.stream.close\n ensure\n \t# When not being used, threads close\n redis.quit\n sse.close\n response.stream.close\n end",
"def subscribe_to_channel; end",
"def initialize(nickname, server, options={})\n @server = server\n @nickname = nickname\n @options = options\n @port = options[:port]\n @port = 9999 if @port == nil and options[:ssl] != nil\n @port = 6667 if @port == nil\n @handlers = {}\n @raw_handler = nil\n @quit = nil\n @channels = @options[:channels]\n @channels = [] if @channels == nil\n @channels.push(@options[:channel]) unless @options[:channel] == nil\n @password = options[:password]\n end",
"def subscribe(channel, *channels, &block); end",
"def subscription(options = {})\n Subscription.new(options.merge(:url => url)).to_hash\n end",
"def write_subscription(query, events)\n unless (channel = query.context[:channel])\n raise GraphQL::Error, \"This GraphQL Subscription client does not support the transport protocol expected\"\\\n \"by the backend Subscription Server implementation (graphql-ruby ActionCableSubscriptions in this case).\"\\\n \"Some official client implementation including Apollo (https://graphql-ruby.org/javascript_client/apollo_subscriptions.html), \"\\\n \"Relay Modern (https://graphql-ruby.org/javascript_client/relay_subscriptions.html#actioncable).\"\\\n \"GraphiQL via `graphiql-rails` may not work out of box (#1051).\"\n end\n subscription_id = query.context[:subscription_id] ||= build_id\n stream = stream_subscription_name(subscription_id)\n channel.stream_from(stream)\n @subscriptions[subscription_id] = query\n events.each do |event|\n # Setup a new listener to run all events with this topic in this process\n setup_stream(channel, event)\n # Add this event to the list of events to be updated\n @events[event.topic][event.fingerprint] << event\n end\n end",
"def events\n response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)\n room_id = params[:room_id]\n sse = Streamer::SSE.new(response.stream) # Opens server sent event stream\n redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread\n # --- Adds all the subscription events for each room --- \n redis.subscribe([\"add_message_#{room_id}\", \"remove_message_#{room_id}\", \"heart\"]) do |on|\n on.message do |event, data|\n if event == \"add_message_#{room_id}\" # For the add song subscription\n sse.write(data, event: \"add_message_#{room_id}\")\n elsif event == \"remove_message_#{room_id}\"\n sse.write(data, event: \"remove_message_#{room_id}\")\n end\n end\n end\n # --- end ---\n rescue IOError\n # Client disconnected\n redis.quit\n sse.close\n response.stream.close\n ensure\n # When not being used, threads close\n redis.quit\n sse.close\n response.stream.close\n end",
"def subscribed\n stream_from channel_name\n end",
"def subscribe(*channels, &block); end",
"def index\n last_event_id = 0\n key = params[:key]\n response.headers['Content-Type'] = 'text/event-stream'\n puts \"subscribing to #{key}\"\n begin\n sse = SSE.new(response.stream)\n ticker = Thread.new do\n sse.write 0, event: 'ack'\n sleep 5\n end\n\n r = Redis.new\n streamer = Thread.new do\n r.subscribe(key) do |on|\n on.message do |channel, message|\n response.stream.write(message)\n end\n end\n end\n\n ticker.join\n streamer.join\n rescue IOError\n puts \"ioerror:: #{$!}\"\n ensure\n Thread.kill(ticker) if ticker\n Thread.kill(streamer) if streamer\n sse.close\n r.quite\n end\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\\n\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\\n\"\n return false\n end\n\n ## Begin Recusive Subscribe\n begin\n ## Wait for Message\n response = self._request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n \n ## If it was a timeout\n if !messages.length\n return self.subscribe(args)\n end\n\n ## Run user Callback and Reconnect if user permits.\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n\n ## Keep Listening.\n return self.subscribe(args)\n rescue Timeout::Error\n return self.subscribe(args)\n rescue\n sleep(1)\n return self.subscribe(args)\n end\n end",
"def setup\n # return if client && client.setup?\n client.register_handler(:ready) do\n puts \"Connected!\"\n ROSTER << [client.roster.items.keys, Opt.groups].flatten.uniq\n ROSTER.flatten!\n ROSTER.select { |j| j =~ /\\@conference\\./ }.each do |c|\n presence = Blather::Stanza::Presence.new\n presence.to = \"#{c}/#{Opt.hostname}\"\n client.write presence\n end\n\n fetch_pubs\n end\n\n client.register_handler :subscription, :request? do |s|\n if ROSTER.include?(s.from.stripped.to_s)\n puts \"[REQUEST] Approve #{s}\"\n client.write s.approve!\n else\n puts \"[REQUEST] Refuse #{s}\"\n client.write s.refuse!\n end\n end\n\n # client.register_handler :message, :chat?, :body => 'exit' do |m|\n # client.write Blather::Stanza::Message.new(m.from, 'Exiting...')\n # client.close\n # end\n #client.register_handler :roster, [],\n #client.register_handler :message, :error?, :body do |m|\n #client.register_handler :message, :headline?, :body do |m|\n #client.register_handler :message, :normal?, :body do |m|\n client.register_handler :pubsub_affiliations, :affiliations do |m|\n puts \"[PUB] => #{m.inspect}\"\n m.each do |af|\n puts \"[PUB ITEM] => #{af.inspect}\"\n PUBSUB[:pubs] = af[1].map { |p| p.gsub(/\\//, '') }\n end\n end\n\n client.register_handler :pubsub_subscriptions, :subscriptions do |m|\n puts \"[SUB] => #{m.inspect}\"\n m.each do |af|\n puts \"[SUB ITEM] => #{af.inspect}\"\n PUBSUB[:subs] = af[1].map { |p| p[:node].gsub(/\\//, '') }\n end\n end\n\n client.register_handler :pubsub_event, :items do |m|\n puts \"[PUBSUB EV] => #{m.inspect}\"\n alert_peers \"PubSub: #{m.node} #{process_items(m.items)}\"\n end\n\n client.register_handler :pubsub_items, :items do |m|\n puts \"[PUBSUB ITEMS] => #{m.inspect}\"\n alert_peers \"PubSub: #{m.node} #{process_items(m.items)}\"\n end\n\n client.register_handler :disco_items do |r|\n puts \"[ITEM] => #{r}\"\n # Pub.delete_all\n # PubItem.delete_all\n for item in r.items\n puts \"[IT] => #{item.name} on #{item.node.class}\"\n # next if item.name =~ /^home$/\n if item.node =~ /\\//\n puts \"[PUBSUB] => #{item.name} on #{item.node}\"\n alert_peers item.name\n else\n if item.jid.to_s =~ /conference\\./\n puts \"[GROUP] => #{item.name} on #{item.node}\"\n else\n puts \"[USER] => #{item.jid} name #{item.name}\"\n end\n end\n end\n end\n\n client.register_handler :message, :groupchat? do |m|\n if m.body =~ Regexp.new(Opt.hostname)\n body = m.body.split(\":\")[-1].strip\n else\n body = m.body\n end\n if m.body =~ /^!|^>|^\\\\|#{Opt.hostname}/ && m.to_s !~ /x.*:delay/ #delay.nil?\n puts \"[GROUP] => #{m.inspect}\"\n for msg in process_message(m.from.stripped, body, :groupchat)\n client.write msg\n end\n end\n end\n\n client.register_handler :message, :chat?, :body do |m|\n if ROSTER.include?(m.from.stripped.to_s)\n puts \"[PVT] => #{m.inspect}\"\n for msg in process_message(m.from, m.body)\n client.write msg\n end\n end\n end\n\n end",
"def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end",
"def subscribe(name, config = {})\n return if subscriptions.has_key? name\n\n queue = @channel.queue(ns(name), {:auto_delete => true}.merge!(config))\n queue.bind(@exchange, :routing_key => ns(name)) \n\n queue.subscribe do |headers, payload|\n decoded = MP.unpack(payload)\n subscriptions[name].handlers.each do |h|\n h.receive(decoded[\"uuid\"], headers.type, decoded[\"msg\"])\n end\n end\n\n subscriptions[name] = HandlerCollection.new(queue, [])\n end",
"def subscribe(args)\n ## Capture User Input\n channel = args['channel']\n callback = args['callback']\n\n ## Fail if missing channel\n if !channel\n puts \"Missing Channel.\"\n return false\n end\n\n ## Fail if missing callback\n if !callback\n puts \"Missing Callback.\"\n return false\n end\n\n ## Begin Subscribe\n loop do\n begin\n timetoken = args['timetoken'] ? args['timetoken'] : 0\n\n ## Wait for Message\n response = _request([\n 'subscribe',\n @subscribe_key,\n channel,\n '0',\n timetoken.to_s\n ])\n\n messages = response[0]\n args['timetoken'] = response[1]\n\n ## If it was a timeout\n next if !messages.length\n\n ## Run user Callback and Reconnect if user permits.\n ## Capture the message and encrypt it\n if @cipher_key.length > 0\n pc = PubnubCrypto.new(@cipher_key)\n messages.each do |message|\n if message.is_a? Array\n message=pc.decryptArray(message)\n else\n message=pc.decryptObject(message)\n end\n if !callback.call(message)\n return\n end\n end\n else\n messages.each do |message|\n if !callback.call(message)\n return\n end\n end\n end\n rescue Timeout::Error\n rescue\n sleep(1)\n end\n end\n end",
"def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end",
"def subscribe(&callback)\n redis.subscribe(channel) do |on|\n on.message do |channel, payload|\n data = JSON.parse(payload) rescue payload\n callback.call channel, data, self\n end\n end\n end",
"def listen\r\n end",
"def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n end",
"def initialize(channel, &callback)\n @channel = channel\n @redis = Connection.new\n subscribe &callback\n end",
"def register_space\n Server.redis do |c|\n c.sadd(\"#{QPush::Base::KEY}:namespaces\", @config.namespace)\n end\n end",
"def do_subscribe(params)\n mode = params['hub.mode']\n callback = params['hub.callback']\n topic = params['hub.topic']\n verify = params['hub.verify']\n vtoken = params['hub.verify_token']\n \n content_type 'text/plain', :charset => 'utf-8'\n unless callback and topic and verify\n throw :halt, [400, \"Bad request: Expected 'hub.callback', 'hub.topic', and 'hub.verify'\"]\n end\n throw :halt, [400, \"Bad request: Empty 'hub.callback' or 'hub.topic'\"] if (callback.empty? or topic.empty?)\n # anchor part in the url not allowed by the spec\n throw :halt, [400, \"Bad request: Invalid URL\"] if (callback.include?('#') or topic.include?('#'))\n \n throw :halt, [400, \"Bad request: Unrecognized mode\"] unless ['subscribe', 'unsubscribe'].include?(mode)\n\n # Processing optional secret\n secret = params['hub.secret'] ? params['hub.secret'] : ''\n \n # remove invalid verify modes \n verify = Array(verify.split(',')).delete_if { |x| not ['sync','async'].include?(x) }\n throw :halt, [400, \"Bad request: Unrecognized verification mode\"] if verify.empty?\n # For now, only using the first preference of verify mode\n verify = verify[0]\n #throw :halt, [400, \"Bad request: Unrecognized verification mode\"] unless ['sync', 'async'].include?(verify)\n begin\n hash = Topic.to_hash(topic)\n tp = DB[:topics].filter(:url => hash).first\n throw :halt, [404, \"Not Found\"] unless tp[:id]\n \n state = (verify == 'async') ? 1 : 0\n query = { 'hub.mode' => mode,\n 'hub.topic' => topic,\n 'hub.lease_seconds' => 0, # still no subscription refreshing support\n 'hub.challenge' => gen_id}\n query['hub.verify_token'] = vtoken if vtoken\n if verify == 'sync'\n MyTimer.timeout(Config::GIVEUP) do\n res = HTTPClient.get_content(callback, query)\n opts = \"m=#{mode} c=#{callback} t=#{topic} v=#{verify} -> res=#{res.inspect}\"\n raise \"do_verify(#{opts})\" unless res and res == query['hub.challenge']\n end\n state = 0\n end\n \n # Add subscription\n # subscribe/unsubscribe to/from ALL channels with that topic\n cb = DB[:subscriptions].filter(:topic_id => tp[:id], :callback => Topic.to_hash(callback))\n cb.delete if (mode == 'unsubscribe' or cb.first)\n if mode == 'subscribe'\n raise \"DB insert failed\" unless DB[:subscriptions] << {\n :topic_id => tp[:id], :callback => Topic.to_hash(callback), \n :vtoken => vtoken, :vmode => verify, :secret => secret, :state => state }\n end\n throw :halt, verify == 'async' ? [202, \"202 Scheduled for verification\"] : \n [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [409, \"Subscription verification failed: #{e.to_s}\"]\n end\n end",
"def register(connection)\n begin\n connection.init!\n connection.transmit(Command::Sub.new(:topic_name => topic, :channel_name => channel))\n self.link connection\n connections[connection.identifier] = connection\n distribution.add_connection(connection)\n true\n rescue Error::BadResponse => e\n debug \"Failed to establish connection: #{e.result ? e.result.error : '<No Response!>'}\"\n connection.terminate\n false\n end\n end",
"def subscribe(options, &block)\n subscriptions.create(options, &block)\n end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def register(connection)\n begin\n connection.init!\n connection.transmit(Command::Sub.new(:topic_name => topic, :channel_name => channel))\n self.link connection\n connections[connection.identifier] = connection\n distribution.add_connection(connection)\n true\n rescue Error::BadResponse => e\n debug \"Failed to establish connection: #{e.result.error}\"\n connection.terminate\n false\n end\n end",
"def subscriber(name)\n subscriber_name = \"#{@name}.#{name}\"\n @client.sadd @name, subscriber_name\n queue = ::Qup::Adapter::Redis::Queue.new(@uri, subscriber_name, @name)\n ::Qup::Subscriber.new( self, queue )\n end",
"def pubsub_adapter; end",
"def subscribe(args = {})\n :no_response\n end",
"def service_subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscriptions')\n )\n )\n send_iq_stanza_fibered iq\n end",
"def listen port, &block\n if @state != :state_inited\n return\n end\n @state = :state_started\n begin\n @server = WebSocket::EventMachine::Server.start(:host => '0.0.0.0', :port => port.to_s) { |ws|\n ws_context = {\n # 'monitor' or 'client'\n :type => nil,\n # for monitor connection\n :server_id => nil, :server_type => nil, :server_info => nil,\n # for client connection\n :client_id => nil,\n # for both connection\n :username => nil, :registered => false\n }\n ws.onopen {\n @wss[ws.signature] = ws\n peer_port, peer_host = Socket.unpack_sockaddr_in ws.get_peername\n emit 'connection', { :id => ws.signature, :ip => peer_host }\n }\n ws.onmessage { |msg, type|\n begin\n event, msg = parse msg\n case event\n when 'register'\n process_register_msg ws, ws_context, msg\n when 'monitor'\n process_msg_from_monitor ws, ws_context, msg\n when 'client'\n process_msg_from_client ws, ws_context, msg\n else\n end\n rescue => err\n end\n }\n ws.onclose {\n @wss.delete ws.signature\n if ws_context[:registered]\n case ws_context[:type]\n when 'monitor'\n remove_monitor_connection(ws_context[:server_id],\n ws_context[:server_type], ws_context[:server_info])\n when 'client'\n remove_client_connection ws_context[:client_id]\n else\n end\n emit 'disconnect', ws_context\n end\n }\n ws.onerror { |err|\n emit 'err', err\n }\n }\n block_given? && yield\n rescue => err\n emit 'error', err\n end\n on('connection') { |obj| ip_filter obj }\n end",
"def define_listening\n end",
"def initialize(opts)\n\n # Initializing with a single hash\n @options = opts.symbolize_keys\n\n @auto_pong = @options.fetch(:auto_pong, nil) || CapistranoSentinel.config.auto_pong\n @read_buffer_size = @options.fetch(:read_buffer_size, nil) || CapistranoSentinel.config.read_buffer_size\n @reconnect = @options.fetch(:reconnect, nil) || CapistranoSentinel.config.reconnect\n @retry_time = @options.fetch(:retry_time, nil) || CapistranoSentinel.config.retry_time\n\n\n @secure = @options.fetch(:secure, nil) || CapistranoSentinel.config.secure\n\n @host = @options.fetch(:host, nil) || CapistranoSentinel.config.host\n @port = @secure ? 443 : (@options.fetch(:port, nil) || CapistranoSentinel.config.port)\n @path = @options.fetch(:path, nil) || CapistranoSentinel.config.path\n @query = @options.fetch(:query, nil)\n\n @actor ||= @options.fetch(:actor, nil)\n @channel ||= @options.fetch(:channel, nil)\n\n\n @closed = false\n @opened = false\n\n @on_open = lambda {\n log_to_file(\"native websocket client websocket connection opened\")\n subscribe(@channel) if @channel.present?\n }\n\n @on_close = lambda { |message|\n log_to_file(\"#{@actor.class} client received on_close #{message.inspect}\")\n if @actor.present? && @actor.respond_to?(:on_close)\n if @actor.respond_to?(:async)\n @actor.async.on_close(message)\n else\n @actor.on_close(message)\n end\n end\n }\n\n @on_ping = lambda { |message|\n log_to_file(\"#{@actor.class} client received PING #{message.inspect}\")\n if @actor.present? && @actor.respond_to?(:on_ping)\n if @actor.respond_to?(:async)\n @actor.async.on_ping(message)\n else\n @actor.on_ping(message)\n end\n end\n }\n\n @on_error = lambda { |error|\n log_to_file(\"#{@actor.class} received ERROR #{error.inspect} #{error.backtrace}\")\n if @actor.present? && @actor.respond_to?(:on_error)\n if @actor.respond_to?(:async)\n @actor.async.on_error(error)\n else\n @actor.on_error(error)\n end\n end\n }\n\n @on_message = lambda { |message|\n message = parse_json(message)\n log_to_file(\"#{@actor.class} websocket client received JSON #{message}\")\n if @actor.present? && @actor.respond_to?(:async)\n log_to_file(\"#{@actor.class} works async on message #{message.inspect}\")\n @actor.async.on_message(message)\n else\n @actor.on_message(message)\n end\n }\n connect\n end",
"def subscribe(subject, opts={}, &callback)\n return unless subject and not draining?\n sid = (@ssid += 1)\n sub = @subs[sid] = { :subject => subject, :callback => callback, :received => 0 }\n sub[:queue] = opts[:queue] if opts[:queue]\n sub[:max] = opts[:max] if opts[:max]\n send_command(\"SUB #{subject} #{opts[:queue]} #{sid}#{CR_LF}\")\n # Setup server support for auto-unsubscribe\n unsubscribe(sid, opts[:max]) if opts[:max]\n sid\n end",
"def subscribe( channel, &callback )\n fail NotImplementedError\n end",
"def initialize( host, port = 8888, path = \"websocket\",\n version = self.version, support )\n super(\"http://#{host}:#{port}/#{path}\") #setup websocket connection\n\n self.init_event_handlers()\n\n @callbacks = {}\n @collections = {}\n @subs = {}\n @version = version\n @session = nil\n @curr_id = 0\n @support = support\n\n end",
"def initialize(options = {})\n url = options.delete(:url) { determine_redis_provider }\n namespace = options.delete(:namespace)\n driver = options.delete(:driver)\n @redis_connection = initialize_conection(url, namespace, driver)\n @redis_client = @redis_connection.client\n @redis_connection\n end",
"def event_subscription(options, &block)\n subscriptions.event(options, &block)\n end",
"def listen_on(channel)\n sns.subscribe(\n topic_arn: channel.arn,\n protocol: 'application',\n endpoint: channel.endpoint\n )\n end",
"def redis=(server)\n @redis = if server.is_a?(String)\n Redis.new(:url => server, :thread_safe => true)\n elsif server.is_a?(Hash)\n Redis.new(server.merge(:thread_safe => true))\n elsif server.respond_to?(:smembers)\n server\n else\n raise ArgumentError,\n \"You must supply a url, options hash or valid Redis connection instance\"\n end\n end",
"def subscribe_with_timeout(timeout, *channels, &block); end",
"def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n Resque.redis.sadd(:queues, :default)\n end",
"def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n Resque.redis.sadd(:queues, :default)\n end",
"def subscribe(params = {})\n @connection ||= stub_connection\n @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)\n @subscription.singleton_class.include(ChannelStub)\n @subscription.subscribe_to_channel\n @subscription\n end",
"def subscribe(prefix)\n setsockopt :subscribe, prefix\n end",
"def subscribe(subject, opts={}, &callback)\n sid = nil\n sub = nil\n synchronize do\n sid = (@ssid += 1)\n sub = @subs[sid] = Subscription.new\n end\n sub.subject = subject\n sub.callback = callback\n sub.received = 0\n sub.queue = opts[:queue] if opts[:queue]\n sub.max = opts[:max] if opts[:max]\n\n send_command(\"SUB #{subject} #{opts[:queue]} #{sid}#{CR_LF}\")\n @flush_queue << :sub\n\n # Setup server support for auto-unsubscribe when receiving enough messages\n unsubscribe(sid, opts[:max]) if opts[:max]\n\n sid\n end",
"def listen\n raise NotImplementedError.new(\"Implement listen() in your Invoker. \")\n end",
"def subscribe(channel, connection)\n sid = Channel[app_id => channel].subscribe {|msg| connection.send(msg) }\n subscriptions[channel => connection.signature] = sid\n sid\n end",
"def subscribe(*args, &blk)\n (@client ||= connect).subscribe(*args, &blk)\n end",
"def pubsub\n stream.config.pubsub(validate_to)\n end",
"def register(channel)\n channel.subscribe(&method(:handle_response))\n end",
"def listen\n # TODO\n self\n end",
"def subscribe!\n # TODO: Implement\n end",
"def setup\n unless APP_CONFIG['single_server']\n @logger.info \"Multiple server mode activated\"\n $redis_listen = EM::Hiredis.connect(APP_CONFIG['redis_url'])\n $redis = EM::Hiredis.connect(APP_CONFIG['redis_url'])\n\n if ENV['TUBEHUB_MODE'] == 'backend'\n $redis_listen.subscribe APP_CONFIG['redis_channel']\n $redis_listen.on(:message) do |channel, msg|\n handle_redis_event((JSON.parse(msg) rescue {}))\n end\n end\n end\n\n reload_channels\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def subscribed\n super\n increase_current_users\n stream_from channel\n end",
"def subscribers\n subs = {}\n subscriber_names.each do |sname|\n subs[sname] = ::Qup::Adapter::Redis::Queue.new(@uri, sname, @name)\n end\n return subs\n end",
"def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end",
"def start_listener!\n memoize(\"#{args[:bind]}-#{args[:port]}\", :global) do\n build_listener do |req|\n begin\n msg = build_message(req)\n # Start with static path lookup since it's the\n # cheapest, then fallback to iterative globbing\n msg_queue = nil\n unless(msg_queue = message_queues[\"#{req.path}-#{req.method.to_s.downcase}\"])\n message_queues.each do |k,v|\n path_glob, http_method = k.split('-')\n if(req.method.to_s.downcase == http_method && File.fnmatch(path_glob, req.path))\n msg_queue = v\n end\n end\n end\n if(msg_queue)\n if(authorized?(msg))\n msg_queue[:queue] << msg\n if(msg_queue[:config][:auto_respond])\n code = msg_queue[:config].fetch(:response, :code, 'ok').to_sym\n response = msg_queue[:config].fetch(:response, :message, 'So long and thanks for all the fish!')\n req.respond(code, response)\n end\n else\n req.respond(:unauthorized, 'You are not authorized to perform requested action!')\n end\n else\n req.respond(:not_found, 'Requested path not found!')\n end\n rescue Zoidberg::DeadException\n raise\n rescue => e\n req.respond(:bad_request, \"Failed to process request -> #{e}\")\n puts \"#{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end",
"def connect(*options)\n self.redis = nil\n @options = options\n end",
"def default_stream_handler(broadcasting, coder:); end",
"def initialize( host, port = 8888, path = \"websocket\",\n version = 1, support )\n super(\"http://#{host}:#{port}/#{path}\") #setup websocket connection\n\n self.init_event_handlers()\n @callbacks = {}\n @collections = {}\n @subs = {}\n @sub_ids = {}\n @version = version\n #setup database info\n @mongo = self.get_db_conn\n\n end",
"def subscriptions\n @subscriptions ||= Hash.new do |subscriptions, channel|\n # Setup the hash to generate subscriptions that can delete themselves from\n # their own collection on an unsubscription event.\n subscription = Subscription.new(self, channel)\n subscription.on_unsubscribe do\n # Remove the subscription from the consumer.subscriptions \n # list when unsubscribe.\n subscriptions.delete channel\n end\n subscriptions[channel] = subscription\n end\n end",
"def channel_open_handlers; end",
"def initialize(exchange_name = nil, routing_key: nil, connection: nil, context: nil, ident: nil, expiration: nil, persistent: true, durable: true, timeout: nil)\n super(connection: connection, context: context, ident: ident)\n\n @routing_key = routing_key\n @timeout = timeout\n\n @rpc_exchange = self.channel.direct(\n exchange_name || EXCHANGE_NAME_DEFAULT,\n durable: durable\n )\n\n @response_queue = self.channel.queue(\n @ident,\n durable: false,\n header: true,\n auto_delete: true\n )\n @expiration = expiration\n @persistent = !!persistent\n\n @callback = { }\n\n @consumer = Skein::Adapter.subscribe(@response_queue, block: false) do |payload, delivery_tag, reply_to|\n self.context.trap do\n if (ENV['SKEIN_DEBUG_JSON'])\n $stdout.puts(payload)\n end\n\n response = JSON.load(payload)\n\n if (callback = @callback.delete(response['id']))\n if (response['error'])\n exception =\n case (response['error'] and response['error']['code'])\n when -32601\n NoMethodError.new(\n \"%s from `%s' RPC call\" % [\n response.dig('error', 'message'),\n response.dig('error', 'data', 'method')\n ]\n )\n when -32602\n ArgumentError.new(\n response.dig('error', 'data', 'message') || 'wrong number of arguments'\n )\n else\n RPCException.new(\n response.dig('error', 'data', 'message') || response.dig('error', 'message')\n )\n end\n\n case (callback)\n when Skein::TimeoutQueue\n callback << exception\n when Proc\n callback.call(exception)\n end\n else\n case (callback)\n when Skein::TimeoutQueue\n callback << response['result']\n when Proc\n callback.call(response['result'])\n end\n end\n end\n\n self.channel.acknowledge(delivery_tag)\n end\n end\n end",
"def subscribe( channel, callback )\n if @channels.include?(channel)\n @channels[channel] << callback\n else\n @channels[channel]=[callback]\n @client.subscribe channel\n end\n end",
"def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end",
"def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end",
"def initialize(options = {})\n @ws_server = options[:host] || \"ws://localhost:9000\"\n @protocols = options[:protocols]\n @headers = options[:headers]\n @id = nil\n @socket = nil\n @wamp_protocol = nil\n @server_ident = nil\n\n @prefixes = {}\n @topics = []\n @callbacks = {}\n end",
"def listen(options = {}, server = nil)\n server ||= create_server(options)\n Reactor.queue_task do\n monitor = Reactor.selector.register(server, :r)\n monitor.value = proc do\n accept_socket server, options do |io| # this next block won't run until ssl (if enabled) has started\n adapter = SERVER_ADAPTER.new(io, options)\n yield(adapter.driver, adapter) if block_given?\n Reactor.queue_task do\n adapter.add_to_reactor\n end\n logger.info \"Host accepted client connection #{io} on port #{options[:port]}\"\n end\n end\n end\n Reactor.start\n logger.info \"Host listening for new connections on port \" + options[:port].to_s\n server\n end",
"def get_subscribe date\n event_stream do |s|\n (Connections[date] ||= []) << s\n # when client disconnected we are no more able to write to there socket\n # so simply removing it from pool.\n s.on_error { Connections[date].delete s }\n end\n end",
"def initialize(url, cookies, logs: false, &handler)\n @super_logger = Logger.new(logs ? 'ws_super_logger.log' : '/dev/null')\n\n @uri = URI.parse(url)\n @url = \"ws#{@uri.scheme.split(\"\")[4]}://#{@uri.host}\"\n\n if @uri.scheme.split(\"\")[4] == 's'\n @socket = TCPSocket.new(@uri.host, 443)\n @super_logger.info \"Opened TCP socket for (port 443) #{@uri} (#{@socket})\"\n @socket = OpenSSL::SSL::SSLSocket.new(@socket)\n @socket.connect\n @super_logger.info \"Upgrade TCP socket to SSL socket socket for #{@uri} (#{@socket})\"\n else\n @socket = TCPSocket.new(@uri.host, 80)\n @super_logger.info \"Opened TCP socket for (port 80) #{@uri} (#{@socket})\"\n end\n\n @handler = handler\n @logger = Logger.new(logs ? \"realtime.log\" : '/dev/null')\n @restart = true\n @super_logger.info \"Set @restart to #{@restart}\"\n\n @driver = WebSocket::Driver.client(self)\n @driver.add_extension PermessageDeflate\n @driver.set_header \"Cookies\", cookies if cookies\n @driver.set_header \"Origin\", \"#{@uri.scheme}://#{@uri.host.split('.')[-2..-1].join('.')}\"\n\n @driver.on :connect, ->(_e) {}\n\n @driver.on :open, ->(_e) do\n send \"155-questions-active\"\n @super_logger.info \"Socket open. Subscribed to 155-questions-active\"\n @logger.info \"WebSocket is open!\"\n end\n\n @driver.on :message do |e|\n @logger.info(\"Read: #{e.data}\")\n data = JSON.parse(e.data)\n if data[\"action\"] == \"hb\"\n send \"hb\"\n else\n @handler.call(data)\n end\n end\n\n @driver.on :close, ->(_e) do\n @logger.info \"Realtime WebSocket is closing.\"\n @super_logger.info \"Socket was closed. @restart == #{@restart}\"\n if @restart\n @logger.info \"Attempting to reopen websocket...\"\n @super_logger.info \"Attempting to reopen socket\"\n @driver.start\n end\n end\n\n @driver.on :error, ->(e) { @logger.error e }\n\n @driver.start\n\n @dead = false\n @thread = Thread.new do\n trap(\"SIGINT\") do\n @restart = false\n @dead = true\n @super_logger.info \"Got SIGINT. Dying.\"\n close\n Thread.exit\n end\n begin\n @driver.parse(@socket.is_a?(TCPSocket) ? @socket.recv(1) : @socket.sysread(1)) until @dead\n rescue IOError, SystemCallError => e\n @super_logger.warn \"Got some kind of interrupt in the thread. Panic.\"\n @logger.warn \"Recieved #{e} closing TCP socket. You shouldn't be worried :)\"\n end\n @super_logger.warn \"Left TCPSocket.recv loop. If you're reading this, panic.\"\n end\n\n at_exit { @thread.join }\n end",
"def listen(p0) end",
"def listen(p0) end",
"def listen(p0) end",
"def subscribe_webhook\n @redis = EM::Hiredis.connect(Settings.redis)\n pubsub = @redis.pubsub\n pubsub.subscribe(subscribed_channel)\n pubsub.on(:message) do |channel, message|\n render(message, event: :webhook)\n end\n end",
"def subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end",
"def initialize options={}\n # set defaults\n @env = options[:env] || 'default'\n @app = options[:app] || 'default'\n @verbose = options[:verbose].nil? ? true : options[:verbose]\n @subscribe_to_changes = options[:subscribe_to_changes].nil? ? true : options[:subscribe_to_changes]\n @cache_locally = options[:cache_locally].nil? ? true : options[:cache_locally]\n\n redis_options = options[:redis] || {}\n\n @prefix = redis_options[:prefix] || 'redfig'\n\n @local_cache = {}\n\n puts \"- Initializing Redis client with settings: #{redis_options.inspect}\" if @verbose\n\n @redis = Redis.new redis_options\n end",
"def subscribe(response)\n response.headers['Content-Type'] = 'text/event-stream'\n @subscriber = response\n end",
"def subscribe\n debug [self.name, \"incoming\"]\n subscribe_request\n end",
"def remove(channel_name, stream_name, connection)\n @mutex.synchronize do\n subscribers[channel_name][stream_name].delete(connection)\n subscribers[channel_name].delete(stream_name) if subscribers[channel_name][stream_name].empty?\n connection\n end\n end",
"def on_message(channel, message)\n doc = JSON.parse(message)\n case channel\n when ALL then to_all(doc)\n when SHARE then analyze_share(doc)\n when @channel then to_node(doc)\n end\n rescue => e\n log.error(\"Cluster subscription message failed: #{e}\")\n end",
"def register(options = {})\n url = options.fetch(:url){ raise ArgumentError, ':url must be provided' }\n\n options[:lifetime] ||= SLP_LIFETIME_DEFAULT\n options[:attributes] ||= ''\n options[:fresh] ||= true\n\n options[:callback] ||= Proc.new{ |_hslp, err, _cookie| }\n\n if options[:attributes] && options[:attributes] != ''\n attributes = options[:attributes].map{ |k,v| \"(#{k}=#{v})\" }.join(',')\n else\n attributes = ''\n end\n\n begin\n cookie = FFI::MemoryPointer.new(:void)\n\n result = SLPReg(\n @handle,\n url,\n options[:lifetime],\n nil,\n attributes,\n options[:fresh],\n options[:callback],\n cookie\n )\n\n raise Error, \"SLPReg(): #{result}\" if result != :SLP_OK\n ensure\n cookie.free unless cookie.null?\n end\n\n url\n end",
"def stream_callback(name, options = {}, &block)\n if not block\n throw ArgumentError\n end\n\n\n # Set instance variable for original rendering before streaming is established\n instance_variable_set(\"@#{name}\", block.call)\n\n # Check if the request is initial or for streaming content\n #\n # If the request is not for streaming ignore the rest of the code\n unless params[STREAMING_PARAM]\n return false\n else\n\n response.headers['Content-Type'] = 'text/event-stream'\n\n connection = Strwatch::Connection.new(response.stream, name)\n\n lambda { connection.stream(block.call, options) }\n end\n end",
"def handle_monitor request, *channels\n channels.map(&:to_sym).each do |channel|\n @node.subscribe(channel) {|*data| respond(request, [channel, *data]) }\n name, *params = channel.to_s.split(\"_\")\n send(\"handle_monitor_#{name}\", request, *params)\n log.info { \"Client subscribed to channel #{channel}\" }\n end\n nil\n end",
"def subscribe(topic, channel, options={}, &block)\n Util.assert_topic_and_channel_valid(topic, channel)\n subscriber = nil\n name = \"#{topic}:#{channel}\"\n @subscriber_mutex.synchronize do\n raise \"Already subscribed to #{name}\" if @subscribers[name]\n subscriber_class = block_given? ? Subscriber : QueueSubscriber\n subscriber = @subscribers[name] = subscriber_class.new(self, topic, channel, options, &block)\n end\n\n @nsqd_tcp_addresses.each do |addr|\n address, port = addr.split(':')\n subscriber.add_connection(address, port.to_i)\n end\n subscriber\n end",
"def on_registration(connection)\n end",
"def dispatch(message, channel)\n if channel =~ /^slanger:/\n # Messages received from the Redis channel slanger:* carry info on\n # subscriptions. Update our subscribers accordingly.\n update_subscribers message\n else\n push message.to_json\n end\n end",
"def add(channel_name, stream_name, connection)\n @mutex.synchronize do\n subscribers[channel_name][stream_name].push(connection)\n connection\n end\n end",
"def subscription_options(subscription_id=nil)\n params = {}\n params['subid'] = subscription_id if subscription_id\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'get'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('options',{'node' => node_id, 'jid'=>subscribee}.merge(params))\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def subscribe(&onMessage) # block\n end",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def initialize(info = {})\n\t\tsuper\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOptAddress.new('PXHOST', [ true, \"The local HTTP listener hostname\" ]),\n\t\t\t\tOptPort.new('PXPORT', [ true, \"The local HTTP listener port\", 8000 ]),\n\t\t\t\tOptString.new('PXURI', [ false, \"The URI root for requests\", \"/\" + Rex::Text.rand_text_alphanumeric(32) ]),\n\t\t\t\tOptString.new('PXAXCLSID', [ true, \"ActiveX CLSID\", \"B3AC7307-FEAE-4e43-B2D6-161E68ABA838\" ]),\n\t\t\t\tOptString.new('PXAXVER', [ true, \"ActiveX DLL Version\", \"-1,-1,-1,-1\" ]),\n\t\t\t], Msf::Handler::PassiveX)\n\n\t\t# Initialize the start of the localized SID pool\n\t\tself.sid_pool = 0\n\t\tself.session_channels = Hash.new\n\t\tself.handler_ref = PxRef.new\n\tend",
"def write_subscription(query, events)\n subscription_id = query.context[:subscription_id] ||= build_id\n connection = query.context.fetch(:connection)\n @subscriptions[subscription_id] = query\n @connections[subscription_id] = connection\n\n events.each do |event|\n pipe.receive subscription_id, event.topic do |object|\n execute(subscription_id, event, object)\n end\n end\n end",
"def listen(klass, *args)\n supervise klass, name, handlers, *args\n end",
"def accept(handler, *params)\n @streamhosts = @iq.streamhosts\n @streamhosts.delete_if {|s| begin IPAddr.new(s.host).private? rescue false end } unless @allow_private_ips\n @socket_address = Digest::SHA1.hexdigest(\"#{@iq.sid}#{@iq.from}#{@iq.to}\")\n\n @handler = handler\n @params = params\n\n connect_next_streamhost\n @stream.clear_handlers :s5b_open, :from => @iq.from\n end",
"def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend",
"def subscribe(channel, data = {})\n log_to_file(\"#{self.class} tries to subscribe to channel #{channel} with #{data.inspect}\")\n send_action('subscribe', channel, data)\n end"
] |
[
"0.5768141",
"0.55437756",
"0.5397223",
"0.5298344",
"0.5191328",
"0.51623774",
"0.5145308",
"0.5144331",
"0.5135618",
"0.5111566",
"0.5104955",
"0.5082597",
"0.5061528",
"0.50525457",
"0.50512004",
"0.50437504",
"0.50396687",
"0.50206244",
"0.5011835",
"0.499689",
"0.49961174",
"0.49935716",
"0.49658775",
"0.49576294",
"0.49537772",
"0.49454194",
"0.4944391",
"0.493882",
"0.4909885",
"0.4900872",
"0.48938543",
"0.4888979",
"0.4886918",
"0.4883156",
"0.4865319",
"0.48645663",
"0.4857496",
"0.4854354",
"0.48516324",
"0.48441708",
"0.4835223",
"0.4828097",
"0.48211026",
"0.481603",
"0.48157486",
"0.47980538",
"0.4787106",
"0.47847548",
"0.47731054",
"0.4766886",
"0.47654322",
"0.47623602",
"0.47562727",
"0.47456792",
"0.47346976",
"0.47247642",
"0.4723878",
"0.47227356",
"0.47175545",
"0.47128886",
"0.47115034",
"0.46914026",
"0.46883965",
"0.4683441",
"0.46822253",
"0.46813172",
"0.46807054",
"0.46776676",
"0.46696344",
"0.46683165",
"0.46639395",
"0.46442005",
"0.46403563",
"0.46361214",
"0.463497",
"0.463497",
"0.463497",
"0.4627948",
"0.46275586",
"0.46268857",
"0.4614831",
"0.46069452",
"0.4604579",
"0.4597128",
"0.45923173",
"0.4590502",
"0.45876032",
"0.4585184",
"0.45833832",
"0.45825663",
"0.45785344",
"0.45777953",
"0.45772845",
"0.45762303",
"0.45757192",
"0.45703548",
"0.4565148",
"0.456227",
"0.45574167",
"0.4552819"
] |
0.5746854
|
1
|
GET /samples GET /samples.json
|
def test
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @sample = Sample.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample }\n end\n end",
"def samples(filter_params = {})\n get_request(shard_endpoint_uri('samples', filter_params))\n end",
"def index\n @samples = Sample.all\n end",
"def index\n @samples = Sample.all\n end",
"def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def sample_json_response\n if @_sample_response.nil?\n example_json = fields.dig('responses', '200', 'examples', 'application/json')\n if example_json\n @_sample_response = JSON.pretty_generate(example_json).strip\n end\n end\n\n @_sample_response\n end",
"def show\n @samples = current_power.project_samples(@project)\n # all exisiting project are null, we ensure private projects are explicitly set to 0\n respond_to do |format|\n format.html\n format.json do\n render json: {\n id: @project.id,\n name: @project.name,\n public_access: @project.public_access.to_i,\n created_at: @project.created_at,\n total_sample_count: @samples.count\n }\n end\n end\n end",
"def sample(query_parameters = {})\n start('statuses/sample', query_parameters)\n end",
"def show\n @sample_set = SampleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_set }\n end\n end",
"def show\n \n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @sample }\n end\n end",
"def show\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sampled_url }\n end\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end",
"def show\n @sample = Sample.find(params[:id])\n @stats = @sample.stats\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sample }\n format.json { render :json => @sample }\n end\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def show\n redirect_to \"samples#index\"\n end",
"def load_sample(file)\n path = Rails.root.join(\"lib\", \"assets\", \"sample_data\", \"#{file}.json\")\n file_data = File.read(path)\n return JSON.parse(file_data, symbolize_names: true)\n end",
"def get_audio_samples \n send_cmd(\"get_audio_samples\")\n end",
"def show\n @patient_sample = PatientSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def create\n @sample = @ogsong.samples.new(sample_params)\n\n respond_to do |format|\n #if sample created successfully, show notice\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n puts \"Index method called...\"\n @studies = Study.all\n\n # render json: @studies\n end",
"def index\n @samples = Sample.all\n @page_title = \"Sample History Overview\"\n end",
"def show\n @sample_type = SampleType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_type }\n end\n end",
"def index\n @studies = Study.all\n #render json: @studies\n end",
"def sample_students_json\n raise Exceptions::EducatorNotAuthorized unless current_educator.can_set_districtwide_access?\n\n seed = params.fetch(:seed, '42').to_i\n n = params.fetch(:n, '40').to_i\n authorized_sample_students = authorized do\n Student.active.sample(n, random: Random.new(seed))\n end\n sample_students_json = authorized_sample_students.as_json({\n only: [:id, :grade, :first_name, :last_name],\n include: {\n school: {\n only: [:id, :name, :school_type]\n }\n }\n })\n render json: {\n sample_students: sample_students_json\n }\n end",
"def sample_params\n params[:sample]\n end",
"def index\n @studies = Study.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @studies }\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def samples; end",
"def samples; end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def index\n @mycometer_coc_samples = MycometerCocSample.all\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def new\n @sampled_url = SampledUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sampled_url }\n end\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def show\n @xml_sample = XmlSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def index\n @text_samples = TextSample.all\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def show\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_line }\n end\n end",
"def index\n @audiences = Audience.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audiences }\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def load_query_response\n load_file('sample_query_response.json')\nend",
"def webhook_example_events(sample_name)\n sample_path = webhook_examples_path.join(\"#{sample_name}.json\")\n JSON.parse(sample_path.read)\n end",
"def samples\n home = File.expand_path('../..', __FILE__)\n Dir.glob(\"#{home}/spec/samples/*.ooc\")\nend",
"def create\n @sample = Sample.new(params[:sample])\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to samples_path, notice: 'Sample was successfully created.' }\n format.json { render json: @sample, status: :created, location: @sample }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_skus()\n\tputs \"Getting skus\"\n\tresponse = request_get(\"/api/sku\")\n\tputs response.body\nend",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def list\n @audios = Audio.all\n\n respond_to do |format|\n format.html\n format.json { render json: @audios }\n end\n end",
"def samples\n\t\treturn self.db[:samples].\n\t\t\tfilter( synsetid: self.synsetid ).\n\t\t\torder( :sampleid ).\n\t\t\tmap( :sample )\n\tend",
"def get_examples(word, *args)\n http_method = :get\n path = '/word/{word}/examples'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n render json: @sample_photo\n end",
"def demos\n get_records \"demo\", \"/demos\"\n end",
"def index\n @sample_identifiers = SampleIdentifier.all\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n puts get_values.sample\n end",
"def index\n @study_units = StudyUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_units }\n end\n end",
"def show\n @study = Study.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @study }\n end\n end",
"def test_get_skills_route\n render :json => get_profile_skills_for_profile(\"https://www.linkedin.com/in/marissamayer\").to_json\n end",
"def show\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backend_tutorial_stat }\n end\n end",
"def index\n @samples = policy_scope(Sample.all)\n authorize Sample\n end",
"def index\n @case_studies = CaseStudy.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @case_studies }\n end\n end",
"def index\n @sample_types = SampleType.all\n end",
"def payload_example(sample_name)\n payload_examples_path.join(sample_name).read\n end",
"def index\n render status: :ok, json: @test_guide_scenario_sas\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def show\n begin\n @example = Example.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n # last URL parameter is not example ID, but the example's number\n @example = @language.examples.where(number: params[:id].to_i).first\n end\n @examples = [@example]\n respond_to do |format|\n format.html { render 'examples/index' } # also show index.html.erb\n format.json { render json: @example }\n end\n end",
"def test_that_you_may_filter_to_single_track\n getting '/v2/exercises?tracks=fruit'\n\n returns_tracks %w( fruit )\n end",
"def index\n render status: :ok, json: @test_guide_scenarios\n end",
"def random\n @song = Song.where(:user => current_user).sample\n if @song.present?\n respond_to do |format|\n format.html\n format.json { render json: @song }\n end\n else\n respond_to do |format|\n format.html { redirect_to songs_url, notice: 'No Songs created yet.' }\n format.json { head :no_content }\n end\n end\n end",
"def show\r\n @sample_is_new = (params[:new_sample] ||= false)\r\n @sample = Sample.includes({:sample_characteristic => :pathology}, :patient, :histology, :sample_storage_container).find(params[:id])\r\n end",
"def index\n @assertions = Assertion.all.sample(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @assertions }\n end\n end",
"def show\n quotes = OriginalQuote.all\n @quote = quotes.sample\n render json: @quote, status: 200\n end",
"def sample_params\n params.require(:sample).permit()\n end",
"def sample_data\n json = JSON.parse File.read(\"db/sample_data.json\")\n sorted_json = json[\"results\"].sort_by { |r| -r[\"score\"] }\n end",
"def new\n \n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @sample }\n end\n end",
"def sample_params\n params.require(:sample).permit(:ogsong_id, :title, :artist, :lyrics)\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 index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def sample_shows(pages: 2)\n respond_to do |format|\n format.html\n format.json do\n nyc = '40.71,-74.01'\n @latlng = params.fetch(:latlng, nyc).split(',').map(&:to_f)\n response = ShowsService.call(latlng: @latlng, pages: pages)\n render json: response\n end\n end\n end",
"def show\n @sample_property = SampleProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_property }\n end\n end",
"def show\n @location = Location.with_samples.find(params[:id])\n @sample_summaries = @location.sample_summaries.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def index\n @students = Student.all\n render json: @students\n end",
"def new\n @patient_sample = PatientSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def demo(id)\n get_record \"/demos/#{id}\"\n end",
"def show\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def index\n @samplings = Sampling.all\n end",
"def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end",
"def elasticsearch_sample\n results = Tweet.all\n if params[:geo]\n results = results.collect do |redis_arr|\n tweet = JSON.parse redis_arr[-1]\n [tweet['lat'].to_f, tweet['lon'].to_f]\n end\n results.delete []\n end\n\n respond_to do |format|\n format.json{ render json: results.to_json }\n end\n end",
"def collect_sample(route, request, response)\n delete_expired_samples\n\n endpoint = ApiSampler::Endpoint\n .find_or_create_by!(path: route.pattern,\n request_method: request.request_method)\n endpoint.samples.create!(query: request.query_string,\n request_body: request.body.read,\n path_params: route.parameters,\n response_body: response.body)\n rescue ActiveRecord::RecordInvalid => error\n Rails.logger.error \"api_sampler :: collect_sample :: #{error}\"\n end"
] |
[
"0.69534856",
"0.6939203",
"0.6814256",
"0.67516744",
"0.66234225",
"0.6532149",
"0.6532149",
"0.6523348",
"0.6489714",
"0.64232147",
"0.6370491",
"0.6357608",
"0.6325009",
"0.6311997",
"0.63068664",
"0.6275714",
"0.6274013",
"0.62677944",
"0.61959803",
"0.616178",
"0.6137376",
"0.6115748",
"0.60927683",
"0.60700846",
"0.6066452",
"0.6048462",
"0.6004443",
"0.59841317",
"0.5978981",
"0.59769696",
"0.59715754",
"0.59715754",
"0.5927804",
"0.5911113",
"0.5904933",
"0.5904492",
"0.589983",
"0.5875129",
"0.5852559",
"0.5848751",
"0.5845972",
"0.5807917",
"0.58037657",
"0.5797379",
"0.5794475",
"0.57895476",
"0.57743657",
"0.57722735",
"0.5768894",
"0.57627714",
"0.57499635",
"0.57385826",
"0.5729285",
"0.57214856",
"0.5721015",
"0.5687406",
"0.5657549",
"0.5657549",
"0.56572527",
"0.56552404",
"0.56517065",
"0.564484",
"0.56439865",
"0.56373763",
"0.5637126",
"0.56327623",
"0.5624043",
"0.5616158",
"0.5613781",
"0.56134766",
"0.56070143",
"0.56039315",
"0.55983627",
"0.55843747",
"0.5578247",
"0.5574792",
"0.5570965",
"0.5569564",
"0.5568672",
"0.555662",
"0.555613",
"0.5554838",
"0.5552936",
"0.5552262",
"0.555138",
"0.55452454",
"0.55448264",
"0.55299145",
"0.5522498",
"0.5520931",
"0.55176616",
"0.5515486",
"0.5515486",
"0.5515486",
"0.5513005",
"0.550697",
"0.5500244",
"0.5497081",
"0.5496047",
"0.5495106",
"0.54943216"
] |
0.0
|
-1
|
GET /samples/1 GET /samples/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @sample = Sample.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample }\n end\n end",
"def sample_json_response\n if @_sample_response.nil?\n example_json = fields.dig('responses', '200', 'examples', 'application/json')\n if example_json\n @_sample_response = JSON.pretty_generate(example_json).strip\n end\n end\n\n @_sample_response\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end",
"def show\n @samples = current_power.project_samples(@project)\n # all exisiting project are null, we ensure private projects are explicitly set to 0\n respond_to do |format|\n format.html\n format.json do\n render json: {\n id: @project.id,\n name: @project.name,\n public_access: @project.public_access.to_i,\n created_at: @project.created_at,\n total_sample_count: @samples.count\n }\n end\n end\n end",
"def show\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sampled_url }\n end\n end",
"def show\n @sample_set = SampleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_set }\n end\n end",
"def index\n @samples = Sample.all\n end",
"def show\n \n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @sample }\n end\n end",
"def index\n @samples = Sample.all\n end",
"def show\n @sample = Sample.find(params[:id])\n @stats = @sample.stats\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sample }\n format.json { render :json => @sample }\n end\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end",
"def show\n @patient_sample = PatientSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def samples(filter_params = {})\n get_request(shard_endpoint_uri('samples', filter_params))\n end",
"def show\n @sample_type = SampleType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_type }\n end\n end",
"def sample(query_parameters = {})\n start('statuses/sample', query_parameters)\n end",
"def show\n redirect_to \"samples#index\"\n end",
"def new\n @sampled_url = SampledUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sampled_url }\n end\n end",
"def load_sample(file)\n path = Rails.root.join(\"lib\", \"assets\", \"sample_data\", \"#{file}.json\")\n file_data = File.read(path)\n return JSON.parse(file_data, symbolize_names: true)\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def show\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_line }\n end\n end",
"def show\n @xml_sample = XmlSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def show\n begin\n @example = Example.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n # last URL parameter is not example ID, but the example's number\n @example = @language.examples.where(number: params[:id].to_i).first\n end\n @examples = [@example]\n respond_to do |format|\n format.html { render 'examples/index' } # also show index.html.erb\n format.json { render json: @example }\n end\n end",
"def create\n @sample = @ogsong.samples.new(sample_params)\n\n respond_to do |format|\n #if sample created successfully, show notice\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @samples = Sample.all\n @page_title = \"Sample History Overview\"\n end",
"def load_query_response\n load_file('sample_query_response.json')\nend",
"def index\n puts \"Index method called...\"\n @studies = Study.all\n\n # render json: @studies\n end",
"def index\n @studies = Study.all\n #render json: @studies\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def index\n @studies = Study.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @studies }\n end\n end",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def show\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backend_tutorial_stat }\n end\n end",
"def demo(id)\n get_record \"/demos/#{id}\"\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def create\n @sample = Sample.new(params[:sample])\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to samples_path, notice: 'Sample was successfully created.' }\n format.json { render json: @sample, status: :created, location: @sample }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def show\n @study = Study.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @study }\n end\n end",
"def new\n \n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @sample }\n end\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n render json: @sample_photo\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def new\n @patient_sample = PatientSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def new\n @sample_type = SampleType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_type }\n end\n end",
"def sample_params\n params[:sample]\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def show\r\n @sample_is_new = (params[:new_sample] ||= false)\r\n @sample = Sample.includes({:sample_characteristic => :pathology}, :patient, :histology, :sample_storage_container).find(params[:id])\r\n end",
"def get_audio_samples \n send_cmd(\"get_audio_samples\")\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @sample = Sample.new\n @sample.state = \"Default\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample }\n end\n end",
"def payload_example(sample_name)\n payload_examples_path.join(sample_name).read\n end",
"def webhook_example_events(sample_name)\n sample_path = webhook_examples_path.join(\"#{sample_name}.json\")\n JSON.parse(sample_path.read)\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @sample_property = SampleProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_property }\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @sample_set = SampleSet.new\n @sample_set.project_id = @project.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_set }\n end\n end",
"def index\n @mycometer_coc_samples = MycometerCocSample.all\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def new\n @sample_line = SampleLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_line }\n end\n end",
"def demos\n get_records \"demo\", \"/demos\"\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def 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 @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def show\n @gen = Gen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gen }\n end\n end",
"def sample_shows(pages: 2)\n respond_to do |format|\n format.html\n format.json do\n nyc = '40.71,-74.01'\n @latlng = params.fetch(:latlng, nyc).split(',').map(&:to_f)\n response = ShowsService.call(latlng: @latlng, pages: pages)\n render json: response\n end\n end\n end",
"def index\n @audiences = Audience.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audiences }\n end\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def index\n @assertions = Assertion.all.sample(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @assertions }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def samples; end",
"def samples; 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 @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\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 get_examples(word, *args)\n http_method = :get\n path = '/word/{word}/examples'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n quotes = OriginalQuote.all\n @quote = quotes.sample\n render json: @quote, status: 200\n end",
"def index\n @study_units = StudyUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_units }\n end\n end",
"def index\n @text_samples = TextSample.all\n end",
"def show\n @fitness_sample = FitnessSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fitness_sample }\n end\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def get_skus()\n\tputs \"Getting skus\"\n\tresponse = request_get(\"/api/sku\")\n\tputs response.body\nend",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def show\n @location = Location.with_samples.find(params[:id])\n @sample_summaries = @location.sample_summaries.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def test_that_you_may_filter_to_single_track\n getting '/v2/exercises?tracks=fruit'\n\n returns_tracks %w( fruit )\n end",
"def random\n @song = Song.where(:user => current_user).sample\n if @song.present?\n respond_to do |format|\n format.html\n format.json { render json: @song }\n end\n else\n respond_to do |format|\n format.html { redirect_to songs_url, notice: 'No Songs created yet.' }\n format.json { head :no_content }\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"
] |
[
"0.71274495",
"0.66596454",
"0.6617429",
"0.6617429",
"0.6612046",
"0.6591987",
"0.65919816",
"0.6583159",
"0.65720254",
"0.64992464",
"0.64299905",
"0.6429778",
"0.6416638",
"0.6381077",
"0.63655794",
"0.63493353",
"0.633182",
"0.6292102",
"0.6271172",
"0.6255353",
"0.6250112",
"0.62273884",
"0.6177619",
"0.6110239",
"0.6097488",
"0.60933924",
"0.6046254",
"0.6042805",
"0.6037745",
"0.5951073",
"0.5946321",
"0.5944772",
"0.59352535",
"0.5931005",
"0.5929028",
"0.5919006",
"0.5917929",
"0.59159327",
"0.5895358",
"0.5884767",
"0.5880078",
"0.58570665",
"0.58479947",
"0.58467925",
"0.58467925",
"0.58436143",
"0.58325374",
"0.5824097",
"0.5814485",
"0.58118576",
"0.58118576",
"0.5811619",
"0.58062196",
"0.5794105",
"0.57925695",
"0.57790816",
"0.5760986",
"0.5751374",
"0.57485825",
"0.5747975",
"0.57462925",
"0.5741443",
"0.57381964",
"0.57256895",
"0.5720989",
"0.5715959",
"0.57103527",
"0.57041705",
"0.57026017",
"0.5700256",
"0.56780505",
"0.56778926",
"0.5669489",
"0.5666418",
"0.56614417",
"0.5654364",
"0.5654364",
"0.56529605",
"0.5624065",
"0.5624065",
"0.5618936",
"0.56169707",
"0.56169707",
"0.56169707",
"0.5609085",
"0.5587484",
"0.55811954",
"0.55786735",
"0.55769384",
"0.55743206",
"0.55700684",
"0.5569525",
"0.55674773",
"0.5565477",
"0.55653167",
"0.55648416",
"0.5545058",
"0.554269",
"0.5539111",
"0.55347365",
"0.5534515"
] |
0.0
|
-1
|
POST /samples POST /samples.json
|
def create
@sample = Sample.new(sample_params)
respond_to do |format|
if @sample.save
format.html { redirect_to @sample, notice: 'Sample was successfully created.' }
format.json { render :show, status: :created, location: @sample }
else
format.html { render :new }
format.json { render json: @sample.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @sample = Sample.new(params[:sample])\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to samples_path, notice: 'Sample was successfully created.' }\n format.json { render json: @sample, status: :created, location: @sample }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = @ogsong.samples.new(sample_params)\n\n respond_to do |format|\n #if sample created successfully, show notice\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sample_params\n params.require(:sample).permit()\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 create\n @sample = Sample.new(sample_params)\n\n if @sample.save\n argument_ids = params[:argument_ids].flatten.compact rescue []\n unless argument_ids.empty?\n ActiveRecord::Base.transaction do\n argument_ids.map do |argument_id|\n @sample.sample_arguments.create(argument_id: argument_id)\n end\n end\n end\n render json: @sample\n else\n render json: @sample.errors, status: :unprocessable_entity\n end\n end",
"def create\n # @sample = Sample.new(params[:sample])\n\n # respond_to do |format|\n # if @sample.save\n # format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n # format.json { render json: @sample, status: :created, location: @sample }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @sample.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @sample = Sample.new(params[:sample])\n @sample.user_id = current_user.id\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render json: @sample, status: :created, location: @sample }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # byebug\n image_file = Cloudinary::Uploader.upload(params[:image_file])\n audio_file = Cloudinary::Uploader.upload(params[:audio_file], :resource_type => :video)\n sample = Sample.create(image_file: image_file[\"url\"], audio_file: audio_file[\"url\"], name: params[:name], genre: params[:genre], collection: params[:collection])\n\n render json: sample\n end",
"def create\n @multi_spectral_sample = MultiSpectralSample.new(multi_spectral_sample_params)\n\n respond_to do |format|\n if @multi_spectral_sample.save\n format.html { redirect_to @multi_spectral_sample, notice: 'Multi spec sample was successfully created.' }\n format.json { render :show, status: :created, location: @multi_spectral_sample }\n else\n format.html { render :new }\n format.json { render json: @multi_spectral_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @code_sample = current_user.code_samples.new(code_sample_params)\n\n respond_to do |format|\n if @code_sample.save\n format.html { redirect_to @code_sample, notice: 'Code sample was successfully created.' }\n format.json { render :show, status: :created, location: @code_sample }\n else\n format.html { render :new }\n format.json { render json: @code_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sample_params\n params[:sample]\n end",
"def sample_json_response\n if @_sample_response.nil?\n example_json = fields.dig('responses', '200', 'examples', 'application/json')\n if example_json\n @_sample_response = JSON.pretty_generate(example_json).strip\n end\n end\n\n @_sample_response\n end",
"def sample_params\n params.require(:sample).permit(:ogsong_id, :title, :artist, :lyrics)\n end",
"def sample_params\n params.require(:sample).permit(:filename, :malz, :hash, :tags_list)\n end",
"def create\n @sample = Sample.new(sample_params)\n @sample.operator_id = current_user.id\n @patient = Patient.find(@sample.patient_id)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sample }\n else\n format.html { render action: 'new' }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sample_params\n params.require(:sample).permit(:name, :title, :quantity, :price, :status, :content, :cover_image, :remove_cover_image, images: [])\n end",
"def create\n @sampling = Sampling.new(sampling_params)\n\n respond_to do |format|\n if @sampling.save\n format.html { redirect_to @sampling, notice: 'Sampling was successfully created.' }\n format.json { render :show, status: :created, location: @sampling }\n else\n format.html { render :new }\n format.json { render json: @sampling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def samples(filter_params = {})\n get_request(shard_endpoint_uri('samples', filter_params))\n end",
"def sample_params\n params.require(:sample).permit(:code, :remarks, :sample_type_id, :sample_type_version_id, :work_order_id, :data, pictures_attributes: [ :id, :local_id, :image, :_destroy ])\n end",
"def collect_sample(route, request, response)\n delete_expired_samples\n\n endpoint = ApiSampler::Endpoint\n .find_or_create_by!(path: route.pattern,\n request_method: request.request_method)\n endpoint.samples.create!(query: request.query_string,\n request_body: request.body.read,\n path_params: route.parameters,\n response_body: response.body)\n rescue ActiveRecord::RecordInvalid => error\n Rails.logger.error \"api_sampler :: collect_sample :: #{error}\"\n end",
"def create\n @sample_type = SampleType.new(sample_type_params)\n\n respond_to do |format|\n if @sample_type.save\n format.html { redirect_to @sample_type, notice: \"Sample type was successfully created.\" }\n format.json { render :show, status: :created, location: @sample_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample_type = SampleType.new(params[:sample_type])\n\n respond_to do |format|\n if @sample_type.save\n format.html { redirect_to @sample_type, notice: 'Sample type was successfully created.' }\n format.json { render json: @sample_type, status: :created, location: @sample_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sample = Sample.new\n\n 2.times { @sample.diver_samples.build }\n @sample.sample_animals.build\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample }\n end\n end",
"def create\n @sample_photo = SamplePhoto.new(sample_photo_params)\n\n\n if @sample_photo.save\n render json: @sample_photo, status: :created\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end",
"def sample_params\n params.require(:sample).permit(:user_id, :state, :note)\n end",
"def create_samples data\n data.each do |line|\n if !line.empty?\n if line[0].include? \"sample\"\n # check and see if this sample exists in inventory\n sample_array = line[0].partition(\":\")\n sample_name = sample_array[2].strip #removes leading and trailing whitespace.\n sample_check = Sample.find_by_name(sample_name)\n if sample_check.nil?\n # create the media\n sample = createMedia(sample_name, \"new sample\", \"media\")\n show do\n title \"Sample Created\"\n \n note \"The sample #{sample_name} has been sucessfully created in Aquarium\"\n end\n end\n end\n end\n end \n \n show do\n title \"Samples Created\"\n \n note \"The samples in #{FILENAME} have been sucessfully created in Aquarium.\"\n note \"Please double check and see if you include the word \\\"sample:\\\" before your sample name.\"\n end\n end",
"def sample_params\n params.require(:sample).permit(:patient_id, :date_sample_taken, :art_status, :art_formula, :cd4_count, :date_cd4_exam, :viral_load, :condition, :remarks, :operator_id, :serostatus)\n end",
"def sample(query_parameters = {})\n start('statuses/sample', query_parameters)\n end",
"def create # rubocop:disable Metrics/MethodLength\n @text_sample = TextSample.new(text_sample_params)\n respond_to do |format|\n if @text_sample.save\n @text_sample.analyse\n\n format.html do\n redirect_to @text_sample,\n notice: 'Text sample was successfully created and analysed.'\n end\n format.json { render :show, status: :created, location: @text_sample }\n else\n format.html { render :new }\n format.json { render json: @text_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image_to_sample = ImageToSample.new(image_to_sample_params)\n\n respond_to do |format|\n if @image_to_sample.save\n format.html { redirect_to @image_to_sample, notice: 'Image to sample was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image_to_sample }\n else\n format.html { render action: 'new' }\n format.json { render json: @image_to_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def 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 @patient_sample = PatientSample.new(params[:patient_sample])\n\n respond_to do |format|\n if @patient_sample.save\n report_patient_sample @patient_sample\n format.html { redirect_to @patient_sample, notice: 'Sample was successfully registered' }\n format.json { render json: @patient_sample, status: :created, location: @patient_sample }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reading = Reading.find(params[:reading_id])\n \n # @reading = Reading.samples.new(sample_params)\n @samples = Sample.where(sample_id: params[:reading_id]).to_a\n\n @sample = @reading.samples.new(sample_params)\n @sample.sample_id = params[:reading_id]\n @sample.reading_number = @samples.length + 1\n\n # respond_to do |format|\n # puts \"-----------------------\"\n # puts \"sample_params = \"\n # sample_params.each do |k, v|\n # puts(k)\n # puts(v)\n # end\n # puts \"-----------------------\"\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to new_reading_sample_path, notice: 'Sample was successfully created.' }\n else\n redirect_to new_reading_sample_path, notice: 'An error occured. Try submitting your record again.'\n end\n end\n\n puts 'params = '\n puts params.inspect\n end",
"def index\n @samples = Sample.all\n end",
"def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end",
"def webhook_example_events(sample_name)\n sample_path = webhook_examples_path.join(\"#{sample_name}.json\")\n JSON.parse(sample_path.read)\n end",
"def create\n \n @project = Project.find(params[:project_id])\n @sample_set = SampleSet.new(params[:sample_set]) \n @sample_set.project_id = @project.id\n respond_to do |format|\n if @sample_set.save\n format.html { redirect_to project_path(@project), notice: 'Sample set was successfully created.' }\n format.json { render json: @sample_set, status: :created, location: @sample_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample_variable = SampleVariable.new(sample_variable_params)\n\n respond_to do |format|\n if @sample_variable.save\n format.html { redirect_to @sample_variable, notice: 'Sample variable was successfully created.' }\n format.json { render :show, status: :created, location: @sample_variable }\n else\n format.html { render :new }\n format.json { render json: @sample_variable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sampled_url = SampledUrl.new(params[:sampled_url])\n\n respond_to do |format|\n if @sampled_url.save\n format.html { redirect_to @sampled_url, notice: 'Sampled url was successfully created.' }\n format.json { render json: @sampled_url, status: :created, location: @sampled_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sampled_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample_user = SampleUser.new(sample_user_params)\n\n respond_to do |format|\n if @sample_user.save\n format.html { redirect_to @sample_user, notice: 'Sample user was successfully created.' }\n format.json { render :show, status: :created, location: @sample_user }\n else\n format.html { render :new }\n format.json { render json: @sample_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @sample }\n end\n end",
"def code_sample_params\n params.require(:code_sample).permit(:title, :versions, :description, :code, :featured, :code_info)\n end",
"def get_examples_post(word, body, *args)\n http_method = :post\n path = '/word/{word}/examples'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def create\n params.permit!\n @mssample = Mssample.new(params[:mssample])\n\n respond_to do |format|\n if @mssample.save\n format.html { redirect_to(@mssample, :notice => 'Mssample was successfully created.') }\n format.xml { render :xml => @mssample, :status => :created, :location => @mssample }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mssample.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_samples(n)\n n.times do |i|\n Post.create(title: \"New Post #{i}\", body: \"Body of post #{i}\", created_at: Time.now)\n end\nend",
"def new\n @sampled_url = SampledUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sampled_url }\n end\n end",
"def create\n @sample_metadata_numerical = SampleMetadataNumerical.new(sample_metadata_numerical_params)\n\n respond_to do |format|\n if @sample_metadata_numerical.save\n format.html { redirect_to @sample_metadata_numerical, notice: 'Sample metadata numerical was successfully created.' }\n format.json { render :show, status: :created, location: @sample_metadata_numerical }\n else\n format.html { render :new }\n format.json { render json: @sample_metadata_numerical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sample_type = SampleType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_type }\n end\n end",
"def create\n @sampleunit = Sampleunit.new(params[:sampleunit])\n\n respond_to do |format|\n if @sampleunit.save\n format.html { redirect_to(@sampleunit, :notice => 'Sample Unit was successfully created.') }\n format.xml { render :xml => @sampleunit, :status => :created, :location => @sampleunit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sampleunit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @samples = Sample.all\n end",
"def new\n @sample = Sample.new\n @sample.state = \"Default\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample }\n end\n end",
"def save_samples(text_line)\n values = text_line.split(',').map(&:strip)\n unix_time, bac_number, flow_rate, percent_open = values\n \n if percent_open != 'NA'\n json = json_body(bac_number, unix_time, 'Percent Open', *percent_open.split(' ')) \n response = HTTParty.post url, body: json\n puts \"status: #{response.code}\"\n puts \"body: #{response.body}\"\n end\n end",
"def sample_students_json\n raise Exceptions::EducatorNotAuthorized unless current_educator.can_set_districtwide_access?\n\n seed = params.fetch(:seed, '42').to_i\n n = params.fetch(:n, '40').to_i\n authorized_sample_students = authorized do\n Student.active.sample(n, random: Random.new(seed))\n end\n sample_students_json = authorized_sample_students.as_json({\n only: [:id, :grade, :first_name, :last_name],\n include: {\n school: {\n only: [:id, :name, :school_type]\n }\n }\n })\n render json: {\n sample_students: sample_students_json\n }\n end",
"def sample_params\n params.permit(:subject_id, argument_id: [])\n end",
"def new\n @patient_sample = PatientSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def sample_params\n params.require(:sample).permit(:bcr_patient_uuid, :file_name, :folder_name_from_manifest, :sample_id, :form_completion_date, :histologic_diagnosis, :prospective_collection, :retrospective_collection, :gender, :birth_days_to, :race, :ethnicity, :history_other_malignancy, :history_neoadjuvant_treatment, :initial_pathologic_dx_year, :ajcc_staging_edition, :ajcc_tumor_pathologic_pt, :ajcc_nodes_pathologic_pn, :ajcc_metastasis_pathologic_pm, :ajcc_pathologic_tumor_stage, :residual_tumor, :lymph_nodes_examined, :lymph_nodes_examined_count, :lymph_nodes_examined_he_count, :lymph_nodes_examined_ihc_count, :vital_status, :last_contact_days_to, :death_days_to, :tumor_status, :cea_level_pretreatment, :specimen_non_node_tumor_deposits, :circumferential_resection_margin_crm, :vascular_invasion_indicator, :lymphovascular_invasion_indicator, :perineural_invasion, :microsatellite_instability, :loci_tested_count, :loci_abnormal_count, :mismatch_rep_proteins_tested_by_ihc, :mismatch_rep_proteins_loss_ihc, :kras_gene_analysis_indicator, :kras_mutation_found, :kras_mutation_codon, :braf_gene_analysis_indicator, :braf_gene_analysis_result, :history_other_malignancy, :history_colon_polyps, :colon_polyps_at_procurement_indicator, :weight_kg_at_diagnosis, :height_cm_at_diagnosis, :family_history_colorectal_cancer, :radiation_treatment_adjuvant, :pharmaceutical_tx_adjuvant, :treatment_outcome_first_course, :new_tumor_event_dx_indicator, :age_at_initial_pathologic_diagnosis, :anatomic_neoplasm_subdivision, :clinical_M, :clinical_N, :clinical_T, :clinical_stage, :days_to_initial_pathologic_diagnosis, :days_to_patient_progression_free, :days_to_tumor_progression, :disease_code, :eastern_cancer_oncology_group, :extranodal_involvement, :icd_10, :icd_o_3_histology, :icd_o_3_site, :informed_consent_verified, :initial_pathologic_diagnosis_method, :karnofsky_performance_score, :number_pack_years_smoked, :patient_id, :project_code, :stage_other, :stopped_smoking_year, :tissue_source_site, :tobacco_smoking_history, :tumor_tissue_site, :year_of_tobacco_smoking_onset)\n end",
"def show\n @sample = Sample.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample }\n end\n end",
"def create\n @test = Test.create!(test_params)\n\n render json: @test\n end",
"def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end",
"def new\n @sample_line = SampleLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_line }\n end\n end",
"def create\n @resource = Resource.new(resource_params)\n @resource.user_id = current_user.id\n @resource.document.attach(params[:resource][:document])\n @resource.sample.attach(params[:resource][:sample])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @sample_set = SampleSet.new\n @sample_set.project_id = @project.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_set }\n end\n end",
"def speciman_params\n params.require(:speciman).permit(:sample_name, :date_received, :sample_type)\n end",
"def payload_example(sample_name)\n payload_examples_path.join(sample_name).read\n end",
"def create\n @sample_identifier = SampleIdentifier.new(sample_identifier_params)\n\n respond_to do |format|\n if admin? and @sample_identifier.save\n format.html { redirect_to @sample_identifier, notice: 'Sample identifier was successfully created.' }\n format.json { render :show, status: :created, location: @sample_identifier }\n else\n format.html { render :new }\n format.json { render json: @sample_identifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_body(samples)\n template = ERB.new(File.read(File.join(File.dirname(__FILE__), \"pachube.erb\")))\n template.result(binding).gsub(/^\\n/, '')\n end",
"def create\n @fitness_sample = FitnessSample.new(params[:fitness_sample])\n @fitness_sample.user_id = current_user.id\n\n respond_to do |format|\n if @fitness_sample.save\n flash[:notice] = 'FitnessSample was successfully created.'\n format.html { redirect_to(:controller => 'index', :action => 'index') }\n format.xml { render :xml => @fitness_sample, :status => :created, :location => @fitness_sample }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fitness_sample.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def generate_bulk_data_params\n {\n 'inputFormat': 'application/fhir+ndjson',\n 'inputSource': @testing_instance.url,\n 'storageDetail': {\n 'type': 'https'\n },\n 'input': [{\n 'type': 'Bundle',\n 'url': generate_ndjson_url\n }]\n }\n end",
"def update\n if @sample.update(sample_params)\n render :show, status: :ok, location: @sample\n else\n render json: @sample.errors, status: :unprocessable_entity\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def submit_samples\n @stats[:machines].each do |machine|\n begin\n create_samples(machine)\n rescue StandardError => e\n message = e.is_a?(RestClient::Exception) ? e.response : e\n raise Exceptions::OnPremiseException, message\n end\n end\n end",
"def create\n @sample_line = SampleLine.new(params[:sample_line])\n\n respond_to do |format|\n if @sample_line.save\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully created.' }\n format.json { render json: @sample_line, status: :created, location: @sample_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @study = Study.new(params[:study])\n\n respond_to do |format|\n if @study.save\n format.html { redirect_to @study, notice: 'Study was successfully created.' }\n format.json { render json: @study, status: :created, location: @study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def samples; end",
"def samples; end",
"def create\n @column_sample = ColumnSample.new(column_sample_params)\n\n respond_to do |format|\n if @column_sample.save\n format.html { redirect_to @column_sample, notice: 'Column sample was successfully created.' }\n format.json { render action: 'show', status: :created, location: @column_sample }\n else\n format.html { render action: 'new' }\n format.json { render json: @column_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_example_result = TestExampleResult.new(test_example_result_params)\n\n respond_to do |format|\n if @test_example_result.save\n format.html { redirect_to @test_example_result, notice: 'Test example result was successfully created.' }\n format.json { render :show, status: :created, location: @test_example_result }\n else\n format.html { render :new }\n format.json { render json: @test_example_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def request_sample\n\n respond_to do |format|\n\n # Checks that the form has been filled out correctly\n if params[:line1].blank? or params[:city].blank? or params[:county].blank? or params[:postcode].blank?\n format.html { redirect_to @post, notice: 'To request a sample you must provide your full address.' }\n else\n # Creates a new sample and redirect to the profile page\n @request = Request_Sample.new\n @request.post_id = @post.id\n @request.seller_id = @post.trader_id\n @request.requestee_id = current_trader.id\n @request.line1 = params[:line1]\n @request.city = params[:city]\n @request.county = params[:county]\n @request.postcode = params[:postcode]\n @request.save\n format.html { redirect_to profiles_path(current_trader.id), notice: 'Request made.' }\n end\n end\n end",
"def text_sample_params\n params.require(:text_sample).permit(:description, :text)\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 create\n @hypothesis = Hypothesis.new(hypothesis_params)\n\n respond_to do |format|\n if @hypothesis.save\n format.html { redirect_to @hypothesis, notice: 'Hypothesis was successfully created.' }\n format.json { render :show, status: :created, location: @hypothesis }\n else\n format.html { render :new }\n format.json { render json: @hypothesis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\n end\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 sample_type_params\n params.require(:sample_type).permit(:name)\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def create\n @sample_product = SampleProduct.new(params[:sample_product])\n\n respond_to do |format|\n if @sample_product.save\n format.html { redirect_to(@sample_product, :notice => 'Sample product was successfully created.') }\n format.xml { render :xml => @sample_product, :status => :created, :location => @sample_product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sample_product.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7141083",
"0.7099799",
"0.66906804",
"0.66406417",
"0.65793705",
"0.6522983",
"0.6498193",
"0.6420759",
"0.6391551",
"0.63422585",
"0.63271666",
"0.63124233",
"0.62573344",
"0.6200999",
"0.61618364",
"0.6143026",
"0.6135293",
"0.6070077",
"0.601044",
"0.59975386",
"0.59681123",
"0.5958715",
"0.5927024",
"0.59251946",
"0.59236217",
"0.58883315",
"0.5885878",
"0.5879848",
"0.58772886",
"0.5871233",
"0.582711",
"0.5815641",
"0.5802944",
"0.5800373",
"0.57788604",
"0.5755292",
"0.57536113",
"0.5714629",
"0.57039976",
"0.5687855",
"0.5681906",
"0.56792355",
"0.56658435",
"0.56586677",
"0.5650586",
"0.5650586",
"0.56372565",
"0.5635608",
"0.56311095",
"0.5628276",
"0.5627937",
"0.56018335",
"0.55936855",
"0.5581437",
"0.5577296",
"0.5577082",
"0.5572666",
"0.55690616",
"0.5568686",
"0.5560703",
"0.5551197",
"0.5537241",
"0.55130225",
"0.55109036",
"0.549206",
"0.549206",
"0.549206",
"0.549206",
"0.549206",
"0.5475769",
"0.5467692",
"0.54628426",
"0.54626036",
"0.54558945",
"0.54552066",
"0.54539615",
"0.54537416",
"0.5449453",
"0.5448755",
"0.543677",
"0.5434686",
"0.54172",
"0.5398788",
"0.5398788",
"0.53884876",
"0.5378952",
"0.5367491",
"0.5367491",
"0.53587735",
"0.53534603",
"0.53244",
"0.5317832",
"0.53112966",
"0.53011274",
"0.52968186",
"0.5295539",
"0.52930665",
"0.5285775"
] |
0.6949383
|
4
|
PATCH/PUT /samples/1 PATCH/PUT /samples/1.json
|
def update
respond_to do |format|
if @sample.update(sample_params)
format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }
format.json { render :show, status: :ok, location: @sample }
else
format.html { render :edit }
format.json { render json: @sample.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @sample = Sample.find(params[:id])\n\n respond_to do |format|\n if @sample.update_attributes(params[:sample])\n format.html { redirect_to samples_path, notice: 'Sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sample = Sample.find(params[:id])\n\n respond_to do |format|\n if @sample.update_attributes(params[:sample])\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n # @sample = Sample.find(params[:id])\n\n # respond_to do |format|\n # if @sample.update_attributes(params[:sample])\n # format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @sample.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def patch!\n request! :patch\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update # PATCH\n raise NotImplementedError\n end",
"def patch(path, **args); end",
"def patch\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\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 if @sample.update(sample_params)\n render :show, status: :ok, location: @sample\n else\n render json: @sample.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n #if producer updated successfully, show notice\n if @sample.update(sample_params)\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample }\n else\n format.html { render :edit }\n format.json { render json: @sample.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 @patient_sample = PatientSample.find(params[:id])\n\n respond_to do |format|\n if @patient_sample.update_attributes(params[:patient_sample])\n format.html { redirect_to @patient_sample, notice: 'Patient sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update!(**args)\n @examples = args[:examples] if args.key?(:examples)\n end",
"def update!(**args)\n @examples_override = args[:examples_override] if args.key?(:examples_override)\n @metadata = args[:metadata] if args.key?(:metadata)\n @parameters = args[:parameters] if args.key?(:parameters)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n if @sample_photo.update(sample_photo_params)\n render json: @sample_photo, status: :ok\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def 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 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_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n if params[:resource][:document].present?\n @resource.document.purge\n @resource.document.attach(params[:resource][:document])\n end\n if params[:resource][:sample].present?\n @resource.sample.purge\n @resource.sample.attach(params[:resource][:sample])\n end\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @code_sample.update(code_sample_params)\n format.html { redirect_to @code_sample, notice: 'Code sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_sample }\n else\n format.html { render :edit }\n format.json { render json: @code_sample.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 update_multi\n params[:sample].each do |id, attributes|\n sample = Sample.find(id)\n sample.update_attributes(attributes) \n end\n flash[:notice] = 'Sample receipt updated'\n redirect_to samples_path\n \n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n pat_id = @sample.patient_id\n respond_to do |format|\n if @sample.update(sample_params)\n @sample.patient_id = pat_id\n @sample.operator_id = current_user.id\n @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @kind = args[:kind] if args.key?(:kind)\n @metadata = args[:metadata] if args.key?(:metadata)\n @spec = args[:spec] if args.key?(:spec)\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"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(path, opts = {})\n request(:patch, path, opts).body\n end",
"def test_client_from_schema_with_url_prefix\n uuid = '1ab1c589-df46-40aa-b786-60e83b1efb10'\n body = {'Hello' => 'World!'}\n result = {'Goodbye' => 'Universe!'}\n Excon.stub(method: :patch) do |request|\n assert_equal(\"/api/resource/#{uuid}\", request[:path])\n assert_equal('application/json', request[:headers]['Content-Type'])\n assert_equal(body, MultiJson.load(request[:body]))\n Excon.stubs.pop\n {status: 200, headers: {'Content-Type' => 'application/json'},\n body: MultiJson.dump(result)}\n end\n\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n output = StringIO.new\n cli = Heroics.cli_from_schema('cli', output, schema,\n 'https://example.com/api')\n cli.run('resource:update', uuid, body)\n assert_equal(MultiJson.dump(result, pretty: true) + \"\\n\", output.string)\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update(&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 @sample_type = SampleType.find(params[:id])\n\n respond_to do |format|\n if @sample_type.update_attributes(params[:sample_type])\n format.html { redirect_to @sample_type, notice: 'Sample type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update\n @sample_set = SampleSet.find(params[:id])\n @project = Project.find(@sample_set.project_id)\n @sample_set.name = params[:sample_set][:name]\n respond_to do |format|\n if @sample_set.save\n format.html { redirect_to project_path(@project), notice: 'Sample set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @sample_row.update(sample_row_params)\n format.html { redirect_to @sample_row, notice: '' }\n format.json { render :show, status: :ok, location: @sample_row }\n else\n format.html { render :edit }\n format.json { render json: @sample_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n respond_to do |format|\n if @image_to_sample.update(image_to_sample_params)\n format.html { redirect_to @image_to_sample, notice: 'Image to sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image_to_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mycometer_coc_sample.update(mycometer_coc_sample_params)\n format.html { redirect_to @mycometer_coc_sample, notice: 'Mycometer coc sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @mycometer_coc_sample }\n else\n format.html { render :edit }\n format.json { render json: @mycometer_coc_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\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(path)\n output { patch(path, params) }\n end",
"def test_run_with_parameters\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command = Heroics::Command.new(\n 'cli', schema.resource('resource').link('update'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:update' => command}, output)\n\n uuid = '1ab1c589-df46-40aa-b786-60e83b1efb10'\n body = {'Hello' => 'World!'}\n result = {'Goodbye' => 'Universe!'}\n Excon.stub(method: :patch) do |request|\n assert_equal(\"/resource/#{uuid}\", request[:path])\n assert_equal('application/json', request[:headers]['Content-Type'])\n assert_equal(body, MultiJson.load(request[:body]))\n Excon.stubs.pop\n {status: 200, headers: {'Content-Type' => 'application/json'},\n body: MultiJson.dump(result)}\n end\n\n cli.run('resource:update', uuid, body)\n assert_equal(MultiJson.dump(result, pretty: true) + \"\\n\", output.string)\n end",
"def update\n\n sub_obj_non_attributes = study_params.select { |key| !key.to_s.match(/_attributes$/) }\n\n @study = Study.find(session[:current_study_id])\n\n \n if ! sub_obj_non_attributes.empty?\n @study.update(sub_obj_non_attributes.to_h.except('_destroy', 'id', 'rec_id', 'updated', 'rec_delete'))\n end\n \n traverse_study_attr(study_params.select { |key| key.to_s.match(/_attributes$/)}, @study)\n \n respond_to do |format|\n format.html { redirect_to study_steps_path}\n format.json { render action: 'show', status: :created, location: @study }\n\n end\n\n end",
"def update!(**args)\n @api_signatures = args[:api_signatures] if args.key?(:api_signatures)\n @unique_apis = args[:unique_apis] if args.key?(:unique_apis)\n end",
"def update\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n if @sample_line.update_attributes(params[:sample_line])\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @sample_errors = args[:sample_errors] if args.key?(:sample_errors)\n end",
"def patch\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.patch do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end",
"def update\n respond_to do |format|\n if @api_hello.update(api_hello_params)\n format.html { redirect_to @api_hello, notice: 'Hello was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_hello }\n else\n format.html { render :edit }\n format.json { render json: @api_hello.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(action, **args); end",
"def patch; end",
"def patch; end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @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(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end",
"def update!(**args)\n @http_body = args[:http_body] if args.key?(:http_body)\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 patch(uri, options = T.unsafe(nil)); end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Content-Length\" => \"nnnn\",\n @auth_header => @token\n }\n )\n response = request.perform\n response\n end",
"def update\n @master_spec = Master::Spec.find(params[:id])\n\n respond_to do |format|\n if @master_spec.update_attributes(params[:master_spec])\n format.html { redirect_to(@master_spec, :notice => 'Spec was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @master_spec.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cocoon_example.update(cocoon_example_params)\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully updated.' }\n format.json { render :show, status: :ok, location: @cocoon_example }\n else\n format.html { render :edit }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @column_sample.update(column_sample_params)\n format.html { redirect_to @column_sample, notice: 'Column sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @column_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\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 put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @sample_type.update(sample_type_params)\n format.html { redirect_to @sample_type, notice: \"Sample type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sample_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update(data = :object || :json)\n end"
] |
[
"0.65712523",
"0.64691603",
"0.6419393",
"0.63918513",
"0.63792026",
"0.62873465",
"0.60940784",
"0.609024",
"0.60694605",
"0.60399264",
"0.60277075",
"0.60231364",
"0.59766597",
"0.5961478",
"0.5929132",
"0.5916164",
"0.5900946",
"0.5900946",
"0.58998424",
"0.5895634",
"0.5853709",
"0.5852789",
"0.5843161",
"0.58385795",
"0.58368933",
"0.58178675",
"0.5812751",
"0.58039075",
"0.58039075",
"0.57795405",
"0.57761735",
"0.5768592",
"0.57587343",
"0.57580566",
"0.5747866",
"0.5745551",
"0.5741475",
"0.57213974",
"0.57148206",
"0.5712887",
"0.5712276",
"0.56930476",
"0.5688723",
"0.5687752",
"0.567832",
"0.56725985",
"0.5668212",
"0.5667422",
"0.56613296",
"0.5660931",
"0.5660526",
"0.56532836",
"0.5637357",
"0.5637077",
"0.5633678",
"0.5621979",
"0.5619981",
"0.5611961",
"0.5611344",
"0.5605085",
"0.5597569",
"0.5596834",
"0.5587448",
"0.5576287",
"0.55603987",
"0.55510885",
"0.55457115",
"0.55447626",
"0.554034",
"0.5539961",
"0.5523997",
"0.5523997",
"0.5523825",
"0.5523825",
"0.5510348",
"0.5501836",
"0.55003613",
"0.54985225",
"0.5497104",
"0.5495409",
"0.5493912",
"0.5492803",
"0.54870915",
"0.5482254",
"0.546509",
"0.5460982",
"0.5460505",
"0.54567426",
"0.5454859",
"0.5454047",
"0.5453313",
"0.5453313",
"0.5452795",
"0.5450575",
"0.54462504",
"0.5445011",
"0.5443141"
] |
0.63079923
|
8
|
DELETE /samples/1 DELETE /samples/1.json
|
def destroy
@sample.destroy
respond_to do |format|
format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @sample = Sample.find(params[:id])\n # @sample.destroy\n\n# respond_to do |format|\n# format.html { redirect_to samples_url }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\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 delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @patient_sample = PatientSample.find(params[:id])\n @patient_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_to_sample.destroy\n respond_to do |format|\n format.html { redirect_to image_to_samples_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @multi_spectral_sample.destroy\n respond_to do |format|\n format.html { redirect_to multi_spectral_samples_url, notice: 'Multi spec sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mycometer_coc_sample.destroy\n respond_to do |format|\n format.html { redirect_to mycometer_coc_samples_url, notice: 'Mycometer coc sample 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 @code_sample.destroy\n respond_to do |format|\n format.html { redirect_to code_samples_url, notice: 'Code sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @normal_example = NormalExample.find(params[:id])\n @normal_example.destroy\n\n respond_to do |format|\n format.html { redirect_to(normal_examples_url) }\n format.xml { head :ok }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.js { flash[:notice] = 'Task was successfully destroyed.'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_example.destroy\n respond_to do |format|\n format.html { redirect_to file_examples_url, notice: 'File example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @column_sample.destroy\n respond_to do |format|\n format.html { redirect_to column_samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @example.destroy\n respond_to do |format|\n format.html { redirect_to examples_url, notice: 'Operação realizada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_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 delete(*rest) end",
"def destroy\n @sampling.destroy\n respond_to do |format|\n format.html { redirect_to samplings_url, notice: 'Sampling was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete(*args)\n request(:delete, *args)\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 @text_sample.destroy\n respond_to do |format|\n format.html do\n redirect_to text_samples_url,\n notice: 'Text sample was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @cocoon_example.destroy\n respond_to do |format|\n format.html { redirect_to cocoon_examples_url, notice: 'Cocoon example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\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 delete\n start { |connection| connection.request http :Delete }\n end",
"def delete\n api(\"Delete\")\n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @sample_set = SampleSet.find(params[:id])\n @project = Project.find(@project_property.project_id)\n @sample_set.destroy\n respond_to do |format|\n format.html { redirect_to sample_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @sample_type.destroy\n respond_to do |format|\n format.html { redirect_to sample_types_url, notice: \"Sample type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @sample_storage_log.destroy\n respond_to do |format|\n format.html { redirect_to sample_storage_logs_url, notice: 'Sample storage log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @sample_metadata_numerical.destroy\n respond_to do |format|\n format.html { redirect_to sample_metadata_numericals_url, notice: 'Sample metadata numerical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if admin?\n @sample_identifier.destroy\n respond_to do |format|\n format.html { redirect_to sample_identifiers_url, notice: 'Sample identifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @experiment_raw_dataset.destroy\n respond_to do |format|\n format.html { redirect_to experiment_raw_datasets_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 delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @sampleunit = Sampleunit.find(params[:id])\n @sampleunit.destroy\n\n respond_to do |format|\n format.html { redirect_to(sampleunits_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"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 @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\n @sample_type = SampleType.find(params[:id])\n\n if !@sample_type.samples.empty?\n flash[:notice] = \"Could not delete sample type definition #{@sample_type.name} because it has samples associated with it.\"\n else\n @sample_type.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @fitness_sample = FitnessSample.find(params[:id])\n @fitness_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => 'index', :action => 'index') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testing_.destroy\n respond_to do |format|\n format.html { redirect_to testing_s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 sample_for_delete(src = :delete_example)\n current = delete_id && Manifest.find_by(id: delete_id)\n return current if current && (src == :delete_example)\n current&.delete\n new_record(src).tap do |record|\n self.delete_id = record.id if record.save!\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Prueba eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def delete\n 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.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.76480424",
"0.76480424",
"0.7645551",
"0.7407162",
"0.7358793",
"0.7338754",
"0.7150406",
"0.7098547",
"0.698806",
"0.6968413",
"0.69566303",
"0.69515824",
"0.69446754",
"0.6901059",
"0.68780226",
"0.68663245",
"0.68663245",
"0.68663245",
"0.68663245",
"0.68550235",
"0.6837331",
"0.6816588",
"0.6798048",
"0.6783585",
"0.67796504",
"0.6778395",
"0.6776946",
"0.6759597",
"0.6756286",
"0.6756286",
"0.67538863",
"0.6724093",
"0.6720322",
"0.6713946",
"0.67091024",
"0.6699274",
"0.6697711",
"0.6684263",
"0.66796654",
"0.6679604",
"0.6667948",
"0.66622365",
"0.6650002",
"0.6645292",
"0.6638433",
"0.6638433",
"0.6621513",
"0.6620872",
"0.66208583",
"0.6620592",
"0.66090083",
"0.6599565",
"0.65962255",
"0.6595771",
"0.6583597",
"0.65778023",
"0.65728337",
"0.6565387",
"0.65648735",
"0.65583456",
"0.65583456",
"0.655748",
"0.6553757",
"0.65501624",
"0.65487146",
"0.6545996",
"0.6537015",
"0.65348667",
"0.6530337",
"0.6525041",
"0.64998835",
"0.64994675",
"0.64977694",
"0.64920866",
"0.6491012",
"0.649003",
"0.646642",
"0.646136",
"0.6460404",
"0.6459182",
"0.6459182",
"0.6456303",
"0.64503235",
"0.6447722",
"0.6445047",
"0.643619",
"0.64296025",
"0.6419093",
"0.64137435",
"0.641207",
"0.641207",
"0.641207",
"0.641207",
"0.641207",
"0.641207",
"0.641207"
] |
0.74189293
|
7
|
Use callbacks to share common setup or constraints between actions.
|
def set_sample
@sample = Sample.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 sample_params
params[:sample]
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 social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def 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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62909746",
"0.62904227",
"0.62837297",
"0.6240993",
"0.6239739",
"0.6217764",
"0.6214983",
"0.62112504",
"0.6194765",
"0.6178",
"0.61755055",
"0.61729854",
"0.61636627",
"0.6153461",
"0.6151674",
"0.61478525",
"0.6122671",
"0.61188513",
"0.61075556",
"0.6105721",
"0.6092412",
"0.6081011",
"0.6071054",
"0.6064436",
"0.6022111",
"0.6018135",
"0.60151577",
"0.60108894",
"0.60070235",
"0.60070235",
"0.6000806",
"0.6000464",
"0.5998811",
"0.59926987",
"0.5992257",
"0.5991173",
"0.5980311",
"0.59660876",
"0.59596545",
"0.5959415",
"0.59589994",
"0.5957478",
"0.5953214",
"0.5952233",
"0.5944033",
"0.59396756",
"0.59396756",
"0.59386414",
"0.59345603",
"0.5931261",
"0.5926345",
"0.5925795",
"0.59174526",
"0.59108645",
"0.5909469",
"0.5908263",
"0.59053195",
"0.58980685",
"0.5897738",
"0.589657",
"0.5895971",
"0.58942044",
"0.5892847",
"0.588742",
"0.58834344",
"0.5880024",
"0.58739793",
"0.5868253",
"0.5867907",
"0.58670515",
"0.58668053",
"0.5865756",
"0.5863549",
"0.5863236",
"0.5862728",
"0.5861283",
"0.58591247",
"0.5855159",
"0.5854291",
"0.58512247",
"0.58498096"
] |
0.0
|
-1
|
returns the top 10 scores on Openspace
|
def topusers
@topusers = User.find(:all, :order => "points DESC", :limit => "10")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def top_10 (matches)\n matches.sort_by! { |match| match['score'] }.reverse[:10]\nend",
"def top(num = nil)\n temp = @user.scores.group(:sentence).sum(:val).sort_by{|_,v| -v}\n filter_by_num(temp, num)\n end",
"def get_scores\r\n items_db = DYNAMODB.scan(table_name: TABLE_NAME).items\r\n items_hash = make_result_list(items_db)\r\n items = items_hash.sort_by { |hash| hash['score'] }\r\n make_response(HttpStatus::OK, items.reverse().first(10))\r\nend",
"def rank_top_teams # DO NOT USE THIS METHOD, outdated, slow\n @top_teams = {}\n @top_teams = Score.in_challenge(self.id).teams_in_all_divisions.limit(5).\n order(\"sum_points DESC, MAX(#{Score.table_name}.\n earned_at) DESC\").sum(:points) \n return @top_teams\n end",
"def highest_score\n sort\n all.first.score\n end",
"def lowest_score\n sort\n all.last.score\n end",
"def top_students(grade_hash, number_of_students)\n grade_hash.transform_values{|score| score.reduce(0,:+)/(score.length)}.sort_by {|student,score| score}.reverse.to_h.keys.first(number_of_students)\nend",
"def topMatches( prefs, person, n=5, scorefunc = :sim_pearson )\n scores = []\n for other in prefs.keys\n if scorefunc == :sim_pearson\n scores << [ sim_pearson(prefs,person,other), other] if other != person\n else\n scores << [ sim_distance(prefs,person,other), other] if other != person\n end\n end\n return scores.sort.reverse.slice(0,n)\n end",
"def topMatches( prefs, person, n=5, scorefunc = :sim_pearson )\n scores = []\n for other in prefs.keys\n if scorefunc == :sim_pearson\n scores << [ sim_pearson(prefs,person,other), other] if other != person\n else\n scores << [sim_distance(prefs,person,other), other] if other != person\n end\n end\n return scores.sort.reverse.slice(0,n)\n end",
"def sort_games\n games.order(:score).limit(5)\n end",
"def top_ten\n reverse_sort = self.sort.reverse\n return reverse_sort[0, 10]\n end",
"def winning_scores\n high_score = scores.max{|score| score.total}.total\n scores.select {|score| score.total == high_score}\n end",
"def getTop10AwesomePeeps\n @persons.sort!\n return @persons[-10..-1]\n end",
"def index\n @teams = Team.order('score desc').limit(10)\n end",
"def top_matches(n=3)\n \n scores = Array.new\n \n @prefs.each_pair do |key,value|\n if key != @person\n scores << [@similarity.compute(key),key]\n end\n end\n \n (scores.sort!.reverse!)[0..n]\n \n end",
"def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end",
"def top\n @game_records = GameRecord.all\n @game_scores = Array.new()\n game_score = Array.new()\n for record in @game_records\n game_score = [record.name, record.get_total_score]\n @game_scores << game_score\n end\n @game_scores = @game_scores.sort_by{|s| s[1]}\n @game_scores = @game_scores.reverse\n @game_scores = @game_scores[0, 10]\n respond_to do |format|\n format.js\n end\n end",
"def best(n)\n @score.sort{|a,b| b[1][0] <=> a[1][0]}[0..n-1]\n end",
"def top_matches(preferences, person, limit = 5)\n scores = preferences.map {|pref| [sim_pearson(preferences, person, pref[0]), pref[0]] unless pref[0] == person}.compact\n scores.sort! {|a,b| b[0] <=> a[0]}\n return scores[0...limit]\nend",
"def personal_top_three\n scores.max([scores.length, 3].min)\n end",
"def display_score score, rank\r\n\r\n end",
"def top_ten\n sorted = @person_array.sort { |a, b| a.awesomeness <=> b.awesomeness }\n sorted.reverse!\n return sorted[0..9] if sorted.size >= 10\n return sorted\n end",
"def get_scores\n scores = get_from_url(@scores_conn, SCORES_KEY, {})\n scores.sort! {|a, b| a['date_time'] <=> b['date_time']}\n scores.reverse!\n scores.sort! {|a, b| a['score'] <=> b['score']}\n scores.reverse!\n end",
"def obtain_scores\n response = DYNAMODB.scan(table_name: TABLE_NAME)\n parsed_items = parse_items(response.items)\n parsed_items = parsed_items.sort_by{ |item| item['score'] }\n parsed_items.sort_by{ |item| item['date_time'] }\nend",
"def list_top_players\n if @highscore_list.empty?\n puts \"No available data.\"\n else\n table = TTY::Table.new header: ['Name', 'Score']\n @highscore_list.each do |player|\n table << [player.name, player.score]\n end\n\n finalTable = table.render :unicode do |renderer|\n renderer.alignments = [:left, :center]\n renderer.border.separator = :each_row\n end\n\n puts \"Sets Current Highscore\"\n puts finalTable\n end\n \n end",
"def test_find_n_people_with_lowest_scores\n skip\n people = phone_book.n_lowest_scorers(2)\n names = people.map do |person|\n person.name\n end\n assert_equal [\"Adeline Wolff\", \"Lorenzo Lowe\"], names.sort\n end",
"def highest_score_from(words)\n all_words_scores = []\n\n # Calculate scores of all words\n words.each do |word|\n each_word_score = {}\n each_word_score[:word] = word\n each_word_score[:score] = score_word(word)\n all_words_scores << each_word_score\n end\n\n word_rank = all_words_scores.each.sort_by {|hash| hash[:score]}.reverse\n\n puts \"word rank: #{word_rank}\"\n\n best_word = word_rank[0]\n\n word_rank.each_with_index do |hash, index|\n\n if word_rank[index][:score] > best_word[:score]\n best_word = word_rank[index]\n\n # Tie Handling\n elsif word_rank[index][:score] == best_word[:score]\n if best_word[:word].length != 10\n if word_rank[index][:word].length == 10\n best_word = word_rank[index]\n elsif word_rank[index][:word].length < best_word[:word].length\n best_word = word_rank[index]\n end\n end\n end\n index += 1\n end\n return best_word\nend",
"def top_students(grade_hash, number_of_students)\n outArray = []\n grade_hash.each do |name, scores|\n sum, n = 0, 0\n scores.each do |x|\n n += 1\n sum += x\n end\n outArray.push([sum/n, name])\n end\n final_answer = []\n outArray.sort.reverse[0...number_of_students].each do |grade,name|\n final_answer.push(name)\n end\n return final_answer\nend",
"def get_scores\n items = DYNAMODB.scan(table_name: TABLE).items\n sort_items_by_descending_scores_and_ascending_timestamp(items)\n make_result_list(items)\nend",
"def top_users(limit = 10)\n @users.sort_by{|user_id,user| -user.score}.first(limit).map do |t|\n {\n :id => t.first,\n :score => t.last.score,\n :common_tracks_count => t.last.common_tracks_count,\n :total_tracks_count => t.last.total_tracks_count\n }\n end\n end",
"def top_students(grade_hash, number_of_students)\n scores = averages(grade_hash)\n shortlist = scores.sort_by{|k,v| v}.reverse.take(number_of_students)\n names = shortlist.map{|k,v| k}\nend",
"def show\n @scores = @music.machine.get_top_scores(@music.season, num: nil)[@music]\n end",
"def base_popularity\n 10\n end",
"def recommendations(url,num=5)\n url = url_host_path(url)\n uid = REDIS[\"id:#{url}\"]\n results = REDIS.zrevrangebyscore(\"recos:#{uid}\", '+inf', '-inf', {:withscores => true} )\n \n recos = results[0...num].map do |x| uid,score = x[0],x[1]\n { :title=>REDIS[\"title:#{uid}\"], :url=>REDIS[\"url:#{uid}\"], :score=>score }\n end\n \n return recos\nend",
"def most_points_scored\n big_score_player = player_collection.reduce { |memo, next_player|\n memo[:points] > next_player[:points] ? memo : next_player; \n }\n big_score_player[:player_name];\nend",
"def top_ten_users\n # Get top 3 dank ranks total scores\n top_danks = DankRank.order('total_score DESC').limit(6)\n # For each top dank_rank, retrieve [lvl, points, id]\n top_users = top_danks.map { |dank| [User.find(dank.user_id).dank_rank.total_score, User.find(dank.user_id).dank_rank.rank_up_xp_progress, User.find(dank.user_id).id] }\n # Sort that array by level and then points\n top_users.sort!{|a, b| b <=> a}\n # Return the users\n return top_users.map { |array| User.find(array[2]) }\n end",
"def rank(hits)\n\t\thits = Search.fill_meta(hits)\n\t\t\n\t\thits.each do |h|\n\t\t\th[:distance] = distance(query, h[:object].display)\n\t\t\th[:score] = h[:distance] * HIT_WEIGHT_SIMILARITY + \n\t\t\t h[:popularity] * HIT_WEIGHT_POPULARITY\n\t\tend\n\t\t\n\t\thits = hits.sort_by { |h| -1 * h[:score] }\n\tend",
"def most_points_scored\n most_points = 0\n leading_scorer = \"\"\n\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n if player[:points] > most_points\n most_points = player[:points]\n leading_scorer = player[:player_name]\n end\n end\n end\n return leading_scorer\nend",
"def find_the_best_words(rack)\n # A hash to store our word and its score\n word_scores = {}\n # Loop through our list of valid words\n valid_words(rack).each do |word|\n # Store our score matched to the key of our word\n word_scores[word] = word_score(word, rack)\n end\n # Puts our first 10 word scores sorted from highest to lowest\n word_scores.sort_by { |_key, value| -value}.first(10).to_h.each { |key, value| p \"#{key}: #{value}\"}\nend",
"def ranks\n @teams = Team.where(\"wins > 0\t\").order(win_percentage: :desc)\n end",
"def top_5\n count = @sentence.blips.group(:body).distinct.count\n percent = count.each {|k, v| count[k] = v / @sentence.blips_count.to_f }\n statistics = percent.sort_by { |k, v| v }.reverse[0..4].flatten.each { |k, v| puts \"#{k}: #{v}\" }\n end",
"def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value }.reverse\n .map { |key, value| key}\n .take(number_of_students)\nend",
"def max_scores\n next_boards.map(&:max_score)\n end",
"def top_students(grade_hash, number_of_students)\n averages(grade_hash).sort_by { |k, v| v}.reverse.map{ |k, v| k }.take(number_of_students)\nend",
"def most_points_scored\n points_scored = 0 # starting score to compare with players shoe sizes\n game_hash.each do |location, team_data| # iterates through each team\n players_array = team_data[:players] # finds the :players info in team_data and puts the players into players_array\n players_array.each do |player_name, data| # iterates through each player..\n if data[:points] > points_scored # if their points scored is greater than 0 (we set this earlier in the top of method)\n points_scored = data[:shoe] # take that players score and make it the new points_scored value\n end # this repeats (iterates) through all players until you don't have any more.. meaning the end result is\n end # the player with the highest score\n end\n return points_scored\nend",
"def index\n @scores = Score.all\n @high_scores = Score.order(correct: :desc).where.not(:correct => nil)\n @score = session[:score]\n end",
"def calculate_team_ratings(roster)\n ratings = Array.new\n roster.each do|player|\n if (player && player.profile && player.profile.rating)\n ratings.push(player.profile.rating.total)\n end\n end\n \n top_ratings = ratings.sort.reverse.take(10)\n top_ratings.sum\n end",
"def findTopMovies(actor, top_number=100) \r\n movie_array = []\r\n\r\n actor.film_actor_hash.each_key {|key| movie_array.push(key)}\r\n\r\n return movie_array.take(top_number)\r\nend",
"def top_matches(item_prefs, item, number=5)\n scores = []\n\n item_prefs.keys.each do |other|\n if other != item\n similarity = distance_similarity(item_prefs, item, other)\n\n if similarity > 0\n scores << [similarity, other]\n end\n end\n end\n\n scores = scores.sort_by { |score| -score[0] }\n\n return scores[0, number]\n end",
"def scores\n @scores\n end",
"def top_students(grade_hash, number_of_students)\nsorted_hash = averages(grade_hash).sort_by {|name, grade| grade}\nsorted_hash.reverse!\ntop_array = []\nsorted_hash.each do |k, v|\n top_array << k\nend\ntop_array.take(number_of_students)\nend",
"def most_points_scored\nplayer_with_most(:points)\nend",
"def table_top_10_Goal_scores\n i=1\n clear_terminal\n divider\n Player.top_goals.each do |player_instance|\n puts \"\\n #{i}. #{player_instance}\"\n i += 1\n end\n choice = @prompt.select(\"\",\n [\"-> Back\",\"-> Quit\",\"-> Restart\"])\n case choice\n when \"-> Back\"\n players_home\n when \"-> Quit\" || \"QUIT\"\n when \"-> Restart\" || \"RESTART\"\n run\n else\n error\n end\n end",
"def sorted_scores(unsorted_scores, highest_score)\n score_counts = Array.new(101, 0) # 101 because it has to be inclusive of 100\n\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n sorted_scores = []\n\n highest_score.downto(0) do |score|\n count = score_counts[score]\n\n count.times do |_time|\n sorted_scores.push(score)\n end\n end\n\n sorted_scores\nend",
"def top10(url)\n\t\tlista=recorre(url)\n\t\tfor i in 1..10\n\t\t\tdatos(lista[i][0])\n\t\tend\n\tend",
"def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value}.reverse\n .map { |key, value| key }\n .take(number_of_students)\nend",
"def top_students(grade_hash, number_of_students)\n sorted_hash = averages(grade_hash).sort_by {|name, grade| grade}\n #reverse! takes the items in an array and reverses them without making a new array\n sorted_hash.reverse!\n top_array = []\n sorted_hash.each do |key, value|\n top_array << key\n end\n top_array.take(number_of_students)\nend",
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def create_scores\n\tscores = [100]\n\tuntil scores.length >= 8\n\t\tif(scores.length < 5)\n\t\t leader_board(scores)\n\t\tend\n\t\tscores << (100 - 10*scores.length)\n\tend\n\tleader_board(scores)\n\treturn scores\n end",
"def most_points_scored\nbest_player = \"\"\npoints = 0\ngame_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n if stats[:points] > points\n points = stats[:points]\n best_player= name\n end\n end\nend\nbest_player\nend",
"def top_students(grade_hash, number_of_students)\n # Loop through hash\n top_students_array = grade_hash.map do |key, value|\n # find average for each student\n average = value.sum / value.length\n # put into array of key, score\n [key, average]\n end\n puts top_students_array\n # turn into hash\n top_students_hash = top_students_array.to_h\n # sort hash\n top_students_sorted = top_students_hash.sort_by do |a, b| \n -b\n end\n # map keys\n sorted_student_array = top_students_sorted.map do |key, value|\n key\n end\n # return top student names in array\n result = sorted_student_array.take(number_of_students)\n result\nend",
"def sort_scores(unsorted_scores, highest_possible_score)\n\n # array of 0s at indices 0..highest_possible_score\n score_counts = [0] * (highest_possible_score+1)\n\n # populate score_counts\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n # populate the final sorted array\n sorted_scores = []\n\n # for each item in score_counts\n score_counts.each_with_index do |count, score|\n\n # for the number of times the item occurs\n (0...count).each do |time|\n\n # add it to the sorted array\n sorted_scores.push(score)\n end\n end\n\n return sorted_scores\nend",
"def print_highscores(m, n)\n self.highscores.print_highscores(m, n)\n end",
"def rank(result_array)\n # Highest first.\n return result_array.sort_by{ |hash| - hash[:score] + (hash[:enabled]==false ? 10 : 0) }\n end",
"def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end",
"def sorted_scores\n self.object.teams.map {|team| team.score}.sort.reverse\n end",
"def score\n last_30_score\n end",
"def best_score\n submissions.min(:score)\n end",
"def high_ranking_cards\n\n array_high_cards = []\n\n cards.each do |card|\n\n if card.rank >= 11\n array_high_cards << card\n end\n\n end\n\n array_high_cards\n\n end",
"def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end",
"def create_scores\r\n scores = Array.new\r\n score = 100\r\n until scores.length == 8\r\n scores << score\r\n score -= 10\r\n if scores.length <= 5\r\n leader_board scores\r\n end\r\n end\r\n scores\r\n end",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by {|team_info| [-team_info[1][:wins], -team_info[1][:ties], team_info[1][:losses]]}\nend",
"def most_points_scored\n most_points = 0\n most_points_player = nil\n game_hash.each do |team, team_stats|\n team_stats[:players].each do |player_stats|\n if most_points < player_stats[:points]\n most_points = player_stats[:points]\n most_points_player = player_stats[:player_name]\n end\n end\n end\n most_points_player\nend",
"def sort_using_rank\n score[1]\n end",
"def index\n @rallies = Rally.includes(:rank_score).order('rank_scores.value desc').all.paginate(page: params[:page])\n end",
"def top_ten_list(category)\n # Select all of category from work instances\n work_by_category = Work.all.select { |work| work.category.downcase == \"#{category}\" }\n # Return max by vote count for top 10\n return work_by_category.max_by(10) { |work| work.votes.length }\n end",
"def highest_score_from(words)\n highest_score = 0\n winning_words = []\n words.each do |word|\n if score_word(word) > highest_score\n highest_score = score_word(word)\n winning_words.clear << word\n elsif score_word(word) == highest_score\n winning_words << word\n end\n end\n\n # no tie scenario\n if winning_words.count == 1\n return {word: winning_words[0], score: highest_score}\n else \n\n # tie scenario\n winning_words.each do |word|\n # determines whether word is 10 letters long\n if word.length == 10\n return {word: word, score: highest_score}\n end\n end\n # if there is no 10 letter word, find shortest word\n winner = winning_words.min_by do |word|\n word.length\n end \n\n return {word: winner, score: highest_score}\n end \nend",
"def most_points_scored\n points = 0\n result = \"\"\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if points < stats[:points]\n points = stats[:points]\n result = name\n end\n end\n end\n result\nend",
"def top_10_sorted\n\t\t\t\t\traw = notable_order_by_cvss_raw\n\t\t\t\t\tdata = Array.new\n\n\t\t\t\t\traw.each do |vuln|\n\t\t\t\t\t\trow = Array.new\n\t\t\t\t\t\tplugin_id = vuln[0]\n\t\t\t\t\t\tcount = vuln[1]\n\n\t\t\t\t\t\tname = scrub_plugin_name(Plugin.find_by_id(plugin_id).plugin_name)\n\n\t\t\t\t\t\trow.push(name)\n\t\t\t\t\t\trow.push(count)\n\t\t\t\t\t\tdata.push(row)\n\t\t\t\t\tend\n\n\t\t\t\t\tdata = data.sort do |a, b|\n\t\t\t\t\t\tb[1] <=> a[1]\n\t\t\t\t\tend\n\n\t\t\t\t\treturn data\n\t\t\t\tend",
"def scores\n response[\"scores\"]\n end",
"def obtenirScores\n\t\tif @scores == nil\n\t\t\tcalculerScores()\n\t\tend\n\t\treturn @scores\n\tend",
"def scores\n buckets = {bot: 0, twenty: 0, thirty: 0, forty: 0, fifty: 0, sixty: 0, seventy: 0, eighty: 0, top: 0 }\n y_axis = []\n\n scores = self.students.map do |student|\n if student.total_score.nil?\n 0\n else\n student.total_score.to_f / self.possible_points.to_f\n end\n end\n scores.sort!\n\n scores.each do |score|\n case score\n when 0.9..1.0\n buckets[:top] += 1\n when 0.8..0.899\n buckets[:eighty] += 1\n when 0.7..0.799\n buckets[:seventy] += 1\n when 0.6..0.699\n buckets[:sixty] += 1\n when 0.5..0.599\n buckets[:fifty] += 1\n when 0.4..0.499\n buckets[:forty] += 1\n when 0.3..0.399\n buckets[:thirty] += 1\n when 0.2..0.299\n buckets[:twenty] += 1\n else\n if score < 0.2\n buckets[:bot] += 1\n end\n end\n end\n buckets.each_value {|val| y_axis.push(val)}\n y_axis\n end",
"def leaderboard\n self.joins(:user).\n select('SUM(score) AS score, users.name, users.uid, users.oauth_token').\n where('score > 0').\n group('users.name, users.uid, users.oauth_token').order('sum(score) desc')\n end",
"def high_ranking_cards\n high_cards = []\n @cards.each do|card|\n if card.rank >= 11\n high_cards << card\n end\n end\n high_cards\n end",
"def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end",
"def answer(unsorted_scores, highest_possible_score)\n score_counts = [0] * (highest_possible_score + 1) # array of 0's at indices 0..highest_possible_score\n unsorted_scores.each { |score| score_counts[score] += 1 } # populate score_counts\n sorted_scores = [] # populate the final sorted_scores\n highest_possible_score.downto(0) do |score|\n count = score_counts[score]\n (0...count).each { |time| sorted_scores << score }\n end\n return sorted_scores\nend",
"def top_hits_count\n return @top_results.length || 0\n end",
"def highest_score_from(words)\n contestants = words.map{ |word| [word, score_word(word)] }.to_h\n\n winning_word = {word: \"\", score: 0}\n\n contestants.each do |word, score|\n if score > winning_word[:score]\n winning_word = {word: word, score: score}\n elsif score == winning_word[:score] \n if winning_word[:word].length == 10\n next\n elsif word.length == 10\n winning_word = {word: word, score: score}\n elsif word.length < winning_word[:word].length\n winning_word = {word: word, score: score}\n end\n end \n end\n return winning_word\nend",
"def highest_score_from(words)\n maximum_score = words.map { |word| score_word(word) }.max\n highest = words.select { |word| score_word(word) == maximum_score }\n if highest.length == 1 \n winning_word = highest.first\n else\n highest_lengths = highest.map {|i| i.length}\n if highest_lengths.any? { |x| x == 10}\n index_of_length_10 = highest_lengths.find_index(10)\n winning_word = highest[index_of_length_10]\n else\n winning_word = highest[highest_lengths.find_index(highest_lengths.min)]\n end \n end\n\n results = Hash.new\n results[:score] = maximum_score\n results[:word] = winning_word \n\n return results\nend",
"def read_scores\n end",
"def popularity_list\n @popularity_list=@movie_index.sort_by { |x| -x[1].size }.col(0) if @popularity_list.nil?\n @popularity_list\n end",
"def most_reviews\n @top_five = Taxi.most_review_answers(current_user, params)\n end",
"def sort_scores(unsorted_scores, highest_possible_score)\n array = []\n array << highest_possible_score\n unsorted_scores.sort.reverse.each { |score| array << score }\nend",
"def index\n @five_scores = FiveScore.all\n end",
"def highest_word_score\n word = highest_scoring_word\n highest_score = Scrabble::Scoring.score(word)\n return highest_score\n end",
"def query(query, print=false)\n rows, word_ids = get_match_rows(query)\n scores = get_scored_list(rows, word_ids)\n scores.to_a.sort_by { |score| score[1] }.reverse\n end",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by! {|team_info| [team_info[1][:wins], team_info[1][:ties], -team_info[1][:losses]]}.reverse!\nend",
"def top_students(grade_hash, number_of_students)\n averages = averages(grade_hash)\n\n result = averages.sort_by do |key, value|\n value\n end\n\n students = result.map do |key, value|\n key\n end\n\n non_reversed = students.last(number_of_students)\n\n reversed = non_reversed.reverse\nend",
"def leader_board(scores)\r\n \r\n end",
"def percent_high_ranking\n high = 0.0\n low = 0.0\n cards.each do |card|\n if card.rank >= 11\n high += 1\n else\n low += 1\n end\n end\n (high * 100 / (high + low)).ceil(2)\n end"
] |
[
"0.77678275",
"0.6852175",
"0.67914927",
"0.6754282",
"0.67193633",
"0.66178745",
"0.661107",
"0.6607321",
"0.6601112",
"0.66009295",
"0.6591012",
"0.65576994",
"0.6519045",
"0.6510493",
"0.6505528",
"0.6504507",
"0.6501067",
"0.6495973",
"0.6495439",
"0.64795977",
"0.6454784",
"0.6451406",
"0.64195275",
"0.63947403",
"0.63422644",
"0.6330965",
"0.6327215",
"0.63271976",
"0.6308396",
"0.63073194",
"0.62984174",
"0.6287605",
"0.6259425",
"0.62582463",
"0.62326103",
"0.6216848",
"0.6212111",
"0.6201173",
"0.6197777",
"0.61968553",
"0.6193537",
"0.61934555",
"0.6193343",
"0.6187046",
"0.6182179",
"0.6177045",
"0.61738783",
"0.61704993",
"0.61634725",
"0.61617166",
"0.61522806",
"0.61409026",
"0.6132651",
"0.6126646",
"0.61230266",
"0.6116053",
"0.61129713",
"0.611246",
"0.6111338",
"0.6109572",
"0.61060214",
"0.6080002",
"0.6079838",
"0.60767084",
"0.60765845",
"0.6074453",
"0.6069594",
"0.606482",
"0.606134",
"0.6051682",
"0.6045517",
"0.6018205",
"0.6012764",
"0.6010072",
"0.60004365",
"0.59957",
"0.5993455",
"0.59933454",
"0.59881634",
"0.59834",
"0.59833294",
"0.596734",
"0.5963426",
"0.5962333",
"0.5960554",
"0.5960238",
"0.59504575",
"0.59485435",
"0.59473664",
"0.5946056",
"0.59450436",
"0.5943849",
"0.594149",
"0.5931855",
"0.5925445",
"0.5924469",
"0.59124035",
"0.5893873",
"0.589354",
"0.5884324"
] |
0.59746414
|
81
|
shows user information avatar + username
|
def u(user, show_avatar = true, size = 16)
if !user.nickname.nil?
display_name = user.nickname
else
display_name = user.login
end
if show_avatar
return avatar(user, size) + " <span title='#{display_name} (#{user.points})'>#{display_name}</span>"
else
return "<span title='#{display_name} (#{user.points})'>#{display_name}</span>"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n if @user_profile.image.attachment \n @profile_image = @user_profile.image\n else\n @profile_image = \"https://api.adorable.io/avatars/200/#{current_user.username}\" \n end\n end",
"def show\n @user_author = User.find_by_id(@materialpicture.user_id)\n @user_author_name = @user_author.username\n end",
"def show_avatar\n\n end",
"def show_avatar\n\n end",
"def user_pic user\n \"<a href='#{site(user)}' title='#{user.city} #{user.jobs} #{user.maxim} #{user.memo}' target='_blank'><img width='48' height='48' src='#{user.avatar.thumb.url}' width='#{USER_THUMB_SIZE}' height='#{USER_THUMB_SIZE}'></a>\"\n end",
"def user_profile_img(user)\n if user.avatar?\n return image_tag(user.avatar, alt: user.name, size: \"60x60\")\n else\n img_url = 'no_image.png'\n end\n image_tag(img_url, alt: user.name, size: \"60x60\")\n end",
"def show\n totalPicture=Timeline.where(\"user_id=#{@user.id}\").count\n @user_info ={profileImage:\"#{@user.profileImage}\", totalPicture:\"#{totalPicture}\"}\n end",
"def avatar_thumb_linked_with_username(user_id, options = {})\n user = User.find(user_id)\n html = \"\"\n avatar_etc = (image_tag (user.avatar.url), options) + (content_tag :br, user.username)\n html += link_to (avatar_etc), user_path(user_id)\n return html.html_safe\n end",
"def show \n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @user.to_json(:methods => [:avatar_url]) }\n end\n end",
"def show \n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @user.to_json(:methods => [:avatar_url]) }\n end\n end",
"def loginViewFetchedUserInfo( loginView, user: user )\n\t\t# here we use helper properties of FBGraphUser to dot-through to first_name and\n\t\t# id properties of the json response from the server; alternatively we could use\n\t\t# NSDictionary methods such as objectForKey to get values from the my json object\n\t\[email protected] = \"Hello #{user[ :first_name ]}!\"\n\n\t\t# setting the userID property of the FBProfilePictureView instance\n\t\t# causes the control to fetch and display the profile picture for the user\n\t\[email protected] = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"def avatar\n @data['avatar']\n end",
"def avatar\n @data['avatar']\n end",
"def profile\n\t\t@user = User.where(username: params[:username])[0]\n\t\t@pics = Picture.where(user_id: @user.id).reverse\n\n\tend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show \n user=current_user\n user={name: user.name,email: user.email ,phone: user.phone,avatar: user.avatar}\n json_response(user)\n end",
"def get_avatar\n KAG.get \"/player/#@nick/avatar\"\n end",
"def show\n @title = \"Photos uploaded by \" + @user.username\n @title_cat = \"Cats belonging to \" + @user.username\n # for partial generic views\n @photos = @user.photos\n @cats = @user.cats\n end",
"def show()\n @authentication = Authentication.find(params[:id])\n\n if @authentication.provider == \"facebook\"\n me = FbGraph::User.me(@authentication.token).fetch\n current_user.fname = me.name.split.first\n current_user.lname = me.name.split.last\n current_user.email = me.email\n current_user.gender = me.gender\n birthday = me.birthday\n current_user.birthday = Chronic.parse(birthday) if birthday\n\n location = me.location\n current_user.location = location if location and location.is_a? String\n current_user.location = location.try(:[], :name) if location and location.is_a? Hash\n pictureurl = me.picture+'?type=large'\n begin\n tempfile = Tempfile.new(['', '.jpg'])\n open(tempfile.path, 'wb') do |file|\n file << open(URI.parse(pictureurl)).read\n end\n current_user.avatar = tempfile\n rescue\n end\n end\n\n current_user.save\n redirect_to edit_user_path\n end",
"def show\n \tif !logged_in?\n \t\tredirect_to :controller => :sessions, :action => :new, :return_to => request.request_uri\n \telse\n\t \tlogin = params[:login]\n\t \t@user = User.find_by_login(login)\n\t \t@user_stream = @user.profile_stream_short\n\t \[email protected]_ranked.each do |i|\n\t \t\t@image = i.photo.url(:profile)\n\t\t\tend\t\t\t \t\n\t \t@cats = @user.cats.paginate :page => params[:page], :order => \"created_at desc\", :per_page => 30\n\t \[email protected] ||= Profile.new\n\t \t@profile = @user.profile\n \tend\n end",
"def linked_in_avatar(user)\n image_tag(user.user_info[\"linked_in\"][\"image\"])\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def picture_show\n path =current_user.user_picture.path.present? ? current_user.user_picture.path.gsub(\"/home/altius/Uma/project/BC4_api/public/\",\"http://192.168.1.238:4020/\") : nil #{}\"http://192.168.1.238:4020/uploads/notfount_image.jpg\"\n user = User.select(:name, :email, :user_uid, :mobile_no, :id).find(current_user.id)\n cg_id = UserAssociation.where(patient_id: current_user.id).pluck(:caregiver_id) != [] ? UserAssociation.where(patient_id: current_user.id).pluck(:caregiver_id) : nil\n caregiver = User.where(id: cg_id)\n pat_id = UserAssociation.where(caregiver_id: current_user.id).pluck(:patient_id) != [] ? UserAssociation.where(caregiver_id: current_user.id).pluck(:patient_id) : nil\n patient = User.where(id: pat_id)\n render json: {profile_pic: path, user_info: user, caregiver: caregiver, patient: patient }, status: :ok\n end",
"def profile_avatar\n if current_user.update(params.require(:user).permit(:avatar))\n render :profile_avatar\n else\n render(json: { errors: current_user.errors.full_messages }, status: :unprocessable_entity) && return\n end\n end",
"def avatar\n respond_with(@user)\n end",
"def avatar_for(user, size = nil)\n avatar_tag user.avatar, size, user.name if user.is_a? User\n end",
"def user_avatar(user_id)\n user = User.find!(user_id)\n if user.avatar.attached?\n image_tag user.avatar\n else\n image_tag \"../images/Littlefinger_Main.jpg\"\n end\n end",
"def link_to_user(user, opts={})\n avatar = AvatarAttachment.find_by_owner_id(user.id)\n img = image_tag(avatar.small_thumb.url, class: \"profile-pic pull-left\", style: \"height:20px;padding-right:5px\") if avatar\n link_to img.to_s+user.full_name, user_path(user.slug, network: user.network)\n end",
"def avatar_for(user, size=32)\n image_location = if user.avatar.nil? || user.avatar.empty?\n \"http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.md5(user.email)}&rating=PG&size=#{size}\"\n else\n sanitize(user.avatar)\n end\n image_tag image_location, :size => \"#{size}x#{size}\", :class => 'photo'\n end",
"def profile_picture_for(user)\n if user.picture?\n image_tag(user.picture.url, alt: user.name, class: \"profile_picture\")\n else\n image_tag(random_default_image, alt: user.name, class: \"profile_picture\")\n end\n end",
"def show\n \tlogger.info \"### Selecting AVATARS in AvatarsController#show\"\n \t@avatar = @user.avatar.find(params[:id])\n end",
"def render_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px').html_safe\n end\n end",
"def show\n @user = User.find(params[:id])\n if $current_user.nil? or $current_user.id != @user.id\n redirect_to signin_path\n else\n @title = \"#{@user.userName}'s profile\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end\n end",
"def show\n\n if current_user && current_user.events.include?(@event)\n @shown_user = current_user.get_user(@event)\n if !@shown_user\n @message = \"There are no Users to display at this time.\"\n else\n @shown_user_image = @shown_user[0].user_image\n end\n else\n @message = \"Please pin event to continue.\"\n end\n\n end",
"def current_user_info\n\t\trespond_to do |format|\n\t\t\tif !current_user\n\t\t\t\tformat.json { render json: { 'User' => 'not logged in' } }\n\t\t\telse\n\t\t\t\tformat.json { render json: { 'Name' => current_user.name, 'Image' => getFacebookPicURL(current_user) } }\n\t\t\tend\n\t\tend\n\tend",
"def set_avatar_name\n self.display_name ||= self.username\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def render_tiny_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '20px', width: '20px').html_safe\n end\n end",
"def profile\n\t\t# determine which user's profile page\n\t\t@user = User.find_by_login(params[:username])\n\t\t# retrieve all bids by this user\n\t @bids = Bid.find_all_by_bidder_id(@user.id, :group => 'item_id')\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = @user.posted_items\n\n\t\t# code for facebox\n\t respond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend",
"def render_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.url, class: \"media-object thumbnail\").html_safe\n else\n image_tag('fallback/default.gif', height: '150px', width: '150px', class: 'media-object thumbnail').html_safe\n end\n end",
"def author_avatar\n is_anonymous ? Avatar.default.url : user.profile.avatar.url\n end",
"def render_super_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.small.url, class: 'media-object thumbnail').html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px', class: 'media-object thumbnail').html_safe\n end\n end",
"def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end",
"def avatar_for(user, size=80)\n user.avatar.attached? ? image_tag(url_for(user.set_avatar(size)), class: \"avatar\") : gravatar_for(user, size)\n end",
"def author_avatar\n anonymous? ? Avatar.default.url : user.profile.avatar.url\n end",
"def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end",
"def avatar\n \"https://cdn.discordapp.com/avatars/#{@obj['id']}/#{@obj['avatar']}.webp?size=1024\"\n end",
"def profile\n @user = @current_user\n\n render :show\n\n end",
"def avatar\n \t\t# get the email from URL-parameters or what have you and make lowercase\n\t\temail_address = self.email.downcase\n\t\t \n\t\t# create the md5 hash\n\t\thash = Digest::MD5.hexdigest(email_address)\n\t\t \n\t\t# compile URL which can be used in <img src=\"RIGHT_HERE\"...\n\t\timage_src = \"http://www.gravatar.com/avatar/#{hash}\"\n \tend",
"def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_at) \n render json: profile\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def avatar(user, options={})\n return unless user\n options.reverse_merge!(:url => \"/\", :width => 24)\n image_tag avatar_url(user, options), :class => 'avatar', :width => options[:width]\n end",
"def profile\n\t@user = current_user\n\t@title = \"This is your profile page\"\n end",
"def show\n if @current_user.nil? and (!params[:id].to_i.zero? or User.find_by_username(params[:id]).nil?)\n redirect_to '/login' \n else\n if !params[:id].to_i.zero? and !@current_user.nil? and @current_user.image_ids.include? params[:id].to_i\n @image=Image.find params[:id]\n user=@current_user\n else\n user=User.find_by_username params[:id]\n @image=user.images.random\n end\n @image.text=user.quotes.random\n send_data(@image.to_img(request),\n :type => 'image/png',\n :disposition => 'inline')\n end\n end",
"def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend",
"def current_avatar\n logged_in? ? \n image_tag(\"/avatar/show?secret_code=#{session[:secret_code]}&\", :alt => current_user.login) : # The '&' is a hack to prevent the appended .png from spoiling the call\n image_tag('id_image.gif', :alt => \"ID Image\", :size => '70x70')\n end",
"def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend",
"def show_a_profile_with_pic(my_name)\n # This time include the person's name which has been passed in\n # as an argument.\n puts \"<h1>#{my_name}</h1>\"\n puts \"<p>This is my profile and below is my pic.<p>\"\n puts \"<img src=\\\"RCA.jpg\\\">\"\nend",
"def image_avatar_tag(person, options={})\n options = {:size => '35x35', :anonymous => false}.merge(options).symbolize_keys\n anonymous = !!options.delete(:anonymous)\n image_tag(image_avatar_path(person, {:anonymous => anonymous}.merge(options)), \n {:alt => person ? (anonymous ? \"\" : h(person.username_or_name)) : \"\", \n :title => person ? (anonymous ? \"\" : h(person.username_or_name)) : \"\"}.merge(options))\n end",
"def get_small_avatar\n KAG.get \"/player/#@nick/avatar/s\"\n end",
"def user_icon()\n photo_name_column(get_person, 65)\n end",
"def user_avatar(user)\n if user.gender == \"Male\"\n return \"jimmy.png\"\n elsif user.gender == \"Female\"\n return \"yanny.svg\"\n else\n return \"blank-avatar.svg\"\n end\n end",
"def user_thumb user\n img = tag(\"img\", :src => formatted_user_url(:id => user, :format => 'jpg'), :class => 'user_picture', :alt => user.name)\n img_link = link_to img, user_url(:id => user)\n text_link = link_to user.short_name, user_url(:id => user)\n content_tag :div, \"#{img_link}<br/>#{text_link}\", :class => 'user'\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user_logo(user)\n image_tag(user.avatar_url)\n end",
"def render_answer_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.tiny.url, class: 'media-object tiny-thumbnail').html_safe\n else\n image_tag('fallback/default.gif', height: '30px', width: '30px', class: 'media-object tiny-thumbnail').html_safe\n end\n end",
"def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end",
"def effective_avatar(ob, user, query)\n\n picture = ob.profile.picture\n\n if picture\n result = rest_reference(picture, query, true)\n result.name = \"avatar\"\n result\n else\n result = LibXML::XML::Node.new('avatar')\n result['resource'] = Conf.base_uri + '/images/avatar.png'\n result\n end\nend",
"def info\n\t@user = User.find(params[:id])\n end",
"def profile_image hash = {}\n image_name = hash.delete(:image_name) ||\n @controller.instance_variable_get(:@profile_user).feed.name.titlecase.\n gsub(/[\\/\\\\\\!\\@\\#\\$\\%\\^\\*\\&\\-\\.\\,\\?]+/, ' ').gsub(' ', '').underscore\n hash.update :action => 'profile_image', :id =>\n image_name, :format => (hash[:format] || 'jpeg'), :trailing_slash => false\n home(hash)\n end",
"def small_profile\n\t\t# determine which user's profile page\n \t@user = User.find_by_login(params[:username])\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = current_user.user_items\n\t\trespond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend",
"def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end",
"def avatar_url(user)\n url = \"http://www.gravatar.com/avatar/#{Digest::MD5::hexdigest(user.email)}?d=mm\"\n image_tag(url, :alt => 'Avatar', :class => 'avatar')\n end",
"def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end",
"def show\n format.html { redirect_to user_path(@image.user), notice: \"Profile picture was successfully created.\" }\n end",
"def show\n # Block execution if there is no current user\n if(current_user.blank?)\n return render json:{\n errors: \"true\",\n message: \"User not connected\"\n }, status: 401\n end\n show= User.find_by(id:current_user.id)\n #atta = photo de profil\n atta = show.featured_image.attached?\n if atta \n avatar = rails_blob_path(show.featured_image)\n render json:{\n user:show,avatar:avatar,photo:atta\n }\n else \n render json:{\n user:show,photo:atta\n }\n end\n end",
"def user_avatar(user)\n if user.avatar.attached?\n return user.avatar\n elsif user.gender == \"Male\"\n return \"jimmy.png\"\n elsif user.gender == \"Female\"\n return \"sue.svg\"\n elsif user.gender == \"Non-Binary\"\n return \"yanny.svg\"\n else\n return \"blank-avatar.svg\"\n end\n end",
"def user_information\n @current_user = current_user\n\n render :partial => 'home/user_info'\n end",
"def user_info(comment)\n if comment.user_nickname.present?\n comment.user_nickname + (comment.user_location ? \" (%s)\" % comment.user_location : \"\")\n else\n \"anonymous\"\n end\n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def show\n @title = \"Perfil del Candidato: #{@profile.forenames} #{@profile.surnames}\"\n end",
"def profile(username = nil, uid = nil)\n\n end",
"def nickname\n user_info['nickname']\n end",
"def gravatar_for(user, options = {size:50})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.firstname, class: \"gravatar\")\nend",
"def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profile\n else\n redirect_to user_profile_path\n end\n end",
"def show\n @user_picture = @user.profile_image.expiring_url(3600, :square)\n @bookmarks = @user.bookmarks\n @enrollments = @user.courses\n @enrollments_visible = @user.course_enrollments_visible_for_user(current_user)\n @completions_visible = @user.course_results_visible_for_user(current_user)\n end",
"def avatar\n if object.dp.present?\n k = object.dp.url.gsub('upload','upload/g_face,c_thumb,w_150,h_150')\n else\n k = object.avatar\n end\n end",
"def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end",
"def artist_avatar\n if self.avatar.attached?\n image_tag artist.avatar\n else\n image_tag 'default_avatar.jpg'\n end\n end",
"def info\n {\n email: username\n }\n end",
"def raster_profile_picture(user)\n if user.authentications.where(:provider == \"Facebook\").any?\n fb_picture(user)\n elsif user.authentications.where(:provider == \"Twitter\").any?\n twitter_picture(user, type: \"normal\") \n else\n image_tag user.avatar.url(:raster), class: \"img-circle small_profile_picture\"\n end\n end",
"def gravatar\n anchor_title = \"#{source.username} GitHub Profile\"\n github_url = GitHub.profile_page(source.username)\n gravatar_url = Gravatar.url(source.gravatar_id)\n\n h.link_to(github_url, title: anchor_title) do\n\n h.image_tag(gravatar_url, alt: source.username,\n width: 90,\n height: 90,\n class: \"img-polaroid\")\n end\n end",
"def user_avatar(user_id, size)\n user = User.find(user_id)\n if user.avatar.attached?\n image_tag user.avatar.variant(resize: \"#{size}x#{size}\"), height: \"#{size}px\", width: \"#{size}px\"\n else\n image_tag 'default-avatar.png', height: \"#{size}px\", width: \"#{size}px\"\n end\n end",
"def profile_picture\n profile_picture_file_name\n end",
"def show\n if Bio.where(:user_id => current_user.id).last == nil #brand new user signed up \n render(\"/bios/new/\")\n else\n @bio = Bio.where(:user_id => current_user.id).last #existing user signing in\n render(\"/bios/show/\")\n end\n end",
"def avatar_for(user, size=32)\n options = {}\n if user.admin == 1\n options[:class] = \"teacher-avatar\" \n end\n case(user.language)\n when 'en'\n flag(\"us\",options)\n when 'es'\n flag(\"cr\",options)\n end\n end",
"def header_nav_avatar\n if current_user.role? :superadmin\n avatar = current_user.institution.institution_logo.url(:thumb)\n else\n avatar = current_user.user_avatar.url(:thumb)\n end\n\n image_tag(avatar, class: 'img-squared', id: 'nav-user-avatar')\n end",
"def display_name \n username\n end",
"def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend",
"def profile\n current_user.update(user_params)\n current_user.avatar.attach(params[:user][:avatar]) if params[:user][:avatar].present?\n end"
] |
[
"0.7530686",
"0.7267867",
"0.7256623",
"0.7256623",
"0.70567954",
"0.7055965",
"0.7049665",
"0.70050794",
"0.6985356",
"0.6985356",
"0.6960068",
"0.695912",
"0.695912",
"0.6941426",
"0.6941266",
"0.6923562",
"0.6847144",
"0.6838325",
"0.6833522",
"0.6824165",
"0.6821433",
"0.6785378",
"0.6756321",
"0.675288",
"0.67402697",
"0.67385995",
"0.6731478",
"0.6725752",
"0.67192686",
"0.6716565",
"0.6711834",
"0.67018557",
"0.66730046",
"0.66711515",
"0.66604775",
"0.66464806",
"0.66343427",
"0.662964",
"0.6623723",
"0.6619973",
"0.66033244",
"0.6601155",
"0.65976065",
"0.6596326",
"0.6591023",
"0.6573593",
"0.6569389",
"0.65604776",
"0.656026",
"0.65538466",
"0.6543343",
"0.65306485",
"0.65292317",
"0.6526153",
"0.6522706",
"0.65190923",
"0.6512997",
"0.6489927",
"0.64873105",
"0.6478445",
"0.6473758",
"0.64567626",
"0.64513606",
"0.644626",
"0.64429617",
"0.64424866",
"0.6425741",
"0.6424362",
"0.6424109",
"0.64156085",
"0.6412294",
"0.64073414",
"0.6404633",
"0.63996315",
"0.6396773",
"0.6382916",
"0.637484",
"0.6374254",
"0.6369803",
"0.63662606",
"0.6366231",
"0.6365325",
"0.63559556",
"0.6355928",
"0.6355105",
"0.6348184",
"0.63399476",
"0.6338253",
"0.63371634",
"0.6334731",
"0.6332147",
"0.63302636",
"0.63203007",
"0.63201815",
"0.63198864",
"0.6317027",
"0.63139933",
"0.6313332",
"0.6309895",
"0.6295988"
] |
0.72422
|
4
|
}}} For prepared statements that return model instance records
|
def select_prepared(plan_name, *args)
# {{{
args_string = ''
if args.to_s != '' && args.length > 0 then
args_string = "(#{args.flatten.map { |a| "'#{a}'" }.join(',')})"
end
query_string = "EXECUTE #{plan_name.to_s} #{args_string}; "
return select_cached(query_string)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prepare record = nil, command\n record ? Statement.new(record, command) : db.prepare(command)\n end",
"def prepare_result; end",
"def prepared_sql\n case prepared_type\n when :select, :all, :each\n # Most common scenario, so listed first.\n select_sql\n when :first\n clone(:limit=>1).select_sql\n when :insert_select\n insert_select_sql(*prepared_modify_values)\n when :insert, :insert_pk\n insert_sql(*prepared_modify_values)\n when :update\n update_sql(*prepared_modify_values)\n when :delete\n delete_sql\n else\n select_sql\n end\n end",
"def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end",
"def prepare; end",
"def prepare; end",
"def prepare; end",
"def run(&block)\n case prepared_type\n when :select, :all\n # Most common scenario, so listed first\n all(&block)\n when :each\n each(&block)\n when :insert_select\n with_sql(prepared_sql).first\n when :first\n first\n when :insert, :update, :delete\n if opts[:returning] && supports_returning?(prepared_type)\n returning_fetch_rows(prepared_sql)\n elsif prepared_type == :delete\n delete\n else\n send(prepared_type, *prepared_modify_values)\n end\n when :insert_pk\n fetch_rows(prepared_sql){|r| return r.values.first}\n when Array\n case prepared_type[0]\n when :map, :as_hash, :to_hash, :to_hash_groups\n send(*prepared_type, &block) \n end\n else\n Sequel::Deprecation.deprecate(\"Using an unsupported prepared statement type (#{prepared_type.inspect})\", 'Switch to using :select as the prepared statement type')\n all(&block)\n end\n end",
"def resultset; end",
"def execute\n # First, execute the SQL, applying the valid after_filters\n ret = apply_after_filters(execute_sql)\n\n # Set changed property to true\n changed\n\n # Notify all observers of the ids of the current result\n # set\n notify_observers(\n ret.collect{|instance| instance.send(model.primary_key)},\n self\n )\n\n # Reset the Query\n reset!\n\n # Return the results\n ret\n end",
"def prepare(*args)\n ps = super\n ps.extend(::Sequel::Postgres::DatasetMethods::PreparedStatementMethods)\n ps\n end",
"def execute_sql\n # add conditions including the cache_ids and retrieve a count and all of the records\n return @model.find(:all,to_active_record)\n end",
"def run(results)\n columns_names = rows.first.inject([]) {|m, kv| m << kv[0]; m}\n row_count = rows.size\n initial_data = results.all.map {|r| columns.map {|c| r[c]}}\n asrecordset = ASRecordset.new(row_count,column_names,initial_data)\n \tresult = asrecordset\n \treturn result\n end",
"def prepare( sql )\n Statement.new( self, sql )\n end",
"def orm; end",
"def save\n result = nil\n # iterate over each instance variable and insert create row to table\n\t\t\t\t obj = self.inst_strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n # Don't save objects with braces to database\n val = self.send(method.to_sym)\n # add rows excluding object, source_id and update_type\n unless self.method_name_reserved?(method) or val.nil?\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>val,\n \"update_type\"=>'create'})\n end\n end\n # Create a temporary query record to display in the list\n Rho::RhoConfig::sources[self.class.name.to_s]['attribs'].each do |attrib|\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>attrib['attrib'],\n \"value\"=>self.send(attrib['attrib'].to_sym),\n \"update_type\"=>'query'})\n end\n result\n end",
"def find_by_sql(sql, binds = [], preparable: nil, &block)\n result_set = connection.select_all(sanitize_sql(sql), \"#{name} Load\", binds, preparable: preparable)\n column_types = {}\n message_bus = ActiveSupport::Notifications.instrumenter\n\n payload = {\n record_count: result_set.length,\n class_name: name\n }\n\n message_bus.instrument(\"instantiation.active_record\", payload) do\n result_set.map { |record| instantiate(record, column_types, &block) }\n end\n end",
"def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end",
"def exec_raw(sql, options = {})\n cursor = $connection.exec(sql)\n if(options[:return_hash])\n recordset, = pack_cursor(cursor, :return => \"hash\")\n return recordset\n else\n return_data = []\n while current_row = cursor.fetch()\n return_data.push(current_row)\n end\n return return_data\n end\n end",
"def index\n @preparedinfos = Preparedinfo.all\n end",
"def prepare\n end",
"def prepare\n end",
"def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end",
"def prepare()\n end",
"def run(result)\r\n\t\t\r\n\t\tcolumn_names = Array.new #store the column names\r\n\t\tfields = result.fetch_fields #get all the fields\r\n\t\tfields.each do |field|\r\n\t\t\tcolumn_names << field.name #push a field into the coumn_names\r\n\t\tend\r\n\t\t\r\n\t\trow_count = result.num_rows #get the number of rows in the Mysql::Result\r\n\t\tinitial_data = Array.new #payload holder\r\n\t\t\r\n\t\tresult.data_seek(0) #Seek the cursor to the beginning of the data\r\n\t\twhile row = result.fetch_row\r\n\t\t\tinitial_data << row # add a row to the payload\r\n\t\tend\r\n\t\t\t\t\r\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\r\n\t\tresult = asrecordset\r\n\t\treturn result\r\n\tend",
"def sql\n @stmt_api.sql\n end",
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n p.meta = set_meta\n end\n end",
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n p.meta = set_meta\n end\n end",
"def prepare\n # Only do this once\n return if $has_prepared\n\n prepared_statements = {\n temperature_readings: :insert_temp,\n moisture_readings: :insert_moisture,\n light_readings: :insert_light,\n }\n\n prepared_statements.each do |table, name|\n DB[table].prepare(:insert, name, plant_id: :$plant_id, value: :$value)\n end\n\n $has_prepared = true\nend",
"def prepare!; end",
"def prepare!; end",
"def execute()\n filters = prepare_filters\n return_filtered_model(filters)\n end",
"def prepare\n model.tap do |p|\n p.identifier = set_identifiers\n p.meta = set_meta\n p.text = set_text\n p.status = COMPLETED_STATUS\n p.authored = set_date\n p.author = set_author\n p.subject = set_subject\n p.questionnaire = set_questionnaire\n p.group = set_group\n end\n end",
"def write_sql model_name, model_attributes,output\n model_attributes.each do|key,query|\n sql= ActiveRecord::Base.connection();\n (sql.select_all query).each do |row|\n make_triples(row,model_name,\"\")\n end\n end\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def subscribe_sql_active_record; end",
"def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n \n results_as_objects << self.new(result_hash)\n \n end\n \n return results_as_objects\n \n end",
"def association_prepared_statement(opts, assoc_bv)\n return unless model.cache_associations\n ps = opts.send(:cached_fetch, :prepared_statement) do\n unless opts[:instance_specific]\n ds, bv = _associated_dataset(opts, {}).unbind\n\n f = ds.opts[:from]\n if f && f.length == 1\n s = ds.opts[:select]\n if ds.opts[:join]\n if opts.eager_loading_use_associated_key? && s && s.length == 1 && s.first.is_a?(SQL::ColumnAll)\n table = s.first.table\n ds = ds.select(*opts.associated_class.columns.map{|c| Sequel.identifier(c).qualify(table)})\n end\n elsif !s || s.empty?\n ds = ds.select(*opts.associated_class.columns.map{|c| Sequel.identifier(c)})\n end\n end \n \n if bv.length != assoc_bv.length\n h = {}\n bv.each do |k,v|\n h[k] = v unless assoc_bv.has_key?(k)\n end\n ds = ds.bind(h)\n end\n ds.clone(:log_sql=>true).prepare(opts.returns_array? ? :select : :first, :\"smpsap_#{NEXT.call}\")\n end\n end\n\n if ps && @server && _associated_objects_use_same_server?\n ps = ps.server(@server)\n end\n\n ps\n end",
"def prepare; self; end",
"def sql\n @context.sql\n end",
"def prepare\n end",
"def row_for_record\n raise IdMissing.new(\"You must set an ID before save.\") if record.id.blank?\n\n MassiveRecord::Wrapper::Row.new({\n :id => record.id,\n :table => klass.table\n })\n end",
"def find_rows(field_name, record_id) \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE #{field_name} = #{record_id}\")\n \n return self.results_as_objects(results) \n end",
"def run(result)\t\t\n\t\tcolumn_names = result.fields #store the column names\n\t\trow_count = result.num_tuples #get the number of rows in the result\n\t\tinitial_data = Array.new #payload holder\n result.each do |item|\n intial_data << item.to_ary\n end\t\t\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\n\t\tresult = asrecordset\n\t\tresults\n\tend",
"def index t,param\n subclass,id = param\n models = t.find_models subclass\n if models\n models.values[0].each do |model_name, model_attributes|\n if model_name.to_s ==\"sql_query\"\n #some magic is needed here ..parse the sql query?\n else\n m = Model.new model_name, models.keys[0].to_s\n row_values=m.get_row_by_id(id).first\n c1=Hash.new\n if row_values\n m.model.columns_hash.each_with_index do |column_name,i|\n c1[column_name[0]]=eval(\"row_values.#{column_name}\")\n end\n t.extract_id_line model_attributes, c1,row_values,m.get_datatypes\n t.make_triples(c1, models.keys[0].to_s , \"\", m.get_datatypes)\n end\n end\n end\n end\n #render :text => t.make_triples(c1, controller , \"\", t.dbd_types)\n \n end",
"def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end",
"def conditions\n sqlwhere = \"1 = 1 \"\n sqlwhere = sqlwhere + \"and orders.namel like ? \" if is_string_here?(namel)\n sqlwhere = sqlwhere + \"and orders.email like ? \" if is_string_here?(email)\n sqlwhere = sqlwhere + \"and addresses.street_address1 like ? \" if is_string_here?(street_address1)\n sqlwhere = sqlwhere + \"and addresses.street_address2 like ? \" if is_string_here?(street_address2)\n sqlwhere = sqlwhere + \"and orders.user_id = ? \" if is_object_here?(user_id)\n sqlwhere = sqlwhere + \"and orders.order_state_id = ? \" if is_object_here?(order_state_id)\n sqlwhere = sqlwhere + \"and orders.checkout_state_id = ? \" if is_object_here?(checkout_state_id)\n sqlwhere = sqlwhere + \"and orders.created_at > ? \" if is_object_here?(created_at_since)\n sqlwhere = sqlwhere + \"and orders.created_at < ? \" if is_object_here?(created_at_till)\n\n result = [sqlwhere]\n result << UnicodeUtils.downcase(namel) if is_string_here?(namel)\n result << UnicodeUtils.downcase(email) if is_string_here?(email)\n result << UnicodeUtils.downcase(street_address1) if is_string_here?(street_address1)\n result << UnicodeUtils.downcase(street_address2) if is_string_here?(street_address2)\n result << user_id if is_object_here?(user_id)\n result << order_state_id if is_object_here?(order_state_id)\n result << checkout_state_id if is_object_here?(checkout_state_id)\n result << created_at_since if is_object_here?(created_at_since)\n result << created_at_till if is_object_here?(created_at_till)\n result\n end",
"def prepare(type, name=nil, *values)\n ps = to_prepared_statement(type, values)\n ps.extend(JDBC::Dataset::PreparedStatementMethods)\n ps.extend(::Sequel::Fdbsql::DatasetMethods::PreparedStatementMethods)\n if name\n ps.prepared_statement_name = name\n db.set_prepared_statement(name, ps)\n end\n ps\n end",
"def prepare\n []\n end",
"def query; end",
"def _insert_raw(ds)\n if use_prepared_statements_for?(:insert)\n _set_prepared_statement_server(model.send(:prepared_insert, @values.keys)).call(@values)\n else\n super\n end\n end",
"def fetch_rows(sql)\n execute(sql) do |stmt|\n columns = []\n convert = convert_smallint_to_bool\n cps = db.conversion_procs\n stmt.num_fields.times do |i|\n k = stmt.field_name i\n key = output_identifier(k)\n type = stmt.field_type(i).downcase.to_sym\n # decide if it is a smallint from precision\n type = :boolean if type == :int && convert && stmt.field_precision(i) < 8\n type = :blob if type == :clob && db.use_clob_as_blob\n columns << [key, cps[type]]\n end\n cols = columns.map{|c| c[0]}\n self.columns = cols\n\n while res = stmt.fetch_array\n row = {}\n res.zip(columns).each do |v, (k, pr)|\n row[k] = ((pr ? pr.call(v) : v) if v)\n end\n yield row\n end\n end\n self\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def subscribe_sql_active_record=(_arg0); end",
"def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end",
"def execute\n ActiveRecord::Base.connection.execute(source)\n end",
"def all \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name}\")\n \n return self.results_as_objects(results)\n end",
"def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def scaffold_get_objects(options)\n optionshash = {}\n data = self.all\n if options[:conditions]\n conditions = options[:conditions]\n if conditions && Array === conditions && conditions.length > 0\n if String === conditions[0]\n data = data.all(:conditions => conditions)\n else\n conditions.each do |cond|\n next if cond.nil?\n data = case cond\n when Hash, String then data.all(:conditions => [cond.gsub(\"NULL\",\"?\"),nil])\n when Array then \n if cond.length==1\n data.all(:conditions => [cond[0].gsub(\"NULL\",\"?\"),nil])\n else\n data.all(:conditions => cond)\n end\n when Proc then data.all(&cond)\n end\n end\n end\n end\n end\n slice = nil\n if options[:limit]\n startpos = options[:offset] || 0\n endpos = options[:limit]\n slice = [startpos,endpos]\n end\n # TODO includes break SQL generation\n # optionshash[:links] = options[:include] if options[:include]\n # optionshash[:links] = [optionshash[:links]] unless optionshash[:links].is_a?(Array)\n if options[:order] then\n optionshash[:order] = get_ordering_options(options[:order])\n end\n if slice then\n q = data.all(optionshash).slice(*slice)\n else\n q = data.all(optionshash)\n end\n #p repository.adapter.send(\"select_statement\",q.query)\n q.to_a\n end",
"def save\n table_name = self.class.to_s.tableize\n variables = self.instance_variables\n attr_hash = {}\n \n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n \n single_variables = []\n \n attr_hash.each do |k, v|\n if v.is_a?(String)\n single_variables << \"#{k} = '#{v}'\"\n else\n single_variables << \"#{k} = #{v}\"\n end\n end\n \n vars_to_sql = single_variables.join(\", \")\n \n CONNECTION.execute(\"UPDATE #{table_name} SET #{vars_to_sql} WHERE id = #{self.id}\")\n \n return self\n end",
"def get_all_from_database\n model.all\n end",
"def find(record_id) \n result = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE id = #{record_id}\").first\n \n self.new(result)\n end",
"def prefetch_rows\n raise NoMethodError, \"Not implemented for this raw driver\"\n end",
"def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects(results)\n \n end",
"def recordset_from_plsql(sp)\n logger.debug \"\\n\" << sp << \"\\n\"\n cursor = $connection.exec(sp)\n recordset, = pack_cursor(cursor, :return => 'hash')\n return recordset\n end",
"def inspect\n \"<#{visible_class_name}/PreparedStatement #{prepared_sql.inspect}>\"\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end",
"def sql\n @sql ||= begin\n bind_params = []\n 1.upto(selector_keys.length + setter_keys.length) { |i| bind_params << \"$#{i}\" }\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end",
"def query_thredis(prepare_only)\n if prepare_only\n @rows = @connection.redis.sqlprepare(@sql)\n else\n @rows = @connection.redis.sql(@sql, *@params)\n @prepare_only = false\n end\n if @rows.is_a? Integer\n @rows, @columns, @connection.changes = [], [], @rows\n else\n @columns = @rows.shift\n## @rows = convert_type(@rows, @columns)\n end\n end",
"def prepare(&block)\n define_method(:prepare, &block)\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = CreateDatabaseResultSet.new(resp)\n return results\n end",
"def run_single(us)\n #debugger\n initial_data = []\n column_names = us.get_column_names\n num_rows = 1\n \n c = 0\n 0.upto(num_rows - 1) do\n o = OpenStruct.new\n class << o\n attr_accessor :id\n end\n\n #turn the outgoing object into a VO if neccessary\n map = VoUtil.get_vo_definition_from_active_record(us.class.to_s)\n if map != nil\n o._explicitType = map[:outgoing]\n end\n \n #first write the primary \"attributes\" on this AR object\n column_names.each_with_index do |v,k|\n k = column_names[k]\n val = us.send(:\"#{k}\")\n eval(\"o.#{k}=val\")\n end\n \n associations = us.get_associates\n if(!associations.empty?)\n #debugger\n #now write the associated models with this AR\n associations.each do |associate|\n na = associate[1, associate.length]\n ar = us.send(:\"#{na}\")\n\t\n ok = false;\n if (ar.instance_of? Array)\n if (!ar.empty? && !ar.nil?)\n ok=true;\n end\n else\n isArray = true\n end\n\n if (isArray && !ar.nil?) || ok \n\n\t if(use_single?(ar))\n initial_data_2 = run_single(ar) #recurse into single AR method for same data structure\n else\n initial_data_2 = run_multiple(ar) #recurse into multiple AR method for same data structure\n end\n eval(\"o.#{na}=initial_data_2\")\n end\n end\n end\n #\tdebugger\n # if us.single? # apparenty this is not needed since it seems to always return nil :)\n initial_data = o \n # else\n # initial_data << o\n # end\n c += 1\n end\n initial_data\n end",
"def raw_all\n query_all\n end",
"def set_preparedinfo\n @preparedinfo = Preparedinfo.find(params[:id])\n end",
"def inspect\n \"#<#{self.class.name}: #{sql.inspect}>\"\n end",
"def build_result(columns:, rows:, column_types: {})\n ActiveRecord::Result.new(columns, rows, column_types)\n end",
"def prepare( str )\n @db.prepare( str )\n end",
"def to_query(_model)\n raise 'subclasses should implement this method.'\n end",
"def prepare_sql; raise \"Define #prepare_sql in your subclass\"; end",
"def query(sql, name, binds)\n \n rs = SA.instance.api.sqlany_execute_direct(@connection, sql)\n raise ActiveRecord::StatementInvalid.new(\"#{SA.instance.api.sqlany_error(@connection)}:#{sql}\") if rs.nil?\n \n max_cols = SA.instance.api.sqlany_num_cols(rs)\n fields = {}\n max_cols.times do |i|\n fields[i] = SA.instance.api.sqlany_get_column_info(rs, i)[2]\n end\n \n rows = []\n while SA.instance.api.sqlany_fetch_next(rs) == 1\n result = Array.new(max_cols)\n max_cols.times do |cols|\n result[cols] = SA.instance.api.sqlany_get_column(rs, cols)[1]\n end\n rows << result\n end\n @affected_rows = SA.instance.api.sqlany_affected_rows(rs)\n SA.instance.api.sqlany_free_stmt(rs)\n\n return rows, fields\n end",
"def finalize(opts = {})\n # Can we use opts[:from] instead of first_source_table and override?\n model_table_name = opts[:model_table_name] || model.raw_dataset.first_source_table\n sel_col = model.columns.map { |c| Sequel.qualify(model_table_name, c) }\n return select(*sel_col) if opts[:no_finalize]\n extra_columns = [opts[:extra_columns]].flatten.compact\n extra_columns_src = extra_columns.map { |c| c.try(:expression) || c }\n\n ds = select(*sel_col,\n Sequel.function(:rank)\n .over(:partition => @opts[:partition_columns] ||\n (extra_columns_src +\n [last_record_id,\n last_branch_path].compact),\n :order => @opts[:order_columns] ||\n Sequel.qualify(model_table_name,\n :version).desc))\n if last_branch_path_context\n ds = ds.select_append(last_branch_path_context.as(:branch_path_context))\n end\n\n ds = ds.select_append(*extra_columns) unless extra_columns.empty?\n\n if opts[:extra_deleted_column]\n ds = ds.select_append(opts[:extra_deleted_column].as(:extra_deleted))\n end\n\n return ds if opts[:include_all]\n\n ds = ds.from_self.where(:rank => 1)\n unless opts[:include_deleted]\n ds = ds.where(:deleted => false)\n ds = ds.where(:extra_deleted => false) if opts[:extra_deleted_column]\n end\n ds = ds.select(*model.columns)\n ds = ds.select_append(:branch_path_context) if last_branch_path_context\n if opts[:extra_columns]\n ds = ds.select_append(*extra_columns.map { |c| c.try(:aliaz) || c.try(:column) || c })\n end\n ds\n end",
"def inspect\n \"#<#{self.class}: #{sql.inspect}>\"\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = InsertRecordsResultSet.new(resp)\n return results\n end",
"def sql_statement_find\n @sql_statement_find ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :project_plan AS project_plan,\n application_data -> :why_selected_project AS why_selected_project,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice,\n hstore_to_json_loose(slice(application_data, ARRAY[:student0_attrs])) AS student0,\n hstore_to_json_loose(slice(application_data, ARRAY[:student1_attrs])) AS student1\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id\n AND applications.id = :id;\n SQL\n end",
"def prepare_export_statements\n @export_point_page =\n @db.prepare(\"select lat, lon from point where (lon between ? and ?) and (lat between ? and ?) limit ? offset ?\")\n @export_point_all = @db.prepare(\"select lat, lon from point where (lon between ? and ?) and (lat between ? and ?) \")\n end",
"def query sql\n result = db[sql].all\n return result\n end",
"def call(bind_vars={}, &block)\n sql = prepared_sql\n prepared_args.freeze\n ps = bind(bind_vars)\n ps.clone(:bind_arguments=>ps.map_to_prepared_args(ps.opts[:bind_vars]), :sql=>sql, :prepared_sql=>sql).run(&block)\n end",
"def questions\n DATABASE.execute(\"SELECT * FROM questions WHERE student_id = #{@id}\")\n \n def self.all\n DATABASE.execute(\"SELECT * FROM students\") \n end\n \n private\n def save\n DATABASE.execute(\"INSERT INTO students (name) VALUES (\\\"#{@name}\\\")\")\n @id = DATABASE.last_insert_row_id\n end\n \nend",
"def query\n end",
"def fetch_rows(sql)\n execute(sql) do |r|\n i = -1\n cps = db.conversion_procs\n cols = r.fetch_fields.map do |f| \n # Pretend tinyint is another integer type if its length is not 1, to\n # avoid casting to boolean if convert_tinyint_to_bool is set.\n type_proc = f.type == 1 && cast_tinyint_integer?(f) ? cps[2] : cps[f.type]\n [output_identifier(f.name), type_proc, i+=1]\n end\n self.columns = cols.map(&:first)\n if opts[:split_multiple_result_sets]\n s = []\n yield_rows(r, cols){|h| s << h}\n yield s\n else\n yield_rows(r, cols){|h| yield h}\n end\n end\n self\n end",
"def find\n self.db.query(\"\n select * \n from dogs\n \")\n end",
"def model(klass)\n unless is_model?(klass)\n raise ArgumentError, \"Must supply an ActiveRecord class to the model method\"\n end\n klass.columns.each do |c|\n param(c.type, c.name, :required => !c.null, :limit => c.limit) unless ignore_column?(c)\n end\n end",
"def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def set_values_from(result)\n @arguments = Arguments.new(result[0]['arguments'])\n @return_type = result[0]['return_type']\n @query = \"SELECT * FROM %s.%s(%s)\" % [\n quoted_schema,\n quoted_name,\n @arguments.to_params\n ]\n end"
] |
[
"0.6576591",
"0.6558719",
"0.65546215",
"0.63562244",
"0.62257713",
"0.62257713",
"0.62257713",
"0.6198121",
"0.61505884",
"0.6121692",
"0.611222",
"0.6107657",
"0.6068164",
"0.6034927",
"0.6018474",
"0.60113287",
"0.60056794",
"0.6004066",
"0.5999624",
"0.59587145",
"0.5921792",
"0.5921792",
"0.59122074",
"0.5898914",
"0.5891731",
"0.5890375",
"0.5844958",
"0.5844958",
"0.5840385",
"0.58350563",
"0.58350563",
"0.58202374",
"0.5814977",
"0.581136",
"0.58021057",
"0.58021057",
"0.58021057",
"0.58021057",
"0.58021057",
"0.58021057",
"0.58021057",
"0.5789234",
"0.5778636",
"0.57692766",
"0.5768659",
"0.57638484",
"0.57568294",
"0.57458615",
"0.57404244",
"0.57368594",
"0.57344556",
"0.57212746",
"0.57015467",
"0.56839037",
"0.56795126",
"0.56788373",
"0.56779397",
"0.56697255",
"0.5666807",
"0.566515",
"0.5653235",
"0.5653168",
"0.5648322",
"0.5643187",
"0.56358206",
"0.56251955",
"0.5611162",
"0.5608166",
"0.55886453",
"0.5579457",
"0.5570007",
"0.5562548",
"0.55538327",
"0.55454457",
"0.55405885",
"0.5539469",
"0.553682",
"0.5529015",
"0.5528798",
"0.55229163",
"0.55188155",
"0.5512757",
"0.5503195",
"0.5502316",
"0.5492971",
"0.54889524",
"0.54862845",
"0.54750705",
"0.5472185",
"0.5466325",
"0.5462919",
"0.5461173",
"0.5457946",
"0.54518247",
"0.5451347",
"0.5450908",
"0.54481614",
"0.5445705",
"0.54413044",
"0.54371595",
"0.54319507"
] |
0.0
|
-1
|
}}} For prepared statements that return arbitrary records
|
def execute_prepared(plan_name, *args)
# {{{
args_string = ''
if args.to_s != '' && args.length > 0 then
args_string = "(#{args.flatten.map { |a| "'#{a}'" }.join(',')})"
end
query_string = "EXECUTE #{plan_name.to_s} #{args_string}; "
return perform_select(query_string).get_rows()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exec_raw(sql, options = {})\n cursor = $connection.exec(sql)\n if(options[:return_hash])\n recordset, = pack_cursor(cursor, :return => \"hash\")\n return recordset\n else\n return_data = []\n while current_row = cursor.fetch()\n return_data.push(current_row)\n end\n return return_data\n end\n end",
"def recordset_from_plsql(sp)\n logger.debug \"\\n\" << sp << \"\\n\"\n cursor = $connection.exec(sp)\n recordset, = pack_cursor(cursor, :return => 'hash')\n return recordset\n end",
"def run(&block)\n case prepared_type\n when :select, :all\n # Most common scenario, so listed first\n all(&block)\n when :each\n each(&block)\n when :insert_select\n with_sql(prepared_sql).first\n when :first\n first\n when :insert, :update, :delete\n if opts[:returning] && supports_returning?(prepared_type)\n returning_fetch_rows(prepared_sql)\n elsif prepared_type == :delete\n delete\n else\n send(prepared_type, *prepared_modify_values)\n end\n when :insert_pk\n fetch_rows(prepared_sql){|r| return r.values.first}\n when Array\n case prepared_type[0]\n when :map, :as_hash, :to_hash, :to_hash_groups\n send(*prepared_type, &block) \n end\n else\n Sequel::Deprecation.deprecate(\"Using an unsupported prepared statement type (#{prepared_type.inspect})\", 'Switch to using :select as the prepared statement type')\n all(&block)\n end\n end",
"def fetch_rows(sql)\n execute(sql) do |stmt|\n columns = []\n convert = convert_smallint_to_bool\n cps = db.conversion_procs\n stmt.num_fields.times do |i|\n k = stmt.field_name i\n key = output_identifier(k)\n type = stmt.field_type(i).downcase.to_sym\n # decide if it is a smallint from precision\n type = :boolean if type == :int && convert && stmt.field_precision(i) < 8\n type = :blob if type == :clob && db.use_clob_as_blob\n columns << [key, cps[type]]\n end\n cols = columns.map{|c| c[0]}\n self.columns = cols\n\n while res = stmt.fetch_array\n row = {}\n res.zip(columns).each do |v, (k, pr)|\n row[k] = ((pr ? pr.call(v) : v) if v)\n end\n yield row\n end\n end\n self\n end",
"def find_rows(field_name, record_id) \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE #{field_name} = #{record_id}\")\n \n return self.results_as_objects(results) \n end",
"def execute( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n result.each { |row| yield row }\n else\n return result.inject( [] ) { |arr,row| arr << row; arr }\n end\n end\n end",
"def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end",
"def pack_cursor(cursor, options = {})\n \n recordset = []\n column_names = []\n var_cursor = cursor.get_col_names\n \n while current_row = cursor.fetch() \n case options[:return]\n when 'hash'\n current_record = {}\n current_row.each_index{ |index| \n current_record[var_cursor[index]] = current_row[index] \n column_names[index] = var_cursor[index].split('_').join(' ')\n }\n when 'array'\n current_record = []\n current_row.each_index{ |index| \n current_record[index] = current_row[index] \n column_names[index] = var_cursor[index].split('_').join(' ')\n } \n end\n \n recordset.push(current_record)\n end\n \n return recordset, column_names\n end",
"def run(results)\n columns_names = rows.first.inject([]) {|m, kv| m << kv[0]; m}\n row_count = rows.size\n initial_data = results.all.map {|r| columns.map {|c| r[c]}}\n asrecordset = ASRecordset.new(row_count,column_names,initial_data)\n \tresult = asrecordset\n \treturn result\n end",
"def resultset; end",
"def oracle_sql_results(sql, conn = VACOLS::Case.connection)\n result = conn.execute(sql)\n output = []\n while r = result.fetch_hash\n output << r\n end\n output\nend",
"def stmt_retr_all_records(fields, charset)\n check_state :RESULT\n enc = charset.encoding\n begin\n all_recs = []\n until (pkt = read).eof?\n all_recs.push StmtRawRecord.new(pkt, fields, enc)\n end\n all_recs\n ensure\n set_state :READY\n end\n end",
"def fetch_rows(sql)\n execute(sql) do |r|\n i = -1\n cps = db.conversion_procs\n cols = r.fetch_fields.map do |f| \n # Pretend tinyint is another integer type if its length is not 1, to\n # avoid casting to boolean if convert_tinyint_to_bool is set.\n type_proc = f.type == 1 && cast_tinyint_integer?(f) ? cps[2] : cps[f.type]\n [output_identifier(f.name), type_proc, i+=1]\n end\n self.columns = cols.map(&:first)\n if opts[:split_multiple_result_sets]\n s = []\n yield_rows(r, cols){|h| s << h}\n yield s\n else\n yield_rows(r, cols){|h| yield h}\n end\n end\n self\n end",
"def recordset_from_stored_procedure(sp)\n \n plsql = $connection.parse(sp)\n plsql.bind_param(':out', OCI8::Cursor)\n plsql.exec\n \n cursor = plsql[':out']\n \n \n recordset, = pack_cursor(cursor, :return => 'hash')\n plsql.close\n return recordset\n end",
"def query(sql, name, binds)\n \n rs = SA.instance.api.sqlany_execute_direct(@connection, sql)\n raise ActiveRecord::StatementInvalid.new(\"#{SA.instance.api.sqlany_error(@connection)}:#{sql}\") if rs.nil?\n \n max_cols = SA.instance.api.sqlany_num_cols(rs)\n fields = {}\n max_cols.times do |i|\n fields[i] = SA.instance.api.sqlany_get_column_info(rs, i)[2]\n end\n \n rows = []\n while SA.instance.api.sqlany_fetch_next(rs) == 1\n result = Array.new(max_cols)\n max_cols.times do |cols|\n result[cols] = SA.instance.api.sqlany_get_column(rs, cols)[1]\n end\n rows << result\n end\n @affected_rows = SA.instance.api.sqlany_affected_rows(rs)\n SA.instance.api.sqlany_free_stmt(rs)\n\n return rows, fields\n end",
"def prepared_sql\n case prepared_type\n when :select, :all, :each\n # Most common scenario, so listed first.\n select_sql\n when :first\n clone(:limit=>1).select_sql\n when :insert_select\n insert_select_sql(*prepared_modify_values)\n when :insert, :insert_pk\n insert_sql(*prepared_modify_values)\n when :update\n update_sql(*prepared_modify_values)\n when :delete\n delete_sql\n else\n select_sql\n end\n end",
"def query_thredis(prepare_only)\n if prepare_only\n @rows = @connection.redis.sqlprepare(@sql)\n else\n @rows = @connection.redis.sql(@sql, *@params)\n @prepare_only = false\n end\n if @rows.is_a? Integer\n @rows, @columns, @connection.changes = [], [], @rows\n else\n @columns = @rows.shift\n## @rows = convert_type(@rows, @columns)\n end\n end",
"def hash_query(sql, name = nil, binds = [])\n \n return if sql.nil?\n #sql = modify_limit_offset(sql)\n\n # ActiveRecord allows a query to return TOP 0. SQL Anywhere requires that the TOP value is a positive integer.\n return Array.new() if sql =~ /TOP 0/i\n\n stmt = SA.instance.api.sqlany_prepare(@connection, sql)\n \n # sql may contain unbounded params\n \n i = 0\n binds.map do |col, val|\n result, param = SA.instance.api.sqlany_describe_bind_param(stmt, i)\n param.set_value(type_cast(val, col)) if result\n result = SA.instance.api.sqlany_bind_param(stmt, i, param) if param\n i = i + 1\n end\n \n # Executes the query, iterates through the results, and builds an array of hashes.\n # rs = SA.instance.api.sqlany_execute_direct(@connection, sql)\n return [] if stmt.nil?\n result = SA.instance.api.sqlany_execute(stmt)\n if result.nil?\n result, errstr = SA.instance.api.sqlany_error(@connection)\n raise SQLAnywhereException.new(errstr, result, sql)\n end\n \n record = []\n if( SA.instance.api.sqlany_num_cols(stmt) > 0 ) \n while SA.instance.api.sqlany_fetch_next(stmt) == 1\n max_cols = SA.instance.api.sqlany_num_cols(stmt)\n result = Hash.new()\n max_cols.times do |cols|\n result[SA.instance.api.sqlany_get_column_info(stmt, cols)[2]] = SA.instance.api.sqlany_get_column(stmt, cols)[1]\n end\n record << result\n end\n @affected_rows = 0\n else\n @affected_rows = SA.instance.api.sqlany_affected_rows(stmt)\n end \n SA.instance.api.sqlany_free_stmt(stmt)\n\n SA.instance.api.sqlany_commit(@connection)\n \n return record\n end",
"def getDBArray(connection, query, id1, *id2)\r\n dbi_query = connection.prepare(query)\r\n dbi_query.execute(id1, *id2)\r\n #fetch the result\r\n return dbi_query.fetch_all\r\nend",
"def prepare record = nil, command\n record ? Statement.new(record, command) : db.prepare(command)\n end",
"def execute_sql(my_sql)\n pg_result = ActiveRecord::Base.connection.execute(my_sql)\n\n # In this example we are just calling #to_a to convert the PG::Result to an\n # Array. PG::Result has a nice API for slicing and dicing itself so you may\n # want to to something clever instead. See\n # https://www.rubydoc.info/gems/pg/PG/Result for details.\n #\n # The important bit here is that we are copying all the data we care about\n # out of the PG::Result in preparation for later clearing the PG::Result\n results = pg_result.to_a\n\n # Calling #clear on the PG::Result is the important bit of cleanup and the\n # whole reason this method exists. See\n # https://www.rubydoc.info/gems/pg/PG/Result#clear-instance_method\n pg_result.clear\n\n yield results if block_given?\n\n results\nend",
"def query_return_array(sql, *binds)\n mysql.fetch(sql, *binds).all\n end",
"def fetch_rows(sql, &block)\n raise NotImplementedError, NOTIMPL_MSG\n end",
"def prepare_explicit_statement(ds, type, vals=OPTS)\n f = ds.opts[:from]\n meth = type == :insert_select ? :returning : :select\n s = ds.opts[meth]\n if f && f.length == 1 && !ds.opts[:join] && (!s || s.empty?)\n ds = ds.send(meth, *columns.map{|c| Sequel.identifier(c)})\n end \n \n prepare_statement(ds, type, vals)\n end",
"def execute2( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n yield result.columns\n result.each { |row| yield row }\n else\n return result.inject( [ result.columns ] ) { |arr,row| arr << row; arr }\n end\n end\n end",
"def run(result)\r\n\t\t\r\n\t\tcolumn_names = Array.new #store the column names\r\n\t\tfields = result.fetch_fields #get all the fields\r\n\t\tfields.each do |field|\r\n\t\t\tcolumn_names << field.name #push a field into the coumn_names\r\n\t\tend\r\n\t\t\r\n\t\trow_count = result.num_rows #get the number of rows in the Mysql::Result\r\n\t\tinitial_data = Array.new #payload holder\r\n\t\t\r\n\t\tresult.data_seek(0) #Seek the cursor to the beginning of the data\r\n\t\twhile row = result.fetch_row\r\n\t\t\tinitial_data << row # add a row to the payload\r\n\t\tend\r\n\t\t\t\t\r\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\r\n\t\tresult = asrecordset\r\n\t\treturn result\r\n\tend",
"def prepare_result; end",
"def getDBValue(connection, query, id1, *id2)\r\n dbi_query = connection.prepare(query)\r\n dbi_query.execute(id1, *id2)\r\n #fetch the result\r\n return dbi_query.fetch\r\nend",
"def run(result)\t\t\n\t\tcolumn_names = result.fields #store the column names\n\t\trow_count = result.num_tuples #get the number of rows in the result\n\t\tinitial_data = Array.new #payload holder\n result.each do |item|\n intial_data << item.to_ary\n end\t\t\n\t\tasrecordset = ASRecordset.new(row_count,column_names,initial_data)\n\t\tresult = asrecordset\n\t\tresults\n\tend",
"def query( sql, *bind_vars, &block ) # :yields: result_set\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute( &block )\n end",
"def query_name(v_quote)\n\n begin\n\n # connect to the database\n conn = PG.connect(dbname: 'test', user: 'something', password: '4321')\n\n # prepare SQL statement\n conn.prepare('q_statement',\n \"select details.id, name, age, quote\n from details\n join quotes on details.id = quotes.details_id\n where quote = $1\")\n\n # execute prepared SQL statement\n rs = conn.exec_prepared('q_statement', [v_quote])\n\n # deallocate prepared statement variable\n conn.exec(\"deallocate q_statement\")\n\n # return array of values returned by SQL statement\n return rs.values[0]\n\n rescue PG::Error => e\n\n puts 'Exception occurred'\n puts e.message\n\n ensure\n\n conn.close if conn\n\n end\n\nend",
"def fetch_rows(sql)\n execute(sql) do |stmt|\n self.columns = cols = stmt.result_fields.map{|c| output_identifier(c)}\n col_count = cols.size\n stmt.each do |result|\n row = {}\n col_count.times{|i| row[cols[i]] = result[i]}\n yield row\n end\n end\n end",
"def query_name(v_name)\n\n begin\n\n # connect to the database\n conn = PG.connect(dbname: 'test', user: 'something', password: '4321')\n\n # prepare SQL statement\n conn.prepare('q_statement',\n \"select details.id, name, age, num_1, num_2, num_3\n from details\n join numbers on details.id = numbers.details_id\n where name = $1\")\n\n # execute prepared SQL statement\n rs = conn.exec_prepared('q_statement', [v_name])\n\n # deallocate prepared statement variable\n conn.exec(\"deallocate q_statement\")\n\n # return array of values returned by SQL statement\n return rs.values[0]\n\n rescue PG::Error => e\n\n puts 'Exception occurred'\n puts e.message\n\n ensure\n\n conn.close if conn\n\n end\n\nend",
"def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end",
"def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end",
"def fetch_rows(sql)\n return cursor_fetch_rows(sql){|h| yield h} if @opts[:cursor]\n execute(sql){|res| yield_hash_rows(res, fetch_rows_set_cols(res)){|h| yield h}}\n end",
"def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end",
"def next_row\n row = []\n case rc = @stmt_api.step\n when ResultCode::ROW\n result_meta.each_with_index do |col, idx|\n value = nil\n column_type = @stmt_api.column_type( idx )\n case column_type\n when DataType::TEXT\n value = @stmt_api.column_text( idx )\n when DataType::FLOAT\n value = @stmt_api.column_double( idx )\n when DataType::INTEGER\n value = @stmt_api.column_int64( idx )\n when DataType::NULL\n value = nil\n when DataType::BLOB\n # if the rowid column is encountered, then we can use an incremental\n # blob api, otherwise we have to use the all at once version.\n if using_rowid_column? then\n value = Amalgalite::Blob.new( :db_blob => SQLite3::Blob.new( db.api,\n col.schema.db,\n col.schema.table,\n col.schema.name,\n @stmt_api.column_int64( @rowid_index ),\n \"r\"),\n :column => col.schema)\n else\n value = Amalgalite::Blob.new( :string => @stmt_api.column_blob( idx ), :column => col.schema )\n end\n else\n raise ::Amalgalite::Error, \"BUG! : Unknown SQLite column type of #{column_type}\"\n end\n\n row << db.type_map.result_value_of( col.schema.declared_data_type, value )\n end\n row.fields = result_fields\n when ResultCode::DONE\n row = nil\n write_blobs\n else\n self.close # must close so that the error message is guaranteed to be pushed into the database handler\n # and we can can call last_error_message on it\n msg = \"SQLITE ERROR #{rc} (#{Amalgalite::SQLite3::Constants::ResultCode.name_from_value( rc )}) : #{@db.api.last_error_message}\"\n raise Amalgalite::SQLite3::Error, msg\n end\n return row\n end",
"def fetch\n row = @result.fetch\n return row unless @bind_result\n row.zip(@bind_result).map do |col, type|\n if col.nil?\n nil\n elsif [Numeric, Integer, Fixnum].include? type\n col.to_i\n elsif type == String\n col.to_s\n elsif type == Float && !col.is_a?(Float)\n col.to_i.to_f\n elsif type == Mysql::Time && !col.is_a?(Mysql::Time)\n if col.to_s =~ /\\A\\d+\\z/\n i = col.to_s.to_i\n if i < 100000000\n y = i/10000\n m = i/100%100\n d = i%100\n h, mm, s = 0\n else\n y = i/10000000000\n m = i/100000000%100\n d = i/1000000%100\n h = i/10000%100\n mm= i/100%100\n s = i%100\n end\n if y < 70\n y += 2000\n elsif y < 100\n y += 1900\n end\n Mysql::Time.new(y, m, d, h, mm, s)\n else\n Mysql::Time.new\n end\n else\n col\n end\n end\n end",
"def all(sql, *args, into: nil, &block)\n raise ArgumentError, \"all no longer support blocks, use each instead.\" if block\n\n rows, pg_source_oid, column_info = each_without_conversion(sql, *args, into: into)\n\n result = convert_rows_to_result rows, into: into, pg_source_oid: pg_source_oid\n\n # [TODO] - resolve associations. Note that this is only possible if the type\n # is not an Array (i.e. into is nil)\n\n result.pagination_scope = sql if sql.is_a?(::Simple::SQL::Connection::Scope) && sql.paginated?\n result.column_info = column_info\n result\n end",
"def select(sql)\n raise(ArgumentError, \"Bad sql parameter\") unless sql.kind_of?(String)\n\n client = ensure_connected\n\n Pod4.logger.debug(__FILE__){ \"select: #{sql}\" }\n query = client.execute(sql)\n\n rows = []\n query.each do |r| \n\n if block_given? \n rows << yield(r)\n else\n rows << r\n end\n\n end\n\n query.cancel \n rows\n\n rescue => e\n handle_error(e)\n end",
"def select_one(stmt, bindvars={})\n sanity_check(stmt)\n row = nil\n execute(stmt, bindvars) do |sth|\n row = sth.fetch\n end\n row\n end",
"def select_one(sql, name = nil) end",
"def select_all(sql, name = nil) end",
"def _select_map_single\n rows = []\n clone(:_sequel_pg_type=>:first).fetch_rows(sql){|s| rows << s}\n rows\n end",
"def prepared_lookup\n # SEQUEL5: Remove\n cached_prepared_statement(:fixed, :lookup){prepare_explicit_statement(filter(prepared_statement_key_array(primary_key)), :first)}\n end",
"def single(sql, values = [])\n r = $db.exec_params(sql, values)\n return nil if r.ntuples == 0\n convert_to_ruby_types(r.first)\nend",
"def exec_query(sql, name = 'SQL', binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n log(expand(sql, args), name) do\n result, rows = @connection.execute(sql, *args) { |cursor| [cursor.fields, cursor.fetchall] }\n if result.respond_to?(:map)\n cols = result.map { |col| col.name } \n ActiveRecord::Result.new(cols, rows)\n else\n result\n end\n end\n end\n end",
"def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end",
"def select_all(stmt, bindvars={}, &p)\n sanity_check(stmt)\n rows = nil\n execute(stmt, bindvars) do |sth|\n if block_given?\n sth.each(&p)\n else\n rows = sth.fetch_all\n end\n end\n return rows\n end",
"def select_rows(sql, name = nil)\r\n rs = ADS.instance.api.ads_execute_direct(@connection, sql)\r\n raise ActiveRecord::StatementInvalid.new(\"#{ADS.instance.api.ads_error(@connection)}:#{sql}\") if rs.nil?\r\n record = []\r\n while ADS.instance.api.ads_fetch_next(rs) == 1\r\n max_cols = ADS.instance.api.ads_num_cols(rs)\r\n result = Array.new(max_cols)\r\n max_cols.times do |cols|\r\n result[cols] = ADS.instance.api.ads_get_column(rs, cols)[1]\r\n end\r\n record << result\r\n end\r\n ADS.instance.api.ads_free_stmt(rs)\r\n return record\r\n end",
"def get_record(param)\n db = Sequel.connect('postgres://username:password@localhost:5432/shorty')\n if param.is_a?(Integer)\n @data = db[:data].limit(param).order(:id.desc).all\n else\n @data = db[:data].filter(:surl => param).first\n end\nend",
"def fetch_rows(sql)\n execute(sql) do |res|\n columns = set_columns(res)\n yield_hash_rows(res, columns) {|h| yield h}\n end\n end",
"def find_by_sql(sql, binds = [], preparable: nil, &block)\n result_set = connection.select_all(sanitize_sql(sql), \"#{name} Load\", binds, preparable: preparable)\n column_types = {}\n message_bus = ActiveSupport::Notifications.instrumenter\n\n payload = {\n record_count: result_set.length,\n class_name: name\n }\n\n message_bus.instrument(\"instantiation.active_record\", payload) do\n result_set.map { |record| instantiate(record, column_types, &block) }\n end\n end",
"def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end",
"def prepare(stmt)\n sanity_check(stmt)\n sth = StatementHandle.new(@handle.prepare(stmt), false, true, @convert_types)\n # FIXME trace sth.trace(@trace_mode, @trace_output)\n sth.dbh = self\n sth.raise_error = raise_error\n\n if block_given?\n begin\n yield sth\n ensure\n sth.finish unless sth.finished?\n end\n else\n return sth\n end\n end",
"def select(sql, name = nil)\n fields, rows = select_raw(sql, name)\n result = []\n for row in rows\n row_hash = {}\n fields.each_with_index do |f, i|\n val = row[i]\n row_hash[f.to_s] = val.respond_to?(:rstrip) ? val.rstrip : val\n end\n result << row_hash\n end\n result\n end",
"def each_without_conversion(sql, *args, into: nil)\n pg_result = exec_logged(sql, *args)\n\n column_info = collect_column_info(pg_result)\n rows = []\n pg_source_oid = nil\n\n if pg_result.ntuples > 0 && pg_result.nfields > 0\n decoder = Decoder.new(pg_result, into: (into ? Hash : nil), column_info: column_info)\n pg_source_oid = pg_result.ftable(0)\n\n pg_result.each_row do |row|\n rows << decoder.decode(row)\n end\n end\n\n [rows, pg_source_oid, column_info]\n ensure\n # optimization: If we wouldn't clear here the GC would do this later.\n pg_result.clear if pg_result && !pg_result.autoclear?\n end",
"def select(sql, name = nil, binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n #\n # => theSql = sql.gsub(/\"/, '')\n # Added by Karl Kloppenborg, see commit log for details\n # \n theSql = sql.gsub(/\"/, '')\n log(expand(theSql, args), name) do\n @connection.query(:hash, theSql, *args)\n end\n end\n end",
"def rows\n @rows ||= if ActiveRecord::Base.connection.adapter_name == \"PostgreSQL\"\n result.entries\n else\n [].tap do |row_hashes|\n result.entries.map do |row|\n hash = {}\n result.fields.each do |field|\n hash[field] = row[result.fields.index(field)]\n end\n row_hashes << hash\n end\n end\n end\n end",
"def prepare(type, name=nil, *values)\n ps = to_prepared_statement(type, values)\n ps.extend(JDBC::Dataset::PreparedStatementMethods)\n ps.extend(::Sequel::Fdbsql::DatasetMethods::PreparedStatementMethods)\n if name\n ps.prepared_statement_name = name\n db.set_prepared_statement(name, ps)\n end\n ps\n end",
"def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end",
"def execute(stmt, bindvars={})\n sanity_check(stmt)\n\n if @convert_types\n bindvars = DBI::Utils::ConvParam.conv_param(driver_name, bindvars)\n end\n\n sth = StatementHandle.new(@handle.execute(stmt, bindvars), true, true, @convert_types, true)\n # FIXME trace sth.trace(@trace_mode, @trace_output)\n sth.dbh = self\n sth.raise_error = raise_error\n\n if block_given?\n begin\n yield sth\n ensure\n sth.finish unless sth.finished?\n end\n else\n return sth\n end\n end",
"def get_records(params, columns)\n []\n end",
"def ask(sql, *args, into: nil)\n catch(:ok) do\n each(sql, *args, into: into) { |row| throw :ok, row }\n nil\n end\n end",
"def fetch(sql, *params)\n rs = self.execute(sql, *params)\n self.execute(\"flush privileges\") # Always flush in case user wants to alter users\n return [] if self.interpreter.preview? && ! rs\n return rs.fetch_all rescue nil\n end",
"def select(db); end",
"def select(db); end",
"def prepare_statement(ds, type, vals=OPTS)\n ds.clone(:log_sql=>true).prepare(type, :\"smpsp_#{NEXT.call}\", vals)\n end",
"def select(sql, name = nil, binds = [])\n fields, rows = select_raw(sql, name)\n rows.map do |row|\n Hash[*fields.zip(row).flatten]\n end\n end",
"def retrieve( query, parameters = [] )\n @adapter.plan_query(query).execute(@connection, parameters) do |row|\n yield(Tuple.new(row))\n end\n end",
"def execute_and_clear(sql, name, binds)\n ret = nil\n if sql.include? \"SELECT \\\"users\\\".* FROM \\\"users\\\"\" and sql.include? 'LIMIT'\n logger.debug \"Returning in-memory users\"\n # instrumentation is inserted at #log, so we fake the call here\n log(sql, name, binds) { io_sleep }\n count = sql.scan(/LIMIT\\s(\\d+)/).last.last.to_i\n ret = ActiveRecord::Result.new(users[:cols],users[:rows][0..(count-1)])\n elsif sql.include? \"SELECT \\\"cities\\\".* FROM \\\"cities\\\"\" and sql.include? 'LIMIT'\n logger.debug \"Returning in-memory cities\"\n # instrumentation is inserted at #log, so we fake the call here\n log(sql, name, binds) { io_sleep } \n count = sql.scan(/LIMIT\\s(\\d+)/).last.last.to_i\n ret = ActiveRecord::Result.new(cities[:cols],cities[:rows][0..(count-1)])\n else\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n ret = yield result\n result.clear\n end\n ret\n end",
"def select(sql, name = nil)\n @connection.context.reset\n log(sql, name) do\n if normal_select?\n # If limit is not explicitly set, return all results.\n @logger.debug \"Setting row count to (#{@limit || 'off'})\" if @logger\n\n # Run a normal select\n @connection.set_rowcount(@limit || 0)\n @connection.sql(sql)\n else\n # Select into a temp table and prune results\n @logger.debug \"Selecting #{@limit + (@offset || 0)} or fewer rows into #artemp\" if @logger\n @connection.set_rowcount(@limit + (@offset || 0))\n @connection.sql_norow(sql) # Select into temp table\n @logger.debug \"Deleting #{@offset || 0} or fewer rows from #artemp\" if @logger\n @connection.set_rowcount(@offset || 0)\n @connection.sql_norow(\"delete from #artemp\") # Delete leading rows\n @connection.set_rowcount(0)\n @connection.sql(\"select * from #artemp\") # Return the rest\n end\n end\n\n rows = []\n if @connection.context.failed? or @connection.cmd_fail?\n raise StatementInvalid, \"SQL Command Failed for #{name}: #{sql}\\nMessage: #{@connection.context.message}\"\n else\n results = @connection.top_row_result\n if results && results.rows.length > 0\n fields = fixup_column_names(results.columns)\n results.rows.each do |row|\n hashed_row = {}\n row.zip(fields) { |cell, column| hashed_row[column] = cell }\n rows << hashed_row\n end\n end\n end\n @connection.sql_norow(\"drop table #artemp\") if !normal_select?\n @limit = @offset = nil\n return rows\n end",
"def create_result_rec(query_type, filter, result_struct, tbl_rec, rec)\r\n # If this isn't a select query or if it is a select query, but\r\n # the table record class is simply a Struct, then we will use\r\n # a Struct for the result record type.\r\n if query_type != :select\r\n result_rec = result_struct.new(*filter.collect { |f|\r\n tbl_rec.send(\"#{f}_upd_res\".to_sym) })\r\n elsif @record_class == 'Struct'\r\n result_rec = result_struct.new(*filter.collect do |f|\r\n if tbl_rec.send(f).kb_nil?\r\n nil\r\n else\r\n tbl_rec.send(f)\r\n end\r\n end)\r\n else\r\n if Object.full_const_get(@record_class).respond_to?(:kb_create)\r\n result_rec = Object.full_const_get(@record_class\r\n ).kb_create(*@field_names.collect do |f|\r\n # Just a warning here: If you specify a filter on\r\n # a select, you are only going to get those fields\r\n # you specified in the result set, EVEN IF\r\n # record_class is a custom class instead of Struct.\r\n if filter.include?(f)\r\n if tbl_rec.send(f).kb_nil?\r\n nil\r\n else\r\n tbl_rec.send(f)\r\n end\r\n else\r\n nil\r\n end\r\n end)\r\n elsif Object.full_const_get(@record_class).respond_to?(\r\n :kb_defaults)\r\n result_rec = Object.full_const_get(@record_class).new(\r\n *@field_names.collect do |f|\r\n if tbl_rec.send(f).kb_nil?\r\n nil\r\n else\r\n tbl_rec.send(f) || Object.full_const_get(\r\n @record_class).kb_defaults[@field_names.index(f)]\r\n end\r\n end)\r\n else\r\n result_rec = Object.full_const_get(@record_class).allocate\r\n @field_names.each do |fn|\r\n if tbl_rec.send(fn).kb_nil?\r\n result_rec.send(\"#{fn}=\", nil)\r\n else\r\n result_rec.send(\"#{fn}=\", tbl_rec.send(fn))\r\n end\r\n end\r\n end\r\n end\r\n\r\n unless query_type == :select\r\n result_rec.fpos = rec[-2]\r\n result_rec.line_length = rec[-1]\r\n end\r\n return result_rec\r\n end",
"def select_prepared(plan_name, *args)\n # {{{\n args_string = ''\n if args.to_s != '' && args.length > 0 then \n args_string = \"(#{args.flatten.map { |a| \"'#{a}'\" }.join(',')})\" \n end\n query_string = \"EXECUTE #{plan_name.to_s} #{args_string}; \"\n return select_cached(query_string)\n end",
"def multiple(sql, values = [])\n r = $db.exec_params(sql, values)\n return [] if r.ntuples == 0\n r.map { |row| convert_to_ruby_types(row) }\nend",
"def pull_records(value)\n begin\n column = match_column(value) # determine which column contains the specified value\n unless column == \"\"\n results = [] # array to hold all matching hashes\n conn = open_db()\n query = \"select *\n from details\n join numbers on details.id = numbers.details_id\n join quotes on details.id = quotes.details_id\n where \" + column + \" ilike $1\n order by name\"\n conn.prepare('q_statement', query)\n rs = conn.exec_prepared('q_statement', [\"%\" + value + \"%\"])\n conn.exec(\"deallocate q_statement\")\n rs.each { |result| results.push(result) }\n return results\n else\n return [{\"quote\" => \"No matching record - please try again.\"}]\n end\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\nend",
"def execute_all( sql ) # :yields: row\n loop do\n stmt = prepare( sql )\n stmt.execute do |result|\n result.each { |row| yield row if block_given? }\n end\n sql = stmt.remainder\n if sql.length > 0\n yield nil if block_given? # notify of new query starting\n else\n break\n end\n end\n end",
"def get_entry(first_name, last_name)\n begin\n conn = open_db()\n query = \"select * from listings where fname = $1 and lname = $2\"\n conn.prepare('q_statement', query)\n user_hash = conn.exec_prepared('q_statement', [first_name, last_name])\n conn.exec(\"deallocate q_statement\")\n user_hash.to_a.size > 0 ? (return user_hash[0]) : (return {})\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\nend",
"def selects_all_female_bears_return_name_and_age\n <<-SQL \n SELECT \n bears.name, \n bears.age \n FROM bears \n WHERE sex='F';\n SQL\nend",
"def sql_literal(*)\n @dataset.sql\n end",
"def grab_rows(field, src_table_name = TABLE_NAME, num_rows = ROWS_PER_TRANSACTION)\n LOGGER.info \"Creating select statement based on field `#{field[:name]}` (#{field[:type]})\"\n \n if !(field[:type] =~ /int/).nil?\n LOGGER.info \"Using integer type for select.\"\n sql = \"SELECT * FROM `%s` WHERE `%s` >= '%s' AND `%s` < '%s' ORDER BY `%s` LIMIT %s;\" % [ Mysql::escape_string(src_table_name), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:min].to_i.to_s), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:max].to_i.to_s), \n Mysql::escape_string(field[:name]), \n num_rows]\n elsif !(field[:type] =~ /datetime/).nil?\n LOGGER.info \"Using datetime type for select.\" \n sql = \"SELECT * FROM `%s` WHERE `%s` >= '%s' AND `%s` < '%s' ORDER BY `%s` LIMIT %s;\" % [ Mysql::escape_string(src_table_name), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:min].strftime(MYSQL_DATETIME_FORMAT)), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:max].strftime(MYSQL_DATETIME_FORMAT)), \n Mysql::escape_string(field[:name]), \n num_rows]\n else\n LOGGER.info \"Using default type for select, this isn't expected.\"\n sql = \"SELECT * FROM `%s` WHERE `%s` >= '%s' AND `%s` < '%s' ORDER BY `%s` LIMIT %s;\" % [ Mysql::escape_string(src_table_name), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:min]), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:max]), \n Mysql::escape_string(field[:name]), \n num_rows] \n end\n \n LOGGER.debug \"SQL: #{sql}\"\n dbres = do_sql_command(sql)\n dbres\nend",
"def build_result(columns:, rows:, column_types: {})\n ActiveRecord::Result.new(columns, rows, column_types)\n end",
"def execute(*values)\n raise ClientError, \"not prepared\" unless @param_count\n raise ClientError, \"parameter count mismatch\" if values.length != @param_count\n values = values.map{|v| @mysql.charset.convert v}\n @protocol.synchronize do\n begin\n @sqlstate = \"00000\"\n @protocol.reset\n @protocol.send_packet Protocol::ExecutePacket.new(@statement_id, CURSOR_TYPE_NO_CURSOR, values)\n res_packet = @protocol.read_result_packet\n raise ProtocolError, \"invalid field_count\" unless res_packet.field_count == @fields.length\n @fieldname_with_table = nil\n if res_packet.field_count == 0\n @affected_rows, @insert_id, @server_status, @warning_conut =\n res_packet.affected_rows, res_packet.insert_id, res_packet.server_status, res_packet.warning_count\n return nil\n end\n @fields = Array.new(res_packet.field_count).map{Field.new @protocol.read_field_packet}\n @protocol.read_eof_packet\n return StatementResult.new(@mysql, @fields)\n rescue ServerError => e\n @sqlstate = e.sqlstate\n raise\n end\n end\n end",
"def execute_prepared(sql,params_arr)\n prepared_statement = @database_handle.prepare(sql)\n params_arr.each_with_index do |param,index|\n prepared_statement.bind_param(index+1,param)\n end \n prepared_statement.execute\n end",
"def next\n return nil if @eof\n\n @stmt.must_be_open!\n\n unless @first_row\n result = @driver.step( @stmt.handle )\n check result\n end\n\n @first_row = false\n\n unless @eof\n row = []\n @driver.data_count( @stmt.handle ).times do |column|\n case @driver.column_type( @stmt.handle, column )\n when Constants::ColumnType::NULL then\n row << nil\n when Constants::ColumnType::BLOB then\n row << @driver.column_blob( @stmt.handle, column )\n else\n row << @driver.column_text( @stmt.handle, column )\n end\n end\n\n if @db.type_translation\n row = @stmt.types.zip( row ).map do |type, value|\n @db.translator.translate( type, value )\n end\n end\n\n if @db.results_as_hash\n new_row = Hash[ *( @stmt.columns.zip( row ).flatten ) ]\n row.each_with_index { |value,idx| new_row[idx] = value }\n row = new_row\n else\n row.extend FieldsContainer unless row.respond_to?(:fields)\n row.fields = @stmt.columns\n end\n\n row.extend TypesContainer\n row.types = @stmt.types\n\n return row\n end\n\n nil\n end",
"def select(*) end",
"def save()\n db = PG.connect({\n dbname: 'houses',\n host: 'localhost'\n })\n\nsql = \"INSERT INTO houses\n(address, value, num_bedrooms, year) VALUES\n($1, $2, $3, $4) RETURNING *\"\nvalues = [@address, @value, @num_bedrooms, @year]\ndb.prepare(\"save\", sql)\nresult = db.exec_prepared(\"save\", values)\n@id = result[0]['id'].to_i()\n\ndb.close()\nend",
"def prepare(*args)\n ps = super\n ps.extend(::Sequel::Postgres::DatasetMethods::PreparedStatementMethods)\n ps\n end",
"def execute( *bind_vars )\n reset! if active? || done?\n\n bind_params(*bind_vars) unless bind_vars.empty?\n @results = ResultSet.new(@connection, self)\n\n step if 0 == column_count\n\n yield @results if block_given?\n @results\n end",
"def cached_prepared_statement(type, subtype)\n h = @prepared_statements[type]\n Sequel.synchronize do\n if v = h[subtype]\n return v\n end\n end\n ps = yield\n Sequel.synchronize{h[subtype] = ps}\n end",
"def association_prepared_statement(opts, assoc_bv)\n return unless model.cache_associations\n ps = opts.send(:cached_fetch, :prepared_statement) do\n unless opts[:instance_specific]\n ds, bv = _associated_dataset(opts, {}).unbind\n\n f = ds.opts[:from]\n if f && f.length == 1\n s = ds.opts[:select]\n if ds.opts[:join]\n if opts.eager_loading_use_associated_key? && s && s.length == 1 && s.first.is_a?(SQL::ColumnAll)\n table = s.first.table\n ds = ds.select(*opts.associated_class.columns.map{|c| Sequel.identifier(c).qualify(table)})\n end\n elsif !s || s.empty?\n ds = ds.select(*opts.associated_class.columns.map{|c| Sequel.identifier(c)})\n end\n end \n \n if bv.length != assoc_bv.length\n h = {}\n bv.each do |k,v|\n h[k] = v unless assoc_bv.has_key?(k)\n end\n ds = ds.bind(h)\n end\n ds.clone(:log_sql=>true).prepare(opts.returns_array? ? :select : :first, :\"smpsap_#{NEXT.call}\")\n end\n end\n\n if ps && @server && _associated_objects_use_same_server?\n ps = ps.server(@server)\n end\n\n ps\n end",
"def sql\n @stmt_api.sql\n end",
"def select_rows(sql, name = nil)\n raise NotImplementedError, \"select_rows is an abstract method\"\n end",
"def set_values_from(result)\n @arguments = Arguments.new(result[0]['arguments'])\n @return_type = result[0]['return_type']\n @query = \"SELECT * FROM %s.%s(%s)\" % [\n quoted_schema,\n quoted_name,\n @arguments.to_params\n ]\n end",
"def find(record_id)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects.first \n end",
"def test_multi_results\n rows = @connection.select_rows(\"CALL ten();\")\n assert_equal 10, rows[0][0].to_i, \"ten() did not return 10 as expected: #{rows.inspect}\"\n\n assert @connection.active?, \"Bad connection use by '#{@connection.class}.select_rows'\"\n end",
"def execute_scalar( sql )\r\n resultset = execute( sql )\r\n return nil unless resultset.rowcount > 0\r\n raise InvalidOperationException.new( \"excecute_scalar can not return multiple rows\" ) if resultset.rowcount > 1\r\n return resultset.rows.first.send( resultset.columns.first.name.to_sym )\r\n end",
"def exec_query(sql, name = 'SQL', _binds = [], prepare: false)\n log(sql, name) do\n result = @connection.run(sql)\n ActiveRecord::Result.new(result.columns, result.rows)\n end\n end",
"def to_prepared_statement(type, values=nil, opts=OPTS)\n mods = opts[:extend] || []\n mods += [PreparedStatementMethods]\n\n bind.\n clone(:prepared_statement_name=>opts[:name], :prepared_type=>type, :prepared_modify_values=>values, :orig_dataset=>self, :no_cache_sql=>true, :prepared_args=>@opts[:prepared_args]||[]).\n with_extend(*mods)\n end"
] |
[
"0.7207686",
"0.6693692",
"0.65496325",
"0.650941",
"0.6464795",
"0.64276296",
"0.6404037",
"0.6259019",
"0.62388533",
"0.6222753",
"0.6214135",
"0.6198562",
"0.61803573",
"0.61758167",
"0.6169054",
"0.6152983",
"0.61445665",
"0.611187",
"0.61068547",
"0.6091655",
"0.6085752",
"0.60839665",
"0.608124",
"0.6055386",
"0.60480684",
"0.6032981",
"0.60202307",
"0.60191286",
"0.60163826",
"0.6006672",
"0.5993101",
"0.5976565",
"0.59121054",
"0.5902666",
"0.5882416",
"0.5867488",
"0.5857628",
"0.58430064",
"0.5832729",
"0.5829238",
"0.582644",
"0.58263373",
"0.5825958",
"0.5816682",
"0.58125675",
"0.5812472",
"0.58093023",
"0.5806753",
"0.58017117",
"0.5799766",
"0.5792565",
"0.5788117",
"0.5781823",
"0.57812554",
"0.5780645",
"0.5775392",
"0.5752433",
"0.5733103",
"0.5726226",
"0.56934476",
"0.566462",
"0.56639344",
"0.5656129",
"0.56551796",
"0.56441855",
"0.5594392",
"0.5593536",
"0.5593536",
"0.5589381",
"0.55860555",
"0.5585629",
"0.5582522",
"0.55589265",
"0.5555266",
"0.55487907",
"0.5533206",
"0.55291814",
"0.552692",
"0.5517801",
"0.551748",
"0.5515271",
"0.55096984",
"0.55090755",
"0.54904056",
"0.5487011",
"0.5479078",
"0.54735774",
"0.5472466",
"0.546807",
"0.546611",
"0.54485923",
"0.54472166",
"0.5445056",
"0.54415846",
"0.54413134",
"0.5438191",
"0.54314566",
"0.54295206",
"0.54217565",
"0.54197496"
] |
0.585943
|
36
|
What is the smallest positive number that is evenly divisible(divisible with no remainder) by all of the numbers from 1 to N? SOLUTION:
|
def is_prime?(num)
return true if num == 1 || num == 2
return false if num % 2 == 0
int = 3
while int <= Math::sqrt(num)
return false if num % int == 0
int += 2
end
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def smallest_divisible_by_all_v2(range)\n return (range).inject(1) do |result, n| \n result.lcm n\n end\nend",
"def smallest_multiple(n)\r\n dividers = (1..n)\r\n dividers.reduce(:lcm)\r\nend",
"def min_divisible_by_all(num)\r\n (1..num).inject(:lcm)\r\nend",
"def smallest(n)\n\tdivisible = false\n\tstart = 1\n\n\tuntil divisible == true\n\t\t(1...n).each do |i|\n\t\t\tif start % i != 0\n\t\t\t\tdivisible = false\n\t\t\telse\n\t\t\t\tdivisible = true\n\t\t\tend \n\t\t\tif divisible == false\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tstart += 1\n\tend\n\tp start - 1\nend",
"def smallest_common_multiple(n)\n\n\treturn 0\nend",
"def smallest_multiple(n)\n m = 1\n while true\n n.downto(1) do |i|\n if (m % i != 0)\n break\n end\n if (i==1)\n return m\n end\n end\n m += 1\n end\nend",
"def find_min_num(num)\n return 1 if num == 1\n n = 2\n minimum_num = nil\n loop do\n minimum_num = n if divisors(n).flatten.uniq.size == num\n n += 1\n break if minimum_num\n end\n minimum_num\nend",
"def smallest_multiple(top_divisor)\n num = 1\n loop do\n return num if top_divisor.downto(1).all? { |divisor| num % divisor == 0 }\n num += 1\n end\nend",
"def solution(n)\n lowest_p = nil\n a = 1\n\n while a * a <= n\n if n % a == 0\n b = n / a\n current_p = 2 * (a + b)\n\n if !lowest_p || current_p < lowest_p\n lowest_p = current_p\n end\n end\n\n a += 1\n end\n\n lowest_p\nend",
"def smallest_multiple(num)\n\t(2..num).inject(1) do |mul, i|\n\t\tif mul%i == 0\n\t\t\tmul\n\t\telse\n\t\t\t(i-1).downto(2) do |j| \n\t\t\t\tif i%j == 0\n\t\t\t\t\ti /= j\n\t\t\t\t\tbreak \n\t\t\t\tend\n\t\t\tend\n\t\t\tmul *= i\n\t\tend\n\tend\nend",
"def solution(n)\n number = 1\n stop = false\n while !stop\n results = []\n (1..n).each do |divider| \n if number % divider != 0\n results << false\n else\n results << true\n end\n end\n if results.count {|x| x == false } > 0\n stop = false\n number += 1\n else \n stop = true\n end \n end\n number\nend",
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def find_smallest_multiple(divisors)\n max_product = divisors.reduce(1,:*)\n smallest = 1\n while smallest < max_product\n return smallest if check_divisibility(smallest, divisors)\n smallest += 1\n end\n max_product\nend",
"def smallest_multiple(input)\n\trange = (1..input)\n\trange.each do |num|\n\t\trunning_total = num\n\t\t\tif running_total % num != 0\n\t\t\t\trunning_total = num * running_total\n\t\t\telse\n\t\t\t\trunning_total\n\t\t\tend\n\tend\nend",
"def perfects (n)\n return (1..n).select { |x| x==(1...x).select { |i| x%i==0 }.inject(:+) }\nend",
"def divisors(n)\n (1.upto(n ** 0.5).select { |d| (n % d).zero? }.size * 2) - 1\nend",
"def smallest_multiple(max)\n\tcurrent_num = 1\n\tsolved = false\n\twhile solved == false do\n\t\t(1..max).to_a.reverse.each do |num|\n\t\t\tif current_num % num != 0\n\t\t\t\tcurrent_num += 1\n\t\t\t\tsolved = false\n\t\t\t\tbreak\n\t\t\tend #if no remainder\n\t\t\tsolved = true\n\t\tend #each\n\tend # while\n\treturn current_num\nend",
"def smallest_multiple(num)\n\n curr = num\n\n loop do\n state = true\n for i in num.downto(1)\n if curr % i != 0\n state = false\n break\n end\n end\n if state == true\n return curr\n else\n curr += num\n end\n end\n\nend",
"def d(n)\n divisors = (1...n).select{ |i| n % i == 0 }\n divisors.reduce(&:+)\nend",
"def divisible_numbers(arr)\n n = arr.size\n (0...n).each do |x|\n a = arr[x]\n ((x+1)...n).each do |y|\n b = arr[y]\n z = [a,b].sort\n return z if z[1] % z[0] == 0\n end\n end\nend",
"def divisors(n)\n results = []\n max = Math.sqrt(n).floor\n (1..(max)).each do |div|\n # next if results.include?(div)\n x, y = n.divmod(div)\n results << x << div if y == 0\n end\n results.uniq.sort\nend",
"def smallest_multiple(input)\n range = (1..input)\n range.reduce(:lcm)\nend",
"def sum_divisors(n)\r\n (1...n).select { |x| (n % x).zero? }.sum - 1\r\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def smallest_multiple\n start_num = 20\n final_num = false\n while !final_num\n is_divisible = true\n (1...20).each do | num |\n remainder = start_num % num\n if remainder != 0\n is_divisible = false\n break\n end\n end\n is_divisible ? final_num = start_num : start_num += 20\n end\n return final_num\nend",
"def smallest_multiple(values)\n max = values.reduce(:*)\n min_step = values.select { |v| v.prime? }.reduce(:*)\n min = min_step\n\n (min..max).step(min).find { |n|\n values.select { |v| n % v != 0 }.empty?\n }\nend",
"def find_smallest_number(largest_divisor)\n smallest = largest_divisor\n found = false\n while !found\n found = true \n largest_divisor.downto(1) do |i| \n if smallest % i != 0\n smallest += largest_divisor\n found = false\n break\n end\n end\n end\n smallest\nend",
"def least_common_multiple(num_1, num_2)\n max = (num_1 * num_2) \n (1..max).each do |n|\n if n % num_1 == 0 && n % num_2 == 0 \n return n\n end\n end\nend",
"def smallest_multiple(ceiling)\n count = ceiling\n\n loop do\n count += ceiling\n divisible = true\n\n ceiling.downto(1) do |num|\n if count % num != 0\n divisible = false\n next\n end\n end\n\n return count if divisible\n end\nend",
"def proper_divisors n\n if (n < 2)\n return []\n end\n\n r = Math.sqrt(n)\n p = (r - 1).ceil\n d = (2..p).collect { |x| [x, n/x] if n % x == 0 }.compact.flatten\n if (r == r.floor)\n d.concat([r.floor])\n end\n return d.concat([1])\nend",
"def multiple_of(n, x)\n x.modulo(n).zero?\n end",
"def smallestMultiple a, b, start = 1\n \n # use start = 2520 for finding the solution in range [1,20]\n\tstart.step((Float::MAX).to_i) do |n| \n\t\tflag = (a..b).inject(true) do |flag, elem|\n\t\t\tflag &= (n % elem == 0)\n\t\t\tbreak if !flag\n\t\t\tflag\n\t\tend\t\n\t\treturn n if flag\n\tend\n\treturn -1\nend",
"def find_lcm(n)\n (1..n).reduce(:lcm)\nend",
"def find_min_prime_factor (n)\n # Find the minimum prime factor from 2 to √n.\n # If no element does, return nil.\n 2.upto(Math.sqrt(n)).lazy.select { |i| (n % i).zero? }.first\nend",
"def p5\n\tdivisors = (1..20).to_a\n\tnum = divisors[-1]\n\tloop do\n\t\tbreak if divisible?(num, divisors)\n\t\tnum += divisors[-1]\n\tend\n\treturn num\nend",
"def howDivisible(val)\n\t#halfPower = val ** 0.5\n\t#halfPower.round()\n\t2.upto(21) do |x|\n\t\treturn x - 1 if(val % x != 0)\n\tend\n\t \n\treturn 21\nend",
"def divisible_by_remaining_odd_numbers?(n)\n potential_divisors = (3..Math.sqrt(n)).step(2).to_a\n divisible = false\n potential_divisors.each do |x|\n if n % x != 0\n potential_divisors.delete_if { |y| y % x == 0 }\n else\n divisible = true\n potential_divisors = []\n end\n end\n\n divisible\n\nend",
"def least_common_multiple(num_1, num_2)\n larger_num = [num_1, num_2].max\n smaller_num = [num_1, num_2].min\n i = 1\n done = false\n until done\n if (i * larger_num) % smaller_num == 0\n answer = i * larger_num\n done = true\n end\n i += 1\n end\n answer\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend",
"def abund? n\n arr = []\n tail = Math.sqrt n\n (1..tail).each do |x|\n if n % x == 0\n arr << x\n arr << n/x\n end\n arr.pop if x*x == n\n end\n n < arr.sum\nend",
"def divisors(n)\n divs = []\n # NOT INCLUDING ITSELF\n (1...n).each do |i|\n if n % i == 0\n divs << i\n end\n end\n divs\nend",
"def smallest_multiple(n)\n def get_prime_factors(n, factors=[])\n return n if n.prime?\n \n Prime.first(n).each do |prime|\n if n % prime == 0\n factors << prime\n n /= prime\n break\n end\n end\n \n \n factors + [get_prime_factors(n)].flatten\n end\n \n def get_highest_exponents(n, factors=[])\n (2..n).each do |m|\n if get_prime_factors(m).is_a? Array\n factors << get_prime_factors(m)\n else\n factors << [m]\n end\n end\n \n highest = []\n Prime.first(n).select { |p| p < n }.each do |factor|\n highest << factors.sort_by { |f| f.count(factor) }[-1].select { |num| num == factor }\n end\n \n \n highest.flatten\n end\n\n\n get_highest_exponents(n).reduce(:*)\nend",
"def divisors(n)\n current_num = 1\n divs = []\n loop do\n result = n.divmod(current_num)\n return divs.uniq.sort if result[0] < current_num\n divs.concat([result[0], current_num]) if result[1].zero?\n current_num += 1\n end\nend",
"def least_common_multiple(num_1, num_2)\n (1...num_1 * num_2).each do |num|\n if num % num_1 == 0 && num % num_2 == 0\n return num\n end\n end\nend",
"def smallestMult()\n (2520...999999999).step(20) do |i|\n if divisionCheck(i)\n return i\n end\n end\nend",
"def least_common_multiple(num_1, num_2)\n value = [num_1, num_2].max\n while (value % num_1 != 0) || (value % num_2 != 0)\n value += 1\n end\n return value\nend",
"def nth_ugly_number(n, a, b, c)\n# a-b, a-c, b-c, ab-c\n ab_lcm = a.lcm(b) # there are some a present in b\n ac_lcm = a.lcm(c) # there are some a present in c\n bc_lcm = b.lcm(c) # there are some b present in c\n abc_lcm = ab_lcm.lcm(c) # there are some a*b in c (because c is the biggest)\n \n # using set theory for binary search\n # a + b + c - ab_lcm - ac_lcm - bc_lcm + abc_lcm\n (1..2*10**9).bsearch{|x| x/a + x/b + x/c - x/ab_lcm - x/ac_lcm - x/bc_lcm + x/abc_lcm >= n}\nend",
"def perfects (n)\n return (1..n).select {| x | factors(x).uniq.sum / 2 == x}\nend",
"def least_common_multiple(num_1, num_2)\n number = 1\n while ((number % num_1 != 0) || (number % num_2 != 0))\n number +=1\n end\n number\nend",
"def smallest_number()\r\n\tprime_numbers = [19,17,13,11,7,5,3,2] # primes numbers from 0-20.\r\n\tproduct_prime = prime_numbers.reduce(:*)\r\n\tnumber = product_prime\r\n\twhile (1)\r\n\t\treturn number if divisible_1to20?(number)\r\n\t\tnumber += product_prime\r\n\tend\r\nend",
"def smallest_multiple\n (1..20).reduce(&:lcm)\nend",
"def divisors(n)\n divisors_found = []\n (1..n).each do |i|\n divisors_found << i if n % i == 0\n end\n divisors_found.uniq.sort\nend",
"def d(n)\r\n proper_divisors(n).reduce(:+)\r\nend",
"def perfect_num?(n)\n if n == 1\n return \"deficient\"\n end\n div_array = []\n (1...n).each do |x|\n if n % x == 0\n div_array << x\n end\n end\n sum = div_array.inject(:+)\n if sum < n\n return \"deficient\"\n elsif sum == n\n return \"perfect\"\n else\n return \"abundant\"\n end\nend",
"def solve( n = 100 )\n n.partition_sieve[-1] - 1\n end",
"def find_smallest_multiple(num,count,acc)\n if count == max\n return acc\n #if number is divisible by one last than the number\n elsif !check_a_num(num,count)\n acc*num\n return check_a_num(num,count)\n \n \n end\n puts num\nend",
"def least_common_multiple(num_1, num_2)\n # return [num_1, num_2].max if num_1 % num_2 == 0 || num_2 % num_1 == 0\n m = num_1\n while true\n return m if m % num_1 == 0 && m % num_2 == 0\n m += num_1\n end\nend",
"def least_product(num)\n m = 2\n 2.upto(num) do |n|\n m = m.lcm(n)\n end\n return m\nend",
"def least_common_multiple(num_1, num_2)\n greatest = num_1 * num_2\n common_multiple = (2..greatest).select {|multiplo| multiplo % num_1 == 0 && multiplo % num_2 == 0}\n return common_multiple.first\n\nend",
"def first_triangle_number_with_divisors_of(num)\n\tcount = 0\n\ti = 0\n\tsum = 0\n\tuntil count >= num do\n\t\ti += 1\n\t\tsum += i\n\t\tcount = divisor_number_of(sum)\n\tend\n\tsum\nend",
"def solution(n)\n min_perimeter = 2 * (1 + n)\n limit = Math.sqrt(n).floor\n (2..limit).each { |a|\n if n % a == 0\n b = n / a\n min_perimeter = [min_perimeter, 2 * (a + b)].min\n end\n }\n min_perimeter\nend",
"def smallest_multiple(max_range)\n\tnumber = max_range\n\tcounter = 1\n\twhile counter != max_range\n\t\tcounter = 1\n\t\t(2..max_range).each do |i|\n\t\t\tif number % i == 0\n\t\t\t\tcounter += 1\n\t\t\tend\n\t\tend\n\t\tnumber += max_range\n\tend\n\n\tnumber - max_range\nend",
"def d(n)\n (2..Math.sqrt(n)).inject(1){|s, i| n % i == 0 ? s + i + n/i : s}\nend",
"def divisible_by(numbers, divisor)\n numbers.find_all { |i| (i % divisor).zero? }\nend",
"def compute\n n = 600851475143\n\n while true\n p = smallest_prime_factor(n)\n\n if p < n\n n /= p\n else\n return n\n end\n end\nend",
"def ideal_numbers(n)\n # perfects = []\n # factors = proper_factors(n)\n\n # while perfects.length <= n \n # factors.each do |factor|\n # sum = aliquot_sum(n)\n \n # if factor == perfect_number?(factor)\n # perfects << factor\n # end \n # end \n # end\n\n perfect_nums = []\n\n i = 1\n while perfect_nums.length < n \n perfect_nums << i if perfect_number?(i)\n i += 1\n end \n\n perfect_nums\nend",
"def problem5(n)\n\tnum = n * 2\n\twhile not divisible?(num, n)\n\t\tnum += n\n\tend\n\tnum\nend",
"def least_common_multiple(num_1, num_2)\n multiple = 1\n multiple += 1 until multiple % num_1 == 0 && multiple % num_2 == 0\n multiple\nend",
"def divisors(n)\n return (1..n/2).select { |i| (n % i) == 0 }\nend",
"def find_smallest_common_multiple(num)\n\tprimes = find_primes_under(num)\n\tproduct = factorial(num)\n\tcounter = 0\n\twhile counter < primes.size\n\t\twhile check_number(num, product)\n\t\t\tproduct = product / primes[counter]\n\t\tend\n\t\tproduct = product * primes[counter]\n\t\tcounter += 1\n\tend\n\tproduct\nend",
"def leastCommonMultiple( factors )\n return nil if factors.include?( 0 )\n\n maxFactor = 1\n minFactor = 1\n factorial = 1\n\n factors.each do | factor |\n maxFactor = factor if factor > maxFactor\n minFactor = factor if factor < minFactor\n factorial *= factor\n end\n\n Range.new( minFactor * minFactor, factorial ).each do | multiple |\n foundMultiple = true\n\n factors.each do | factor |\n if multiple % factor != 0\n foundMultiple = false\n break\n end\n end\n\n if foundMultiple == true\n return multiple\n end\n\n foundMultiple = true\n end\nend",
"def least_common_multiple(num_1, num_2)\n (1..num_1 * num_2).each do |el|\n return el if el % num_1 == 0 && el % num_2 == 0\n end\nend",
"def smallest_multiple(limit)\n powers_arr = largest_power(limit).slice(1..-1)\n start = largest_power(limit).shift\n answer = powers_arr.inject { |a, e| a * e }\n\n (start + 1..limit).each do |i|\n answer *= i if prime?(i)\n end\n puts answer\nend",
"def least_common_multiple(num_1, num_2)\n match = false \n n = 0\n while !match \n n += 1\n if n % num_1 == 0 && n % num_2 == 0\n match = true \n end \n end \n n \n\nend",
"def smallest_multiple\n results = []\n values = (1..300000000).to_a\n\n values.each do |value|\n if value % 20 == 0 &&\n value % 19 == 0 &&\n value % 18 == 0 &&\n value % 17 == 0 &&\n value % 16 == 0 &&\n value % 15 == 0 &&\n value % 14 == 0 &&\n value % 13 == 0 &&\n value % 12 == 0 &&\n value % 11 == 0 &&\n value % 10 == 0 &&\n value % 9 == 0 &&\n value % 8 == 0 &&\n value % 7 == 0 &&\n value % 6 == 0 &&\n value % 5 == 0 &&\n value % 4 == 0 &&\n value % 3 == 0 &&\n value % 2 == 0\n results << value\n end\n\n end\n results\nend",
"def least_common_multiple(num_1, num_2)\n i = [num_1,num_2].max\n while i > 0\n if i%num_1==0 && i%num_2==0\n return i\n end\n i+=1\n end\nend",
"def solve( n = 1_000, a = 3, b = 5 )\n # Important that multiples of BOTH a and b not be double-counted.\n (0...n).select {|x| 0 == x % a || 0 == x % b}.inject( :+ )\n end",
"def problem_5(lower_limit, upper_limit)\n searching = true\n numerator = upper_limit\n while searching == true\n numerator += 2\n searching = false\n (lower_limit..upper_limit).each do |denominator|\n searching = true unless numerator % denominator == 0\n end\n end\n return numerator\nend",
"def smallest_multiple_rec range = 1..20, value = 1\n return value if range.size == 1\n f, l = range.first, range.last\n value = value.lcm f\n smallest_multiple_rec((f + 1)..l, value)\nend",
"def prim value\n for i in 2..(value - 1)\n if value % i == 0 \n return 0\n end\n end\n \n return 1\nend",
"def perfects(n)\n return (6..n).select {|x| factors(x).reduce(:+) == 2*x}\nend",
"def calculated(number)\n (2..(number/2)).each { |i| return i if number%i == 0 }\n number\nend",
"def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend",
"def numDivisors(n)\n exponents = []\n remaining = n\n\n return 1 if n == 1\n\n for i in [email protected]\n\n if remaining == 1 then\n return exponents.inject(:*)\n end\n\n if remaining % @primes[i] == 0 then\n exponent_count = 0\n while remaining % @primes[i] == 0 do\n remaining /= @primes[i]\n\n exponent_count += 1\n end\n exponents.push(exponent_count + 1)\n end\n end\n return 1\nend",
"def least_common_multiple(num_1, num_2)\n num_1 > num_2 ? max = num_1 : max = num_2\n (max..num_1 * num_2).each {|n| return n if n % num_1 == 0 && n % num_2 == 0}\nend",
"def isFirst(nb)\n first = true\n\n if((nb.is_a? Integer) && (nb >= 0))\n limit = Math.sqrt(nb)\n\n if (nb > 2)\n i = 2\n while ((i <= limit) && first)\n if (nb % i == 0)\n first = false\n end\n i += 1\n end\n else first = false\n end\n\n else first = false\n end\n\n return first\nend",
"def solution(n)\n factors = 0\n (1..Math.sqrt(n)).each do |i|\n if n % i == 0\n factors += i == Math.sqrt(n) ? 1 : 2\n end\n end\n factors\nend",
"def divisors(num)\n (1...num).select{|n| num % n ==0}.reduce(:+)\nend",
"def solve\n n = 33\n while true\n begin\n n += 2\n end while n.prime?\n\n s, ds = 2, 6\n while s < n && !(n - s).prime?\n s += ds\n ds += 4\n end\n\n break if s >= n\n end\n \n n\n end",
"def divisors(number)\n (1..number).select do |candidate|\n number % candidate == 0\n end\nend",
"def smallest_multiple\n 9*16*5*7*11*13*17*19\nend",
"def least_common_multiple(num_1, num_2)\n num_1, num_2 = [num_1, num_2].sort\n\n (1..num_2).each do |i|\n mutiple_1 = num_1 * i\n\n return mutiple_1 if mutiple_1 % num_2 == 0\n end\nend",
"def smallest_multiple\n count = 0\n number = 1\n\n while true\n (1..20).each { |x| count += 1 if number % x == 0 }\n\n if count == 20\n number\n break\n else\n number += 1\n count = 0\n end\n end\n\n puts number\nend",
"def solution(n)\n r = (n**0.5).floor\n (1..r).reduce(Float::INFINITY) do |perimeter, h|\n n % h == 0 ? [perimeter, 2 * (h + n / h)].min : perimeter\n end\nend",
"def multiples(n)\n (1...n).select do |num|\n num if (num % 3).zero? || (num % 5).zero?\n end.reduce(:+)\nend",
"def least_common_multiple(num_1, num_2)\n check = num_1 <=> num_2\n return num_1 if check == 0\n if check == -1\n lcm = num_2\n while true\n return lcm if lcm % num_1 == 0\n lcm += num_2\n end\n else\n lcm = num_1\n while true\n return lcm if lcm % num_2 == 0\n lcm += num_1\n end\n end\n # (1..num_1 * num_2).each do |i|\n # return i if i % num_1 == 0 && i % num_2 == 0\n # end\nend",
"def least_common_multiple(num_1, num_2)\n (1...num_1 * num_2).each do |multiple|\n return multiple if multiple % num_1 === 0 && multiple % num_2 === 0\n end\nend",
"def common_dividor(num1, num2)\n limit = [num1, num2].min\n limit.downto(1) do |int|\n return int if num1 % int == 0 && num2 % int == 0\n end\nend",
"def smallest_common_multiple(numbers)\n i = numbers.max\n \n until numbers.all? { |n| i % n == 0}\n puts i\n i += 20\n end\n puts i\nend",
"def getDivSums(n)\n #initialize total\n total = 0\n #for every number less than n\n for i in 1..n-1\n #if i is a divisor\n if n%i == 0\n #add divisor to total\n total += i\n end\n end\n #return total\n return total\nend",
"def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend"
] |
[
"0.7848905",
"0.7807805",
"0.77478737",
"0.77267814",
"0.76549506",
"0.7508944",
"0.7451165",
"0.7449361",
"0.7382869",
"0.73757535",
"0.7349275",
"0.7281679",
"0.7275512",
"0.72302496",
"0.7219051",
"0.7198163",
"0.71946985",
"0.71796215",
"0.71444196",
"0.7126453",
"0.7119955",
"0.71151155",
"0.70703673",
"0.7067354",
"0.70640624",
"0.7049186",
"0.70137024",
"0.699778",
"0.6993153",
"0.69866997",
"0.69790846",
"0.6970892",
"0.6968479",
"0.69663453",
"0.6965072",
"0.69633293",
"0.69631517",
"0.69323844",
"0.69257724",
"0.6925306",
"0.69249135",
"0.6885865",
"0.6864302",
"0.68638074",
"0.6855896",
"0.6849204",
"0.6846499",
"0.68386245",
"0.6833282",
"0.6830413",
"0.6824234",
"0.6823611",
"0.6813409",
"0.680472",
"0.6804567",
"0.6791912",
"0.677436",
"0.67616785",
"0.676125",
"0.6758756",
"0.67463297",
"0.6742494",
"0.6737829",
"0.6735769",
"0.6730714",
"0.6729519",
"0.672935",
"0.6729206",
"0.6715099",
"0.67099637",
"0.6705466",
"0.669729",
"0.668275",
"0.66680026",
"0.666172",
"0.66614115",
"0.6650876",
"0.66487265",
"0.6647881",
"0.6646029",
"0.664391",
"0.66383666",
"0.6635879",
"0.6631628",
"0.66312486",
"0.662582",
"0.6620932",
"0.6613323",
"0.66116714",
"0.66105676",
"0.66097844",
"0.6601516",
"0.65954745",
"0.65876776",
"0.65857726",
"0.6585309",
"0.6582064",
"0.6579979",
"0.65788156",
"0.65783733",
"0.65757394"
] |
0.0
|
-1
|
Delete current session release
|
def cleanup_release
if ssh.directory_exists?(release_path)
ssh.run("rm -rf #{release_path}")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def release!\n ensure_service!\n service.delete_session path\n end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def delete\n return unless @session\n @session.destroy\n @session = nil\n end",
"def destroy\n @session.clear\n end",
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def delete_session(env, sid, options); end",
"def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end",
"def releasesession(ses)\n\t\[email protected]{\n\t\t\[email protected] ses\n\t\t}\n\tend",
"def destroy\n session.delete :name\n end",
"def destroy\n session.delete(:user)\n end",
"def cleanup\n @session_id = nil\n end",
"def destroy\n @current_session = CurrentSession.find(params[:id])\n @current_session.destroy\n\n head :no_content\n end",
"def delete\n java_session = @java_request.getSession(false)\n java_session.invalidate if java_session\n end",
"def delete_session\n @env['java.servlet_request'].session.invalidate\n end",
"def delete\n GLOBAL_HASH_TABLE.delete(@session_id)\n end",
"def remove!\n @session.delete(SESSION_KEY) if empty?\n end",
"def destroy\n @session_resource.destroy\n\n head :no_content\n end",
"def delete_session(session)\n return Seasar::Rack::Session.delete_session(@env, session)\n end",
"def destroy\n session.destroy\n redirect_to root_path \n end",
"def destroy\n session.clear\n\n redirect_to root_url\n end",
"def destroy\r\n session.clear\r\n redirect_to root_path\r\n end",
"def destroy \n\t session[:guestaccount_id] = nil \n\t \n\tend",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session.clear\n redirect_to root_path\n end",
"def destroy\n session[:developer_id] = nil\n redirect_to sessions_new_path\n end",
"def destroy\n @session[:user_id] = nil\n @current_user = nil\n end",
"def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end",
"def remove\n if empty?\n @session.delete(SESSION_KEY)\n @session.delete(KEPT_KEY)\n end\n end",
"def destroy\n session.clear\n redirect_to '/'\n end",
"def destroy\n\t\treset_session\n\t\tredirect_to new_session_path\n\tend",
"def destroy\r\n session.clear\r\n redirect_to '/'\r\n end",
"def destroy\n logout!\n redirect_to new_session_url\n end",
"def destroy\n session.delete :name\n redirect_to root_path\n end",
"def destroy\n id = shift_argument ||\n raise(Heroku::Command::CommandFailed, \"Usage: sessions:destroy [ID]\")\n session = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :delete,\n :path => \"/oauth/sessions/#{CGI.escape(id)}\"\n ).body\n end\n puts %{Destroyed \"#{session[\"description\"]}\".}\n end",
"def destroy\n warden.logout\n @session.destroy\n head :no_content\n end",
"def delete_session(req, sid, options)\n @lock.delete_session(req.env, sid)\n generate_sid unless options[:drop]\n end",
"def destroy \n session.delete :user_id \n head :no_content \n end",
"def destroy\n @license.destroy\n end",
"def delete_session(session_id)\n delete(\"session:#{session_id}\")\n end",
"def delete(session, context = Context.current)\n digest = session.instance_variable_get(\"@digest\")\n @cache.delete(digest)\n super\n end",
"def delete #:nodoc:#\n Cachetastic::Caches::RailsSessionCache.delete(@session_key)\n @session_data = {}\n end",
"def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end",
"def destroy; delete end",
"def destroy\n session.delete :name\n redirect_to '/'\n end",
"def destroy\n session.delete :user_id\n redirect_to root_path\n end",
"def destroy\n\t\t# reset_session will kill the existing session\n\t\treset_session\n\t\tredirect_to '/login'\n\tend",
"def logout\n session.delete(:subscription_id)\n session.delete(:customer_id)\n redirect_to \"/ssp/index\"\n end",
"def close_session(session_id)\n @allocator.release_id session_id\n end",
"def destroy\n @user_session = @current_user_session\n if @user_session\n @user_session.destroy\n end\n redirect_to login_path\n end",
"def destroy(env)\n destroy_session(env, current_session_id(env), {})\n end",
"def destroy\n @os_release = OsRelease.find(params[:id])\n @os_release.destroy\n\n respond_to do |format|\n format.html { redirect_to os_releases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n requires :ip\n remove(:release => true)\n end",
"def destroy\n\t\treset_session\n\t\tredirect_to \"/\"\n\tend",
"def destroy\n session.clear\n redirect_to :back\n end",
"def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url }\n format.json { head :no_content }\n end\n end",
"def kill\n\t\tframework.sessions.deregister(self)\n\tend",
"def kill\n\t\tframework.sessions.deregister(self)\n\tend",
"def destroy_session(env, sid, options)\n raise '#destroy_session not implemented'\n end",
"def delete(url)\n setup_or_refresh_rest_session\n @session.delete(url: url)\n end",
"def destroy\n session.delete(:current_user_key)\n redirect_to welcome_index_path, alert: \"Logged out.\"\n end",
"def log_out\n session.delete(:contributor_id)\n @current_contributor = nil\n end",
"def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end",
"def delete_session(request, _sid, options)\n old_record = destroy_session(request)\n return if options[:drop]\n\n generate_sid.tap do |new_sid|\n if options[:renew]\n request.env[SESSION_RECORD_KEY] =\n @@session_class.create(session_id: new_sid, data: old_record&.data)\n end\n end\n end",
"def destroy\n user_session.log_out\n redirect_to root_url\n end",
"def destroy\n return if Settings.readonly \n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #puts \".............>>>>>>>>>> user_session_controller::destroy - removing user session \"+current_user_session.id.to_s\n current_user_session.destroy\n\n # Clean up any old sessions\n #current_user_session.clearOldSessions\n\n # MK - don't need to display this anymore\n flash[:success] = \" You have successfully logged out.\"\n session[:project_id] = nil\n session[:project_title] = nil\n session[:study_id] = nil\n\n # Jump to home page\n redirect_to \"/\"\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def destroy \n reset_session\n redirect_to \"/login\"\n end",
"def destroy\n current_user_session.destroy\n redirect_to root_url\n end",
"def destroy\n session.delete :user_id\n redirect_to '/'\n end",
"def destroy\n session.delete(:user_id) if session[:user_id]\n redirect_to new_session_path\n end",
"def destroy\n begin\n client = DiscourseApi::Client.new(\"https://intranet.cuhappycorner.com\")\n client.api_key = \"1729b13700d45e58d2e3d81c1bee5431a5167244e75389c07bb613fae54777ee\"\n client.api_username = \"ckho\"\n user = client.by_external_id(current_user.id)\n client.log_out(user[\"id\"]) if user\n rescue\n # nothing\n ensure\n super\n end\n end",
"def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end",
"def remove_old_sessions\n candidates = find_old_sessions\n candidates.destroy_all\nend",
"def destroy\n @release = Release.find(params[:id])\n \n if current_user.id == @release.user.id\n @release.destroy\n respond_to do |format|\n format.html { redirect_to \"/releases\" }\n format.json { head :no_content }\n end\n else\n # Do not have permission to delete this release\n respond_to do |format|\n format.html { redirect_to @release, notice: 'You do not have permission to delete this release'}\n format.json { head :no_content }\n end\n end \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n delete ''\n end",
"def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url, notice: 'Press release was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n session[:user_id] = nil\n redirect_to new_session_path, notice: 'You have been logged out of Unify.'\n end",
"def release\n action('release')\n end",
"def destroy\n # Delete the user access tokens on logout\n User.find(session[:user_id]).delete\n # Delete the session as well\n session = {}\n \n redirect_to root_path\n end",
"def destroy\n session.delete(:user_id)\n session.delete(:auth)\n flash[:notice] = 'Logged out successfully.'\n redirect_to \"/home\"\n end",
"def destroy\n log_out\n end",
"def delete\n Fission::Action::VM::Deleter.new(self).delete\n end",
"def teardown\n teardown_construct(@target_path)\n @release.destroy\n @release = nil\n end",
"def destroy\n @release.destroy\n respond_to do |format|\n format.html { redirect_to project_releases_path(@project), notice: 'Release deletada.' }\n end\n end",
"def destroy\n UserSession.find.try(:destroy)\n redirect_back_or_default login_url\n end",
"def destroy_session_token!\n update_attribute(:session_token, nil)\n end",
"def session_destroy(input={}, raw=false)\n response = get('mw/Session.Destroy', input, raw)\n end",
"def destroy\n session[:user_id] = nil\n redirect_to sessions_path\n end",
"def destroy\n @pool_session = PoolSession.find(params[:id])\n @pool_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end",
"def revoke_session(user)\n\t\[email protected] user\n\tend",
"def destroy\n\t\t#logout method is defined in helper file\n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path\n\tend",
"def destroy\n # Remove the user id from the session\n session.clear\n redirect_to root_url\n end"
] |
[
"0.7587336",
"0.74852246",
"0.7197912",
"0.7186222",
"0.69286567",
"0.6900274",
"0.6829874",
"0.67848706",
"0.6765451",
"0.67618865",
"0.6725155",
"0.67089045",
"0.6679904",
"0.6645306",
"0.66032964",
"0.6591644",
"0.6568679",
"0.6568481",
"0.65493107",
"0.6540163",
"0.65365887",
"0.6519394",
"0.6509466",
"0.6503139",
"0.6503139",
"0.6503139",
"0.6503139",
"0.64686304",
"0.6410262",
"0.63999236",
"0.6346905",
"0.63172084",
"0.6310874",
"0.6309797",
"0.6303442",
"0.63002926",
"0.62744457",
"0.627035",
"0.62670976",
"0.62545973",
"0.6244346",
"0.62441033",
"0.62413085",
"0.6227764",
"0.6224649",
"0.62061703",
"0.620376",
"0.61696935",
"0.6160365",
"0.61562616",
"0.6156136",
"0.6150598",
"0.61399287",
"0.6129695",
"0.61294043",
"0.6127591",
"0.61211514",
"0.6115112",
"0.61021763",
"0.61006856",
"0.6100529",
"0.6099198",
"0.6092379",
"0.60890704",
"0.6087852",
"0.60723877",
"0.60641295",
"0.60633093",
"0.6062702",
"0.60623467",
"0.6055077",
"0.6053321",
"0.6050629",
"0.604421",
"0.604149",
"0.60336274",
"0.6025976",
"0.6022136",
"0.6022004",
"0.601539",
"0.6013903",
"0.6013903",
"0.6005461",
"0.60034657",
"0.5995596",
"0.59953",
"0.5987632",
"0.5987598",
"0.5983336",
"0.5982809",
"0.59788316",
"0.59753466",
"0.5971756",
"0.5970799",
"0.5970738",
"0.59654",
"0.5964349",
"0.5961653",
"0.5958523",
"0.59542894"
] |
0.61311513
|
53
|
I worked on this challenge with Jack Huang. Your Solution Below
|
def factorial(number)
if number == 0
return 1
elsif number == 1
return 1
end
i=number-1
f=number*i
while i > 1
i=i-1
f=f*i
end
return f
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution4(input)\n end",
"def challenge; end",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend",
"def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend",
"def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend",
"def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend",
"def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend",
"def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend",
"def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\nend",
"def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend",
"def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend",
"def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend",
"def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend",
"def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend",
"def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend",
"def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend",
"def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend",
"def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend",
"def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend",
"def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend",
"def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend",
"def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend",
"def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend",
"def hackerrankInString(str)\n expected_chars = %w[h a c k e r r a n k]\n input_chars = str.chars\n\n str.chars.each do |char|\n # Thought so, apparently not: Edge case: there should be no more chars after the last 'k' in hackerrank.\n # break if expected_chars.empty?\n\n input_chars.shift\n expected_chars.shift if char == expected_chars[0]\n end\n\n expected_chars.empty? && input_chars.empty? ? 'YES' : 'NO'\nend",
"def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend",
"def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend",
"def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend",
"def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def solve_cipher(string, n)\n\n#Split each element of the string to get and array and return an array where each element is x (to operate with each element)\n string.split('').map do |x|\n#Create a new variable that will be the new index for each element.\n new_index = x.ord + n\n \n#Define the new index value with if conditional statements.\n\n#The value for whitespace is its value -26 as it is not included in the alphanumerical rules defined above\nif x == ' '\n new_index = ' '.ord - 26\nend\n\n\n#Declare the values of the index where it is above z's\nif new_index > 'z'.ord\n new_index = 'a'.ord + new_index - 'z'.ord - 1\nend\n\n#Declare the values of the index where it is beyond a's\nif new_index < 'a'.ord\n new_index = 'z'.ord - ('a'.ord - new_index) + 1\nend\n \n #Make the function return the list of numbers converted into letters \n new_index.chr\n\nend.join\n\nend",
"def is_happy(n)\n return false if n < 10 && n % 2 == 0\n return false if n < 1 \n return true if n == 1\n \n sum = 0\n\n nsplit = n.to_s.split(\"\")\n nsplit.each do |i|\n sum += (i.to_i * i.to_i)\n end\n\n return is_happy(sum)\n \nend",
"def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend",
"def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend",
"def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend",
"def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend",
"def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend",
"def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend",
"def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend",
"def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend",
"def answer\n composition = 1\n array = ['2,3,4,5']\n puts array\n array.split(',')\n #@inputArray = array\n #array.map!{|x| x.to_i}\n puts array\n #lastEvenIndex = last_even(array)\n #array.each_index {|x| composition*=array[x] if (array[x]%7).zero?}\n #array[lastEvenIndex] = composition\n #@modifiedArray = array\nend",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend",
"def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\nend",
"def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend",
"def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend",
"def is_armstrong(n)\n n_str=n.to_s()\n char_list=n_str.split(//)\n int_list=char_list.map {|x| (x.to_i())**(n_str.length()) }\n mysum = int_list.reduce(0) { |sum, num| sum + num }\n return (mysum==n)\nend",
"def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend",
"def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend",
"def recursive_solution\n\n end",
"def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend",
"def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend",
"def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend",
"def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend",
"def solution(s)\n return 0 if s.empty?\n t = 0\n ('A'..'Z').to_a.each do |c|\n t += s.count(c)\n end\n t + 1\nend",
"def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend",
"def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend",
"def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend",
"def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend",
"def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend",
"def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend",
"def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend",
"def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend",
"def isHappy? n\n acc = {}\n acc[n] = true\n begin\n sum = 0\n n.to_s.split(\"\").map {|i| sum += i.to_i**2}\n\n if sum == 1 then return true\n elsif acc.has_key?(sum) then return false\n else acc[sum] = true end\n\n n = sum\n end while sum != 1\nend",
"def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend",
"def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend",
"def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend",
"def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend",
"def happy? n\n visited = []\n until n == 1 || visited.include?(n)\n visited << n\n n = n.to_s.chars.map{ |x| x.to_i * x.to_i }.inject{ |sum, x| sum + x }\n end\n n == 1\nend",
"def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend",
"def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend",
"def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend",
"def scoobydoo(villian, villians)\n letters = ('a'..'z').to_a\n numbers = (0..25).to_a\n letters_to_numbers = letters.zip(numbers).to_h\n numbers_to_letters = numbers.zip(letters).to_h\n\n villians_downcase = villians.map { |v| v.downcase.delete(' ') }\n villians_hash = (villians_downcase).zip(villians).to_h\n\n s = villian.reverse.chars.rotate(5)\n new = []\n (0...s.size).each do |i|\n if i.even?\n new[i] = s[i]\n else\n num = (letters_to_numbers.fetch(s[i]) + 5) % 26\n new[i] = numbers_to_letters.fetch(num)\n end\n end\n\n villians_hash.fetch(new.join)\n\nend",
"def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend",
"def alg; end",
"def solution(s, p, q)\n counts = [nil, [0], [0], [0], [0]]\n factors = s.split(//).map do |nu|\n case nu\n when 'A'\n 1\n when 'C'\n 2\n when 'G'\n 3\n when 'T'\n 4\n end\n end\n for i in (1..factors.length)\n fa = factors[i - 1]\n for j in [1, 2, 3, 4]\n counts[j][i] = counts[j][i - 1]\n end\n counts[fa][i] += 1\n end\n \n (0..p.count - 1).map { |k|\n if p[k] == q[k]\n factors[p[k]]\n else\n [1, 2, 3, 4].index do |i|\n counts[i][q[k] + 1] - counts[i][p[k]] > 0\n end + 1\n end\n }\nend",
"def solve\n n = 33\n while true\n begin\n n += 2\n end while n.prime?\n\n s, ds = 2, 6\n while s < n && !(n - s).prime?\n s += ds\n ds += 4\n end\n\n break if s >= n\n end\n \n n\n end",
"def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end",
"def solution\n 971 * (-61)\nend",
"def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend"
] |
[
"0.6670118",
"0.64935124",
"0.6405797",
"0.6389439",
"0.62589556",
"0.62513846",
"0.62220705",
"0.61623204",
"0.61576265",
"0.6156878",
"0.6141082",
"0.6128271",
"0.6102838",
"0.606117",
"0.6038531",
"0.60349095",
"0.6021287",
"0.6013494",
"0.6006348",
"0.5998362",
"0.59837043",
"0.59525156",
"0.59462255",
"0.59387785",
"0.5938365",
"0.5930579",
"0.5925117",
"0.5921112",
"0.5914885",
"0.5914561",
"0.5913014",
"0.59101033",
"0.5895895",
"0.58896595",
"0.58838004",
"0.58818436",
"0.5869509",
"0.5869342",
"0.58579254",
"0.58521",
"0.58518165",
"0.5848397",
"0.5837273",
"0.58318293",
"0.58318",
"0.58281994",
"0.58140516",
"0.5810623",
"0.58097965",
"0.5800378",
"0.5794812",
"0.57907736",
"0.579037",
"0.578224",
"0.57811767",
"0.5780088",
"0.57798004",
"0.577949",
"0.577838",
"0.57734287",
"0.5766247",
"0.5753888",
"0.5753044",
"0.5751653",
"0.5742346",
"0.57368124",
"0.57366914",
"0.57321215",
"0.5726066",
"0.5717451",
"0.57156414",
"0.57128817",
"0.5707261",
"0.57064843",
"0.5703965",
"0.57020223",
"0.56969273",
"0.56966656",
"0.56964725",
"0.5695367",
"0.5694676",
"0.5691094",
"0.56901866",
"0.56885433",
"0.56882",
"0.5681399",
"0.56790936",
"0.5677365",
"0.5675174",
"0.5674865",
"0.56735665",
"0.56727064",
"0.5671634",
"0.5671526",
"0.5669128",
"0.56633574",
"0.5663248",
"0.5661588",
"0.5660388",
"0.56577456",
"0.565191"
] |
0.0
|
-1
|
Methode qui permet de mettre en gras un label
|
def setBold(btn, nom)
label = Gtk::Label.new
label.set_markup("<span weight = 'ultrabold'>#{nom}</span>")
btn.add(label)
btn.set_height_request(60)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def label\n end",
"def label\n nome\n end",
"def label; end",
"def label; end",
"def set_label(l); end",
"def label\n return @label\n end",
"def label\r\n\t\t''\r\n\tend",
"def label\n label = \"#{number}: #{name}\"\n end",
"def add_label label\n @labels[label] = true\n\n label\nend",
"def labels; end",
"def label\n @label || \"unknown\"\n end",
"def label\n \"\"\n end",
"def label label = nil\n @label = label if label\n @label\n end",
"def label_as label\n @label = label\n end",
"def label_translation; end",
"def label(lname)\n $labels[lname] = $iptr\nend",
"def label_name\n \n \"#{nombre_etiqueta}\"\n \n end",
"def label; Common.label(@handle); end",
"def s_label; det.link(:text, 'Label'); end",
"def label\n return @label\n end",
"def label(label = nil)\n @label = label if label\n @label\n end",
"def label() @positive end",
"def to_label\n \"#{label}\"\n end",
"def label\n full_title\n end",
"def name\n label\n end",
"def name label\n label(label)\n end",
"def label\n self['label']\n end",
"def label=(value)\n @label = value\n end",
"def OPRLabel(text:)\n {\n type: \"label\",\n text: text\n }\nend",
"def label\n attribute :label\n end",
"def label\n \"#{@name} (#{@id})\"\n end",
"def custom_label\n \"#{self.name}\"\n end",
"def to_s\n label\n end",
"def label\n read_attr :label\n end",
"def label(attribute_name, *args); end",
"def label\n attributes.fetch(:label)\n end",
"def label\n attributes.fetch(:label)\n end",
"def label\n attributes.fetch(:label)\n end",
"def label\n attributes.fetch(:label)\n end",
"def label\n attributes.fetch(:label)\n end",
"def label\n attributes.fetch(:label)\n end",
"def to_label(label)\n return unless label\n label.draw_multi_text(type.name, {:font_reverse => true})\n label.draw_multi_text(observations.collect{|obs|obs.to_short_s}.join(\", \"), {:font_reverse => false})\n end",
"def labels\n [label()]\n end",
"def label(l)\n @out.label(l)\n l\n end",
"def label\n @label ||= self.new.class.to_s.underscore.gsub('/', '.')\n end",
"def label_for(id, value, name)\n if error = @form_errors.delete(name.to_s)\n @g.label(\"#{value} \", :for => id){ @g.span(:class => :error){ error } }\n else\n @g.label(value, :for => id)\n end\n end",
"def to_s\r\n label\r\n end",
"def label(operate, label, number)\n Giic::Core.label(:user => @project.user, :repo => @project.repo, :number => number,\n :operate => operate, :label => label,\n :params => authentication_data)\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label\n @given_label || I18n.t(\"bureaucrat.#{form_name}.#{name}.label\", default: name.to_s.humanize)\n end",
"def label=(_arg0); end",
"def custom_label\n \"#{self.name}\"\n end",
"def required_label_text; end",
"def label\n @params['label']\n end",
"def to_label\n \"#{name}\"\n end",
"def to_label\n to_s\n end",
"def label(*args)\n current_form_context.label(*args)\n end",
"def label\n @attributes[:label]\n end",
"def generate_label_for_attribute?; end",
"def label=(val)\n @label << val\n end",
"def label name\n UnknownLabel.new(name)\n end",
"def print_label\n puts \"#{@nombre_etiqueta}\"\n puts \"\\nValor energetico o nutriente | por 100g o 100ml de producto \"\n puts \"--------------------------------|--------------------------------\"\n puts \"valor energetico |\" + \" #{energetic_value_KJ}\" + \" KJ/\" + \"#{energetic_value_Kcal}\" + \" Kcal\"\n puts \"Camtidad de grasas |\" + \" #{@grasa}g\"\n puts \"Camtidad de grasas saturadas |\" + \" #{@grasa_saturada}g\"\n puts \"Camtidad de hidratos de carbono |\" + \" #{@hid_carbono}g\"\n puts \"Camtidad de azucares |\" + \" #{@azucares}g\"\n puts \"Camtidad de proteinas |\" + \" #{@proteinas}g\"\n puts \"Camtidad de sal |\" + \" #{@sal}g\"\n @nombre_etiqueta\n end",
"def label\n @name.to_s.empty? ? @id : @name\n end",
"def change_label_text_to(name)\n @label.text = name\n end",
"def set_label label\n # added case for user just using a string\n case label\n when String\n # what if no form at this point\n @label_unattached = true unless @form\n label = Label.new @form, {:text => label}\n end\n @label = label\n # in the case of app it won't be set yet FIXME\n # So app sets label to 0 and t his won't trigger\n # can this be delayed to when paint happens XXX\n if @row\n position_label\n else\n @label_unplaced = true\n end\n label\n end",
"def mylabel args, x, row, message\r\n [x, row_to_px(args, row), message, font]\r\nend",
"def updateLabel(newLabel)\n @label=newLabel\n apply\n self\n end",
"def label\n code.to_s.capitalize\n end",
"def label\n raise 'answer the list label'\n end",
"def label\n <<-HTML\n\n <label id=\"#{label_id}\" class=\"string #{label_classes}\">#{attribute_name.to_s.titleize}</label>\n HTML\n end",
"def full_label\n ''\n end",
"def to_s; \"<Label: #{@name}>\"; end",
"def label\r\n\t\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\t\tend",
"def emit_label\n return '' if @options[:no_label]\n title = @anno[:title] || @options[:label] || @anno[:name].to_s.humanize\n %{<label for=\"#{control_id}\">#{title}</label>}\n end",
"def to_label\n tag\n end",
"def label(model = nil)\n model ||= @core.label(:count => 2)\n @label ? as_(@label) : as_(:update_model, :model => model)\n end",
"def update_label(label, bytepos); end",
"def label\r\n\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\tend",
"def add_label(coords)\n add_post_command(coords)\n end",
"def add_label(label, number)\n label 'add', label, number\n end",
"def set_label(data,data_description,serie_name,value_name,caption,r=210,g=210,b=210)\n data_description = validate_data_description(\"set_label\",data_description)\n validate_data(\"set_label\",data)\n shadow_factor = 100\n c_label =allocate_color(@picture,r,g,b)\n c_shadow =allocate_color(@picture,r-shadow_factor,g-shadow_factor,b-shadow_factor)\n c_text_color =allocate_color(@picture,0,0,0)\n cp = 0\n found = false\n numerical_value = 0\n data.each do |key|\n if key[data_description[\"position\"]].to_s == value_name.to_s\n numerical_value = key[serie_name]\n found = true\n end\n cp +=1 if !found\n end\n\n xpos = @g_area_x1 + @g_area_x_offset + ( @division_width * cp ) + 2\n ypos = @g_area_y2 - (numerical_value - @vmin) *@division_ratio\n position = image_ftb_box(@font_size,0,@font_name,caption)\n text_height = position[3] - position[5]\n text_width = position[2]-position[0] + 2\n text_offset = (text_height/2).floor\n # Shadow\n poly = [xpos+1,ypos+1,xpos + 9,ypos - text_offset,xpos + 8,ypos + text_offset + 2]\n image_filled_polygon(@picture,poly,r-shadow_factor,g-shadow_factor,b-shadow_factor,3)\n draw_line(xpos,ypos+1,xpos + 9,ypos - text_offset - 0.2,r-shadow_factor,g-shadow_factor,b-shadow_factor)\n draw_line(xpos,ypos+1,xpos + 9,ypos + text_offset + 2.2,r-shadow_factor,g-shadow_factor,b-shadow_factor)\n draw_filled_rectangle(xpos + 9,ypos - text_offset-0.2,xpos + 13 + text_width,ypos + text_offset + 2.2,r-shadow_factor,g-shadow_factor,b-shadow_factor)\n\n #Label background\n poly = [xpos,ypos,xpos + 8,ypos - text_offset - 1,xpos + 8,ypos + text_offset + 1]\n image_filled_polygon(@picture,poly,r,g,b,3)\n draw_line(xpos-1,ypos,xpos + 8,ypos - text_offset - 1.2,r,g,b)\n draw_line(xpos-1,ypos,xpos + 8,ypos + text_offset + 1.2,r,g,b)\n draw_filled_rectangle(xpos + 8,ypos - text_offset - 1.2,xpos + 12 + text_width,ypos + text_offset + 1.2,r,g,b)\n\n image_ttf_text(@picture,@font_size,0,xpos + 10,ypos + text_offset,c_text_color,@font_name,caption)\n end",
"def %(name)\n self.label = name\n self\n end",
"def position_label\n $log.debug \"XXX: LABEL row #{@label.row}, #{@label.col} \"\n @label.row @row unless @label.row #if @label.row == -1\n @label.col @col-(@label.name.length+1) unless @label.col #if @label.col == -1\n @label.label_for(self) # this line got deleted when we redid stuff !\n $log.debug \" XXX: LABEL row #{@label.row}, #{@label.col} \"\n end",
"def set_label\n @label = Label.find(params[:id])\n end",
"def set_label\n @label = Label.find(params[:id])\n end",
"def label_text\n method.to_s.gsub('-', ' ')\n end",
"def show_label(t)\n t(t) + ':'\n end",
"def label(name)\n @labels[name.to_sym]\n end",
"def label\n raise \"Label provider key :label must be set to produce the text of the message!\" unless @data[:label]\n @data[:label]\n end",
"def to_s\n @label\n end",
"def to_label\n \"#{I18n.t(\"activerecord.models.bonus.one\")} n° #{id}\"\n end",
"def set_label(v,l)\n @l[v] = l.to_s \n @unlabeled_v.delete(v)\n @labeling_pbar.inc if @pbar\n end",
"def input_label(name)\n field = field_content(name)\n label(field, name)\n end",
"def label(label, options = {})\n run_command(\"label/#{label}/values\", options)\n end",
"def labels\n inject_block(:name, :label)\n end",
"def label(method, text = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def process_labeling\n process_adding_labels\n process_removing_labels\n end",
"def label_tag(name = T.unsafe(nil), content_or_options = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def label\n elements.select { |e| e.respond_to?(:label) }.first.label\n end"
] |
[
"0.8457275",
"0.82376856",
"0.8136432",
"0.8136432",
"0.7971316",
"0.7734121",
"0.7727831",
"0.7712106",
"0.76194215",
"0.7533873",
"0.75251377",
"0.75082076",
"0.74817795",
"0.74765384",
"0.7469411",
"0.74680316",
"0.7418688",
"0.7377389",
"0.73027533",
"0.7279293",
"0.7267555",
"0.7260738",
"0.7256278",
"0.7237611",
"0.72167355",
"0.7207309",
"0.72017044",
"0.71903616",
"0.71453166",
"0.70991504",
"0.7097534",
"0.70927715",
"0.7085661",
"0.70811385",
"0.70776945",
"0.7074869",
"0.7074869",
"0.7074869",
"0.7074869",
"0.7074869",
"0.7074869",
"0.70695156",
"0.70399374",
"0.7026687",
"0.7018201",
"0.70167094",
"0.7011234",
"0.6991273",
"0.6989438",
"0.6989438",
"0.6989438",
"0.6986488",
"0.69861364",
"0.6979693",
"0.69621855",
"0.69618696",
"0.6955797",
"0.69552493",
"0.69271564",
"0.69179744",
"0.6902157",
"0.6887924",
"0.6884914",
"0.6880908",
"0.6839119",
"0.6831971",
"0.6827218",
"0.6822804",
"0.6814283",
"0.6812044",
"0.68035054",
"0.67926335",
"0.6789577",
"0.6782085",
"0.67647874",
"0.67643553",
"0.6746055",
"0.6729335",
"0.6713912",
"0.6712317",
"0.66976595",
"0.669373",
"0.66835266",
"0.6681629",
"0.66804975",
"0.6657749",
"0.6657749",
"0.6647961",
"0.66279006",
"0.6623172",
"0.6622803",
"0.66167134",
"0.66139036",
"0.66010016",
"0.6573026",
"0.6568475",
"0.65547395",
"0.6552117",
"0.65514296",
"0.65511084",
"0.65453416"
] |
0.0
|
-1
|
Methode qui permet de modifier l'affichage des bouton lorsque l'utilisateur clique sur le bouton 'survie'. Le bouton se divise en 3 boutons ('facile', 'moyen' et 'difficile')
|
def creationHBoxSurvie( box, position , remove , positionOtherDifficulty , btnOtherMode )
if box.children[positionOtherDifficulty] != btnOtherMode
box.remove( box.children[positionOtherDifficulty] )
box.add(btnOtherMode)
box.reorder_child(btnOtherMode, positionOtherDifficulty)
end
box.remove(remove) #DELETE
hBox = Gtk::Box.new(:horizontal)
hBox.set_height_request(60); hBox.set_homogeneous(true)
hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )
hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )
hBox.add ( Gtk::Button.new() )
# gestion des evenements des boutons de choix de niveau
hBox.children[0].signal_connect("clicked"){
Fenetre.remove(box);
nbGrille = SauvegardeGrille.getInstance.getNombreGrille
indiceRand = rand(1..(nbGrille/3))
FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))
}
hBox.children[1].signal_connect("clicked"){
Fenetre.remove(box);
nbGrille = SauvegardeGrille.getInstance.getNombreGrille
indiceRand = rand((1+nbGrille/3)..(2*nbGrille/3))
FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))
}
hBox.children[2].signal_connect("clicked"){
Fenetre.remove(box);
nbGrille = SauvegardeGrille.getInstance.getNombreGrille
indiceRand = rand((1+2*nbGrille/3)..nbGrille)
FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))
}
setBold( hBox.children[0] , @@lg.gt("FACILE") )
setBold( hBox.children[1] , @@lg.gt("MOYEN") )
setBold( hBox.children[2] , @@lg.gt("DIFFICILE") )
box.add( setmargin(hBox,0,15,70,70) ) #ADD
box.reorder_child( hBox , position ) #REORDER
Fenetre.show_all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend",
"def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_damage\n\n #AFFICHE LE NOMBRE DE DOMMAGES INFLIGES\n puts \"il lui inflige #{damage_computed} points de dommages\"\n\n #VICTIM RECOIS LES DOMMAGES\n victim.gets_damage(damage_computed)\n end",
"def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end",
"def changerEnVide\n\t\t@couleur=-1\n\tend",
"def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend",
"def utiliser(unJoueur)\n\t\tunJoueur.incEndurance(@valeurED)\n\t\tunJoueur.incPointsDeVie(@valeurPV)\n\tend",
"def panier_valid\n balance = 0\n if params[:commit] == 'Option famille'\n current_user.eleves.sort_by { |el| el.prix }.each.with_index do |ele, i|\n if i == 1 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: nouv_montant)\n balance = balance - nouv_montant if ele.commandes.last.sold == true\n end\n if i == 2 && ele.commandes.exists?\n ele.commandes.last.update(montant: 0)\n balance = balance - ele.prix if ele.commandes.last.sold == true\n end\n if i > 2 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: nouv_montant)\n balance = balance - nouv_montant if ele.commandes.last.sold == true\n end\n end\n if balance != 0\n current_user.commandes << Commande.create(description: \"Balance sur soldes précédents\", montant: balance)\n end\n redirect_to panier_path, notice: 'Option famille appliquée avec succès.'\n end\n\n if params[:commit] == 'Enlever option famille'\n current_user.eleves.sort_by { |el| el.prix }.each.with_index do |ele, i|\n if i == 1 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: ele.prix)\n balance = balance + nouv_montant if ele.commandes.last.sold == true\n end\n if i == 2 && ele.commandes.exists?\n ele.commandes.last.update(montant: ele.prix)\n balance = balance + ele.prix if ele.commandes.last.sold == true\n end\n if i > 2 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: ele.prix)\n balance = balance + nouv_montant if ele.commandes.last.sold == true\n end\n end\n if balance != 0\n current_user.commandes << Commande.create(description: \"Balance sur soldes précédents\", montant: balance)\n end\n redirect_to panier_path, notice: 'Option famille retirée avec succès.'\n end\n\n if params[:commit] == 'Régler vos commandes'\n @paiement = Paiement.new(paiement_params)\n @paiement.commandes << current_user.commandes.where(:sold => false).all\n current_user.paiements << @paiement\n respond_to do |format|\n if @paiement.save\n @paiement.commandes.each do |com|\n com.update(sold: true)\n end\n format.html { redirect_to panier_confirm_path(:pid => @paiement.id), notice: 'Votre réglement a bien été enregistré.' }\n format.json { render :panier, status: :created, location: panier_confirm_path }\n else\n format.html { render :panier_confirm }\n format.json { render json: @paiement.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def irpoliinsaturadas\n vag=(grasaspoli * 100) / 70\n vag.round(2)\n end",
"def changerEnRouge\n\t\t@couleur=1\n\tend",
"def irvitaminas\n vag=(vitymin * 100) / 50\n vag.round(2)\n end",
"def victory(joueur)\n\t\t# On définit les 8 possibilités de victoires si elles se vérifient les 3 dans la combinaison donnée alors la partie s'arrête\n\t\tif (plateau[0] == joueur.value) && (plateau[1] == joueur.value) && (plateau[2] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\n\t\telsif (plateau[3] == joueur.value) && (plateau[4] == joueur.value) && (plateau[5] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[3] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[4] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[4] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[5] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[1] == joueur.value) && (plateau[4] == joueur.value) && (plateau[7] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"def changerEnBleu\n\t\t@couleur=0\n\tend",
"def subract_mileage_from_shoe(mileage_of_run)\n\t\tself.mileage_total -= mileage_of_run\n\t\tself.save(:validate => false)\n\tend",
"def cobroViaje(tipoViaje, numPersonas, distancia)\n cobro = 0.0\n if (tipoViaje == \"Distrital\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 0.60 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 0.60 * distancia/10 + 0.60\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 0.75 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 0.75 * distancia/10 + 0.75\n end\n elsif (tipoViaje == \"Provincial\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 0.95 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 0.95 * distancia/10 + 0.95\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 1.25 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 1.25 * distancia/10 + 1.25\n end\n elsif (tipoViaje == \"Departamental\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 1.95 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 1.95 * distancia/10 + 1.95\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 2.25 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 2.25 * distancia/10 + 2.25\n end \n end\n return cobro\nend",
"def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end",
"def obchoduj\r\n @weapon.length.times do |i|\r\n puts \"#{i + 1}) Jmeno:#{@weapon[i].jmeno},Sila #{@weapon[i].sila}, cena:#{@weapon[i].cena}\"\r\n end\r\n puts \"Vyber si zbran k nakupu. Mas momentalne #{@valecnik.gold} zlatych. Pro ukonceni stiskni enter\"\r\n volba = gets.to_i\r\n while volba != 0\r\n if @valecnik.gold < @weapon[volba - 1].cena\r\n puts \"Na nakup #{@weapon[volba - 1].jmeno} nemas dostatek penez. Vyber si jinou zbran. Pro ukonceni obchodovani stiskni enter\"\r\n volba = gets.to_i\r\n else\r\n @valecnik.zbran = @weapon[volba - 1]\r\n @valecnik.gold -= @weapon[volba - 1].cena\r\n puts \"Koupil jsi #{@valecnik.zbran.jmeno}.\"\r\n break\r\n end\r\n end\r\n end",
"def class_div_note_finale\n if unote_finale > 15\n 'good'\n elsif unote_finale > 10\n 'moyen'\n else\n 'bad'\n end\n end",
"def changerVers(couleur)\n\t\t@couleur=couleur\n\tend",
"def changerVers(couleur)\n\t\t@couleur=couleur\n\tend",
"def irgrasassaturadas\n vag=(cgrasassa * 100) / 70\n vag.round(2)\n end",
"def assign_bonuses\n allocate_comp_energy\n if self.user_quaffle_allocation > @s_energy\n @uq_bonus = (2 * (self.user_quaffle_allocation - @s_energy) - 1)\n end \n\n if @q_energy > self.user_snitch_allocation \n @cq_bonus = (2 * (@q_energy - self.user_snitch_allocation) - 1)\n end\n\n if self.user_bludger_allocation > @q_energy\n @ub_bonus = (2 * (self.user_bludger_allocation - @q_energy) - 1)\n end\n\n if @b_energy > self.user_quaffle_allocation \n @cb_bonus = (2 * (@b_energy - self.user_quaffle_allocation) - 1)\n end\n\n if self.user_snitch_allocation > @b_energy\n @us_bonus = (2 * (self.user_snitch_allocation - @b_energy) - 1)\n end\n\n if @s_energy > self.user_bludger_allocation\n @cs_bonus = (2 * (self.user_bludger_allocation) - 1)\n end\n end",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend",
"def gets_damage(attack_value)\n\t\t@life_points -= attack_value\n\t\tif @life_points <= 0 \n\t\t\t@life_points = 0 \n\t\t\treturn \" Le joueur #{self.name} a été tué !\"\n\t\tend\n\tend",
"def irfibrap\n vag=(valorfibrap * 100) / 50\n vag.round(2)\n end",
"def combat_2ennemi(user_nameP, barret, ennemi1, ennemi2)\n puts ' _________ ________ _____ __________ ________________ '\n puts ' \\_ ___ \\ \\_____ \\ / \\\\______ \\ / _ \\__ ___/ '\n puts ' / \\ \\/ / | \\ / \\ / \\| | _/ / /_\\ \\| | '\n puts ' \\ \\____/ | \\/ Y \\ | \\/ | \\ | '\n puts ' \\______ /\\_______ /\\____|__ /______ /\\____|__ /____| '\n puts ' \\/ \\/ \\/ \\/ \\/ '\n numero_tour = 0\n\n\n while ennemi1.personnage_alive && ennemi2.personnage_alive\n if ennemi1.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi1.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi2.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi1.personnage_hp <= 0 && ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Les ennemis sont morts !\"\n puts \"--------------------------------\"\n total_xp = ennemi1.xp + ennemi2.xp\n puts \"Vous gagnez #{total_xp} points d'XP !\"\n ennemi1.personnage_alive = false\n ennemi2.personnage_alive = false\n\n if ennemi1.loot == '1po'\n $mon_inventaire.addpotion\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1gre'\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1po1gre'\n $mon_inventaire.addpotion\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi2.loot == '1po'\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addpotion\n\n elsif ennemi2.loot == '1gre'\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addgrenade\n end\n\n puts \"\"\n elsif ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n\n numero_tour += 1\n puts \"----------------------------------\"\n puts \"Tour n°#{numero_tour}\"\n puts \"Ennemis : #{ennemi1.name} ET #{ennemi2.name}\"\n puts \"TIRENT A DISTANCE\"\n if ennemi1.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi1.name} #{ennemi1.personnage_hp} HP\"\n end\n if ennemi1.personnage_hp <= 0\n puts \"#{ennemi1.name} : mort.\"\n end\n if ennemi2.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi2.name} #{ennemi2.personnage_hp} HP\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"#{ennemi2.name} : mort.\"\n end\n puts \"\"\n puts \"Que faites-vous ?\"\n puts \"1. Attaquer\"\n puts \"2. Défendre\"\n puts \"3. Utiliser un objet\"\n user_choice_4 = $stdin.gets.chomp\n if user_choice_4 == \"1\"\n puts \"Qui attaquer ?\"\n if ennemi1.personnage_hp > 0\n puts \"1. #{ennemi1.name}\"\n end\n if ennemi2.personnage_hp > 0\n puts \"2. #{ennemi2.name}\"\n end\n print \"> \"\n user_choice_4_fight = $stdin.gets.chomp\n if user_choice_4_fight == \"1\" && ennemi1.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(user_nameP.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n #On fait attaquer Barret\n\n puts \"Barret attaque le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_barret_1 = barret.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(barret.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n if ennemi1.personnage_hp > 0\n\n ennemi1.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi1.name} est mort !\"\n ennemi1.personnage_alive = false\n end\n elsif user_choice_4_fight == \"2\" && ennemi2.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi2.name}.\"\n puts \"Le #{ennemi2.name} réduit les dégats de #{ennemi2.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi2.personnage_defense\n puts \"Le #{ennemi2.name} subit #{(user_nameP.personnage_attaque - ennemi2.personnage_defense)} points de dégats !\"\n if ennemi2.personnage_hp > 0\n\n ennemi2.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi2.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi2.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi2.name} est mort !\"\n ennemi2.personnage_alive = false\n end\n end\n elsif user_choice_4 == \"2\"\n puts \"Vous gagnez de la défense !\"\n puts \"Barret gagne de la défense !\"\n user_nameP.personnage_defense += 3\n barret.personnage_defense += 3\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Le #{ennemi1.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n elsif user_choice_4 ==\"3\"\n if $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"Potions : #{$mon_inventaire.show_potion}\"\n puts \"Grenades : #{$mon_inventaire.show_grenade}\"\n puts \"Que voulez-vous utiliser ?\"\n if $mon_inventaire.show_potion > 0\n puts \"1. Une potion.\"\n puts \"2. Rien finalement.\"\n combat2_potion_simple = $stdin.gets.chomp\n\n if combat2_potion_simple == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur vous-même.\"\n puts \"2. Sur Barret.\"\n user_potion_fight = $stdin.gets.chomp\n\n if user_potion_fight == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Que faites-vous ?\"\n elsif combat2_potion_simple == \"2\"\n numero_tour -= 1\n else\n puts \"Merci d'indiquer un nombre pertinent.\"\n numero_tour -=1\n end\n\n elsif $mon_inventaire.show_grenade > 0\n puts \"1. Une grenade !\"\n puts \"2. Rien finalement.\"\n combat2_grenade_simple = $stdin.gets.chomp\n if combat2_grenade_simple == \"1\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_simple == \"2\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n else\n puts \"1. Une potion.\"\n puts \"2. Une grenade !\"\n puts \"3. Rien finalement.\"\n combat2_grenade_ou_potion = $stdin.gets.chomp\n if combat2_grenade_ou_potion == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur #{user_name}.\"\n puts \"2. Sur Barret.\"\n user_potion_fight1 = $stdin.gets.chomp\n\n if user_potion_fight1 == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight1 ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \" Que faites-vous ?\"\n elsif combat2_grenade_ou_potion == \"2\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_ou_potion == \"3\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n\n\n end\n else\n puts \"Vous n'avez pas d'objet !\"\n numero_tour -= 1\n end\n\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\" && $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"\"\n puts '|' + '-'*20 + '|'\n puts \"|INVENTAIRE |\"\n puts '|' + '-'*20 + '|'\n puts \"|Potions : #{$mon_inventaire.show_potion} |\"\n puts \"|Grenades : #{$mon_inventaire.show_grenade} |\"\n puts '|' + '-'*20+ '|'\n numero_tour -= 1\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\"\n puts \"Vous n'avez pas d'objets dans votre inventaire pour l'instant.\"\n numero_tour -= 1\n else\n puts \"\"\n puts \"Je n'ai pas compris. Que faites-vous ?\"\n puts \"\"\n numero_tour -= 1\n end\n end\n end\n\n def afficher_inventaire\n#à compléter\n\n end\nend",
"def irvitaminasp\n vag=(valorvityminp * 100) / 50\n vag.round(2)\n end",
"def get_individual_bono_percentage\n @goles / (@nivel.goles_mes.to_f / 100)\n end",
"def irpoliinsaturadasp\n vag=(valorgrasaspolip * 100) / 70\n vag.round(2)\n end",
"def decrement_of_health(user)\n -((user.max_health / 10) + 5 * (4 - difficulty)).round\n end",
"def cap_redeem(num_bottles)\n\tnum_bottles/4\nend",
"def gets_damage(damage)\n @life_points = @life_points - damage\n# point de vie est = point de vie - les dommages saisi\n if @life_points <= 0\n# si les points de vie inférieur ou égal à 0 le joueur est mort \n puts \"le joueur #{@name} a été tué!!\"\n end\n end",
"def make_better_change(value, coins)\n\nend",
"def make_better_change(value, coins)\n\nend",
"def make_better_change(value, coins)\n\nend",
"def cure\n puts\"Vous soignez votre animal \\n\"\n @mental +=30\n @health +=60\n return 3\n end",
"def irhidratos\n vag=(hcarbono * 100) / 260\n vag.round(2)\n end",
"def place_boutons_pour_balise_in code\n file_url = \"analyse/#{id}/show\"\n code.gsub(/<(h[2-6])(?:.*?)id=\"(.+?)\"(?:.*?)>(.+?)<\\/\\1>/){\n tout = $&.freeze\n titre_id = $2.freeze\n titre_nom = $3.freeze\n titre_complet = \"Analyse de #{titre}, #{titre_nom}\"\n relative_url = \"#{file_url}##{titre_id}\"\n absolute_url = \"#{site.distant_url}/#{relative_url}\"\n clips = [\"'BRUT': '#{relative_url}'\"]\n clips << \"'MD Loc': '[#{titre_nom}](#{relative_url})'\"\n clips << \"'MD Dist':'[#{titre_complet}](#{absolute_url})'\"\n clips << \"'Markdown': '[#{titre_complet}](#{absolute_url})'\"\n clips << \"'Mail': 'ALINK[#{absolute_url},#{titre_complet}]'\"\n clips = \"{#{clips.join(',')}}\"\n box = \"<lien>\".in_a(onclick:\"UI.clip(#{clips})\").in_div(class:'fright small')\n \"<ADMIN>#{box}#{tout}</ADMIN>\"\n }\n end",
"def getBonus\r\n @bonus = super.getSalario / (2*100)\r\n end",
"def bloquea\r\n\r\n #@sivic_professor = SivicProfessor.find(\"#{params[:id]}\")\r\n\r\n @sivic_professor = SivicProfessor.find(params[:id])\r\n\r\n @sivic_professor.update(:DATA_bloqueio => Time.now, :user_bloqueio => current_user.id)\r\n\r\n respond_to do |format|\r\n format.html { redirect_to sivic_professors_path }\r\n format.json { head :no_content }\r\n\r\n end\r\n end",
"def add_to_bank\n @user.balance -= 10\n @croupier.balance -= 10\n @bank = 20\n end",
"def fuel_up()\n\t\tgallons_needed = 10.0 - @fuel\n\t\tputs \"You must pay $#{3.5 * gallons_needed}\"\n\t\t@fuel = 10.0\n\tend",
"def irpolialcoholesp\n vag=(valorpolialcoholesp * 100) / 90\n vag.round(2)\n end",
"def descuento_sueldo(sueldo, tipo_obrero)\n\tif tipo_obrero == 'o'\n\t\tsueldo - (sueldo * 0.12) #OCURRE A\n\telse\n\t\tsueldo - (sueldo * 0.15) #OCURRE B\n\tend\nend",
"def moverA_Despacho oc\n #sku = Integer(params[:sku])\n #cantidad = Integer(params[:cantidad])\n #oc = params[:oc]\n idDespacho = (Almacen.find_by depacho:true).almacenId\n @id = idDespacho\n sku = (((Orden.find_by idOrden: oc).sku).strip).to_i\n cantidad = (((Orden.find_by idOrden: oc).cantidad).strip).to_i\n puts cantidad\n cliente = (Orden.find_by idOrden: oc).cliente\n cantidadBodega = ((Inventario.find_by sku: sku).cantidadBodega).to_i\n cantidadBodega = cantidadBodega - cantidad\n (Inventario.find_by sku: sku).update(cantidadBodega: cantidadBodega)\n cantidadVendida = ((Inventario.find_by sku: sku).cantidadVendida).to_i\n cantidadVendida = cantidadVendida - cantidad\n (Inventario.find_by sku: sku).update(cantidadVendida: cantidadVendida)\n # producto = ((Inventario.find_by sku: sku).cantidadBodega).to_i - ((Inventario.find_by sku: sku).cantidadVendida).to_i\n # if sku == 19\n # StockItem.find(1).update(count_on_hand:producto)\n # elsif sku == 27\n # StockItem.find(2).update(count_on_hand:producto)\n # elsif sku == 40\n # StockItem.find(3).update(count_on_hand:producto)\n # elsif sku == 45\n # StockItem.find(4).update(count_on_hand:producto)\n # elsif sku == 47\n # StockItem.find(5).update(count_on_hand:producto)\n # end\n if cliente == 'internacional'\n #Vemos si tenemos lo suficiente en el almacén de despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho}}\n contenido = JSON.parse temp\n i=0\n necesario = cantidad\n restante = cantidad\n while contenido[i].nil? == false do\n sku_ = Integer(contenido[i][\"_id\"])\n total = Integer(contenido[i][\"total\"])\n if sku_ == sku\n puts 'ehtra aca'\n if total >= cantidad\n necesario = 0\n restante = 0\n while cantidad > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => cantidad}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n puts cantidad\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n direccion = 'internacional'\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'DELETE' + idProducto + direccion + precio.to_s + oc\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient::Request.execute(method: :delete, url: 'http://integracion-2016-prod.herokuapp.com/bodega/stock', payload: {:productoId => idProducto, :direccion => direccion, :precio => precio, :oc => oc}, headers: {Authorization: 'INTEGRACION grupo1:'+clave})\n k += 1\n end\n cantidad -= k\n end\n else\n necesario = cantidad - total\n restante = cantidad - total\n while total > 0\n #Despachamos lo que teniamos en despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => total}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n direccion = 'internacional'\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'DELETE' + idProducto + direccion + precio.to_s + oc\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient::Request.execute(method: :delete, url: 'http://integracion-2016-prod.herokuapp.com/bodega/stock', payload: {:productoId => idProducto, :direccion => direccion, :precio => precio, :oc => oc}, headers: {Authorization: 'INTEGRACION grupo1:'+clave})\n k += 1\n end\n total -= k\n end\n #@necesario = necesario\n end\n else\n #necesario = cantidad\n #restante = cantidad\n end\n i += 1\n end\n while necesario > 0 do\n i = Almacen.first.id\n #recorremos los almacenes buscando el producto\n nAlmacenes = Almacen.last.id\n while i <= nAlmacenes \n id = Almacen.find(i).almacenId\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + id\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id}}\n contenido = JSON.parse temp\n j=0\n while contenido[j].nil? == false do\n sku_ = Integer(contenido[j][\"_id\"])\n total = Integer(contenido[j][\"total\"])\n if sku_ == sku && id != idDespacho\n #Encontramos el producto\n signature = 'GET' + id.to_s + sku_.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n if necesario != 0\n puts necesario\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id, :sku => sku_, :limit => necesario}}\n productos = JSON.parse temp\n @productos = productos\n puts productos\n k = 0\n while k < productos.length\n idProducto = productos[k][\"_id\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStock', {:productoId => idProducto, :almacenId => idDespacho}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n necesario -= k\n end \n end\n j += 1\n end\n i += 1\n end \n end\n #Enviamos lo restante\n while restante > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => restante}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n direccion = 'internacional'\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'DELETE' + idProducto + direccion + precio.to_s + oc\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient::Request.execute(method: :delete, url: 'http://integracion-2016-prod.herokuapp.com/bodega/stock', payload: {:productoId => idProducto, :direccion => direccion, :precio => precio, :oc => oc}, headers: {Authorization: 'INTEGRACION grupo1:'+clave})\n k += 1\n end\n restante -= k\n end\n\n #(Orden.find_by idOrden: oc).update(estado: \"despachada\")\n #Aquí termina el if internacional \n else\n almacenRecepcion = (IdGrupoProduccion.find_by idGrupo: cliente).idBodegaRecepcion\n #Vemos si hay lo suficiente en el almacén de despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho}}\n contenido = JSON.parse temp\n i=0\n necesario = cantidad\n restante = cantidad\n while contenido[i].nil? == false do\n sku_ = Integer(contenido[i][\"_id\"])\n total = Integer(contenido[i][\"total\"])\n if sku_ == sku\n if total >= cantidad\n necesario = 0\n restante = 0\n while cantidad > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => cantidad}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n puts cantidad\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + almacenRecepcion\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStockBodega', {:productoId => idProducto, :almacenId => almacenRecepcion, oc => oc, precio => precio}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n cantidad -= k\n end\n else\n necesario = cantidad - total\n restante = cantidad - total\n while total > 0\n #Despachamos lo que teniamos en despacho\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => total}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + almacenRecepcion\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStockBodega', {:productoId => idProducto, :almacenId => almacenRecepcion, oc => oc, precio => precio}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n total -= k\n end\n #@necesario = necesario\n end\n else\n necesario = cantidad\n restante = cantidad\n end\n i += 1\n end\n while necesario > 0 do\n i = Almacen.first.id\n #recorremos los almacenes buscando el producto\n nAlmacenes = Almacen.last.id\n while i <= nAlmacenes \n id = Almacen.find(i).almacenId\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + id\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/skusWithStock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id}}\n contenido = JSON.parse temp\n j=0\n while contenido[j].nil? == false do\n sku_ = Integer(contenido[j][\"_id\"])\n total = Integer(contenido[j][\"total\"])\n if sku_ == sku && id != idDespacho\n #Encontramos el producto\n signature = 'GET' + id.to_s + sku_.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n if necesario != 0\n temp = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => id, :sku => sku_, :limit => necesario}}\n productos = JSON.parse temp\n @productos = productos\n puts productos\n k = 0\n while k < productos.length\n idProducto = productos[k][\"_id\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + idDespacho\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStock', {:productoId => idProducto, :almacenId => idDespacho}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n necesario -= k\n end \n end\n j += 1\n end\n i += 1\n end \n end\n #Enviamos lo restante\n while restante > 0\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'GET' + idDespacho + sku.to_s\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n stock = RestClient.get 'http://integracion-2016-prod.herokuapp.com/bodega/stock', {:Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json', :params => {:almacenId => idDespacho, :sku => sku, :limit => restante}}\n stockParseado = JSON.parse stock\n puts stockParseado.length\n k = 0\n while k < stockParseado.length\n idProducto = stockParseado[k][\"_id\"]\n orden = RestClient.get 'http://moto.ing.puc.cl/oc/obtener/' + oc\n ordenParseada = JSON.parse orden\n precio = ordenParseada[0][\"precioUnitario\"]\n key = '.k3GBP9YYZmzWCr'\n hmac = HMAC::SHA1.new(key)\n signature = 'POST' + idProducto + almacenRecepcion\n hmac.update(signature)\n clave = Base64.encode64(\"#{hmac.digest}\")\n RestClient.post 'http://integracion-2016-prod.herokuapp.com/bodega/moveStockBodega', {:productoId => idProducto, :almacenId => almacenRecepcion, oc => oc, precio => precio}.to_json, :Authorization => 'INTEGRACION grupo1:' + clave, :content_type => 'application/json'\n k += 1\n end\n restante -= k\n end\n #(Orden.find_by idOrden: oc).update(estado: \"despachada\")\n end\n\n end",
"def take_ride\n if self.user.height < self.attraction.min_height && self.user.tickets < self.attraction.tickets\n \"Sorry. You do not have enough tickets to ride the #{attraction.name}. You are not tall enough to ride the #{attraction.name}.\"\n elsif self.user.height < self.attraction.min_height\n \"Sorry. You are not tall enough to ride the #{attraction.name}.\"\n elsif self.user.tickets < self.attraction.tickets\n \"Sorry. You do not have enough tickets to ride the #{attraction.name}.\"\n else\n self.user.tickets -= self.attraction.tickets\n self.user.nausea += self.attraction.nausea_rating\n self.user.happiness += self.attraction.happiness_rating\n user.save\n \"Thanks for riding the #{self.attraction.name}!\"\n end\n end",
"def rafraichir\n\t\tj = @jeu.joueur\n\t\tpos = j.position\n\n\t\[email protected]( @jeu.carte.vueJoueur(pos,15) )\n\t\[email protected]( @jeu.carte.vueJoueur(pos,@interface.taille) )\n\t\[email protected]( j.pointsDeVie, j.pointsDeVieMax )\n\t\[email protected]( j.endurance, j.enduranceMax )\n\t\[email protected]( j.score )\n\t\[email protected]( @jeu.nbTour )\n\t\[email protected]( j.or )\n\t\tif j.position.objet\n\t\t\[email protected]( \"Ramasser #{j.position.objet.getNom}\" )\n\t\telsif j.position.pnj\n\t\t\[email protected]( j.position.pnj.actionNom )\n\t\telsif j.position.type.nom == \"herbe\"\n\t\t\[email protected]( \"Regarder l'herbe pousser\" )\n\t\telsif j.position.type.nom == \"desert\"\n\t\t\[email protected]( \"Compter les grains de sable\" )\n\t\telsif j.position.type.nom == \"eau\"\n\t\t\[email protected]( \"Faire la planche\" )\n\t\telse\n\t\t\[email protected]( \"Rien à faire\" )\n\t\tend\n\tend",
"def attack_bonus(lv)\n (110 * 3 * lv.to_f + 250) / 100 + 5\n end",
"def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl1.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl2.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl3.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl4.vertikal_bewegen(anzahl_punkte)\n end",
"def capacidad_combustible_f=(valor)\n self.capacidad_combustible = format_valor(valor)\n end",
"def affichage_bienvenue\nputs\"------------------------------------------------\n|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |\n|Le but du jeu est d'être le dernier survivant !|\n-------------------------------------------------\"\nend",
"def update\n @feuille = validateBelongsToEmploye(Feuille.find(params[:id]))\n \n if (params[:cancel])\n redirect_to(@feuille)\n return;\n end\n \n heures = Feuille.getHeures(@feuille.periode, params[:feuille][:jours])\n heures = @feuille.replaceWithDbHeures(heures)\n if @feuille.heuresValidations(heures)\n @feuille.heures = heures;\n flash[:notice] = 'Feuille de temps mise à jour.'\n backToFeuilleGroupe(@feuille.periode)\n else\n @feuille.jourVar = params[:feuille][:jours]\n render :action => \"edit\"\n end\n end",
"def create\n @bet = Bet.new(bet_params)\n @bet.user_id = current_user.id\n @bet.before_save\n if @bet.result ==1\n @bet.gain= ((@bet.bet * @bet.course ) - @bet.bet).round(3)\n elsif @bet.result ==0\n @bet.gain= [email protected](3)\n end\n respond_to do |format|\n if @bet.save\n if @bet.result == 0\n vypocet = [email protected](3)\n @bet.update_attributes(result: 0, gain:vypocet)\n elsif @bet.result == 1\n vypocet = ((@bet.bet * @bet.course ) - @bet.bet).round(3)\n @bet.update_attributes(result: 1, gain: vypocet)\n elsif @bet.result==2\n @bet.update_attributes(result: 2, gain: 0)\n end\n\n format.html { redirect_to list_url, notice: 'Bet was successfully created.' }\n format.json { render :show, status: :created, location: @bet }\n else\n format.html { render :new }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def irazucaresp\n vag=(valorazucaresp * 100) / 90\n vag.round(2)\n end",
"def calculDesTaxes\n # Si un montant negatif, il s'agit d'une correction pour un\n # paiement annule. Ne rien modifier.\n return if self.montant < 0\n \n # Trouver la somme des montants non-taxable de tous les paiements precedents\n if self.new_record? # Est-ce un nouveau paiement ou une modification?\n paiementsNonTaxable = self.famille.paiements.sum(:non_taxable)\n else\n paiementsNonTaxable = self.famille.paiements.sum(:non_taxable) - Paiement.find(self.id).non_taxable\n end\n paiementsNonTaxable = 0 if paiementsNonTaxable.nil?\n \n if (paiementsNonTaxable < self.famille.cotisation.non_taxable)\n self.non_taxable = self.famille.cotisation.non_taxable - paiementsNonTaxable\n self.non_taxable = self.montant if self.non_taxable > self.montant\n end\n \n brut = self.montant - self.non_taxable;\n if brut > 0\n cts = Constantes.instance\n self.tps = (brut * 100.0 * cts.tps / (1.0 + cts.tps + cts.tvq)).round / 100.0\n self.tvq = (brut * 100.0 * cts.tvq / (1.0 + cts.tps + cts.tvq)).round / 100.0\n self.taxable = brut - self.tps - self.tvq\n else\n self.tps = 0\n self.tvq = 0\n self.taxable = 0\n end \n end",
"def gets_damage(damages)\n @life_points -= damages\n if life_points > 0\n puts \"#{name} a perdu #{damages}, il lui reste #{life_points} points de vie\"\n else\n puts \"#{name} a perdu #{damages}, #{name} a été tué\"\n end\n end",
"def alter_multiplayer_info key, component, bomb_number_component, comparing_function, increment\n # only bombs value has this privilege to get acceleration in a separate function\n accel = key == \"bombs\" ? calculate_bomb_acceleration(MODIFIABLE_MULTIPLAYER_DATA) : 1\n new_data = MODIFIABLE_MULTIPLAYER_DATA[key] + (increment ? accel : -accel)\n data_limit = MODIFIABLE_MULTIPLAYER_DATA[\"#{key}_limit\"]\n\n if data_limit && comparing_function.call(new_data, data_limit)\n # it is in the limit => acceptable\n change_button_text(component, new_data.to_s)\n\n # change current ui text representation\n MODIFIABLE_MULTIPLAYER_DATA[key] = new_data\n\n # if the key is not bombs then calculate the new limit\n # however, the text is not changed tho\n if key != \"bombs\" and bomb_number_component != nil\n MODIFIABLE_MULTIPLAYER_DATA[\"bombs_limit\"][1] = calculate_current_bomb_limit(MODIFIABLE_MULTIPLAYER_DATA)\n change_button_text(bomb_number_component, MODIFIABLE_MULTIPLAYER_DATA[\"bombs\"])\n end\n end\nend",
"def irgrasassaturadasp\n vag=(valorgrasassatup * 100) / 70\n vag.round(2)\n end",
"def charger(nomHeros)\n heros = Joueur.creer(nomHeros,1)\n self.lancerJeu(heros,1)\n @jeu.chargementJeu(nomHeros)\n end",
"def irproteinasp\n vag=(valorproteinasp * 100) / 50\n vag.round(2)\n end",
"def update\n @etat = etat\n @bail = Bail.find(params[:id])\n nouveau_bail = (@etat[@bail.etat] == 'nouveau')\n old_date_solde = @bail.date_solde\n if nouveau_bail then\n @montant = params[:montant]\n @montant_loyer = MontantLoyer.find(@bail.montant_loyer_id)\n @montant_charge = MontantCharge.find(@bail.montant_charge_id)\n end \n respond_to do |format|\n if @bail.update_attributes(params[:bail])\n if nouveau_bail then\n if @montant_loyer.montant != @montant[\"montant_loyer\"].to_f then # nouveau loyer\n @montant_loyer.montant = @montant[\"montant_loyer\"].to_f\n @montant_loyer.save\n end\n if @montant_charge.montant != @montant[\"montant_charge\"].to_f then # nouveau charge\n @montant_charge.montant = @montant[\"montant_charge\"]\n @montant_charge.save\n end\n end \n #si date_solde modifier\n if old_date_solde != @bail.date_solde then\n @bail.apayer_depuis_solde = 0\n if @bail.date_solde < @bail.date_debut then\n @bail.date_maj_apayer = @bail.date_debut\n else\n @bail.date_maj_apayer = @bail.date_solde\n end \n @bail.save\n end\n flash[:notice] = 'Bail was successfully updated.'\n format.html { redirect_to(@bail) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def extracosmic_expansive_onstand(lymphatolysis_fissure, french, whauve_diapophysial)\n unsuckled_catsup(apterygota, unfightable_phoneticist)\n end",
"def maj_biens(transaction_type = nil)\n \n # Commit: age old goods, activate newly imported goods\n\tif transaction_type\n\t\tto_age = @passerelle.biens.where(:statut => \"cur\", :bien_transaction_id => transaction_type.id)\n\t\tnom = transaction_type.nom\n\telse\n\t\tto_age = @passerelle.biens.where(:statut => \"cur\")\n\t\tnom = \"Tous type\"\n\tend\n\tto_activate = @passerelle.biens.where(:statut => \"new\")\n \n Bien.transaction do\n\t destroyedsize = to_age.size\n to_age.each do |b|\n b.destroy\n end\n to_activate.each do |b|\n b.statut = 'cur'\n b.save!\n end\n\t \n\t Logger.send(\"warn\", \"[Import : #{nom}] Destroy #{destroyedsize} old good entries.\")\n\t @result[:description] << \"[Import : #{nom}] Destroy #{destroyedsize} old good entries.\"\n\t Logger.send(\"warn\", \"[Import : #{nom}] Activated #{to_activate.size} new good entries.\")\n\t @result[:description] << \"[Import : #{nom}] Activated #{to_activate.size} new good entries.\"\n end\n end",
"def gets_damage(damage)\n @life_points = @life_points - damage\n\n # If the user has 0 life point it show a message that he loose\n if @life_points <= 0\n puts \"\\n\"\n puts \"----- La partie est finie #{self.name} a perdu ! -----\"\n end\n end",
"def compute_damage\n super * @weapon_level\n end",
"def onalg_player_has_changed_brisc(player, card_briscola, card_on_hand)\r\n str_msg = \"#{player.name} ha scambiato [#{nome_carta_ita(card_on_hand)}] \" + \r\n \"con [#{nome_carta_ita(card_briscola)}]\\n\"\r\n log(str_msg) \r\n \r\n # check if it was gui player\r\n if @player_on_gui[:player] == player\r\n log \"Scambio briscola OK [#{nome_carta_ita(card_on_hand)}] -> [#{nome_carta_ita(card_briscola)}]\\n\"\r\n player_sym = player.name.to_sym\r\n @cards_players.swap_card_player(player_sym, card_on_hand, card_briscola)\r\n else\r\n # other player has changed the briscola, shows a dialogbox\r\n if @option_gfx[:use_dlg_on_core_info]\r\n @msg_box_info.show_message_box(\"Briscola in tavola cambiata\", str_msg, false)\r\n end \r\n end\r\n \r\n if @option_gfx[:autoplayer_gfx]\r\n @alg_auto_player.onalg_player_has_changed_brisc(player, card_briscola, card_on_hand)\r\n end\r\n \r\n #set the briscola with the card on player hand (the 7) \r\n @deck_main.set_briscola(card_on_hand)\r\n \r\n # refresh the display\r\n @app_owner.update_dsp\r\n end",
"def update\n \n respond_to do |format|\n @auction1.update(auction1_params)\n #if @auction1.update(auction1_params)\n # @mensaje= 'Subasta se acutalizo con exito'\n # format.html { redirect_to @auction1, notice: 'Subasta se acutalizo con exito' }\n \n #else\n # format.html { render :edit }\n # end\n if (@auction1.monto > @auction1.puja ) \n @auction1.puja= @auction1.monto\n @auction1.ganador=current_user.id\n format.html { redirect_to @auction1, notice: 'Subasta Actualizada' }\n\n else\n @mensaje= 'la puja debe ser mayor a la actual'\n format.html { redirect_to lista_path(property_id: @auction1.property_id), notice: 'la puja debe ser mayor a la actual' }\n\n end\n @auction1.update(auction1_params)\n end\n end",
"def define_cutoffs\n @contest.bronze_cutoff = params[:bronze_cutoff].to_i\n @contest.silver_cutoff = params[:silver_cutoff].to_i\n @contest.gold_cutoff = params[:gold_cutoff].to_i\n if @contest.save\n compute_new_contest_rankings(@contest)\n flash[:success] = \"Les médailles ont été distribuées !\"\n else\n flash[:danger] = error_list_for(@contest)\n end\n redirect_to @contest\n end",
"def downvote\n @question.downvote_from current_user\n #si votas negativo automaticamente el usuario logueaado tiene un punto negativo -1\n @question.user.puntaje-=2\n @question.user.save\n\n current_user.puntaje-=1\n current_user.save\n redirect_to @question, notice: 'Gracias por puntuar'\n end",
"def irazucares\n vag=(azucares * 100) / 90\n vag.round(2)\n end",
"def actualizar_balance\n @cuenta_general = Sistema::Usuario.find_by(\n numero_cuenta: Finanzas::Transaccion::CUENTA_GENERAL\n )\n @cuenta_general.update_attribute :balance, @cuenta_general.balance.to_f + @deposito.comision\n @usuario.update_attribute :balance, @usuario.balance.to_f + @deposito.monto\n end",
"def get_damage(damage_points)\n \t# On soustraie les points de dommage aux points de vie\n \t@life_points = @life_points - damage_points\n\n \t# On vérifie s'il reste des points de vie au joueur\n \tif @life_points <= 0\n \t\tputs \"Le joueur #{@name} a été tué !\"\n \tend\n end",
"def irgrasas\n vag=(cgrasas * 100) / 70\n vag.round(2)\n end",
"def pbRoughDamage(move,user,target,skill,baseDmg)\r\n # Fixed damage moves\r\n return baseDmg if move.is_a?(PokeBattle_FixedDamageMove)\r\n # Get the move's type\r\n type = pbRoughType(move,user,skill)\r\n ##### Calculate user's attack stat #####\r\n atk = pbRoughStat(user,:ATTACK,skill)\r\n if move.function==\"121\" # Foul Play\r\n atk = pbRoughStat(target,:ATTACK,skill)\r\n elsif move.specialMove?(type)\r\n if move.function==\"121\" # Foul Play\r\n atk = pbRoughStat(target,:SPECIAL_ATTACK,skill)\r\n else\r\n atk = pbRoughStat(user,:SPECIAL_ATTACK,skill)\r\n end\r\n end\r\n ##### Calculate target's defense stat #####\r\n defense = pbRoughStat(target,:DEFENSE,skill)\r\n if move.specialMove?(type) && move.function!=\"122\" # Psyshock\r\n defense = pbRoughStat(target,:SPECIAL_DEFENSE,skill)\r\n end\r\n ##### Calculate all multiplier effects #####\r\n multipliers = {\r\n :base_damage_multiplier => 1.0,\r\n :attack_multiplier => 1.0,\r\n :defense_multiplier => 1.0,\r\n :final_damage_multiplier => 1.0\r\n }\r\n # Ability effects that alter damage\r\n moldBreaker = false\r\n if skill>=PBTrainerAI.highSkill && target.hasMoldBreaker?\r\n moldBreaker = true\r\n end\r\n if skill>=PBTrainerAI.mediumSkill && user.abilityActive?\r\n # NOTE: These abilities aren't suitable for checking at the start of the\r\n # round.\r\n abilityBlacklist = [:ANALYTIC,:SNIPER,:TINTEDLENS,:AERILATE,:PIXILATE,:REFRIGERATE]\r\n canCheck = true\r\n abilityBlacklist.each do |m|\r\n next if move.id != m\r\n canCheck = false\r\n break\r\n end\r\n if canCheck\r\n BattleHandlers.triggerDamageCalcUserAbility(user.ability,\r\n user,target,move,multipliers,baseDmg,type)\r\n end\r\n end\r\n if skill>=PBTrainerAI.mediumSkill && !moldBreaker\r\n user.eachAlly do |b|\r\n next if !b.abilityActive?\r\n BattleHandlers.triggerDamageCalcUserAllyAbility(b.ability,\r\n user,target,move,multipliers,baseDmg,type)\r\n end\r\n end\r\n if skill>=PBTrainerAI.bestSkill && !moldBreaker && target.abilityActive?\r\n # NOTE: These abilities aren't suitable for checking at the start of the\r\n # round.\r\n abilityBlacklist = [:FILTER,:SOLIDROCK]\r\n canCheck = true\r\n abilityBlacklist.each do |m|\r\n next if move.id != m\r\n canCheck = false\r\n break\r\n end\r\n if canCheck\r\n BattleHandlers.triggerDamageCalcTargetAbility(target.ability,\r\n user,target,move,multipliers,baseDmg,type)\r\n end\r\n end\r\n if skill>=PBTrainerAI.bestSkill && !moldBreaker\r\n target.eachAlly do |b|\r\n next if !b.abilityActive?\r\n BattleHandlers.triggerDamageCalcTargetAllyAbility(b.ability,\r\n user,target,move,multipliers,baseDmg,type)\r\n end\r\n end\r\n # Item effects that alter damage\r\n # NOTE: Type-boosting gems aren't suitable for checking at the start of the\r\n # round.\r\n if skill>=PBTrainerAI.mediumSkill && user.itemActive?\r\n # NOTE: These items aren't suitable for checking at the start of the\r\n # round.\r\n itemBlacklist = [:EXPERTBELT,:LIFEORB]\r\n if !itemBlacklist.include?(user.item_id)\r\n BattleHandlers.triggerDamageCalcUserItem(user.item,\r\n user,target,move,multipliers,baseDmg,type)\r\n end\r\n end\r\n if skill>=PBTrainerAI.bestSkill && target.itemActive?\r\n # NOTE: Type-weakening berries aren't suitable for checking at the start\r\n # of the round.\r\n if target.item && !target.item.is_berry?\r\n BattleHandlers.triggerDamageCalcTargetItem(target.item,\r\n user,target,move,multipliers,baseDmg,type)\r\n end\r\n end\r\n # Global abilities\r\n if skill>=PBTrainerAI.mediumSkill\r\n if (@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||\r\n (@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)\r\n if @battle.pbCheckGlobalAbility(:AURABREAK)\r\n multipliers[:base_damage_multiplier] *= 2 / 3.0\r\n else\r\n multipliers[:base_damage_multiplier] *= 4 / 3.0\r\n end\r\n end\r\n end\r\n # Parental Bond\r\n if skill>=PBTrainerAI.mediumSkill && user.hasActiveAbility?(:PARENTALBOND)\r\n multipliers[:base_damage_multiplier] *= 1.25\r\n end\r\n # Me First\r\n # TODO\r\n # Helping Hand - n/a\r\n # Charge\r\n if skill>=PBTrainerAI.mediumSkill\r\n if user.effects[PBEffects::Charge]>0 && type == :ELECTRIC\r\n multipliers[:base_damage_multiplier] *= 2\r\n end\r\n end\r\n # Mud Sport and Water Sport\r\n if skill>=PBTrainerAI.mediumSkill\r\n if type == :ELECTRIC\r\n @battle.eachBattler do |b|\r\n next if !b.effects[PBEffects::MudSport]\r\n multipliers[:base_damage_multiplier] /= 3\r\n break\r\n end\r\n if @battle.field.effects[PBEffects::MudSportField]>0\r\n multipliers[:base_damage_multiplier] /= 3\r\n end\r\n end\r\n if type == :FIRE\r\n @battle.eachBattler do |b|\r\n next if !b.effects[PBEffects::WaterSport]\r\n multipliers[:base_damage_multiplier] /= 3\r\n break\r\n end\r\n if @battle.field.effects[PBEffects::WaterSportField]>0\r\n multipliers[:base_damage_multiplier] /= 3\r\n end\r\n end\r\n end\r\n # Terrain moves\r\n if skill>=PBTrainerAI.mediumSkill\r\n case @battle.field.terrain\r\n when :Electric\r\n multipliers[:base_damage_multiplier] *= 1.5 if type == :ELECTRIC && user.affectedByTerrain?\r\n when :Grassy\r\n multipliers[:base_damage_multiplier] *= 1.5 if type == :GRASS && user.affectedByTerrain?\r\n when :Psychic\r\n multipliers[:base_damage_multiplier] *= 1.5 if type == :PSYCHIC && user.affectedByTerrain?\r\n when :Misty\r\n multipliers[:base_damage_multiplier] /= 2 if type == :DRAGON && target.affectedByTerrain?\r\n end\r\n end\r\n # Badge multipliers\r\n if skill>=PBTrainerAI.highSkill\r\n if @battle.internalBattle\r\n # Don't need to check the Atk/Sp Atk-boosting badges because the AI\r\n # won't control the player's Pokémon.\r\n if target.pbOwnedByPlayer?\r\n if move.physicalMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_DEFENSE\r\n multipliers[:defense_multiplier] *= 1.1\r\n elsif move.specialMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_SPDEF\r\n multipliers[:defense_multiplier] *= 1.1\r\n end\r\n end\r\n end\r\n end\r\n # Multi-targeting attacks\r\n if skill>=PBTrainerAI.highSkill\r\n if pbTargetsMultiple?(move,user)\r\n multipliers[:final_damage_multiplier] *= 0.75\r\n end\r\n end\r\n # Weather\r\n if skill>=PBTrainerAI.mediumSkill\r\n case @battle.pbWeather\r\n when :Sun, :HarshSun\r\n if type == :FIRE\r\n multipliers[:final_damage_multiplier] *= 1.5\r\n elsif type == :WATER\r\n multipliers[:final_damage_multiplier] /= 2\r\n end\r\n when :Rain, :HeavyRain\r\n if type == :FIRE\r\n multipliers[:final_damage_multiplier] /= 2\r\n elsif type == :WATER\r\n multipliers[:final_damage_multiplier] *= 1.5\r\n end\r\n when :Sandstorm\r\n if target.pbHasType?(:ROCK) && move.specialMove?(type) && move.function != \"122\" # Psyshock\r\n multipliers[:defense_multiplier] *= 1.5\r\n end\r\n end\r\n end\r\n # Critical hits - n/a\r\n # Random variance - n/a\r\n # STAB\r\n if skill>=PBTrainerAI.mediumSkill\r\n if type && user.pbHasType?(type)\r\n if user.hasActiveAbility?(:ADAPTABILITY)\r\n multipliers[:final_damage_multiplier] *= 2\r\n else\r\n multipliers[:final_damage_multiplier] *= 1.5\r\n end\r\n end\r\n end\r\n # Type effectiveness\r\n if skill>=PBTrainerAI.mediumSkill\r\n typemod = pbCalcTypeMod(type,user,target)\r\n multipliers[:final_damage_multiplier] *= typemod.to_f / Effectiveness::NORMAL_EFFECTIVE\r\n end\r\n # Burn\r\n if skill>=PBTrainerAI.highSkill\r\n if user.status == :BURN && move.physicalMove?(type) &&\r\n !user.hasActiveAbility?(:GUTS) &&\r\n !(Settings::MECHANICS_GENERATION >= 6 && move.function == \"07E\") # Facade\r\n multipliers[:final_damage_multiplier] /= 2\r\n end\r\n end\r\n # Aurora Veil, Reflect, Light Screen\r\n if skill>=PBTrainerAI.highSkill\r\n if !move.ignoresReflect? && !user.hasActiveAbility?(:INFILTRATOR)\r\n if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0\r\n if @battle.pbSideBattlerCount(target) > 1\r\n multipliers[:final_damage_multiplier] *= 2 / 3.0\r\n else\r\n multipliers[:final_damage_multiplier] /= 2\r\n end\r\n elsif target.pbOwnSide.effects[PBEffects::Reflect] > 0 && move.physicalMove?(type)\r\n if @battle.pbSideBattlerCount(target) > 1\r\n multipliers[:final_damage_multiplier] *= 2 / 3.0\r\n else\r\n multipliers[:final_damage_multiplier] /= 2\r\n end\r\n elsif target.pbOwnSide.effects[PBEffects::LightScreen] > 0 && move.specialMove?(type)\r\n if @battle.pbSideBattlerCount(target) > 1\r\n multipliers[:final_damage_multiplier] *= 2 / 3.0\r\n else\r\n multipliers[:final_damage_multiplier] /= 2\r\n end\r\n end\r\n end\r\n end\r\n # Minimize\r\n if skill>=PBTrainerAI.highSkill\r\n if target.effects[PBEffects::Minimize] && move.tramplesMinimize?(2)\r\n multipliers[:final_damage_multiplier] *= 2\r\n end\r\n end\r\n # Move-specific base damage modifiers\r\n # TODO\r\n # Move-specific final damage modifiers\r\n # TODO\r\n ##### Main damage calculation #####\r\n baseDmg = [(baseDmg * multipliers[:base_damage_multiplier]).round, 1].max\r\n atk = [(atk * multipliers[:attack_multiplier]).round, 1].max\r\n defense = [(defense * multipliers[:defense_multiplier]).round, 1].max\r\n damage = (((2.0 * user.level / 5 + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2\r\n damage = [(damage * multipliers[:final_damage_multiplier]).round, 1].max\r\n # \"AI-specific calculations below\"\r\n # Increased critical hit rates\r\n if skill>=PBTrainerAI.mediumSkill\r\n c = 0\r\n # Ability effects that alter critical hit rate\r\n if c>=0 && user.abilityActive?\r\n c = BattleHandlers.triggerCriticalCalcUserAbility(user.ability,user,target,c)\r\n end\r\n if skill>=PBTrainerAI.bestSkill\r\n if c>=0 && !moldBreaker && target.abilityActive?\r\n c = BattleHandlers.triggerCriticalCalcTargetAbility(target.ability,user,target,c)\r\n end\r\n end\r\n # Item effects that alter critical hit rate\r\n if c>=0 && user.itemActive?\r\n c = BattleHandlers.triggerCriticalCalcUserItem(user.item,user,target,c)\r\n end\r\n if skill>=PBTrainerAI.bestSkill\r\n if c>=0 && target.itemActive?\r\n c = BattleHandlers.triggerCriticalCalcTargetItem(target.item,user,target,c)\r\n end\r\n end\r\n # Other efffects\r\n c = -1 if target.pbOwnSide.effects[PBEffects::LuckyChant]>0\r\n if c>=0\r\n c += 1 if move.highCriticalRate?\r\n c += user.effects[PBEffects::FocusEnergy]\r\n c += 1 if user.inHyperMode? && move.type == :SHADOW\r\n end\r\n if c>=0\r\n c = 4 if c>4\r\n damage += damage*0.1*c\r\n end\r\n end\r\n return damage.floor\r\n end",
"def increment_of_health(user)\n (user.max_health / 15) + 5 * (difficulty - 1).round\n end",
"def irmonograsas\n vag=(grasasmono * 100) / 70\n vag.round(2)\n end",
"def alg_player_change_briscola(player, card_briscola, card_on_hand )\r\n return if super_alg_player_change_briscola(player, card_briscola, card_on_hand)\r\n @log.debug \"alg_player_change_briscola #{player.name}\"\r\n if @segno_state == :end\r\n return :not_allowed\r\n end\r\n res = :not_allowed\r\n if @round_players.last == player\r\n # the player on turn want to change briscola: ok\r\n cards = @carte_in_mano[player.name]\r\n if cards \r\n pos1 = cards.index(card_on_hand)\r\n if pos1 and @briscola_in_tav_lbl == card_briscola\r\n symb_card_on_hand = get_card_logical_symb(card_on_hand)\r\n if is_briscola?(card_on_hand) and symb_card_on_hand == :set \r\n # 7 of briscola is really in the hand of the player\r\n res = :allowed\r\n if @game_opt[:record_game]\r\n @game_core_recorder.store_player_action(player.name, :change_briscola, player.name, card_briscola, card_on_hand)\r\n end\r\n # swap 7 with briscola\r\n @carte_in_mano[player.name][pos1] = card_briscola\r\n @briscola_in_tav_lbl = card_on_hand\r\n @log.info \"Player #{player.name} changes the briscola on table \" +\r\n \"#{@deck_information.nome_carta_completo(card_briscola)} with #{@deck_information.nome_carta_completo(card_on_hand)}\"\r\n # notify all players that a briscola was changed\r\n @players.each do |pl| \r\n pl.algorithm.onalg_player_has_changed_brisc(player, card_briscola, card_on_hand) \r\n end\r\n #notify the player that have to play with a recalculation of commands\r\n # mariazza is available only if we start firts\r\n command_decl_avail = []\r\n #if @carte_gioc_mano_corr.size == 0\r\n command_decl_avail = check_mariaz_declaration(player)\r\n #end\r\n # don't need to check change briscola\r\n # remember the player have to play\r\n player.algorithm.onalg_have_to_play(player, command_decl_avail)\r\n end\r\n end\r\n end \r\n end\r\n if res == :not_allowed\r\n @log.info \"Changing #{card_briscola} with #{card_on_hand} not allowed from player #{player.name}\"\r\n else\r\n @log.debug \"Change ok\"\r\n end \r\n \r\n return res\r\n end",
"def change_carma(vote, votable, voter, vals)\n author = votable.user\n author.carma += if votable.class.name == 'Example'\n vote == 'up' ? vals[:ex_up] : vals[:ex_down]\n else # Phrase\n vote == 'up' ? vals[:ph_up] : vals[:ph_down]\n end\n\n author.update(carma: author.carma)\n voter.update(carma: voter.carma + vals[:usr]) unless vals[:usr].zero?\n end",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def change (cost, quantity) \n\t@total_change = @total - (cost.to_i * quantity.to_i) #subtract cost*quantity to the total money\n\t@new_total = @total_change \n\t#looking for number of bills per denomination\n\tif @total_change >= 1000\n \t\tthousands_change = @total_change / 1000\n \t\t@total_change = @total_change % 1000\n \tend\n \t\n \tif @total_change >= 500\n \t\tfive_hundreds_change = @total_change / 500\n \t\t@total_change = @total_change % 500\n \tend\n \t\n \tif @total_change >= 100\n \t\thundreds_change = @total_change / 100\n \t\t@total_change = @total_change % 100\n \tend\n \t\n \tif @total_change >= 50\n \t\tfifties_change = @total_change / 50\n \t\t@total_change = @total_change % 50\n \tend\n \t\n \tif @total_change >= 20\n \t\ttwenties_change = @total_change / 20\n \t\t@total_change = @total_change % 20\n \tend\n \t\n \tif @total_change >= 10\n \t\ttens_change = @total_change / 10\n \t\t@total_change = @total_change % 10\n \tend\n \t\n \tif @total_change >= 5\n \t\tfives_change = @total_change / 5\n \t\t@total_change = @total_change % 5\n \tend\n \t\n \tif @total_change >= 1\n \t\tones_change = @total_change / 1\n \t\t@total_change = @total_change % 1\n \tend\n \t\n \tchange = {\n \t\t:ones => ones_change.to_i,\n \t\t:fives => fives_change.to_i,\n \t\t:tens => tens_change.to_i,\n \t\t:twenties => twenties_change.to_i,\n \t\t:fifties => fifties_change.to_i,\n \t\t:hundreds => hundreds_change.to_i,\n \t\t:five_hundreds => five_hundreds_change.to_i,\n \t\t:thousands => thousands_change.to_i\n \t}\n \t\n \t\"<br /> #{change[:ones]} Php 1\" \"<br />#{change[:fives]} Php 5\" \"<br />#{change[:tens]} Php 10,\" \"<br />#{change[:twenties]} Php 20\" \"<br />#{change[:fifties]} Php 50\" \"<br />#{change[:hundreds]} Php 100\" \"<br />#{change[:five_hundreds]} Php 500\" \"<br />#{change[:thousands]} Php 1000\"\n end",
"def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n victory = false\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n emp_phase(@attacker)\n emp_phase(@defender)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n turn_fleet.each do |fleet|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if fleet[1] > 0 && fleet[2] > 0 \n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target==-1)\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if fleet[3] == 2\n mult = DamageType.find(fleet[3]).shield_mult\n end\n damage = fleet[2] * mult\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult = 1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if (fleet[3] == 1)\n mult = DamageType.find(fleet[3]).shell_mult\n end \n if fleet[3] == 3 and !fleet[6]\n mult = DamageType.find(fleet[3]).station_mult\n end\n if fleet[3] == 4 and fleet[0] == @plattform_id\n mult = DamageType.find(fleet[3]).plattform_mult\n end \n # Bestimme welche Einheit getroffen wurde\n victim = target_fleet[target]\n # Schadensberechnung\n damage = fleet[2] * mult\n # Berechne neue HP\n hit_points = victim[-2]\n victim[-2] = hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim, target_user)\n end\n end \n end\n # Füge Runden-Bericht ein\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue = false\n if turn_user == @attacker\n victory = true \n end\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user == @attacker\n @attacker_shield = @fight_shield\n else\n @defender_shield = @fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet = turn_fleet\n tmp_user = turn_user\n turn_fleet = target_fleet\n turn_user = target_user\n target_fleet = tmp_fleet\n target_user = tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n attacker_fleet_ary = []\n defender_fleet_ary = []\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n attacker_fleet_ary = turn_fleet\n defender_fleet_ary = target_fleet\n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n\n attacker_fleet_ary = target_fleet\n defender_fleet_ary = turn_fleet\n end\n update_fighting_fleet(@attacker_fleet, attacker_fleet_ary)\n update_fighting_fleet(@defender_fleet, defender_fleet_ary)\n ary = [@attacker_fleet, @defender_fleet] \n return [@report, @spy_report]\n end",
"def por_carbo\n\t\t\t(@carbohidratos/suma_gramos)*100\n\t\tend",
"def disbursement_percentage\n disbursement_factor * 100\n end",
"def tourSuivant( vue )\n\t\t@nbTour += 1\n\t\tlistePNJ = Array.new\n\t\tvue.each do |y|\n\t\t\ty.each do |x|\n\t\t\t\tif x.pnj\n\t\t\t\t\tlistePNJ.push(x.pnj)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tlistePNJ.each do |x|\n\t\t\tx.comportement( joueur )\n\t\tend\n\t\tif joueur.pointsDeVie <= 0\n\t\t\[email protected]\n\t\tend\n\tend",
"def increase_insurance_premium\n self.insurance_premium += 100\n end",
"def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend",
"def donate_blood \n self.status = STATUS_DONATING_BLOOD\n self.health -= 1\n self.balance += select_blood_machine\n self.save\n end",
"def show\n@volumecont20 = 27 \n@volumepeca = @mercadorium.altura * @mercadorium.largura * @mercadorium.comprimento \n @multiplicador = @mercadorium.imposto/100.to_f \n @a = @volumepeca /3 \n @quantcont = (27/0.036176).round \n @quantporcbm = (1/0.036176).round(2) \n @precofobcont = (@quantcont * @mercadorium.preco).round(2) \n @cifvar = @mercadorium.precofrete + @precofobcont \n @impostocontainer = @multiplicador * @cifvar\n \n @custocontainernacional = (@multiplicador * @precofobcont) + @precofobcont \n @freteunit = @mercadorium.precofrete / @quantcont\n @custnaciounit = (@custocontainernacional / @quantcont).round(3)\n \n end",
"def search_weapon\n#lancer de dé\n new_weapon_level = dice_launch\n puts \"Tu as trouvé une arme de niveau #{new_weapon_level}\"\n#condition de changement d'arme\n if new_weapon_level > @weapon_level\n \n @weapon_level = new_weapon_level\n puts \"Youhou! elle est meilleur que ton arme actuelle : tu la prends\"\n \n else \n \n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n \n end\n\n end",
"def gets_damage(less_points)\n @life_points = @life_points - less_points \n if @life_points <= 0\n puts \"le fantôme #{@name} a été capturé\"\n end\n end",
"def suivre; end",
"def give_right_to_vote( to_voter )\r\n assert msg.sender == @chairperson && @voters[to_voter].voted? == false\r\n @voters[to_voter].weight = 1\r\nend",
"def blam!\n self.health -= 10\n end",
"def defense_bonus(lv)\n (80 * 3 * lv.to_f / 2 + 250) / 100 + 5\n end",
"def gets_damage(damage) \n @life_points -= damage\n\n if @life_points <= 0 \n puts \"Déso #{@name} t'es mort !\"\n end\n end",
"def boil_off_gallons\n (@boil_minutes.to_f / 60.to_f) * boil_off_gallons_per_hour.to_f\n end",
"def get_bronzes(value)\n value % VALUESILVER\n end",
"def item_apply(user, item)\n super\n if item.damage.element_id < 0\n user.atk_elements.each do |e|\n $game_party.add_bestiary_data(@enemy_id, :ele, e)\n end\n else\n $game_party.add_bestiary_data(@enemy_id, :ele, item.damage.element_id)\n end\n end",
"def lancerJeu( hero, niveau )\n\t\t@jeu = Jeu.nouveau( 100, 100, niveau, hero )\n\t\[email protected]( self )\n\tend",
"def withdraw(monies)\n @amount -= monies\n end",
"def irproteinas\n vag=(proteinas * 100) / 50\n vag.round(2)\n end",
"def give_bonuses(acquired_hotel, primary, secondary, acquired_hotel_size, tie_for_first, tie_for_second)\n response = acquired_hotel.get_bonus_amounts(acquired_hotel_size)\n majority_bonus = response[0]\n minority_bonus = response[1]\n\n if tie_for_first != 'none'\n split = (majority_bonus + minority_bonus)/2\n primary.cash = primary.cash + split\n tie_for_first.cash = tie_for_first.cash + split\n primary.save\n tie_for_first.save\n if tie_for_second != 'none'\n split = minority_bonus/2\n secondary.cash = secondary.cash + split\n tie_for_second.cash = tie_for_second.cash + split\n secondary.save\n tie_for_second.save\n end\n elsif tie_for_second != 'none'\n split = minority_bonus/2\n secondary.cash = secondary.cash + split\n tie_for_second.cash = tie_for_second.cash + split\n secondary.save\n tie_for_second.save\n else\n primary.cash = primary.cash + majority_bonus\n secondary.cash = secondary.cash + minority_bonus\n primary.save\n secondary.save\n end\n end"
] |
[
"0.6093953",
"0.58751285",
"0.5852571",
"0.5839256",
"0.58385485",
"0.58189803",
"0.57666135",
"0.5739894",
"0.57251817",
"0.5666428",
"0.562609",
"0.5607013",
"0.55598885",
"0.5549703",
"0.55069846",
"0.55016655",
"0.5500432",
"0.54959226",
"0.54959226",
"0.54770094",
"0.54559696",
"0.54410464",
"0.54300714",
"0.5414155",
"0.5387312",
"0.53860337",
"0.53642315",
"0.5349733",
"0.5332262",
"0.53137",
"0.5310143",
"0.5305552",
"0.5305552",
"0.5305552",
"0.52875113",
"0.52726436",
"0.52681184",
"0.52516323",
"0.5241063",
"0.523872",
"0.5235801",
"0.52190787",
"0.5216083",
"0.5210968",
"0.52007014",
"0.51994795",
"0.51983577",
"0.5186333",
"0.5179169",
"0.5175969",
"0.51746273",
"0.5172643",
"0.5171668",
"0.51677495",
"0.51513535",
"0.51429784",
"0.5141178",
"0.5138356",
"0.51354104",
"0.51292664",
"0.51178503",
"0.5114671",
"0.5113668",
"0.509812",
"0.50977546",
"0.50924134",
"0.5091826",
"0.5091181",
"0.50819695",
"0.5081819",
"0.5078899",
"0.5077017",
"0.5072304",
"0.5071381",
"0.5069703",
"0.5069054",
"0.5067252",
"0.50659704",
"0.5065725",
"0.50631016",
"0.5062008",
"0.5048922",
"0.50392276",
"0.5035553",
"0.5033227",
"0.502464",
"0.5017858",
"0.5017627",
"0.501762",
"0.50170285",
"0.5012021",
"0.50099987",
"0.500666",
"0.5005267",
"0.5003072",
"0.500107",
"0.50008976",
"0.5000819",
"0.49989697",
"0.49969473",
"0.49843743"
] |
0.0
|
-1
|
Methode qui permet de modifier l'affichage des bouton lorsque l'utilisateur clique sur le bouton 'contrelamontre'. Le bouton se divise en 3 boutons ('facile', 'moyen' et 'difficile')
|
def creationHBoxCLM( box, position , remove , positionOtherDifficulty , btnOtherMode )
if box.children[positionOtherDifficulty] != btnOtherMode
box.remove( box.children[positionOtherDifficulty] )
box.add(btnOtherMode)
box.reorder_child(btnOtherMode, positionOtherDifficulty)
end
box.remove(remove) #DELETE
hBox = Gtk::Box.new(:horizontal)
hBox.set_height_request(60); hBox.set_homogeneous(true)
hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )
hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )
hBox.add ( Gtk::Button.new() )
# gestion des evenements des boutons de choix de niveau
hBox.children[0].signal_connect("clicked"){
Fenetre.remove(box);
nbGrille = SauvegardeGrille.getInstance.getNombreGrille
gridsId = (1..(nbGrille/3)).to_a.shuffle
indiceRand = -1
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0)
indiceRand = id
break
end
}
if(indiceRand == -1 )
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1)
indiceRand = id
break
end
}
end
if(indiceRand == -1 )
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2)
indiceRand = id
break
end
}
end
if(indiceRand == -1 )
indiceRand = gridsId[0]
end
FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))
}
hBox.children[1].signal_connect("clicked"){
Fenetre.remove(box);
nbGrille = SauvegardeGrille.getInstance.getNombreGrille
gridsId = ((1 + nbGrille/3)..(2*nbGrille/3)).to_a.shuffle
indiceRand = -1
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0)
indiceRand = id
break
end
}
if(indiceRand == -1 )
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1)
indiceRand = id
break
end
}
end
if(indiceRand == -1 )
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2)
indiceRand = id
break
end
}
end
if(indiceRand == -1 )
indiceRand = gridsId[0]
end
FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))
}
hBox.children[2].signal_connect("clicked"){
Fenetre.remove(box);
nbGrille = SauvegardeGrille.getInstance.getNombreGrille
gridsId = ((1 + 2*nbGrille/3)..nbGrille).to_a.shuffle
indiceRand = -1
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0)
indiceRand = id
break
end
}
if(indiceRand == -1 )
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1)
indiceRand = id
break
end
}
end
if(indiceRand == -1 )
gridsId.each{ |id|
if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2)
indiceRand = id
break
end
}
end
if(indiceRand == -1 )
indiceRand = gridsId[0]
end
FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))
}
setBold( hBox.children[0] , @@lg.gt("FACILE") )
setBold( hBox.children[1] , @@lg.gt("MOYEN") )
setBold( hBox.children[2] , @@lg.gt("DIFFICILE") )
box.add( setmargin(hBox,0,15,70,70) ) #ADD
box.reorder_child( hBox , position ) #REORDER
Fenetre.show_all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend",
"def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend",
"def panier_valid\n balance = 0\n if params[:commit] == 'Option famille'\n current_user.eleves.sort_by { |el| el.prix }.each.with_index do |ele, i|\n if i == 1 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: nouv_montant)\n balance = balance - nouv_montant if ele.commandes.last.sold == true\n end\n if i == 2 && ele.commandes.exists?\n ele.commandes.last.update(montant: 0)\n balance = balance - ele.prix if ele.commandes.last.sold == true\n end\n if i > 2 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: nouv_montant)\n balance = balance - nouv_montant if ele.commandes.last.sold == true\n end\n end\n if balance != 0\n current_user.commandes << Commande.create(description: \"Balance sur soldes précédents\", montant: balance)\n end\n redirect_to panier_path, notice: 'Option famille appliquée avec succès.'\n end\n\n if params[:commit] == 'Enlever option famille'\n current_user.eleves.sort_by { |el| el.prix }.each.with_index do |ele, i|\n if i == 1 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: ele.prix)\n balance = balance + nouv_montant if ele.commandes.last.sold == true\n end\n if i == 2 && ele.commandes.exists?\n ele.commandes.last.update(montant: ele.prix)\n balance = balance + ele.prix if ele.commandes.last.sold == true\n end\n if i > 2 && ele.commandes.exists?\n nouv_montant = ele.prix / 2\n ele.commandes.last.update(montant: ele.prix)\n balance = balance + nouv_montant if ele.commandes.last.sold == true\n end\n end\n if balance != 0\n current_user.commandes << Commande.create(description: \"Balance sur soldes précédents\", montant: balance)\n end\n redirect_to panier_path, notice: 'Option famille retirée avec succès.'\n end\n\n if params[:commit] == 'Régler vos commandes'\n @paiement = Paiement.new(paiement_params)\n @paiement.commandes << current_user.commandes.where(:sold => false).all\n current_user.paiements << @paiement\n respond_to do |format|\n if @paiement.save\n @paiement.commandes.each do |com|\n com.update(sold: true)\n end\n format.html { redirect_to panier_confirm_path(:pid => @paiement.id), notice: 'Votre réglement a bien été enregistré.' }\n format.json { render :panier, status: :created, location: panier_confirm_path }\n else\n format.html { render :panier_confirm }\n format.json { render json: @paiement.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def changerEnRouge\n\t\t@couleur=1\n\tend",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend",
"def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end",
"def class_div_note_finale\n if unote_finale > 15\n 'good'\n elsif unote_finale > 10\n 'moyen'\n else\n 'bad'\n end\n end",
"def changerEnVide\n\t\t@couleur=-1\n\tend",
"def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend",
"def por_carbo\n\t\t\t(@carbohidratos/suma_gramos)*100\n\t\tend",
"def calculCouleur(cellule,clique)\n #Gestion du clique gauche\n if clique == CLIQUEGAUCHE\n couleur = cellule.clicGauche\n #Gestion duclique droit\n elsif clique == CLIQUEDROIT\n couleur = cellule.clicDroit\n #Aucune gestion pour tout les autres boutons de la souris\n else\n couleur = nil\n puts \"Aucun evenement lié au bouton\"+clique.to_s\n end\n return couleur\n end",
"def changerEnBleu\n\t\t@couleur=0\n\tend",
"def alter_multiplayer_info key, component, bomb_number_component, comparing_function, increment\n # only bombs value has this privilege to get acceleration in a separate function\n accel = key == \"bombs\" ? calculate_bomb_acceleration(MODIFIABLE_MULTIPLAYER_DATA) : 1\n new_data = MODIFIABLE_MULTIPLAYER_DATA[key] + (increment ? accel : -accel)\n data_limit = MODIFIABLE_MULTIPLAYER_DATA[\"#{key}_limit\"]\n\n if data_limit && comparing_function.call(new_data, data_limit)\n # it is in the limit => acceptable\n change_button_text(component, new_data.to_s)\n\n # change current ui text representation\n MODIFIABLE_MULTIPLAYER_DATA[key] = new_data\n\n # if the key is not bombs then calculate the new limit\n # however, the text is not changed tho\n if key != \"bombs\" and bomb_number_component != nil\n MODIFIABLE_MULTIPLAYER_DATA[\"bombs_limit\"][1] = calculate_current_bomb_limit(MODIFIABLE_MULTIPLAYER_DATA)\n change_button_text(bomb_number_component, MODIFIABLE_MULTIPLAYER_DATA[\"bombs\"])\n end\n end\nend",
"def charger(nomHeros)\n heros = Joueur.creer(nomHeros,1)\n self.lancerJeu(heros,1)\n @jeu.chargementJeu(nomHeros)\n end",
"def bilan\n raise \"Il faut lancer l'étude avec Etude::start avant de construire le bilan\" if @data.nil?\n @bilan ||= begin\n c = []\n # Largeur : 26 (sans les \"|\")\n titre = \"Exercices #{from_exercice} à #{to_exercice}\"\n gauche = ((26 - titre.length).to_f / 2).floor - 1\n droite = \" \" * (26 - (gauche + titre.length))\n gauche = \" \" * gauche\n entete = <<-TXT\n----------------------------\n|#{gauche}#{titre}#{droite}|\n----------------------------\n| Doigté | Nombre de fois |\n TXT\n c << entete.strip\n titre_section = <<-TXT\n----------------------------\n| Par quantité |\n----------------------------\n TXT\n c << titre_section.strip\n nombre_max = nil\n nombre_min = nil\n nb_courant = nil\n @data.sort_by{|c, e| e[:nombre]}.reverse.each do |combi, data_combi|\n nb_courant = data_combi[:nombre]\n nombre_max = nb_courant if nombre_max.nil?\n nb = (\" \" * 5) << nb_courant.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n nombre_min = nb_courant\n \n titre_section = <<-TXT\n----------------------------\n| Par premier doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[0..0]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n \n titre_section = <<-TXT\n----------------------------\n| Par second doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[2..2]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n c << \"-\" * 28\n c << \"\\n\"\n c.join(\"\\n\")\n end\n end",
"def actualizar_balance\n @cuenta_general = Sistema::Usuario.find_by(\n numero_cuenta: Finanzas::Transaccion::CUENTA_GENERAL\n )\n @cuenta_general.update_attribute :balance, @cuenta_general.balance.to_f + @deposito.comision\n @usuario.update_attribute :balance, @usuario.balance.to_f + @deposito.monto\n end",
"def actualiza_atributos_diariodets \n sum_debe = 0\n sum_haber = 0\n sum_debe_sec = 0\n sum_haber_sec = 0\n item_max = 0\n idcuenta_ajuste_dif_cambio = 709 #Catalogo.find_by(id: Catalogo::ID_CTA_AJUSTE_DIF_CAMBIO)\n\n set_datos_segun_conf\n\n if self.origenasiento_id == 1 # si es manual actualiza columnas debe, haber...\n diariodets.each do |child| \n if child.ajuste.blank? or child.ajuste == '0'\n cod_moneda_trasac = Moneda.find_by(id:child.moneda_id).codigo \n child.tcori = self.tc\n child.ajuste = '0' \n if cod_moneda_trasac == Moneda::CODIGO_SYS[:nal]\n child.debe = (child.debeori).round(2) \n child.haber = (child.haberori).round(2) \n child.debesec = (child.debeori/Conta::TCV_CONST).round(2) \n child.habersec = (child.haberori/Conta::TCV_CONST).round(2) \n child.tcsec = child.tcori\n else\n if cod_moneda_trasac == Moneda::CODIGO_SYS[:sec]\n tc_transac = 0\n if Conta::TCV_CONST != child.tcori\n tc_transac = child.tcori\n else\n tc_transac = Conta::TCV_CONST\n end\n child.tcsec = tc_transac\n\n child.debe = (child.debeori*tc_transac).round(2) \n child.haber = (child.haberori*tc_transac).round(2) \n\n child.debesec = (child.debeori).round(2) \n child.habersec = (child.haberori).round(2) \n end #cod_moneda_trasac = Moneda::CODIGO_SYS[:sec]\n end #cod_moneda_trasac = Moneda::CODIGO_SYS[:nal]\n if item_max < child.item\n item_max = child.item\n end \n sum_debe = sum_debe + child.debe\n sum_haber = sum_haber + child.haber\n sum_debe_sec = sum_debe_sec + child.debesec\n sum_haber_sec = sum_haber_sec + child.habersec\n end #if child.ajuste.blank? or child.ajuste == '0'\n end #end diariodets.each do |child|\n\n ###\n ###cuadre global\n if (sum_debe != sum_haber) or (sum_debe_sec != sum_haber_sec)\n ajuste = 0\n ajuste_sec = 0 \n ajuste = sum_debe - sum_haber\n ajuste_sec = sum_debe_sec - sum_haber_sec \n if ajuste != 0 \n if ajuste > 0\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber => ajuste, :debesec => 0, :habersec => 0, :debeori => 0, :haberori => ajuste, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 1)\n else\n ajuste = ajuste * (-1)\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => ajuste, :haber => 0, :debesec => 0, :habersec => 0, :debeori => ajuste, :haberori => 0, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 1)\n end#end ajuste > 0\n end# end ajuste != 0 \n if ajuste_sec != 0\n if ajuste_sec > 0\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber =>0 , :debesec => 0, :habersec => ajuste_sec, :debeori => 0, :haberori => ajuste_sec, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 2)\n else\n ajuste_sec = ajuste_sec * (-1)\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber => 0, :debesec => ajuste_sec, :habersec => 0, :debeori => ajuste_sec, :haberori => 0, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 2) \n end#end ajuste_sec > 0\n end# end ajuste_sec != 0 \n end #(sum_debe != sum_haber) or (sum_debe_sec != sum_haber_sec)\n end#if self.tipocomprobante_id != 5 # si es automatico no aplica lo siguiente \n end",
"def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end",
"def get_individual_bono_percentage\n @goles / (@nivel.goles_mes.to_f / 100)\n end",
"def cobroViaje(tipoViaje, numPersonas, distancia)\n cobro = 0.0\n if (tipoViaje == \"Distrital\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 0.60 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 0.60 * distancia/10 + 0.60\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 0.75 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 0.75 * distancia/10 + 0.75\n end\n elsif (tipoViaje == \"Provincial\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 0.95 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 0.95 * distancia/10 + 0.95\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 1.25 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 1.25 * distancia/10 + 1.25\n end\n elsif (tipoViaje == \"Departamental\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 1.95 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 1.95 * distancia/10 + 1.95\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 2.25 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 2.25 * distancia/10 + 2.25\n end \n end\n return cobro\nend",
"def update\n @etat = etat\n @bail = Bail.find(params[:id])\n nouveau_bail = (@etat[@bail.etat] == 'nouveau')\n old_date_solde = @bail.date_solde\n if nouveau_bail then\n @montant = params[:montant]\n @montant_loyer = MontantLoyer.find(@bail.montant_loyer_id)\n @montant_charge = MontantCharge.find(@bail.montant_charge_id)\n end \n respond_to do |format|\n if @bail.update_attributes(params[:bail])\n if nouveau_bail then\n if @montant_loyer.montant != @montant[\"montant_loyer\"].to_f then # nouveau loyer\n @montant_loyer.montant = @montant[\"montant_loyer\"].to_f\n @montant_loyer.save\n end\n if @montant_charge.montant != @montant[\"montant_charge\"].to_f then # nouveau charge\n @montant_charge.montant = @montant[\"montant_charge\"]\n @montant_charge.save\n end\n end \n #si date_solde modifier\n if old_date_solde != @bail.date_solde then\n @bail.apayer_depuis_solde = 0\n if @bail.date_solde < @bail.date_debut then\n @bail.date_maj_apayer = @bail.date_debut\n else\n @bail.date_maj_apayer = @bail.date_solde\n end \n @bail.save\n end\n flash[:notice] = 'Bail was successfully updated.'\n format.html { redirect_to(@bail) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def bc_movimiento\r\n\t\t\tself.fecha = Time.now\r\n\t\t\tif self.monto_cheque == 0 \r\n\t\t\t\tmonto_cheque = 0\r\n\t\t\t\tself.cheque_recibidos.each do |cheque|\r\n\t\t\t\t\tmonto_cheque = monto_cheque + cheque.monto\r\n\t\t\t\tend\r\n\t\t\t\tself.monto_cheque = monto_cheque \r\n\t\t\tend\r\n\t\tend",
"def capacidad_combustible_f=(valor)\n self.capacidad_combustible = format_valor(valor)\n end",
"def aplicar_efecto(objeto_espacial_generador_de_choque, objeto_espacial_receptor_de_choque)\n porcentaje_de_masa_actual = @porcentaje_de_masa\n if(porcentaje_de_masa_actual.to_s.include? \"%\")\n porcentaje_de_masa_actual.gsub!(/%/, \"\")\n end\n objeto_espacial_generador_de_choque.masa = objeto_espacial_generador_de_choque.masa + ((porcentaje_de_masa_actual.to_f/100) * objeto_espacial_receptor_de_choque.masa) \n end",
"def maj_biens(transaction_type = nil)\n \n # Commit: age old goods, activate newly imported goods\n\tif transaction_type\n\t\tto_age = @passerelle.biens.where(:statut => \"cur\", :bien_transaction_id => transaction_type.id)\n\t\tnom = transaction_type.nom\n\telse\n\t\tto_age = @passerelle.biens.where(:statut => \"cur\")\n\t\tnom = \"Tous type\"\n\tend\n\tto_activate = @passerelle.biens.where(:statut => \"new\")\n \n Bien.transaction do\n\t destroyedsize = to_age.size\n to_age.each do |b|\n b.destroy\n end\n to_activate.each do |b|\n b.statut = 'cur'\n b.save!\n end\n\t \n\t Logger.send(\"warn\", \"[Import : #{nom}] Destroy #{destroyedsize} old good entries.\")\n\t @result[:description] << \"[Import : #{nom}] Destroy #{destroyedsize} old good entries.\"\n\t Logger.send(\"warn\", \"[Import : #{nom}] Activated #{to_activate.size} new good entries.\")\n\t @result[:description] << \"[Import : #{nom}] Activated #{to_activate.size} new good entries.\"\n end\n end",
"def restaure\n montant = self.amount\n\n # je mets a jour le solde du client\n account = Await.find(self.id).customer.account\n customer = Await.find(self.id).customer\n if account.blank?\n\n puts \"Aucun utilisateur ne correspond a cette intention de retrait\"\n Raise ActiveRecord::RecordNotFound \"Pas de compte trouvé\"\n\n else\n\n if account.update(amount: account.amount + montant.to_f)\n puts \"Customer Updated\"\n else\n puts \"Une erreur est survenu\"\n end\n\n end\n \n end",
"def place_boutons_pour_balise_in code\n file_url = \"analyse/#{id}/show\"\n code.gsub(/<(h[2-6])(?:.*?)id=\"(.+?)\"(?:.*?)>(.+?)<\\/\\1>/){\n tout = $&.freeze\n titre_id = $2.freeze\n titre_nom = $3.freeze\n titre_complet = \"Analyse de #{titre}, #{titre_nom}\"\n relative_url = \"#{file_url}##{titre_id}\"\n absolute_url = \"#{site.distant_url}/#{relative_url}\"\n clips = [\"'BRUT': '#{relative_url}'\"]\n clips << \"'MD Loc': '[#{titre_nom}](#{relative_url})'\"\n clips << \"'MD Dist':'[#{titre_complet}](#{absolute_url})'\"\n clips << \"'Markdown': '[#{titre_complet}](#{absolute_url})'\"\n clips << \"'Mail': 'ALINK[#{absolute_url},#{titre_complet}]'\"\n clips = \"{#{clips.join(',')}}\"\n box = \"<lien>\".in_a(onclick:\"UI.clip(#{clips})\").in_div(class:'fright small')\n \"<ADMIN>#{box}#{tout}</ADMIN>\"\n }\n end",
"def assign_bonuses\n allocate_comp_energy\n if self.user_quaffle_allocation > @s_energy\n @uq_bonus = (2 * (self.user_quaffle_allocation - @s_energy) - 1)\n end \n\n if @q_energy > self.user_snitch_allocation \n @cq_bonus = (2 * (@q_energy - self.user_snitch_allocation) - 1)\n end\n\n if self.user_bludger_allocation > @q_energy\n @ub_bonus = (2 * (self.user_bludger_allocation - @q_energy) - 1)\n end\n\n if @b_energy > self.user_quaffle_allocation \n @cb_bonus = (2 * (@b_energy - self.user_quaffle_allocation) - 1)\n end\n\n if self.user_snitch_allocation > @b_energy\n @us_bonus = (2 * (self.user_snitch_allocation - @b_energy) - 1)\n end\n\n if @s_energy > self.user_bludger_allocation\n @cs_bonus = (2 * (self.user_bludger_allocation) - 1)\n end\n end",
"def chargeGrille()\n data = []\n File.foreach(@nomniv).with_index do |line, line_no|\n data << line.chomp\n end\n # Slice permet de récupérer la taille de la matrice \n # tel que 7:7\n num = data.slice!(0)\n self.colonnes = @x\n self.lignes = @y\n\n # Parcours des données récupérés afin de charger\n # les boutons\n for i in 0..(data.length() - 1) \n data[i].split(':').each_with_index do | ch, index| \n # # Création d'une case \n if ch != '0'\n btn = Ile.new(self, ch,index,i)\n @sommets << btn\n else \n btn = Pont.new(self, index, i)\n end\n\n # On attache la référence de la grille\n self.attach(btn, index,i, 1,1)\n end\n end\n\n return self\n end",
"def calculDesTaxes\n # Si un montant negatif, il s'agit d'une correction pour un\n # paiement annule. Ne rien modifier.\n return if self.montant < 0\n \n # Trouver la somme des montants non-taxable de tous les paiements precedents\n if self.new_record? # Est-ce un nouveau paiement ou une modification?\n paiementsNonTaxable = self.famille.paiements.sum(:non_taxable)\n else\n paiementsNonTaxable = self.famille.paiements.sum(:non_taxable) - Paiement.find(self.id).non_taxable\n end\n paiementsNonTaxable = 0 if paiementsNonTaxable.nil?\n \n if (paiementsNonTaxable < self.famille.cotisation.non_taxable)\n self.non_taxable = self.famille.cotisation.non_taxable - paiementsNonTaxable\n self.non_taxable = self.montant if self.non_taxable > self.montant\n end\n \n brut = self.montant - self.non_taxable;\n if brut > 0\n cts = Constantes.instance\n self.tps = (brut * 100.0 * cts.tps / (1.0 + cts.tps + cts.tvq)).round / 100.0\n self.tvq = (brut * 100.0 * cts.tvq / (1.0 + cts.tps + cts.tvq)).round / 100.0\n self.taxable = brut - self.tps - self.tvq\n else\n self.tps = 0\n self.tvq = 0\n self.taxable = 0\n end \n end",
"def show\n@volumecont20 = 27 \n@volumepeca = @mercadorium.altura * @mercadorium.largura * @mercadorium.comprimento \n @multiplicador = @mercadorium.imposto/100.to_f \n @a = @volumepeca /3 \n @quantcont = (27/0.036176).round \n @quantporcbm = (1/0.036176).round(2) \n @precofobcont = (@quantcont * @mercadorium.preco).round(2) \n @cifvar = @mercadorium.precofrete + @precofobcont \n @impostocontainer = @multiplicador * @cifvar\n \n @custocontainernacional = (@multiplicador * @precofobcont) + @precofobcont \n @freteunit = @mercadorium.precofrete / @quantcont\n @custnaciounit = (@custocontainernacional / @quantcont).round(3)\n \n end",
"def alg_player_change_briscola(player, card_briscola, card_on_hand )\r\n return if super_alg_player_change_briscola(player, card_briscola, card_on_hand)\r\n @log.debug \"alg_player_change_briscola #{player.name}\"\r\n if @segno_state == :end\r\n return :not_allowed\r\n end\r\n res = :not_allowed\r\n if @round_players.last == player\r\n # the player on turn want to change briscola: ok\r\n cards = @carte_in_mano[player.name]\r\n if cards \r\n pos1 = cards.index(card_on_hand)\r\n if pos1 and @briscola_in_tav_lbl == card_briscola\r\n symb_card_on_hand = get_card_logical_symb(card_on_hand)\r\n if is_briscola?(card_on_hand) and symb_card_on_hand == :set \r\n # 7 of briscola is really in the hand of the player\r\n res = :allowed\r\n if @game_opt[:record_game]\r\n @game_core_recorder.store_player_action(player.name, :change_briscola, player.name, card_briscola, card_on_hand)\r\n end\r\n # swap 7 with briscola\r\n @carte_in_mano[player.name][pos1] = card_briscola\r\n @briscola_in_tav_lbl = card_on_hand\r\n @log.info \"Player #{player.name} changes the briscola on table \" +\r\n \"#{@deck_information.nome_carta_completo(card_briscola)} with #{@deck_information.nome_carta_completo(card_on_hand)}\"\r\n # notify all players that a briscola was changed\r\n @players.each do |pl| \r\n pl.algorithm.onalg_player_has_changed_brisc(player, card_briscola, card_on_hand) \r\n end\r\n #notify the player that have to play with a recalculation of commands\r\n # mariazza is available only if we start firts\r\n command_decl_avail = []\r\n #if @carte_gioc_mano_corr.size == 0\r\n command_decl_avail = check_mariaz_declaration(player)\r\n #end\r\n # don't need to check change briscola\r\n # remember the player have to play\r\n player.algorithm.onalg_have_to_play(player, command_decl_avail)\r\n end\r\n end\r\n end \r\n end\r\n if res == :not_allowed\r\n @log.info \"Changing #{card_briscola} with #{card_on_hand} not allowed from player #{player.name}\"\r\n else\r\n @log.debug \"Change ok\"\r\n end \r\n \r\n return res\r\n end",
"def changerVers(couleur)\n\t\t@couleur=couleur\n\tend",
"def changerVers(couleur)\n\t\t@couleur=couleur\n\tend",
"def preencherLancamentoMulti(valorD1, valorD2, valorC1, valorC2, valorC3)\n preencherCabecalhoLancamento\n # INCLUSAO PRIMEIRO DEBITO \n campoDebitoConta.send_keys(@@conta)\n sleep 1\n campoDebitoConta.send_keys :down\n campoDebitoConta.send_keys :enter\n campoDebitoValor.set(valorD1)\n campoDebitoHistorico.set(@@historico)\n sleep 1\n campoDebitoHistorico.send_keys :down\n campoDebitoHistorico.send_keys :enter\n campoDebitoComplemento.set(@@complementoDebito)\n click_button('Adicionar Débito')\n # INCLUSAO SEGUNDO DEBITO \n campoDebitoConta2.send_keys(@@conta)\n sleep 1\n campoDebitoConta2.send_keys :down\n campoDebitoConta2.send_keys :enter\n campoDebitoValor2.set(valorD2)\n campoDebitoHistorico2.set(@@historico)\n sleep 1\n campoDebitoHistorico2.send_keys :down\n campoDebitoHistorico2.send_keys :enter\n campoDebitoComplemento2.set(@@complementoDebito)\n # INCLUSAO PRIMEIRO CREDITO\n campoCreditoConta.send_keys(@@conta)\n sleep 1\n campoCreditoConta.send_keys :down\n campoCreditoConta.send_keys :enter\n campoCreditoValor.set(valorC1)\n campoCreditoHistorico.set(@@historico)\n sleep 1\n campoCreditoHistorico.send_keys :down\n campoCreditoHistorico.send_keys :enter\n campoCreditoComplemento.set(@@complementoCredito)\n click_button('Adicionar Crédito')\n # INCLUSAO SEGUNDO CREDITO\n campoCreditoConta2.send_keys(@@conta)\n sleep 1\n campoCreditoConta2.send_keys :down\n campoCreditoConta2.send_keys :enter\n campoCreditoValor2.set(valorC2)\n campoCreditoHistorico2.set(@@historico)\n sleep 1\n campoCreditoHistorico2.send_keys :down\n campoCreditoHistorico2.send_keys :enter\n campoCreditoComplemento2.set(@@complementoCredito)\n click_button('Adicionar Crédito')\n # INCLUSAO TERCEIRO CREDITO\n campoCreditoConta3.send_keys(@@conta)\n sleep 1\n campoCreditoConta3.send_keys :down\n campoCreditoConta3.send_keys :enter\n campoCreditoValor3.set(valorC3)\n campoCreditoHistorico3.set(@@historico)\n sleep 1\n campoCreditoHistorico3.send_keys :down\n campoCreditoHistorico3.send_keys :enter\n campoCreditoComplemento3.set(@@complementoCredito)\n end",
"def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end",
"def calcula_imc\n \n if @peso/@altura*@altura < 18\n puts \"vc esta magro\"\n elsif @peso/@altura*@altura <= 25\n puts \"vc esta no peso ideal\"\n elsif @peso/@altura*@altura > 25\n puts \"vc esta acima do peso\"\n end\n \n end",
"def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_damage\n\n #AFFICHE LE NOMBRE DE DOMMAGES INFLIGES\n puts \"il lui inflige #{damage_computed} points de dommages\"\n\n #VICTIM RECOIS LES DOMMAGES\n victim.gets_damage(damage_computed)\n end",
"def dispense_b_mercap(buff_Y1_b_me, buff_rlt_b_me)\n buff = 'Beta-Mercaptoethanol'\n \n # Prepares fumehood for working with organics\n prepare_fumehood(buff)\n \n # while in fumehood also aliquot ethanol required\n get_etoh()\n \n # add b-me to both\n b_me_tab = [\n [\"Buffer(s)\", \"#{buff} (uL)\"]\n ]\n (buff_Y1_b_me != 0) ? b_me_tab.push([\"Buffer Y1\"].concat([buff_Y1_b_me].map{ |v| { content: v, check: false }})) : nil\n (buff_rlt_b_me != 0) ? b_me_tab.push( [\"RLT Buffer\"].concat( [(buff_rlt_b_me * 10)].map{ |v| { content: v, check: false }} )) : nil # 10ulB-E : 1mL RLT\n \n show do \n title \"Dispense Beta-Mercaptoethanol in Fume Hood\"\n separator\n # check \"Bring the test tube containing <b>Buffer Y1</b> and the test tube containing <b>Buffer RLT<b/> to the fume hood\"\n warning \"The next step should be done in the fumehood\"\n note \"Follow table below to and take the listed tubes to the fume hood\"\n table b_me_tab\n check \"After dispensing B-ME, clean pipettes and gloves with EtOH to prevent B-ME from leaving fume hood.\"\n check \"<b>Place both tubes on ice until later use.</b>\"\n end\n end",
"def descifrar(mCifradoB,claveB)\n \n puts \"\\n\\n\"\n puts \"DESCIFRANDO MENSAJE\"\n puts \"------------------\"\n puts \"\\n\"\n #Si el tamaño de la clave y del mensaje son iguales se puede hacer\n \n \n if (mCifradoB.length == claveB.length) then\n \n mCifradoC = pasar_cadena(mCifradoB)\n resul = xor(mCifradoB,claveB)\n \n puts \"Mensaje Cifrado es: \" + mCifradoC\n puts \"Mensaje Cifrado en binario: \" + mCifradoB\n puts \"Longitud del mensaje en binario: \" + mCifradoB.length.to_s\n \n puts \"---------------------------------------------\"\n \n claveC = pasar_cadena(claveB) \n puts \"Clave Original es: \" + claveC\n puts \"Clave Original en binario: \" + claveB\n puts \"Longitud de la clave binario: \" + claveB.length.to_s\n \n puts \"---------------------------------------------\"\n \n puts \"Mensaje descifrado: \" \n puts pasar_cadena(resul)\n puts \"Mensaje descifrado en binario: \" + resul\n puts \"Longitud mensaje descifrado binario: \" + resul.length.to_s\n \n #resultado en binario\n return resul\n \n else \n puts \"NO PODEMOS DECIFRAR CLAVE Y EL MENSAJE NO ES DEL MISMO TAMAÑO\"\n end\n end",
"def change (cost, quantity) \n\t@total_change = @total - (cost.to_i * quantity.to_i) #subtract cost*quantity to the total money\n\t@new_total = @total_change \n\t#looking for number of bills per denomination\n\tif @total_change >= 1000\n \t\tthousands_change = @total_change / 1000\n \t\t@total_change = @total_change % 1000\n \tend\n \t\n \tif @total_change >= 500\n \t\tfive_hundreds_change = @total_change / 500\n \t\t@total_change = @total_change % 500\n \tend\n \t\n \tif @total_change >= 100\n \t\thundreds_change = @total_change / 100\n \t\t@total_change = @total_change % 100\n \tend\n \t\n \tif @total_change >= 50\n \t\tfifties_change = @total_change / 50\n \t\t@total_change = @total_change % 50\n \tend\n \t\n \tif @total_change >= 20\n \t\ttwenties_change = @total_change / 20\n \t\t@total_change = @total_change % 20\n \tend\n \t\n \tif @total_change >= 10\n \t\ttens_change = @total_change / 10\n \t\t@total_change = @total_change % 10\n \tend\n \t\n \tif @total_change >= 5\n \t\tfives_change = @total_change / 5\n \t\t@total_change = @total_change % 5\n \tend\n \t\n \tif @total_change >= 1\n \t\tones_change = @total_change / 1\n \t\t@total_change = @total_change % 1\n \tend\n \t\n \tchange = {\n \t\t:ones => ones_change.to_i,\n \t\t:fives => fives_change.to_i,\n \t\t:tens => tens_change.to_i,\n \t\t:twenties => twenties_change.to_i,\n \t\t:fifties => fifties_change.to_i,\n \t\t:hundreds => hundreds_change.to_i,\n \t\t:five_hundreds => five_hundreds_change.to_i,\n \t\t:thousands => thousands_change.to_i\n \t}\n \t\n \t\"<br /> #{change[:ones]} Php 1\" \"<br />#{change[:fives]} Php 5\" \"<br />#{change[:tens]} Php 10,\" \"<br />#{change[:twenties]} Php 20\" \"<br />#{change[:fifties]} Php 50\" \"<br />#{change[:hundreds]} Php 100\" \"<br />#{change[:five_hundreds]} Php 500\" \"<br />#{change[:thousands]} Php 1000\"\n end",
"def percentagem_tarefas_concluidas(args)\n\t\targs[:estoria_id] ||= 0\n\t\targs[:tipo] ||= 0 #tipo 1 - percentagem normal\n\t\t #tipo 2 - em pixel para criar gráfico\n \n \tif args[:tipo] == 1 \n \t\tif (qtd_tarefas_total :estoria_id => args[:estoria_id] ) == 0\n \t\t\treturn 0\n \t\telse\t\t\t\t\t\t\t\t\t \n\t \t\t\t@percent_tarefas_concluidas = ((qtd_tarefas_concluidas :estoria_id => args[:estoria_id] ) * 100) / (qtd_tarefas_total :estoria_id => args[:estoria_id] ) \n\t \t\t\treturn @percent_tarefas_concluidas\n \t\t\tend\n \t\telse\n \t\t\tif (qtd_tarefas_total :estoria_id => args[:estoria_id] ) == 0\n \t\t\treturn 120\n \t\telse\t\n \t \t\t\t@percent_tarefas_concluidas = ((qtd_tarefas_concluidas :estoria_id => args[:estoria_id] ) * 120) / (qtd_tarefas_total :estoria_id => args[:estoria_id] ) #120 pois o gráfico tem 120 pixels\n\t \t\t\treturn (119 - @percent_tarefas_concluidas)\n\t \t\tend\t\n\t end\n end",
"def retrait\n @notice = nil\n if params[:phone].present? && params[:montant].present?\n phone = params[:phone].to_i\n montant = params[:montant]\n\n # searching customer with phone\n if Customer.exists?(phone: phone)\n # begin transaction\n\n a = Client.debit_user_account(phone, montant)\n\n puts a\n\n @notice = true\n\n else\n\n #flash[:notice] = \"Numero inexistant sur la plateforme\"\n @notice = \"Numéro inconnu\"\n redirect_to \"/admin/users/retrait\"\n return\n\n end\n end\n render layout: \"layouts/dashboard/application\"\n end",
"def combat_2ennemi(user_nameP, barret, ennemi1, ennemi2)\n puts ' _________ ________ _____ __________ ________________ '\n puts ' \\_ ___ \\ \\_____ \\ / \\\\______ \\ / _ \\__ ___/ '\n puts ' / \\ \\/ / | \\ / \\ / \\| | _/ / /_\\ \\| | '\n puts ' \\ \\____/ | \\/ Y \\ | \\/ | \\ | '\n puts ' \\______ /\\_______ /\\____|__ /______ /\\____|__ /____| '\n puts ' \\/ \\/ \\/ \\/ \\/ '\n numero_tour = 0\n\n\n while ennemi1.personnage_alive && ennemi2.personnage_alive\n if ennemi1.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi1.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi2.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi1.personnage_hp <= 0 && ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Les ennemis sont morts !\"\n puts \"--------------------------------\"\n total_xp = ennemi1.xp + ennemi2.xp\n puts \"Vous gagnez #{total_xp} points d'XP !\"\n ennemi1.personnage_alive = false\n ennemi2.personnage_alive = false\n\n if ennemi1.loot == '1po'\n $mon_inventaire.addpotion\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1gre'\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1po1gre'\n $mon_inventaire.addpotion\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi2.loot == '1po'\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addpotion\n\n elsif ennemi2.loot == '1gre'\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addgrenade\n end\n\n puts \"\"\n elsif ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n\n numero_tour += 1\n puts \"----------------------------------\"\n puts \"Tour n°#{numero_tour}\"\n puts \"Ennemis : #{ennemi1.name} ET #{ennemi2.name}\"\n puts \"TIRENT A DISTANCE\"\n if ennemi1.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi1.name} #{ennemi1.personnage_hp} HP\"\n end\n if ennemi1.personnage_hp <= 0\n puts \"#{ennemi1.name} : mort.\"\n end\n if ennemi2.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi2.name} #{ennemi2.personnage_hp} HP\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"#{ennemi2.name} : mort.\"\n end\n puts \"\"\n puts \"Que faites-vous ?\"\n puts \"1. Attaquer\"\n puts \"2. Défendre\"\n puts \"3. Utiliser un objet\"\n user_choice_4 = $stdin.gets.chomp\n if user_choice_4 == \"1\"\n puts \"Qui attaquer ?\"\n if ennemi1.personnage_hp > 0\n puts \"1. #{ennemi1.name}\"\n end\n if ennemi2.personnage_hp > 0\n puts \"2. #{ennemi2.name}\"\n end\n print \"> \"\n user_choice_4_fight = $stdin.gets.chomp\n if user_choice_4_fight == \"1\" && ennemi1.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(user_nameP.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n #On fait attaquer Barret\n\n puts \"Barret attaque le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_barret_1 = barret.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(barret.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n if ennemi1.personnage_hp > 0\n\n ennemi1.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi1.name} est mort !\"\n ennemi1.personnage_alive = false\n end\n elsif user_choice_4_fight == \"2\" && ennemi2.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi2.name}.\"\n puts \"Le #{ennemi2.name} réduit les dégats de #{ennemi2.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi2.personnage_defense\n puts \"Le #{ennemi2.name} subit #{(user_nameP.personnage_attaque - ennemi2.personnage_defense)} points de dégats !\"\n if ennemi2.personnage_hp > 0\n\n ennemi2.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi2.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi2.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi2.name} est mort !\"\n ennemi2.personnage_alive = false\n end\n end\n elsif user_choice_4 == \"2\"\n puts \"Vous gagnez de la défense !\"\n puts \"Barret gagne de la défense !\"\n user_nameP.personnage_defense += 3\n barret.personnage_defense += 3\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Le #{ennemi1.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n elsif user_choice_4 ==\"3\"\n if $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"Potions : #{$mon_inventaire.show_potion}\"\n puts \"Grenades : #{$mon_inventaire.show_grenade}\"\n puts \"Que voulez-vous utiliser ?\"\n if $mon_inventaire.show_potion > 0\n puts \"1. Une potion.\"\n puts \"2. Rien finalement.\"\n combat2_potion_simple = $stdin.gets.chomp\n\n if combat2_potion_simple == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur vous-même.\"\n puts \"2. Sur Barret.\"\n user_potion_fight = $stdin.gets.chomp\n\n if user_potion_fight == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Que faites-vous ?\"\n elsif combat2_potion_simple == \"2\"\n numero_tour -= 1\n else\n puts \"Merci d'indiquer un nombre pertinent.\"\n numero_tour -=1\n end\n\n elsif $mon_inventaire.show_grenade > 0\n puts \"1. Une grenade !\"\n puts \"2. Rien finalement.\"\n combat2_grenade_simple = $stdin.gets.chomp\n if combat2_grenade_simple == \"1\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_simple == \"2\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n else\n puts \"1. Une potion.\"\n puts \"2. Une grenade !\"\n puts \"3. Rien finalement.\"\n combat2_grenade_ou_potion = $stdin.gets.chomp\n if combat2_grenade_ou_potion == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur #{user_name}.\"\n puts \"2. Sur Barret.\"\n user_potion_fight1 = $stdin.gets.chomp\n\n if user_potion_fight1 == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight1 ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \" Que faites-vous ?\"\n elsif combat2_grenade_ou_potion == \"2\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_ou_potion == \"3\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n\n\n end\n else\n puts \"Vous n'avez pas d'objet !\"\n numero_tour -= 1\n end\n\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\" && $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"\"\n puts '|' + '-'*20 + '|'\n puts \"|INVENTAIRE |\"\n puts '|' + '-'*20 + '|'\n puts \"|Potions : #{$mon_inventaire.show_potion} |\"\n puts \"|Grenades : #{$mon_inventaire.show_grenade} |\"\n puts '|' + '-'*20+ '|'\n numero_tour -= 1\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\"\n puts \"Vous n'avez pas d'objets dans votre inventaire pour l'instant.\"\n numero_tour -= 1\n else\n puts \"\"\n puts \"Je n'ai pas compris. Que faites-vous ?\"\n puts \"\"\n numero_tour -= 1\n end\n end\n end\n\n def afficher_inventaire\n#à compléter\n\n end\nend",
"def bloquea\r\n\r\n #@sivic_professor = SivicProfessor.find(\"#{params[:id]}\")\r\n\r\n @sivic_professor = SivicProfessor.find(params[:id])\r\n\r\n @sivic_professor.update(:DATA_bloqueio => Time.now, :user_bloqueio => current_user.id)\r\n\r\n respond_to do |format|\r\n format.html { redirect_to sivic_professors_path }\r\n format.json { head :no_content }\r\n\r\n end\r\n end",
"def excede_control_de_pago_x_ticket_x_parlay(last_tickect_current_user, entrada) # define el monto maximo a sacar por parlay, ej. pago max para tripletas, cuartetas etc.. no por ticket sino por tipo de ticket parlay ok\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0 # inicializacion de variable de sumatoria en cero ok.\n #verificar tipo de parlay de ese ticket:\n parlay_count = Jugadalot.where(:ticket_id => last_tickect_current_user).count\n #parlay_count\n\n #switch case para asignar tipo de jugada segun tipo de parlay para buscar en control de pago:\n tipo_jugada = \"default\" # valor vacio para posible uso fuera de contexto de septimetas en adelante, hacer que retorne false la funcion ok. (no encontrado)\n \n #el switch case lo haremos de modo simple con el if statement por ahora ok:\n if parlay_count.to_i == 1\n tipo_jugada = \"directo\" \n end\n\n if parlay_count.to_i == 2\n tipo_jugada = \"pale\" \n end\n\n if parlay_count.to_i == 3\n tipo_jugada = \"tripleta\" \n end\n\n if parlay_count.to_i == 4\n tipo_jugada = \"cuarteta\" \n end\n\n if parlay_count.to_i == 5\n tipo_jugada = \"quinteta\" \n end\n\n if parlay_count.to_i == 6\n tipo_jugada = \"sexteta\" \n end\n\n if parlay_count.to_i == 7\n tipo_jugada = \"septimeta\" \n end\n\n if parlay_count.to_i == 8\n tipo_jugada = \"octaveta\" \n end\n\n control_monto_max_pago = Controldepagogt.where(:tipojugada => tipo_jugada ).first.limiteglobal.to_i\n\n #acabo de conseguir el limite global de ese parlay en curso, ahora buscar la sumatoria de todos las jugadalots.posiblepago de los ticket activo de hoy y ver si no sbobrepara ese limiet ok\n t_ids = Ticket.today.where(:activo => \"si\", :parlay => tipo_jugada.to_s ).ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_jugadas_a_sumar = Jugadalot.where(:ticket_id => t_ids)# POstgres casting sum string error ok..sum(:posiblepago).to_i\n \n if not @listado_jugadas_a_sumar.nil?\n @listado_jugadas_a_sumar.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += jugada.posiblepago.to_i\n end\n end\n\n \n\n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n #@sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0\n #t.each do |ticket|\n # @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n #end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay.to_i <= control_monto_max_pago.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end",
"def getBonus\r\n @bonus = super.getSalario / (2*100)\r\n end",
"def onalg_player_has_changed_brisc(player, card_briscola, card_on_hand)\r\n str_msg = \"#{player.name} ha scambiato [#{nome_carta_ita(card_on_hand)}] \" + \r\n \"con [#{nome_carta_ita(card_briscola)}]\\n\"\r\n log(str_msg) \r\n \r\n # check if it was gui player\r\n if @player_on_gui[:player] == player\r\n log \"Scambio briscola OK [#{nome_carta_ita(card_on_hand)}] -> [#{nome_carta_ita(card_briscola)}]\\n\"\r\n player_sym = player.name.to_sym\r\n @cards_players.swap_card_player(player_sym, card_on_hand, card_briscola)\r\n else\r\n # other player has changed the briscola, shows a dialogbox\r\n if @option_gfx[:use_dlg_on_core_info]\r\n @msg_box_info.show_message_box(\"Briscola in tavola cambiata\", str_msg, false)\r\n end \r\n end\r\n \r\n if @option_gfx[:autoplayer_gfx]\r\n @alg_auto_player.onalg_player_has_changed_brisc(player, card_briscola, card_on_hand)\r\n end\r\n \r\n #set the briscola with the card on player hand (the 7) \r\n @deck_main.set_briscola(card_on_hand)\r\n \r\n # refresh the display\r\n @app_owner.update_dsp\r\n end",
"def update\n @feuille = validateBelongsToEmploye(Feuille.find(params[:id]))\n \n if (params[:cancel])\n redirect_to(@feuille)\n return;\n end\n \n heures = Feuille.getHeures(@feuille.periode, params[:feuille][:jours])\n heures = @feuille.replaceWithDbHeures(heures)\n if @feuille.heuresValidations(heures)\n @feuille.heures = heures;\n flash[:notice] = 'Feuille de temps mise à jour.'\n backToFeuilleGroupe(@feuille.periode)\n else\n @feuille.jourVar = params[:feuille][:jours]\n render :action => \"edit\"\n end\n end",
"def update\n \n respond_to do |format|\n @auction1.update(auction1_params)\n #if @auction1.update(auction1_params)\n # @mensaje= 'Subasta se acutalizo con exito'\n # format.html { redirect_to @auction1, notice: 'Subasta se acutalizo con exito' }\n \n #else\n # format.html { render :edit }\n # end\n if (@auction1.monto > @auction1.puja ) \n @auction1.puja= @auction1.monto\n @auction1.ganador=current_user.id\n format.html { redirect_to @auction1, notice: 'Subasta Actualizada' }\n\n else\n @mensaje= 'la puja debe ser mayor a la actual'\n format.html { redirect_to lista_path(property_id: @auction1.property_id), notice: 'la puja debe ser mayor a la actual' }\n\n end\n @auction1.update(auction1_params)\n end\n end",
"def mi_carrera\n\n\tend",
"def victory(joueur)\n\t\t# On définit les 8 possibilités de victoires si elles se vérifient les 3 dans la combinaison donnée alors la partie s'arrête\n\t\tif (plateau[0] == joueur.value) && (plateau[1] == joueur.value) && (plateau[2] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\n\t\telsif (plateau[3] == joueur.value) && (plateau[4] == joueur.value) && (plateau[5] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[3] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[4] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[4] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[5] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[1] == joueur.value) && (plateau[4] == joueur.value) && (plateau[7] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"def chargementJeu(nomJoueur)\n @sauvegardeYaml = SauvegardeYAML.creer(nomJoueur)\n @sauvegarde = @sauvegardeYaml.chargement()\n @joueur = @sauvegarde.joueur\n [email protected](\".\")\n @joueur.nom = nom[0]\n print @joueur.nom\n @carte = @sauvegarde.carte\n @nbTour = @sauvegarde.nbTour\n\tend",
"def add_to_bank\n @user.balance -= 10\n @croupier.balance -= 10\n @bank = 20\n end",
"def cure\n puts\"Vous soignez votre animal \\n\"\n @mental +=30\n @health +=60\n return 3\n end",
"def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend",
"def comer\r\n # @image = Image[\"pez2.png\"]\r\n # Al comer, un pez tendrá x segundos mas de vida, y queda libre para buscar mas comida\r\n @vida_inicio += 2\r\n @libre = true\r\n end",
"def excede_control_de_pago_x_ticket(last_tickect_current_user, entrada)\n #verificar tipo de parlay de ese ticket:\n parlay_count = Jugadalot.where(:ticket_id => last_tickect_current_user).count\n #parlay_count\n\n #switch case para asignar tipo de jugada segun tipo de parlay para buscar en control de pago:\n tipo_jugada = \"default\" # valor vacio para posible uso fuera de contexto de septimetas en adelante, hacer que retorne false la funcion ok. (no encontrado)\n \n #el switch case lo haremos de modo simple con el if statement por ahora ok:\n if parlay_count.to_i == 1\n tipo_jugada = \"directo\" \n end\n\n if parlay_count.to_i == 2\n tipo_jugada = \"pale\" \n end\n\n if parlay_count.to_i == 3\n tipo_jugada = \"tripleta\" \n end\n\n if parlay_count.to_i == 4\n tipo_jugada = \"cuarteta\" \n end\n\n if parlay_count.to_i == 5\n tipo_jugada = \"quinteta\" \n end\n\n if parlay_count.to_i == 6\n tipo_jugada = \"sexteta\" \n end\n\n if parlay_count.to_i == 7\n tipo_jugada = \"septimeta\" \n end\n\n if parlay_count.to_i == 8\n tipo_jugada = \"octaveta\" \n end\n\n control_monto_max_pago = Controldepagogt.where(:tipojugada => tipo_jugada ).first.limitexticket.to_i\n\n #verificar posible pago: riesgo\n entrada = entrada[1..(entrada.size-1)] # \"SOBREESCRIBO ESTO ASI: ..250 => .250\" ESTO PARA QUE LUEGO SE TRANSFORME DE .250 A 250 DENTRO DE LA FUNCION. REUCUERDA QUE EN ESTA SECCION DE CODIGO ENTRADA DE DE COBRO FINAL NO DE EVALUACION DE PAGO: ..250 ES DE COBRO FINAL. OK. TED.\n riesgo = procesar_posible_pago(last_tickect_current_user, entrada)# procesar_posible_pago retorna array ok ted.\n\n if (riesgo != nil) # esto para evitar errores de nil. ya no necesario porue depuramos no jugadas vacias para computar pero lo dejaremos ok. ted\n if (riesgo[1].to_i <= control_monto_max_pago)\n false # no excede ok\n else\n true # execede\n end\n end\n\n end",
"def imprimir_parciales1\n\n #aqui guardo todos los datos que necesito para imprimirlos en las variable\n\n @width_layout = '955'\n @form_title = ''\n @imprimo='1'\n\n @factura_orden_despacho_otra= FacturaOrdenDespacho.find(:all, :conditions=>\"id in #{params[:parciales_id]}\")\n\n factura_orden_despacho_count=FacturaOrdenDespacho.count(:all, :conditions=>\"id in #{params[:parciales_id]}\")\n\n @factura_orden_despacho=FacturaOrdenDespacho.find(:first, :conditions=>\"id in #{params[:parciales_id]}\")\n\n contw=0\n \n while contw < factura_orden_despacho_count\n @factura_orden_despacho_otra[contw].update_column(:emitida, true)\n #@factura_orden_despacho_otra[contw].emitida=true\n #@factura_orden_despacho_otra[contw].send(:update_without_callbacks)\n contw+=1\n\n end\n\n solicitu=OrdenDespacho.find(OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id).solicitud_id\n\n @solicitudes = Solicitud.find(:all,:conditions => ['id = ?', solicitu])\n\n unless @solicitudes[0].nil?\n if !@solicitudes[0].cliente.persona_id.nil? \n \t@es_no=1\n \t@datos_cliente=Persona.find(@solicitudes[0].cliente.persona_id) unless @solicitudes[0].nil?\n else\n \t@es_no=2\n \t@datos_cliente=Empresa.find(@solicitudes[0].cliente.empresa_id) unless @solicitudes[0].nil?\n end\n end\n @numero_desembolso=OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id\n\n @orden_despacho= OrdenDespacho.find(:all,:conditions => ['solicitud_id = ?', solicitu])\n\n\n @oficina= Oficina.find(:all,:conditions => ['id = ?', @solicitudes[0].oficina_id]) unless @solicitudes[0].nil?\n\n\n @parametros_general=ParametroGeneral.find(:first)\n\n @condition = \" orden_despacho_id = #{@factura_orden_despacho.orden_despacho_detalle.orden_despacho_id} and cantidad > 0\"\n @total = OrdenDespachoDetalle.count(:conditions=>@condition)\n @list = OrdenDespachoDetalle.find(:all, :conditions => ['orden_despacho_id = ? and cantidad > 0', @factura_orden_despacho.orden_despacho_detalle.orden_despacho_id])\n\n @total_saldo_entregar=0\n @total_precio_total=0\n cont=0\n diferencia=0.00\n @total_monto_confirmado=0.00\n \n while cont< @total\n\n #if OrdenDespacho.find(@numero_desembolso).estatus_id==20000 || OrdenDespacho.find(@numero_desembolso).estatus_id==20010 || OrdenDespacho.find(@numero_desembolso).estatus_id==20020\n \t \n # codigo nuevo al 3/9/2013 \n if ( ((@list[cont].cantidad * @list[cont].costo_real)!=@list[cont].monto_financiamiento) and (@list[cont].monto_recomendado!=0))\n @total_saldo_entregar+=@list[cont].monto_recomendado\n diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n else\n @total_saldo_entregar+=@list[cont].monto_financiamiento\n diferencia=@list[cont].monto_financiamiento - @list[cont].monto_facturacion\n end\n #codigo nuevo al 3/9/2013 \n \n \n #else\n \t #@total_saldo_entregar+=@list[cont].monto_recomendado\n #diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n #end\n @total_monto_confirmado+=@list[cont].monto_facturacion\n \n logger.debug \"monto financiamiento = \" << @list[cont].monto_financiamiento.to_s\n logger.debug \"monto facturacion = \" << @list[cont].monto_facturacion.to_s\n logger.debug \"diferencia = \" << diferencia.to_s\n if diferencia < 0\n diferencia=diferencia * -1 \n\n end\n \n @total_precio_total+=diferencia\n\n #@total_precio_total+=@list[cont].monto_facturacion\n \tcont+=1\t\n end\n @vista = 'view_factura_orden_despacho_parciales'\n\nend",
"def update\n super\n\n # Cuando un pez encuentra comida\n Pez.each_collision(Comida) do |pez, comida|\n pez.comer\n comida.destroy\n end # each\n\n #Cuando se generan las burbujas\n if (Time.now - @tiempo_burbuja) > 1\n Burbuja.create\n @tiempo_burbuja = Time.now\n end # if\n\n\n\n\n\n # Cuando ha pasado el tiempo necesario, se genera comida\n if (Time.now - @comida_inicio) > @comida_tasa\n Comida.create\n @comida_inicio = Time.now\n end # if\n\n # Cuando un pez encuentra otro pez\n Pez.each_collision(Pez) do |pez1, pez2|\n # print rand(10).to_s + \"Colision: pez1.rep=#{pez1.puede_reproducir?}, pez2.rep=#{pez1.puede_reproducir?}\\n\"\n if pez1.puede_reproducir? && pez2.puede_reproducir? && pez1.get_genero != pez2.get_genero\n pez1.reproducirse\n pez2.reproducirse\n reproducir_veces = $configuracion[2][1].to_i\n pez_vida_tiempo = $configuracion[3][1].to_i\n pez_reproducir_tiempo = $configuracion[6][1].to_i\n Pez.create.definir_parametros2(pez1.get_x, pez2.get_y, rand(2)+1, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo)\n end # if\n end # each\n\n # Cuando un tiburon encuentra con un pez\n Tiburon.each_collision(Pez) do |tiburon, pez|\n tiburon.comer_pez(pez)\n pez.destroy\n end # each\n\n # Los peces buscan particulas de comida y pareja al azar\n Pez.each do |pez|\n if pez.get_libre\n # 50 % de probabilidad de ir a buscar comida o buscar pareja\n pareja = rand(2)\n\n contador = 0\n if pareja == 1\n # los peces macho son la segunda mitad, por lo tanto si el pez\n # ... es hembra debe buscar solo los peces de la segunda mitad\n tam_pez = Pez.size / 2\n sumar = pez.get_genero == 1 ? tam_pez : 0\n elegido = rand(tam_pez) + sumar\n Pez.each do |pez2|\n if contador == elegido\n pez.buscar(pez2.get_x, pez2.get_y)\n end # if\n contador += 1\n end # each\n else\n elegido = rand(Comida.size)\n Comida.each do |comida|\n if contador == elegido\n pez.buscar(comida.get_x, comida.get_y)\n end # if\n contador += 1\n end # each\n end #if\n end # if\n\n # El pez tiende a evitar un tiburon al azar\n contador = 0\n elegido = rand(Tiburon.size)\n Tiburon.each do |tiburon|\n if contador == elegido\n pez.evitar(tiburon.get_x, tiburon.get_y)\n end # if\n contador += 1\n end # each\n end # each\n\n # Los tiburones buscan peces al azar\n Tiburon.each do |tiburon|\n contador = 0\n if tiburon.get_libre\n elegido = rand(Pez.size)\n Pez.each do |pez|\n if contador == elegido\n tiburon.buscar(pez.get_x, pez.get_y)\n end # if\n contador += 1\n end # each\n end #if\n end # each\n\n $window.caption = \"FPS: #{$window.fps} - Objetos: #{current_game_state.game_objects.size} - Peces: #{Pez.size} - Tiburones: #{Tiburon.size}\"\n end",
"def notaFinal\n print \"Aciertos: \"\n print @aciertos\n print \" / \"\n puts @numeroPreguntas\n print \"Su nota ha sido: \"\n @nota = ((@aciertos * 10) / @numeroPreguntas)\n print @nota\n return @nota\n end",
"def cobrar_alquiler costeAlquiler\n @propietario.modificar_saldo(costeAlquiler) \n end",
"def excede_control_de_pago_global()\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0 # inicializacionn de variable sumatoria en cero ok\n #La idea aqui es verificar si la sumatoria de posible pago de todas las jugadas de todos los tipos de tickets activos de hoy no excede el limite globar de riesgo del sistema ok\n \n #limite GLOBAL = 1 ADMINISTRATIVO OK Y TIPOJUGADA TAMBIEN MANUAL = GLOBAL OK TED. POPULATE IT IN DATABASE PRODUCTION OK:\n control_monto_max_pago_global = Controldepagogt.where(:tipojugada => \"global\" ).first.limiteglobal.to_i || 1 # setear un valor default ok \n\n t_ids = Ticket.today.where(:activo => \"si\").ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_sumatoria_posible_pago = Jugadalot.where(:ticket_id => t_ids)# postrges casting erro string ok .sum(:posiblepago).to_i\n \n if not @listado_sumatoria_posible_pago.nil?\n @listado_sumatoria_posible_pago.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += jugada.posiblepago.to_i\n end\n \n end\n \n \n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0\n# t.each do |ticket|\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n# end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global.to_i <= control_monto_max_pago_global.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end",
"def lancementAccueil\n\t\t@@fenetre.changerWidget(HudAccueil.new(@@fenetre))\n\t\tself\n\tend",
"def annulerresa\n @coinused = Coin.where(\"(user_id = #{current_user.id} AND bid_id = #{@bid.id})\")\n if @coinused.size > 0\n if @bid.pass1_id == current_user.id\n @bid.pass1_id = 0\n elsif @bid.pass2_id == current_user.id\n @bid.pass2_id = 0\n elsif @bid.pass3_id == current_user.id\n @bid.pass3_id = 0\n else\n @bid.pass4_id = 0\n end\n @val = Validation.where(\"(bid_id = #{@bid.id} AND pass_id = #{current_user.id})\").first\n if @val.validated\n coco = Coin.where(\"(comment1 = 'Validation bid #{@val.bid_id}' AND user_id = #{@val.driver_id})\").first\n coco.destroy\n end\n @val.destroy\n # ContactMailer.annulresa_email(current_user,@bid).deliver_now\n # ContactMailer.annulresaP_email(current_user,@bid).deliver_now\n @coinused.first.update_attributes(:bid_id => 0, :comment2 => \"annulation pour le trajet #{@bid.id} le #{DateTime.now.to_s}\")\n respond_to do |format|\n if @bid.save\n format.html { redirect_to root_path, notice: 'Votre reservation a été annulée' }\n format.json { render :show, status: :created, location: @bid }\n else\n format.html { render :new }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n if @bid.save\n format.html { redirect_to root_path, notice: \"Vous n'avez pas de reservation pour ce trajet \" }\n format.json { render :show, status: :created, location: @bid }\n else\n format.html { render :new }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def status_da_divulgacao(topico)\n end",
"def carbo \n grtotal = 0\n sum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las \n #cabrohidratos dependiendo de la cantidad y tambien suma\n #todas las cantidades para poder calcular el porcentaje\n #despues\n @lista.zip(@listagr).each do |normal, gr|\n grtotal += gr\n cant = gr/1000.0\n sum += normal.carbo*cant\n end\n (sum*100)/grtotal\n end",
"def descuento_sueldo(sueldo, tipo_obrero)\n\tif tipo_obrero == 'o'\n\t\tsueldo - (sueldo * 0.12) #OCURRE A\n\telse\n\t\tsueldo - (sueldo * 0.15) #OCURRE B\n\tend\nend",
"def cicloInactiva\n \n #-- Se calcula la cantidad de insumo basico requerido por la maquina C \n insumoRequerido = @porcentajeIB * @cantidadMax\n \n #-- Unicamente si se tiene la cantidad requerida de insumo basico\n #-- en el contenedor, se procede a analizar el resto de la mezcla\n if @insumoBasico.cantidad >= insumoRequerido \n \n #-- Caso en el que la maquina posee un contenedor de enlace\n #-- con una maquina anterior.\n if @productoAnterior != nil\n \n\n \n #-- Se calcula la cantidad de producto anterior requerido\n #-- por la maquina Compleja\n productoAnteriorRequerido = @porcentajePA * @cantidadMax\n cantidadAObtener = productoAnteriorRequerido -\n @productoAnteriorRestante \n \n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- es suficiente para comenzar el procesamiento de \n #-- la maquina\n if @productoAnterior.cantidad >= cantidadAObtener\n \n #-- Se resta la cantidad necesaria para comenzar a \n #-- procesar de la cantidad encontrada en el contenedor\n @productoAnterior.cantidad -= cantidadAObtener\n \n #-- Se disminuye la cantidad de insumo basico del \n #-- contenedor\n @insumoBasico.cantidad -= insumoRequerido\n @productoAnteriorRestante = 0.0\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- no es el suficiente para comenzar el procesamiento de\n #-- de la maquina\n else\n #-- Se recolecta en su totalidad la fraccion restante \n #-- de producto anterior del contenedor\n @productoAnteriorRestante += @productoAnterior.cantidad\n @productoAnterior.cantidad = 0\n \n end\n \n #-- Caso en el que la maquina corresponde a la primera dentro\n #-- del proceso de produccion. Unicamente se verifica el insumo\n #-- basico, pues no se depende de ningun producto anterior.\n else\n @insumoBasico.cantidad -= insumoRequerido\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n end\n end\n end",
"def transferir(conta, valor)\n \n if self.saldo > valor\n if valor > 1000 #Se a transferencia for maior que 1000 \n retirar_valor(valor+self.taxa)\n depositar_valor(conta,valor) \n else\n depositar_valor(conta,valor) \n retirar_valor(valor)\n end\n else\n p \"Nao e possivel transferir R$#{valor} para #{conta.proprietario}\" \n end\n \n end",
"def update\n @dock = Dock.find(params[:dock_id])\n @berth = Berth.find(params[:id])\n newvalue = params[:berth][:width]\n currentTotalWidth = Berth.where(:dock_id => params[:dock_id]).sum('width').to_f\n currentTotalWidth = currentTotalWidth - @berth.width.to_f\n currentTotalWidth = currentTotalWidth + newvalue.to_f\n isOk = currentTotalWidth <= @dock.length.to_f\n okRek = true\n respond_to do |format|\n if isOk && @berth.update_attributes(params[:berth])\n unless params[:berth][:reknro].blank?\n @boat = Boat.where(:reknro => params[:berth][:reknro]).first\n if @boat != nil\n unless @boat.pituus.to_f <= params[:berth][:length].to_f && @boat.leveys.to_f <= params[:berth][:width].to_f && @boat.syvyys.to_f <= params[:berth][:depth].to_f\n params[:berth][:reknro] = \"\"\n flash[:alert] = 'Vene on liian suuri mahtuakseen paikkaan.'\n @berth.update_attributes(params[:berth])\n end\n else\n okRek = false\n format.html { redirect_to @dock, notice: 'Laituripaikkaa ei päivitetty kyseiselle rekisterinumerolle, virheellinen rekisterinumero.'}\n end\n end\n format.html { redirect_to @dock, notice: 'Laituripaikka päivitetty.'}\n format.json { head :no_content }\n else\n format.html {\n flash[:notice] = 'Laituripaikkojen leveys ylitti laiturin leveyden'\n render :edit\n }\n format.json { render json: @berth.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:elefe][:prix]\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n params[:elefe][:signature] = false\n cour = Cour.find_by(:id => params[:elefe][:ville_entrainement])\n cours = @elefe.cours\n if !cours.detect { |b| b.id == cour.id }\n @elefe.cours << cour\n end\n @elefe.commandes.first.update(montant: params[:elefe][:prix])\n @elefe.update_attributes(:updated_at => Time.now)\n end\n respond_to do |format|\n if @elefe.update(elefe_params)\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été modifiée.' }\n format.json { render :show, status: :ok, location: @elefe }\n else\n format.html { render :edit }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def nouveau_prix\n nouveau_prix = 0\n if(!bouteille.nil?)\n nouveau_prix = bouteille.prix\n nouveau_prix = nouveau_prix * (1 - (rabais/100)) if rabais?\n end\n ActionController::Base.helpers.number_to_currency(nouveau_prix, unit: \"\", separator: \".\", delimiter: \"\", format: \"%n\")\n end",
"def update\n @egreso_interno = EgresoInterno.find(params[:id])\n @total=dinero_actual\n if @egreso_interno.monto>@total\n flash[:warning] = 'El monto de egreso no puede ser mayor al monto actual'\n render action: \"edit\"\n else\n if @egreso_interno.update(egreso_interno_params)\n flash[:success] = \"Egreso Interno actualizado exitosamente\"\n redirect_to @egreso_interno\n else\n render action: \"edit\"\n end\n end\n end",
"def blam!\n self.health -= 10\n end",
"def utiliser(unJoueur)\n\t\tunJoueur.incEndurance(@valeurED)\n\t\tunJoueur.incPointsDeVie(@valeurPV)\n\tend",
"def preencherLancamento(valorDeb, valorCred)\n preencherCabecalhoLancamento\n # INCLUSAO DEBITO\n campoDebitoConta.send_keys(@@conta)\n sleep 1\n campoDebitoConta.send_keys :down\n campoDebitoConta.send_keys :enter\n campoDebitoValor.set(valorDeb)\n campoDebitoHistorico.set(@@historico)\n sleep 1\n campoDebitoHistorico.send_keys :down\n campoDebitoHistorico.send_keys :enter\n campoDebitoComplemento.set(@@complementoDebito)\n # INCLUSAO CREDITO\n campoCreditoConta.send_keys(@@conta)\n sleep 1\n campoCreditoConta.send_keys :down\n campoCreditoConta.send_keys :enter\n campoCreditoValor.set(valorCred)\n campoCreditoHistorico.set(@@historico)\n sleep 1\n campoCreditoHistorico.send_keys :down\n campoCreditoHistorico.send_keys :enter\n campoCreditoComplemento.set(@@complementoCredito)\n end",
"def calculate_commissions\n # We take 30% of the final price\n commission = (self.price * 0.3).round\n\n # We split this commission into fees\n # Half goes to the insurance\n self.insurance_fee = (commission * 0.5).round\n # 1€/day goes to the roadside assistance.\n self.assistance_fee = self.duration * 100\n # The rest goes to us\n self.drivy_fee = commission - self.insurance_fee - self.assistance_fee\n end",
"def calcular()\n lista_nombres=@individuos[0].get_lista_nombres\n lista_nombres.each do |nombre|\n cont=0\n igind=0\n #puts nombre\n for j in [email protected]\n\tglucosa=@individuos[j].get_glucosa.to_f\n #puts glucosa\n aibc=@individuos[j].get_aibc(nombre)\n #puts aibc\n aux=aibc/glucosa*100\n #puts aux\n igind=igind+aux\n\tcont=cont+1\n end\n igind=igind/cont\n #puts igind\n @resultados << nombre + \" \" + igind.round(2).to_s + \"\\n\"\n end\n end",
"def horizontal_bewegen(anzahl_punkte)\n @fuss.horizontal_bewegen(anzahl_punkte)\n @stiel.horizontal_bewegen(anzahl_punkte)\n @schirm.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl1.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl2.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl3.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl4.horizontal_bewegen(anzahl_punkte)\n end",
"def deshabilitar\n @usuario = Usuario.find(params[:id])\n respond_to do |format|\n if @usuario.bloqueado == 0 \n if @usuario.update_attribute(\"bloqueado\", 1)\n format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n format.json { head :no_content }\n else\n flash.keep\n format.html { render action: \"edit\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n else @usuario.bloqueado == 1\n if @usuario.update_attribute(\"bloqueado\", 0)\n format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n format.json { head :no_content }\n format.html { render action: \"edit\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end \n end\n end \n end",
"def feuer_frei(concentration, barrels)\n fuel = concentration * barrels\n if fuel == 100\n 'Perfekt!'\n elsif fuel < 100\n (100 - fuel).to_s + ' Stunden mehr Benzin benötigt.'\n else\n fuel - 100\n end\nend",
"def debo_ir_a_carcel\n if (super)\n return !pagar_fianza\n else\n return true \n # Lo hemos hecho así, porque pensamos que si tiene carta y llama a \n # pagar fianza y tiene el saldo suficiente, se restaría dinero\n # del saldo aún teniendo la carta libertad\n end\n end",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def calcula_imc(peso, altura)\n return peso / altura ** 2\nend",
"def lancerJeu( hero, niveau )\n\t\t@jeu = Jeu.nouveau( 100, 100, niveau, hero )\n\t\[email protected]( self )\n\tend",
"def define_cutoffs\n @contest.bronze_cutoff = params[:bronze_cutoff].to_i\n @contest.silver_cutoff = params[:silver_cutoff].to_i\n @contest.gold_cutoff = params[:gold_cutoff].to_i\n if @contest.save\n compute_new_contest_rankings(@contest)\n flash[:success] = \"Les médailles ont été distribuées !\"\n else\n flash[:danger] = error_list_for(@contest)\n end\n redirect_to @contest\n end",
"def por_lip\n\t\t\t(@lipidos/suma_gramos)*100\n\t\tend",
"def cap_redeem(num_bottles)\n\tnum_bottles/4\nend",
"def subract_mileage_from_shoe(mileage_of_run)\n\t\tself.mileage_total -= mileage_of_run\n\t\tself.save(:validate => false)\n\tend",
"def set_administracao_combustivel\n @administracao_combustivel = Administracao::Combustivel.find(params[:id])\n @valor = @administracao_combustivel.valor.to_f\n end",
"def activar()\n\n i=0\n\n print \"Inicio planta\\n\"\n\n cantidadCervezas = 0\n while(i < @ciclos)\n\n i+=1;\n print \"---------->Ciclo numero\",i,\"<---------------\\n\"\n\n #Inicio de procesamiento\n @silosCebada.producir(@almacen)\n @silosCebada.imprimir()\n @molino.producir(@almacen)\n @molino.imprimir()\n @pailaMezcla.producir(@almacen)\n @pailaMezcla.imprimir()\n @cuba.producir(@almacen)\n @cuba.imprimir()\n @pailaCoccion.producir(@almacen)\n @pailaCoccion.imprimir()\n @tanquePreclarif.producir(@almacen)\n @tanquePreclarif.imprimir()\n @enfriador.producir(@almacen)\n @enfriador.imprimir()\n @tcc.producir(@almacen)\n @tcc.imprimir()\n @filtroCerveza.producir(@almacen)\n @filtroCerveza.imprimir()\n @tanqueFiltroCerveza.producir(@almacen)\n @tanqueFiltroCerveza.imprimir()\n @llenadora.producir(@almacen) \n @llenadora.imprimir() \n\n #Verifica si hubo cambios en la cantidad de cervezas\n #en el ciclo\n cervezasCiclo = @almacen.obtener_insumo(\"cerveza\")\n if (cantidadCervezas != cervezasCiclo)\n print \"Cervezas Salientes: \", (cervezasCiclo - cantidadCervezas), \"\\n\\n\"\n cantidadCervezas = cervezasCiclo\n end \n\n end\n\n #Despues de haber terminado de fabricar, imprimimos lo que haya quedado\n #en el almacen\n @almacen.imprimir()\n\n end",
"def recu\n if request.post? && params[:parent] && params[:courriel] then\n annee = (Date.today.month > 6 ? Date.today.year : Date.today.year - 1)\n parent = params[:parent]\n to = params[:courriel]\n unless @famille.recus.nil? || @famille.recus.empty?\n FamilleMailer.recu(@famille, @famille.recus, to, parent).deliver\n flash[:notice] = t(:public_recu_sent, to: to)\n else\n flash[:notice] = t(:public_recu_na)\n end\n redirect_to public_home_path\n return;\n end\n \n # On doit avoir une adresse courriel\n if @famille.courriels.empty?\n flash[:notice] = t(:public_recu_email_needed)\n redirect_to :action => 'edit'\n return\n end\n \n # Si on parvient jusqu'ici, on affiche le formulaire\n end",
"def valorizacao\n \t\tif self.tipo_de_operacao.compra?\n ((self.atual - self.entrada) / self.entrada) * 100.0\n else\n ((self.entrada - self.atual) / self.atual ) * 100.0\n end\n \tend",
"def descontar_medicamentos\n\t \tself.medicamento.cantidad -= self.cantidad\n\t \tself.medicamento.save\n\t end",
"def split_the_check\n @split_check = (total_check / diners).round(2)\n end",
"def pai_modificado\n \tif (self.changed.include? 'pai_id') & (self.pai == nil) \t\t\n \t\tself.errors.add(:pai, \"Não é possível tornar Matriz uma conta Filial\")\n \tend\n \tend",
"def clean\n puts\"Vous nettoyez votre animal \\n\"\n @mental +=10\n @health +=30\n return 4\n end",
"def destroy\n \n respond_to do |format|\n if @auction1.puja>= @auction1.montominimo\n @ganador= User.find(@auction1.ganador)\n @ganador.update(creditos: @ganador.creditos - 1) \n @auction1.destroy\n format.html { redirect_to terminar_path, notice: 'Subasta terminada correctamente con un ganador'} \n format.json { head :no_content }\n\n else \n @auction1.destroy\n format.html { redirect_to terminar_path, notice: 'Subasta terminada Sin ningun ganador,no se supero la puja minima' }\n format.json { head :no_content }\n end\n end\nend",
"def afficher()\n 0.upto(@largeur + 1) do\n print(\"$\")\n end\n print(\"\\n$\")\n @table.each{|c|\n if((c.y)+1 >= @largeur)\n c.afficher\n print(\"$\\n$\")\n else\n c.afficher\n end\n }\n 0.upto(@largeur - 1) do\n print(\"$\")\n end\n puts(\"$\")\n end",
"def monto_utilizado_devoluciones\n credito_restante = notas_creditos_debito.credito_restante\n credito_restante += monto_utilizado_was if persisted? # sumar el monto_utilizado anterior si se esta editando\n errors.add(:monto_utilizado, I18n.t('activerecord.errors.messages.credito_superior_a_disponible')) if credito_restante < monto_utilizado\n errors.add(:monto_utilizado, I18n.t('activerecord.errors.messages.monto_utilizado_cero')) if monto_utilizado <= 0\n false if errors.size > 0\n end"
] |
[
"0.61234796",
"0.5997743",
"0.59718865",
"0.5799232",
"0.5722709",
"0.5607618",
"0.5603682",
"0.55915296",
"0.5581747",
"0.5580277",
"0.5556741",
"0.5518329",
"0.5511251",
"0.5481011",
"0.54755145",
"0.54505134",
"0.5448348",
"0.5442821",
"0.5425443",
"0.5419622",
"0.5416064",
"0.54108804",
"0.5402896",
"0.53879905",
"0.5386903",
"0.5382652",
"0.5381587",
"0.5374901",
"0.5350579",
"0.5348296",
"0.53366023",
"0.53184825",
"0.53070605",
"0.53070605",
"0.53019357",
"0.5301041",
"0.5275891",
"0.5267594",
"0.5263171",
"0.5249732",
"0.5237309",
"0.5227773",
"0.5215386",
"0.52072376",
"0.5199944",
"0.51978153",
"0.51857156",
"0.51832515",
"0.5180134",
"0.5176153",
"0.51760817",
"0.51709825",
"0.5159496",
"0.51502454",
"0.5144245",
"0.5141521",
"0.51331484",
"0.5133044",
"0.5130409",
"0.5120315",
"0.5112002",
"0.51103634",
"0.51059467",
"0.5105415",
"0.5104062",
"0.51035",
"0.51016825",
"0.51003927",
"0.5096163",
"0.50899446",
"0.5088117",
"0.5080836",
"0.5075801",
"0.507463",
"0.5069854",
"0.50567657",
"0.50535923",
"0.50351286",
"0.50293237",
"0.50292534",
"0.5021955",
"0.5020483",
"0.50121087",
"0.50073457",
"0.50039893",
"0.5001223",
"0.5000754",
"0.50005174",
"0.49946994",
"0.49932736",
"0.49896634",
"0.4985729",
"0.49852037",
"0.49740836",
"0.4971389",
"0.4963912",
"0.49627018",
"0.49567908",
"0.4953746",
"0.49533015",
"0.49526626"
] |
0.0
|
-1
|
Function constructor for immutable Set
|
def Set(*elements)
Set.new(elements).freeze
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_set(klass = Set, *args, &block)\n return self if instance_of?(Set) && klass == Set && block.nil? && args.empty?\n klass.new(self, *args, &block)\n end",
"def to_set(klass = IntegerSet, *args, &block)\n return self if instance_of?(IntegerSet) && klass == IntegerSet && block.nil? && args.empty?\n klass.new(self, *args, &block)\n end",
"def EmptySet\n Class.new do\n define_method(:empty?) { true }\n\n define_method(:contains?) { |i| false }\n\n define_method(:insert) { |i| InsertSet(self, i) }\n\n define_method(:union) { |s| s }\n end.new\nend",
"def initialize(tuples)\n raise ArgumentError unless tuples.is_a?(Set)\n @tuples = tuples\n end",
"def initialize( x, y, z=0 ) ; set( x, y, z ) end",
"def initialize(*args, set_operations: true, **kws)\n super(*args, **kws)\n @set_operations = set_operations # Instruct to emit standard set operations (conjunction, disjunction etc.)\n end",
"def make_set(x,y,z)\n return [x,y,z]\n end",
"def initialize(array = [])\n raise ArgumentError, 'New set must be given an array' unless array.class == Array\n \n @internal_hash = array.reduce(Hash.new(false)) do |hash, i|\n hash[i] = true\n hash\n end\n end",
"def initialize(iterable = nil)\n raise 'MySet only accepts iterables or nothing on initialization!' unless \n iterable.nil? || iterable.kind_of?(Array) || iterable.kind_of?(String)\n\n @data = {}\n\n unless iterable.nil?\n items = iterable.kind_of?(String) ? iterable.split('') : iterable\n\n items.each { |el| @data[el] = true }\n end\n end",
"def initialize_set(h)\n set(h) unless h.empty?\n end",
"def initialize_set(h)\n set(h) unless h.empty?\n end",
"def initialize(set, name)\n @set, @name = set, name\n end",
"def to_set\n ::Set.new(to_a)\n end",
"def initialize(*elements)\n @elements = Set.new\n elements.each {|elt| add(elt) }\n super()\n end",
"def MakeSet(dset, x)\n unless dset[x] \n # add x to the disjoint-set tree\n dset[x] = {parent: x, size:1}\n end\nend",
"def set=(_arg0); end",
"def initialize(children = [], properties = {})\n super(Set.ast_type, children, properties)\n end",
"def set(pairs={})\n if not(immutable?)\n pairs.each {|idx, val| self[idx] = val}\n return self\n else\n pairs.inject(self) {|obj, (idx, val)| obj.send(\"[]=\", idx, val)}\n end\n end",
"def to_hashset(method = nil, *args)\n return self if self.is_a? java.util.HashSet and not method\n hs = java.util.HashSet.new\n if method\n each do |e|\n hs.add e.send(method, *args)\n end\n else\n each do |e|\n hs.add e\n end\n end\n hs\n end",
"def initialize( one_of: [], all_of: [], none_of: [] )\n\t\t@one_of = Set.new( one_of )\n\t\t@all_of = Set.new( all_of )\n\t\t@none_of = Set.new( none_of )\n\tend",
"def to_set\n require 'set' unless defined?(::Set)\n each.to_set\n end",
"def set(values); end",
"def initialize args={}\n assign(args)\n @associated_objects = Hash.new{ |h, k| h[k] = Set.new }\n end",
"def set(enumerable); end",
"def find_duplicates_set_approach(array)\n duplicates = []\n set = Set.new(array)\n \n set\n \nend",
"def ^(enum)\n if enum.is_a?(Set)\n enum = try_integer_set(enum)\n return enum.is_a?(IntegerSet) ? self.class.from_i(@val ^ enum.to_i) : enum ^ self\n end\n n = IntegerSet.new(enum)\n each { |o| if n.include?(o) then n.delete(o) else n.add(o) end }\n n\n end",
"def unique(integers)\n integers.to_set.to_a\nend",
"def initialize\n super\n @scope = ::Set.new\n end",
"def createNewSet (source)#, depth=1,clean=false)\r\n\tns = source.clone\r\n\tns.root.children.remove\r\n\tns.encoding = 'UTF-8'\r\n\treturn ns\r\nend",
"def sets\n return [EscholSet.new({name: \"everything\", spec: \"everything\"})]\n end",
"def call(value)\n coerced = value.map { |item| super(item) }\n\n @set ? Set.new(coerced) : coerced\n end",
"def initialize(*sets)\n super()\n\n @sets = sets\n end",
"def initialize(x = nil, y = nil)\n set(x,y) ;\n end",
"def uniq\n self.class.new(values: to_a.uniq)\n end",
"def immutable\n\n instance_eval { def set(name, value) raise \"Array is immutable\" end }\n instance_eval { def set_scalar(name, value) raise \"Array is immutable\" end }\n instance_eval { def set_next(value) raise \"Array is immutable\" end }\n instance_eval { def []=(name, value) raise \"Array is immutable\" end }\n\n end",
"def initialize(*initial_bits)\n @bits = initial_bits.map {|bit| convert_bit(bit) }.inject(:+) || 0\n\n @set_indexes = []\n @set_indexes += initial_bits.uniq if initial_bits\n end",
"def initialize(keyword); super(keyword); @argSet = Set.new end",
"def const_set(p0, p1) end",
"def |(other_set)\n super(CharSet.new(other_set))\n end",
"def initialize(v = nil, **opt)\n set(v, **opt)\n end",
"def new_input_set()\n return SetDescriptionInputSet.new()\n end",
"def to_hashset(method = nil, *args)\n return self if self.is_a? java.util.HashSet\n hs = java.util.HashSet.new\n iter = self.each rescue nil\n if not iter and respond_to? :iterator\n iter = self.iterator\n end\n e = iter.next\n if method\n while true\n hs.add e.send(method, *args)\n e = iter.next\n end\n else\n while true\n hs.add e\n e = iter.next\n end\n end\n rescue StopIteration\n return hs\n rescue NativeException => e\n if (e.cause.kind_of?(java.util.NoSuchElementException))\n return hs\n else\n raise\n end\n end",
"def &(enum)\n new_set = TreeSet.new\n enum.each do |val|\n new_set << val if self.include?(val)\n end\n new_set\n end",
"def clone\n new_set = TreeSet.new\n # Create new nodes in the same order as self's\n if root\n root.root_traverse do |node|\n new_set << node.value\n end\n end\n new_set\n end",
"def initialize_set(h)\n super\n reset_initial_values\n end",
"def new_input_set()\n return UniqueNameSearchInputSet.new()\n end",
"def new_input_set()\n return SpecialNeedsInputSet.new()\n end",
"def sets\n end",
"def new_set\r\n @sets[@current_set_name] = @current_set\r\n @current_set = []\r\n end",
"def [](*names)\n NameSet.new(*names)\n end",
"def |(enum)\n if enum.is_a?(Set)\n enum = try_integer_set(enum)\n return enum.dup.merge(self) unless enum.is_a?(IntegerSet)\n end\n dup.merge(enum)\n end",
"def valid_sets; end",
"def initialize()\r\n @entries = Set.new\r\n @entries_by_date = {}\r\n end",
"def uniq(&block)\n _uniq(::Set.new, &block)\n end",
"def initialize()\n @restaurants = SortedSet.new\n end",
"def initialize; @imps = Set.new end",
"def const_set(arg0, arg1)\n end",
"def add_set(set_id, item_ids)\n raise \"implemented in subclass\"\n end",
"def mset(*)\n raise CannotDistribute, :mset\n end",
"def initialize(sets, indices=nil)\n @sets = sets\n\n @set_indices = indices ?\n winnow_indices(indices) :\n create_indices\n end",
"def set; end",
"def set; end",
"def initialize(one)\n @one = one\n @many = Set.new\n end",
"def |(enum)\n new_set = TreeSet.new\n [self, enum].each do |enumerable|\n enumerable.each do |val|\n new_set << val\n end\n end\n new_set\n end",
"def to_set\n a = Set.new\n @index.each_value do |s|\n s.each do |t|\n a << t\n end\n end\n a\n end",
"def set(arr)\n\treturn arr.uniq\nend",
"def add(*args)\n args.flatten! # allow [] as a param\n args.each do |arg|\n arg = arg.to_sym if arg.is_a? String\n @set << arg unless @set.include? arg # avoid duplicates\n end\n end",
"def set(*args)\n # not supported\n end",
"def set(*args)\n # not supported\n end",
"def convert(y)\n y.chars.to_a.to_set\nend",
"def initialize(vert = nil, forw = nil, back = nil)\n @vert = vert || Set.new\n @forw = forw || Map.new\n @back = back || Map.new\n freeze\n end",
"def new_input_set()\n return UnsharePublicInputSet.new()\n end",
"def uniq!() end",
"def ===(other)\n to_set == other.to_set\n end",
"def new_input_set()\n return AncestryInputSet.new()\n end",
"def initialize( *cookies )\n\t\t@cookie_set = Set.new( cookies.flatten )\n\tend",
"def new_input_set()\n return RemoveInputSet.new()\n end",
"def new_input_set()\n return GenomesInputSet.new()\n end",
"def call(value)\n coerced = value.map do |item|\n coerced_item = super(item)\n\n return coerced_item if coerced_item.is_a?(InvalidValue)\n\n coerced_item\n end\n\n @set ? Set.new(coerced) : coerced\n end",
"def add_all(set)\n raise NotImplementedError\n end",
"def new_input_set()\n return CreateCollectionInputSet.new()\n end",
"def test_create_dict_set_is_a_set\n assert_kind_of Set, @grapher.create_dict_set('wordlist.txt')\n end",
"def multipleSet(n)\n return (n..99).step(n).to_a.to_set\nend",
"def nsindexset\n if self.length == 0\n raise \"An index set must have at least one index\"\n end\n\n set = NSMutableIndexSet.indexSet\n self.each do |val|\n set.addIndex val\n end\n set\n end",
"def nsindexset\n if self.length == 0\n raise \"An index set must have at least one index\"\n end\n\n set = NSMutableIndexSet.indexSet\n self.each do |val|\n set.addIndex val\n end\n set\n end",
"def new_input_set()\n return MathAndScienceInputSet.new()\n end",
"def minus(other)\n set = MyHashSet.new\n to_a.each { |el| set.insert(el) unless other.include?(el) }\n set\n end",
"def <=>(set)\n return unless set.is_a?(Set)\n\n case size <=> set.size\n when -1 then -1 if proper_subset?(set)\n when +1 then +1 if proper_superset?(set)\n else 0 if self.==(set)\n end\n end",
"def mset(*_arg0); end",
"def new_input_set()\n return ListSetsInputSet.new()\n end",
"def getset(key); end",
"def new_input_set()\n return SharePublicInputSet.new()\n end",
"def initialize(name, *xs)\n xs.flatten!\n CAS::Help.assert_name name\n xs.each do |x|\n CAS::Help.assert x, CAS::Op\n end\n # raise CASError, \"Function #{name} already exists\" if CAS::Function.exist? name\n\n @x = xs.uniq\n @name = name\n @@container[@name] = self\n end",
"def -(enum)\n new_set = self.clone\n enum.each do |val|\n new_set.delete(val)\n end\n new_set\n end",
"def hash_record_low_mem! set, rec, duplicate_type\n key = make_key rec, duplicate_type\n\n set << key\nend",
"def uniq(*args)\n clone(:distinct => args)\n end",
"def new_input_set()\n return UserInputSet.new()\n end",
"def my_unique\n dict = Hash.new(false)\n self.each_with_index do |el, idx|\n self[idx] = nil if dict[el]\n dict[el] = true\n end\n self.compact!\n end",
"def initialize_copy(from)\n @set = from.instance_variable_get('@set').clone\n end",
"def change_set_fn\n -> f, g, prev, this {\n f.(Set.new(this) - Set.new(prev))\n g.(Set.new(prev) - Set.new(this))\n }.curry\n end"
] |
[
"0.72407925",
"0.68801",
"0.66608435",
"0.662431",
"0.64515585",
"0.64301264",
"0.6287075",
"0.62222373",
"0.61873573",
"0.6140284",
"0.6140284",
"0.6114759",
"0.61047876",
"0.60450715",
"0.59863216",
"0.5957244",
"0.59066105",
"0.5890212",
"0.5861376",
"0.58516794",
"0.5846549",
"0.5841087",
"0.58358574",
"0.5818027",
"0.581102",
"0.5741269",
"0.5727034",
"0.57216847",
"0.5702223",
"0.5667407",
"0.5667188",
"0.5660577",
"0.56116027",
"0.5581439",
"0.5575114",
"0.5534766",
"0.55041635",
"0.5503029",
"0.54947555",
"0.54827935",
"0.54625267",
"0.54611236",
"0.5454439",
"0.54481864",
"0.5446475",
"0.54422027",
"0.5422967",
"0.5416516",
"0.5404152",
"0.53954583",
"0.538888",
"0.53849095",
"0.5366848",
"0.53660214",
"0.5355293",
"0.53436875",
"0.5342455",
"0.5334858",
"0.53341204",
"0.5332897",
"0.53183365",
"0.53183365",
"0.53085387",
"0.5306324",
"0.52977115",
"0.5280275",
"0.52792704",
"0.5268639",
"0.5268639",
"0.5265565",
"0.523283",
"0.52259654",
"0.52238435",
"0.52220035",
"0.52205545",
"0.52178746",
"0.51983833",
"0.5187061",
"0.51670444",
"0.51634735",
"0.5153952",
"0.5147225",
"0.51365095",
"0.51352346",
"0.51352346",
"0.5134121",
"0.5130426",
"0.5118346",
"0.5116074",
"0.51135397",
"0.5113027",
"0.5086584",
"0.50862324",
"0.507982",
"0.5078795",
"0.50676185",
"0.50578845",
"0.5056573",
"0.50538653",
"0.5050496"
] |
0.6943262
|
1
|
Functional constructor for weighted and unweighted links.
|
def Link(from, to, weight = nil)
if weight
WeightedLink.new(from, to, weight)
else
Link.new(from, to)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def link(src, dest, w=1, add=:add)\n if (!@directed) \n begin\n src, dest = dest, src if (src > dest)\n rescue ArgumentError\n src, dest = dest, src if (src.object_id > dest.object_id)\n end\n end\n key = [src,dest]\n unless l = @links[key]\n l = Link.new(self, src, dest)\n @sourcelinks[src] << l\n @destlinks[dest] << l\n @links[key] = l\n end\n\n case add\n when :max, false\n l.maxweight(w)\n when :min\n l.minweight(w)\n else # add\n l.addweight(w)\n end\n l\n end",
"def initialize(weight, capacity)\n @weight, @capacity = weight, capacity\n end",
"def initialize(type, weight)\n @type = type\n @weight = weight\n end",
"def initialize\n @weights = { count: {}, first: {}, next: {}, last: {} }\n end",
"def initialize(weight, fake_functions=nil)\n @max_random_weight = weight\n @fake_functions_collection = fake_functions\n end",
"def initialize args = {}\n hash_make args, Network::ARG_SPECS\n \n # ensure that all sample rates match given rate\n @blocks.each do |block_name, block|\n if block.sample_rate != @sample_rate\n raise ArgumentError, \"block sample rate #{block.sample_rate} does not match network sample rate #{@sample_rate}\"\n end\n end\n \n @links.each do |link|\n link.activate\n end\n end",
"def initialize(one, other, weight = 1.0)\n @one, @other = (one.hash < other.hash)? [one, other] : [other, one]\n @weight = weight\n end",
"def initialize(name, opts={})\n super(name, opts)\n @weight = opts[:weight] || 1.0\n @assumed_probability = opts[:assumed_probability] || 0.1\n\n end",
"def initialize(graph, src, dest, attrs={})\n @graph = graph\n @src = src\n @dest = dest\n @weight = 0\n @attrs = attrs\n @timeline = []\n end",
"def initialize(network_structure)\n @structure = network_structure\n @initial_weight_function = lambda { |n, i, j| ((rand 2000)/1000.0) - 1}\n @propagation_function = lambda { |x| 1/(1+Math.exp(-1*(x))) } # lambda { |x| Math.tanh(x) } #\n @derivative_propagation_function = lambda { |y| y*(1-y) } # lambda { |y| 1.0 - y**2 } #\n @disable_bias = false\n @learning_rate = 0.25\n @momentum = 0.1\n end",
"def initialize(edge, v1, v2)\n \t@edge = edge\n @v1 = v1\n @v2 = v2\n @weight = distance([v1.lat.to_f, v1.lon.to_f],[v2.lat.to_f, v2.lon.to_f])\n end",
"def new(*args, &block)\n self.class.new(relation.public_send(*args, &block), options)\n end",
"def initialize(weight, gender, drinks, volume, last_drink)\n @weight = weight\n @gender = gender\n @drinks = drinks\n @volume = volume\n @last_drink = last_drink\n end",
"def initialize(layout, corpus)\n @layout = layout\n @corpus = corpus\n\n @weights = ORDER1.map{ |o| o * 10 } # DEPRECATED\n end",
"def link( index )\n\t\tLink.new( \n\t\t\tself.words[ self.link_lword(index) ],\n\t\t\tself.words[ self.link_rword(index) ],\n\t\t\tself.link_length(index),\n\t\t\tself.link_label(index),\n\t\t\tself.link_llabel(index),\n\t\t\tself.link_rlabel(index),\n\t\t\tLinkTypes[ self.link_label(index).gsub(/[^A-Z]+/, '').to_sym ]\n\t\t)\n\tend",
"def initialize( floating_points: false )\n @weights = []\n @max_weight = BASE_WEIGHT\n @floating_points = floating_points\n end",
"def add_edge(source, destination, weight)\n super(source, destination, weight) if weight > 0\n end",
"def connect(a, b, weight = 0.5)\n c = Connection.new a, b, weight\n a.join c\n # Also add the Connection here\n connections << c\n end",
"def initialize(a, b)\n @source, @target = a, b\n end",
"def initialize(capacity)\n @capacity = capacity\n @hash = {}\n @dlink = DLinkedList.new capacity\n end",
"def initialize(priority, weight, port, target)\n @priority = priority.to_int\n @weight = weight.to_int\n @port = port.to_int\n @target = Name.create(target)\n end",
"def initialize(graph, damping_factor = 0.85, iterations = 100)\n @graph = graph.to_h\n # { :p1 => [:p2], :p2 => [:p1,:p3], :p3 => [:p2] }\n @outlinks = Hash.new { |_, key| @graph[key].size }\n # { :p1 => 1, :p2 => 2, :p3 => 1 }\n @inlinks = Hash.new { |_, key| inlinks(key) }\n # { :p1 => [:p2], :p2 => [:p1,:p3], :p3 => [:p2] }\n @ranks = Hash.new(1.0 / @graph.size)\n # { :p1 => 1/3, :p2 => 1/3, ... }\n @sinknodes = @graph.select { |_, v| v.empty? }.keys\n # sinknodes aka dead-ends, have no outlink at all\n\n @damper = damping_factor\n @iterations = iterations\n end",
"def remove_links(w=nil)\n w = w || (1.0/0)\n @links.delete_if { |k,l| \n (l.weight<w) && \n @sourcelinks[l.src].delete(l) && # always true\n @destlinks[l.dest].delete(l) # always true\n }\n self\n end",
"def add_undirected_edge(vertex_a, vertex_b, weight)\n super(vertex_a, vertex_b, weight) if weight > 0\n end",
"def initialize( alpha=2.0, beta=0.5, default_weight=2.0 )\n @model = Model.new\n @alpha = alpha\n @beta = beta\n @default_weight = default_weight\n end",
"def initialize(n, c)\n @weights = Array.new(n) { rand(-1.0..1) }\n @c = c # learning constant\n end",
"def initialize(type, weight) #constructor/initializator for this class, invoked when .new kbyrd is activated\n @type = type\n @weight= weight\n end",
"def initialize(subject, sibling, distance=nil)\n @subject = subject\n @sibling = sibling\n @distance = distance\n end",
"def initialize(relation = self.class.relation, attributes = self.class.attributes)\n super()\n @relation = relation\n @attributes = attributes\n @relationships = self.class.relationships\n end",
"def initialize(nodes, edges)\n super()\n self.nodes = nodes\n self.edges = edges.map { |e| Edge.new(e[0], e[1], e[2]) }\n\n self.build\n end",
"def initialize(height, weight, color)\n @height = height\n @weight = weight\n @color = color\n end",
"def initialize(backend, server, weight)\n @backend = backend\n @server = server\n @weight = weight\n end",
"def new(relation, attributes = self.attributes)\n self.class.new(relation, attributes)\n end",
"def initialize(node1, node2)\n @s1=node1\n @s2=node2\n\n #calculate length\n @length = Edge.distanceCalc(@s1,@s2)\n end",
"def initialize(nodes=nil, weights=nil)\n @ring = {}\n @_sorted_keys = []\n\n @nodes = nodes\n\n weights = {} if weights.nil?\n \n @weights = weights\n\n self._generate_circle()\n self\n end",
"def initialize(theName = \"Not Set\", theWeight = 1.01)\n # assign instance variables\n @name = theName\n @weight = theWeight\n @@count += 1\n end",
"def initialize(title, weight)\n @grades = []\n @title = title\n\n # If the weight is an Integer convert it to a Float,\n # else if is a float then pass it on unchanged.\n @weight = weight.is_a?(Fixnum) ? weight/100.0 : weight\n end",
"def initialize(node_list = Hash.new, edges = Hash.new)\n @node_list = node_list\n @edges = edges\n end",
"def from_weighted_table( table )\n raise 'Table must contain at least one element' if table.empty?\n\n # We may call this method many time for an existing object, so we must clear it\n @weights.clear\n\n base = BASE_WEIGHT\n w = nil\n\n table.each do |weight, data|\n w = base + weight\n @weights << [base, w, data]\n base = w\n end\n\n @max_weight = w\n\n # p @weights, @max_weight\n\n self\n end",
"def initialize contents = nil, options = {}\n @contents, @weight = contents, 0\n options.apply_to self if options\n end",
"def initialize(a, b) end",
"def initialize(from_node, to_node, label = nil, properties = nil)\n @from = from_node\n @to = to_node\n @label = label\n\n self.properties = properties\n end",
"def initialize\n @id = self.class.uid\n @connections = Connections.new({}, {}, {})\n @error = Error.new(0.0, 0.0, 0.0)\n @trace = Trace.new({}, {}, {})\n\n @state = @old = @activation = 0.0\n @selfconnection = Synaptical::Connection.new(self, self, 0.0)\n @squash = Synaptical::Squash::Logistic\n @neighbors = {}\n @bias = rand * 0.2 - 0.1\n end",
"def set_weights(weights); self;end",
"def initialize(attrs={})\n @attrs = attrs[:relationship]\n end",
"def create_edge_to_and_from(other, weight = 1.0)\n self.class.edge_class.create!(:from_id => id, :to_id => other.id, :weight => weight)\n self.class.edge_class.create!(:from_id => other.id, :to_id => id, :weight => weight)\n end",
"def link(*args)\n Restfulie::Common::Builder::Rules::Link.new(*args)\n end",
"def initialize network:\n super network[:type], network[:struct], act_fn: network[:act_fn]\n end",
"def add_edge(u, v, w)\n super(u,v)\n @weights[[u,v]] = w\n end",
"def weight\n @graph.weight(source, target)\n end",
"def add_relation source_label, relation, destination_label, direction = '<->'\n # More popular nodes have more weigth\n @node_weights[source_label] += 1\n @node_weights[destination_label] += 1\n\n @edge_buffer << Edge.new(\n source_label: source_label,\n relation: relation,\n destination_label: destination_label,\n direction: direction\n )\n end",
"def edge_class\n WeightedDirectedEdge\n end",
"def new(*args)\n type, from_node, to_node = args\n rel = Neo4j::Relationship.create(type, from_node, to_node)\n wrapped_rel = super()\n Neo4j::IdentityMap.add(rel, wrapped_rel)\n wrapped_rel.init_on_load(rel)\n wrapped_rel.init_on_create(*args)\n wrapped_rel\n end",
"def initialize tuples, directed, save_intermediate=true\n @graph = Graph.new tuples, directed, 0\n @levels = [] # List of Graphs\n @save_intermediate_graphs = save_intermediate\n end",
"def connectWith(node, weight = 0)\n edge = Edge.new(self, node, weight)\n @edges << edge\n\n edge\n end",
"def new_from_link(href)\n self.class.new(:root => self.root,\n :auth => self.auth,\n :headers => self.headers,\n :namespace => self.namespace,\n :href => href)\n end",
"def initialize(nodes_v, nodes_s)\n @nodes_v = nodes_v\n @nodes_s = nodes_s\n @cost = nil\n end",
"def initialize\n @x = Array.new\n @y = Array.new\n @output = Array.new\n @weights = [0.0001,0.0001,0.0001]\n end",
"def initialize(link_string)\n @link_string = link_string\n end",
"def initialize(*args)\n if (args[0].kind_of?(Java::org.neo4j.graphdb.Relationship))\n init_with_rel(args[0])\n else\n init_with_args(*args)\n end\n\n # must call super with no arguments so that chaining of initialize method will work\n super()\n end",
"def weight w=nil\n if w.nil?\n @weight\n else\n @weight = w\n end\n end",
"def initialize(args = {Cmaxsize => 20, Cttl => nil}, ttlarg = nil)\n\t\t\t\tif args.kind_of? ::Hash\n\t\t\t\t\toargs = args\n\t\t\t\t\targs = Iowa::Hash.new\n\t\t\t\t\targs.step_merge!(oargs)\n\t\t\t\tend\n\t\t\t\targs.stringify_keys! if args.respond_to? :stringify_keys!\n\t\t\t\tbegin\n\t\t\t\t\t@max = args[Cmaxsize] || 20\n\t\t\t\t\t@maxttl = args[Cttl]\n\t\t\t\t\t@mutex = Mutex.new\n\t\t\t\trescue Exception\n\t\t\t\t\targs = {Cmaxsize => args || 20, Cttl => ttlarg}\n\t\t\t\t\tretry\n\t\t\t\tend\n\t\t\t\t@finalizers = []\n\t\t\t\t@head = Node.new\n\t\t\t\t@tail = Node.new\n\t\t\t\t@lookup = Hash.new\n\t\t\t\tnode_join(@head,@tail)\n\t\t\tend",
"def initialize(graph, options = {}, &block)\n @graph = graph\n @id = next_object_id\n @name = (options[:name] or \"Edge#{@id}\")\n @description = (options[:description] or \"Edge #{@id}\")\n @source = options[:source] \n @destination = options[:destination]\n @label = (options[:label] or @name)\n @probability = options[:probability]\n @transition = (options[:transition] or \"\")\n\n yield self unless block.nil?\n end",
"def add_edge(u,v,weight)\n @source[u] = Hash.new unless @source.has_key?(u)\n @source[v] = Hash.new unless @source.has_key?(v)\n @source[u][v]=weight\n @source[v][u]=weight\n end",
"def connect(a, b, weight=1)\n if @words[a][b].nil? then\n @words[a][b] = weight\n else\n @words[a][b] += weight\n end\n end",
"def initialize(x, y)\n\t\t@neurons = Array.new\n\t\tx.times do\n\t\t\tneuron = Array.new(y)\n\t\t\t\n\t\t\t#create random weights\n\t\t\tneuron.each_index do |weight|\n\t\t\t\tneuron[weight] = rand * 2.0 - 1.0\n\t\t\tend\n\t\t\t@neurons << neuron\n\t\tend\n\tend",
"def initialize(head_value = nil, tail_value = nil)\n @head = Node.new(head_value)\n @tail = Node.new(tail_value)\n # If either, but not both, head or tail is nil set size to 1; otherwise 0\n @size = (head_value ^ tail_value) ? 1 : 0\n\n\n # If both head and tail vals are provided\n if head_value && tail_value\n # The head and tail props are already set, so now just set the next on head to tail\n @head.next = @tail\n # and set the prev no tail to head\n @tail.prev = @head\n # The XOR check on size set it to 0 so here is where actual size is set under these conds\n @size = 2\n elsif head_value\n # If only the head val is given, the head is set so this is where tail is set\n @tail = @head\n else\n # In this case, no head was given, but a tail was; set head to the tail node\n @head = @tail\n end\n end",
"def initialize\n @forward_edges_with_info = IdentityHash.new\n @backward_edges = IdentityHash.new\n end",
"def initialize(link_options={})\n @id = link_options[\"id\"]\n @assignment_id = link_options[\"assignment_id\"] \n @link = link_options[\"link\"]\n @type = link_options[\"type\"]\n end",
"def initialize(weight, maximum_holding_weight)\n @weight = weight\n @maximum_holding_weight = maximum_holding_weight\n @ingredients = []\n end",
"def initialize(object)\n @object = object\n @adjacents = []\n end",
"def with_link(*args)\n @links.push(args.length == 1 ? args.first : Link.new(*args))\n self\n end",
"def initialize(relation, params, options = {})\n self.relation = relation\n self.options = options\n self.params = params\n end",
"def initialize(name, comment, properties, attributes, input, output, in_out,\n stat, temp, networks)\n @name = name\n @comment = comment\n @properties = properties\n @attributes = attributes\n @input = input\n @output = output\n @in_out = in_out\n @stat = stat\n @temp = temp\n @networks = networks\n end",
"def initialize(value, next_node=nil) #create node object with head and pointer to next node\n @value = value\n @next_node = next_node #initialized to nil by default \n end",
"def connect_graph(source, target, weight)\n if (!graph.has_key?(source))\n graph[source] = {target => weight}\n else\n graph[source][target] = weight\n end\n if (!locations.include?(source))\n locations << source\n end\n end",
"def initialize(type, ref, role='')\n if type !~ /^(node|way|relation)$/\n raise ArgumentError.new(\"type must be 'node', 'way', or 'relation'\")\n end\n if ref.to_s !~ /^[0-9]+$/\n raise ArgumentError\n end\n @type = type\n @ref = ref.to_i\n @role = role\n end",
"def initialize(type, ref, role='')\n if type !~ /^(node|way|relation)$/\n raise ArgumentError.new(\"type must be 'node', 'way', or 'relation'\")\n end\n if ref.to_s !~ /^[0-9]+$/\n raise ArgumentError\n end\n @type = type\n @ref = ref.to_i\n @role = role\n end",
"def initialize(type, ref, role='')\n if type !~ /^(node|way|relation)$/\n raise ArgumentError.new(\"type must be 'node', 'way', or 'relation'\")\n end\n if ref.to_s !~ /^[0-9]+$/\n raise ArgumentError\n end\n @type = type\n @ref = ref.to_i\n @role = role\n end",
"def initialize(options = nil)\n options ||= {}\n @labeled_edges = !options[:ignore_labels]\n @directed = !options[:undirected]\n\n if @labeled_edges\n @labels = []\n class << self\n include LabeledGraph\n end\n else\n class << self\n include UnlabeledGraph\n end\n end\n\n @nodes = Set.new\n @edges = Hash.new {|h,k| h[k] = Set.new; h[k]}\n @add_edge_callbacks = []\n\n unless self.directed\n @add_edge_callbacks << Proc.new {|from,to,label| actually_add_edge(to,from,label)}\n end\n end",
"def initialize( connection, id, link, extra_data = nil )\n @id = id\n @connection = connection\n @populated = false\n @link = link\n populate_from_hash( extra_data ) if extra_data\n #populate( link )\n end",
"def new(*args)\n my = self.init\n my.connect(*args)\n end",
"def initialize(tag, status, summary, links=[], links_comments=[])\n @tag = tag\n @status = status\n @summary = summary\n @t2p = Tag2Pst.new()\n if @summary.nil? or @summary == \"\"\n @summary = @t2p.summary @tag\n end\n @links = links\n @links_comments = links_comments\n end",
"def initialize\n @weight = 80\n @max_age = 365\n end",
"def initialize(tail,head)\n @tail = Sower::Node.ident(tail)\n @head = Sower::Node.ident(head)\n @key = [@tail,@head]\n end",
"def initialize(v, opts = {})\n options = {\n :weight => 1,\n :jump => 0,\n :passable => true,\n :direction => -1\n }.merge(opts)\n \n @vertex = v\n @weight = options[:weight] + (@jump = options[:jump])\n @passable = options[:passable]\n @dir = options[:direction]\n if @dir != 1\n @passable = $game_map.passable?(v.x,v.y,@dir)\n end\n end",
"def initialize(*parameters, &block)\n container, arguments, methods, signals = Thing.do_parameters(parameters)\n super(*arguments)\n Thing.do_methods(self, methods, container)\n Thing.do_links(self, signals, block)\n end",
"def links\n valid_link_keys = %w(mandate new_customer_bank_account organisation parent_event payment payout previous_customer_bank_account refund subscription )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n mandate: '',\n\n new_customer_bank_account: '',\n\n organisation: '',\n\n parent_event: '',\n\n payment: '',\n\n payout: '',\n\n previous_customer_bank_account: '',\n\n refund: '',\n\n subscription: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def initialize(headNode = nil)\n @head = headNode\n end",
"def add(x, y, weight)\n @store[x] ||= EdgeBag.new\n @store[x].add(y, weight)\n @store[y] ||= EdgeBag.new if undirected?\n @store[y].add(x, weight) if undirected?\n end",
"def initialize\n @nodes = {}\n @edges = {}\n @back_edges = {}\n end",
"def initialize(params={})\n @network = params.fetch(:network,0)\n @members = params.fetch(:members,'NA')\n @kegg_path = annotate_kegg(ids=@members) #get KEGG pathways annotation of all the members in a network\n @go_terms = annotate_GO(ids=@members) #get GO biological processes annotation of all the members in a network\n @@num += 1 #every time a network object is initialized count it\n @@all_interactions << self #add all the objects to this list\n end",
"def add_edge(from, to, weight = 1.0)\n\t\t\tadd_node(from)\n\t\t\tadd_node(to)\n\t\t\t@size += 1 if connect(from, to, weight)\n\t\t\tself\n\t\tend",
"def initialize(key, color)\n @key = key\n # node's color is parent link's color\n @color = color\n end",
"def new_interlink(sax, author_id)\n Interlink.new.tap do |interlink|\n interlink.author_id = author_id\n interlink.synset_id = sax.synset_id\n interlink.pwn = sax.pwn\n end\nend",
"def initialize(num_units_list)\n @layers = []\n @num_units_list = num_units_list\n @weights_set = WeightContainer.new(@num_units_list)\n end",
"def initialize width, height, cycle_detection = true, seed_network = nil\n \n @randomizer = proc {rand(2)}\n \n @cycle_detection_enabled = cycle_detection\n \n @width = width\n @height = height\n\n if seed_network\n self.network = seed_network\n else\n generate_network\n end\n \n reset_history\n \n end",
"def initialize(*nodes, attributes: {}, infos: nil)\n\t\t\t@nodes=[]\n\t\t\t# a node can be a Hash or a Node\n\t\t\t# so nodes really is a list of subgraphs\n\t\t\tbuild(*nodes, attributes: attributes, infos: infos)\n\t\tend",
"def initialize(attrs = {})\n attrs.stringify_keys!\n @nodes = []\n super(attrs)\n end",
"def initialize(capacity)\n @cache = {}\n @size = 0\n @capacity = capacity\n @head = DLinkedNode.new\n @tail = DLinkedNode.new\n @head.next = @tail\n @tail.prev = @head\n end"
] |
[
"0.6252265",
"0.62365425",
"0.6232321",
"0.61812884",
"0.6170899",
"0.6011076",
"0.58283603",
"0.5809302",
"0.5762102",
"0.5742521",
"0.57237875",
"0.570081",
"0.5675787",
"0.5666668",
"0.5584298",
"0.55717134",
"0.55508465",
"0.5520146",
"0.5518455",
"0.55116475",
"0.550711",
"0.54300344",
"0.54168254",
"0.5412725",
"0.5401852",
"0.53947073",
"0.53757423",
"0.5362981",
"0.5356022",
"0.5355659",
"0.53497016",
"0.5345475",
"0.53350246",
"0.5320788",
"0.53188735",
"0.5306349",
"0.5290508",
"0.5250665",
"0.52322924",
"0.52246803",
"0.51699144",
"0.5150292",
"0.51482403",
"0.51372814",
"0.5132662",
"0.5127778",
"0.51245534",
"0.512021",
"0.51131827",
"0.5102984",
"0.5099292",
"0.5091505",
"0.50901836",
"0.50523",
"0.5041405",
"0.50341225",
"0.50307405",
"0.501493",
"0.50147444",
"0.50142354",
"0.5006491",
"0.50059056",
"0.49941915",
"0.49896672",
"0.498921",
"0.4988072",
"0.49823987",
"0.4981029",
"0.49805158",
"0.49784163",
"0.4977099",
"0.4972057",
"0.49636817",
"0.4960812",
"0.4952896",
"0.495221",
"0.49497133",
"0.49492142",
"0.49478462",
"0.49444374",
"0.49424022",
"0.49226397",
"0.49161905",
"0.49143776",
"0.49083498",
"0.49029753",
"0.49027878",
"0.49008074",
"0.48915398",
"0.48890275",
"0.4887167",
"0.48864704",
"0.488517",
"0.48708537",
"0.48645893",
"0.48562798",
"0.48525602",
"0.48521346",
"0.48468807",
"0.48465344"
] |
0.7324075
|
0
|
TODO this should call an action not use send
|
def enqueued(t, game)
@enqueued_at = t
raise "timed event: unknown start action #{@start_action} rest of #{@end_action}conf#{@start_data} #{@end_data}" unless game.respond_to? @start_action
game.send(@start_action, @start_data)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process\n send_request @action\n end",
"def process_action(...)\n send_action(...)\n end",
"def send_request; end",
"def send_action(*_arg0); end",
"def act\n end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def transmission; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def send_action &block\n @actions[:send] = block\n end",
"def send\n puts \"a fake implementation of `send`\"\n end",
"def send_pending; end",
"def respond(); end",
"def send_moola!\n # @todo\n end",
"def __send__(*rest) end",
"def action_run\n end",
"def call\n\n\tend",
"def call\n\n\tend",
"def send(*rest) end",
"def send(*rest) end",
"def send(*rest) end",
"def transfer; end",
"def transfer; end",
"def actions; end",
"def run_actions; end",
"def action args = {}\n\t\tend",
"def send(*args); __send__(*args); end",
"def send_action action_name, service_name\n self.class.actions[action_name][service_name].run(self)\n end",
"def action\n end",
"def weber; end",
"def send_message(msg); end",
"def http_send_action\n http = http_inst\n req = http_post\n Response.new http.request req\n end",
"def send_message(message); end",
"def send_message(message); end",
"def perform\n \n end",
"def sendAsGift\n end",
"def sendChatAction to, act\n self.query(\"sendChatAction\", {:chat_id=>to, :action=>act})\n end",
"def reply\n end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def perform_action(data); end",
"def doAction(action)\n @IRCsocket.write(\"PRIVMSG #{@ch} :\\001ACTION #{action} \\001\\n\")\n end",
"def transact; end",
"def run() end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def send\n generate_url\n end",
"def send\n generate_url\n end",
"def send\n copy self.class.send(@id)\n true\n end",
"def send\n copy self.class.send(@id)\n true\n end",
"def handler; end",
"def handler; end",
"def action\n end",
"def receive(request); end",
"def action(unit)\n\tend",
"def run\n end",
"def _call_action(action)\n send(action)\n end",
"def send_text\n\nend",
"def send(message)\n ## empty\n end",
"def run\n end",
"def run\n end",
"def send(options={})\n end",
"def send_request(req); end",
"def send_act(conn, act)\r\n conn.respond(Yajl::Encoder.encode(act))\r\n end",
"def send(message)\n message\n end",
"def send_action(method_name, *args)\n #call the action, and store return value\n rval = self.send(method_name, *args)\n\n unless response_body\n #set the view variable with the return value\n name = self.class.instance_variable_get(:@view_var_name)\n name = name.pluralize if name && method_name.to_s == \"index\" #pluralize the @view_var_name if it was set at the class and this is GET/index\n name ||= \"data\"\n self.instance_variable_set :\"@#{name}\", rval\n\n #always follow responder pattern passing in the action's return value unless already rendered\n respond_with rval, (@respond_opts || {})\n end\n end",
"def do()\r\n\tend",
"def received\n end",
"def send_action(action, *params)\n world_lock.synchronize { self.world = Actions.send(action, world, *params) }\n end",
"def respond\n end",
"def message() end",
"def send_events; end",
"def action\n puts \"use command!\\n\\n\"\n end"
] |
[
"0.68344945",
"0.6798762",
"0.672713",
"0.65715086",
"0.6540881",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.6462667",
"0.63862383",
"0.6375067",
"0.6375067",
"0.6375067",
"0.6375067",
"0.6375067",
"0.63670456",
"0.6298154",
"0.6264857",
"0.6231114",
"0.62302464",
"0.6229488",
"0.621311",
"0.616441",
"0.616441",
"0.61546546",
"0.61546546",
"0.61546546",
"0.61481005",
"0.61481005",
"0.6122947",
"0.6111425",
"0.6083823",
"0.60616416",
"0.60572964",
"0.60089207",
"0.5983411",
"0.59829473",
"0.5971108",
"0.59682876",
"0.59682876",
"0.5961241",
"0.595782",
"0.5905521",
"0.5904467",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.5880733",
"0.58728296",
"0.58593565",
"0.5859079",
"0.5846755",
"0.5845684",
"0.5845684",
"0.5845684",
"0.5845684",
"0.5845684",
"0.5845684",
"0.584384",
"0.584384",
"0.5842907",
"0.5842907",
"0.5842401",
"0.5842401",
"0.5840534",
"0.5839829",
"0.5823558",
"0.5813794",
"0.58069944",
"0.57942486",
"0.57914966",
"0.5787015",
"0.5787015",
"0.577483",
"0.57724917",
"0.5770705",
"0.575823",
"0.57395285",
"0.572975",
"0.57287496",
"0.5715813",
"0.5711619",
"0.5704797",
"0.5704085",
"0.5703891"
] |
0.0
|
-1
|
Write code to remove duplicates from an unsorted linked list. Follow ups: How would you solve this problem if a temporary buffer is not allowed? Iterate through the linked list Have a histogram hash that keeps tracks of occurrencies of values in the list If ever reach a value that already has an occurrence in the hash, don't increment the occurrence Have a variable that keeps track of the previous node and point it to the current node's next node if we find a duplicate Edge cases: Empty linked list
|
def remove_dups(head)
current_node = head
previous_node = nil
histogram = Hash.new(0)
until current_node.nil?
if histogram[current_node].zero?
histogram[current_node.value] += 1
previous_node = current_node
current_node = current_node.next
else
previous_node.next = current_node.next
current_node = previous_node.next
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_duplicates(linked_list)\n duplicate_hash = Hash.new(0)\n test_node = linked_list.head.next\n until test_node.next.value == nil\n next_node = test_node.next\n if duplicate_hash[test_node.value] > 0\n linked_list.remove(test_node)\n end\n duplicate_hash[test_node.value] += 1\n test_node = next_node\n end\n linked_list\nend",
"def remove_duplicates(head)\n nodes_seen = {}\n\n ptr = head\n while (ptr != nil)\n nodes_seen[ptr.value] = 1\n \n if nodes_seen[ptr.next.value] != nil\n ptr.put_next(ptr.next.next)\n end\n\n ptr = ptr.next\n end\nend",
"def remove_duplicates!\n \t\t# current will move forward 1 each step\n \t\tcurrent = @head\n\n \t\t# prev will hold on to the last non-duplicate node\n \t\tprev = @head\n\n \t\twhile (current.next_node)\n \t\t\t# if we find a new value...\n \t\t\tif prev.val != current.val\n \t\t\t\t# add this current node to our non-duplicate list\n \t\t\t\tprev.next_node = current\n \t\t\t\t# update prev to store this most recent non-duplciate node\n \t\t\t\tprev = current\n \t\t\tend\n \t\t\t\n \t\t\t# always advance current\n \t\t\tcurrent = current.next_node\n \t\tend\n \t\t# finally, add tail value if it's unique\n \t\tif prev.val != current.val\n\t\t\t# add this current node to our non-duplicate list\n\t\t\tprev.next_node = current\n\t\t\t@tail = current\n\t\telse\n\t\t\tprev.next_node = nil\n\t\t\t@tail = prev\n\t\tend\n \tend",
"def remove_duplicate_in_place(head)\n head = LinkedListNode.from_array(head.to_array.sort)\n current = head\n while (current.next_item != nil) do\n if current.next_item.data != current.data\n current = current.next_item\n else\n current.next_item = find_different_next(current)\n end\n end\n\n head\nend",
"def remove_duplicates(linked_list)\n if !linked_list.is_a?(LinkedList) || linked_list.head == nil\n return nil\n end\n\n hash_table = {}\n node = linked_list.head\n\n while node.next != nil\n\n if hash_table[node.data]\n node.data = node.next.data\n node.next = node.next.next\n else\n hash_table[node.data] = true\n end\n\n if node.next != nil\n node = node.next\n end\n end\nend",
"def remove_dups(linked_list)\n node = linked_list.head.next\n seen = {}\n\n until node == linked_list.tail\n linked_list.delete(node) if seen[node.value]\n seen[node.value] = true\n\n node = node.next\n end\n\n linked_list\nend",
"def remove_duplicate(head)\n existing = [head.data]\n current = head\n while current.next_item != nil do\n if existing.include?(current.next_item.data)\n if current.next_item.next_item\n current.next_item = current.next_item.next_item\n else\n current.next_item = nil\n break\n end\n else\n existing << current.data\n end\n\n current = current.next_item\n end\n\n head\nend",
"def remove_dup(head)\n @head = head\n seen = {}\n prev = nil\n while head\n if seen[head.val]\n prev.next = head.next\n else\n seen[head.val] = true\n prev = head\n end\n\n head = head.next\n end\n @head\nend",
"def remove_dups(list)\n current = list.head\n until current.next.nil?\n compare = current.next\n until compare.next.nil?\n if compare.value == current.value\n # remove duplicate\n befr = compare.prev\n aftr = compare.next\n befr.next = aftr\n aftr.prev = befr\n end\n compare = compare.next\n end\n current = current.next\n end\nend",
"def remove_duplicates(head)\n return nil unless head\n visited = Set.new\n visited.add(head.key)\n prev_node = head\n current_node = head.next\n while current_node\n # when adding to a set via add?, a nil signals existence in set\n unless visited.add?(current_node.key)\n # no need to change prev_node\n prev_node.next = current_node.next\n else\n prev_node.next = current_node\n prev_node = current_node\n end\n current_node = current_node.next\n end\n \n return head\nend",
"def remove_duplicate(node)\n h = Hash.new()\n c = node\n\n while c\n if h[c.data]\n previous = c.previous\n previous.next = c.next\n else\n h[c.data] = true\n c = c.next\n end\n end\nend",
"def delete_duplicates(head)\n sentinel = ListNode.new(0, head)\n curr = head\n prev = sentinel\n\n while(curr)\n if (curr.next && curr.val == curr.next.val)\n # check for all duplicates\n while(curr.next && curr.val == curr.next.val)\n curr = curr.next\n end\n prev.next = curr.next\n else\n prev = prev.next\n end\n\n curr = curr.next\n end\n sentinel.next\nend",
"def delete_duplicates(head)\n\tcur = head \n\twhile cur != nil && cur.next != nil do \n\t\tif cur.val == cur.next.val\n\t\t\tcur.next = cur.next.next\n\t\telse\n\t\t\tcur = cur.next\n\t\tend\n\tend\n\thead\nend",
"def dups(linked_list)\n return \"list is empty\" if linked_list.head==null\n current_node= linked_list.head\n occurred={}\n occurred[current_node.data]=true\n \n while(current_node.next!=null)\n if occurred[current_node.next.data]\n current_node.next=current_node.next.next\n end\n end \n \nend",
"def remove_dupes list\n cur = list.head\n i = 0\n while cur != nil\n list.remove i\n if !contains(list, cur.node)\n list.insert cur.node, i\n i += 1\n end\n cur = cur.nxt\n end\n\n return list\nend",
"def remove_duplicate_without_buffer(node)\n return if node.nil?\n\n c = node\n\n while c\n n = c.next\n while n\n if n.data == c.data\n c.next = n.next\n else\n n = n.next\n end\n end\n c = c.next\n end\nend",
"def remove_dupes(head)\n # 1) if the given node is nil or the next node is nil return the head (nil)\n # if the next node is nil we want to stop\n return head if head.nil? || head.next.nil\n # 2) the node after our head node will be set through recursion\n # if the next value is nil we'll have head followed by head again\n head.next = remove_dupes(head.next)\n # 3) after we have set head.next\n # if the next value is equal to head's value we return head.next\n # this lets us skip duplicate values\n # by putting a return statement here it lets us undo our double head assignment above\n return head.next if head.val == head.next.val\n # 4) finally return head if we're all clear\n head\nend",
"def removeDupeBuff(linkedlist)\n # Initialize buffer array\n result = Array.new\n for i in 0..linkedlist.length-1\n # Pop value from linkedlist \n value = linkedlist[i]\n # Check if value already exists in buffer linkedlist\n if !result.include?(value)\n # If not, add to beginning of linkedlist\n result.push(value)\n end\n end\n # Return result\n return result\nend",
"def remove_dup(head)\n current = head\n until current.next_node.nil?\n while head.val == head.next_node.val\n head.next_node = head.next_node.next_node\n end\n\n current = current.next_node\n end\n\n head\nend",
"def remove_duplicates_2(list)\n seen = {}\n to_delete = []\n\n list.each do |node|\n if seen[node.value]\n to_delete << node\n end\n seen[node.value] = true\n end\n\n to_delete.each do |node|\n list.delete_node(node)\n end\n\n return list\nend",
"def remove_duplicates(list)\n list.each do |unique_node|\n if unique_node.next\n unique_node.next.each do |possible_duplicate|\n if possible_duplicate.value == unique_node.value\n list.delete_node(possible_duplicate)\n end\n end\n end\n end\n\n return list\nend",
"def remove_dup(linked)\n dups = Set.new\n remove = []\n copy = linked\n while (copy != nil)\n if dups.include? copy.data\n remove << copy.data\n else\n dups.add copy.data\n end\n copy = copy.next\n end\n p remove\n i = 0\n while i < remove.size do\n linked = linked.delete(remove[i])\n i += 1\n end\n return linked\nend",
"def removeDupe(linkedlist)\n return linkedlist.uniq!\nend",
"def remove_duplicate_inspired_book(head)\n current = head\n previous = nil\n keep_previous = false\n while current != nil do\n runner = head\n while runner != current\n if runner.data == current.data\n previous.next_item = current.next_item\n keep_previous = true\n break\n else\n runner = runner.next_item\n keep_previous = false\n end\n end\n previous = current unless keep_previous\n current = current.next_item\n end\n\n head\nend",
"def removeDup(list)\n hash = {}\n count = list.count\n i = 0\n while i < count\n key = list[i].key\n if hash[key]\n list.remove_pos(i)\n i = i-1\n count = count-1\n else\n hash[key] = true\n end\n i = i+1\n end\nend",
"def list_cycles?(head_node)\n\n node_hash = Hash.new([])\n\n current_node = head_node\n while true\n return true if node_hash[current_node.value].include?(current_node)\n return false unless current_node.next\n node_hash[current_node.value].push(current_node)\n current_node = current_node.next\n end\nend",
"def detect_loop(list)\n current = list.head\n visited = Set.new\n until current.nil?\n return current if visited.include? current.hash\n visited << current.hash\n current = current.next\n end\n nil\nend",
"def remove_dups\n unique_values = []\n while head\n node = shift\n value = node.value\n unique_values << value unless unique_values.include? value\n end\n unique_values.each {|value| unshift(Node.new(value))}\n return self\n end",
"def detect_cycle_with_hash(head)\n seen_nodes = {}\n\n current_node = head\n\n while current_node != nil\n if seen_nodes[current_node.object_id]\n return true\n end\n\n seen_nodes[current_node.object_id] = true\n current_node = current_node.next_node\n end\n\n return false\nend",
"def remove_duplicates(nums)\n prev = nil\n count = 0\n nums.each do |num|\n if num == prev\n next\n else\n nums[count] = num\n prev = num\n count+=1\n end\n end\n\n return count\nend",
"def unique(mylist)\r\n\r\n counts = Hash.new(0)\r\n\r\n mylist.each { |item|\r\n # if item is Not in the hash\r\n puts \"looking in hash for #{item}\"\r\n if counts[item] == 0\r\n puts \"#{item} is not in hash. Adding it!\"\r\n counts[item] = 1\r\n end\r\n # counts[item] +=1\r\n # puts counts\r\n # if counts[item] > 1\r\n # end\r\n}\r\n\r\n # if element you are testing is the same\r\n # remove the element you are testing\r\n # else redo the loop\r\n \r\nend",
"def unoptimized_contains_cycle(head)\n histo = {}\n node = head\n while node\n if histo[node]\n return true\n else\n histo[node] = true\n end\n node = node.next\n end\n false\nend",
"def remove_dup_recur(head)\n return nil if head.nil?\n\n if head.val == head.next_node.val\n return remove_dup_recur(head.next_node)\n end\n\n head.next_node = remove_dup_recur(head.next_node)\n head\nend",
"def detect_cycle(head)\n hash_map = {}\n\n while head\n if hash_map.keys.include?(head)\n return head\n end\n\n hash_map[head] = 0\n head = head.next\n end\n\n nil\nend",
"def remove_elements(head, val)\n return nil if head.nil?\n\n dummy = ListNode.new(nil)\n dummy.next = head\n current = dummy\n\n while current.next\n if current.next.val == val\n current.next = current.next.next\n else\n current = current.next\n end\n end\n\n dummy.next\nend",
"def delete(value)\r\n prev = nil\r\n curr = @head \r\n\r\n while curr \r\n if curr.data == value \r\n if prev == nil\r\n @head = curr.next \r\n else \r\n prev.next = curr.next \r\n end\r\n return\r\n\r\n else\r\n prev = curr\r\n curr = curr.next\r\n end\r\n end\r\n\r\n # if u reached this point, then nothing matches, and no changes made to list\r\n end",
"def delete_node(list, head)\n curr = list\n while(curr.next.val != head.val)\n curr = curr.next\n end\n curr.next = head.next\n head = nil\nend",
"def delete(value)\n return nil if @head.nil?\n\n current = @head\n\n if current.data == value\n @head = current.next\n @head.previous = nil\n return\n end\n\n until current.next.nil?\n if current.next.data == value\n temp = current.next.next\n current.next = temp\n if temp\n temp.previous = current\n end\n return\n end\n current = current.next\n end\n end",
"def unique?(head, node_value)\n queue = []\n queue.push(head)\n if head.get_value == node_value\n return false\n end\n until queue.empty?\n if head.get_children == []\n return true\n end\n i = 0\n while i < queue[0].get_children_counter do\n if queue[0].get_children[i].get_value == node_value\n return false\n else\n queue.push(queue[0].get_children[i])\n i += 1\n end\n end\n queue.shift\n end\n return true\nend",
"def remove_duplicates(nums)\n return 0 if nums.length === 0\n\n curr_idx = 0\n j = 0\n val = nums[j]\n\n while curr_idx < nums.length\n curr_val = nums[curr_idx]\n if curr_val === val\n curr_idx += 1\n next\n else\n val = curr_val\n j += 1\n nums[j] = curr_val\n end\n end\n\n j + 1\nend",
"def remove (data)\n if @head.data == data\n @head = @head.next # Move head to the next node\n else\n current_node = @head.next # Go the next element\n prev_node = @head\n while current_node\n if current_node.data == data\n prev_node.next = current_node.next\n return @head # Head didnt change\n end\n prev_node = current_node\n current_node = current_node.next\n end\n\n return @head\n end\n end",
"def two_point_one(head)\n @s1 = Set.new\n @current = head\n while(@current.next != nil)\n if(@s1.include?(@current.next.data))\n @current.next = @current.next.next\n else\n @s1.add(@current.data)\n end\n @current = @current.next\n end\n return head\n end",
"def remove(value)\n current = @head\n current = current.next while current && current.value != value\n return raise \"Value not found: #{value}\" if current.nil?\n\n if current == @head\n @head = @head.next\n @head.prev = nil unless @head.nil?\n @size -= 1\n return\n end\n if current == @tail\n @tail = @tail.prev\n @tail.next = nil unless @tail.nil?\n @size -= 1\n return\n end\n current.prev.next = current.next\n current.next.prev = current.prev\n @size -= 1\n end",
"def remove_duplicates(list)\n d = list.clone\n dups = find_duplicates(list).each_with_object([]) { |(k, v), a| a << k if v > 1 }\n dups.each { |i| d.delete(i) }\n d\nend",
"def remove_duplicates(list)\n list.sort!\n first_element = list.first\n previous_element = list.first\n list[1..-1].map do |element|\n element = nil if element == previous_element\n previous_element = element\n end.compact.unshift(list.first)\nend",
"def delmid(linked_list)\n curr = linked_list\n count = 0\n\n while curr != null\n count += 1\n curr = curr.next\n end\n\n return linked_list if count <= 2\n mid = (count/2).round()\n curr = linked_list\n\n mid.each do |num|\n curr = curr.next\n end\n\n return curr\nend",
"def delete(value)\n return nil if !@head\n if @head.data == value\n @head = @head.next\n @head.prev = nil\n return\n end \n cursor = @head\n while cursor && cursor.data != value\n cursor = cursor.next\n end\n\n if cursor\n cursor.prev.next = cursor.next\n cursor.next.prev = cursor.prev if cursor.next\n @tail = cursor.prev if cursor == @tail\n \n end\n end",
"def contains_cycle_via_array_storage # O(n) time O(n) space\n current = head\n prevs = []\n cycle = false\n while current.next != nil\n prevs.each do |prev| \n cycle = true if prev == current.next\n end\n break if cycle == true\n prevs.push(current)\n current = current.next\n end\n cycle\n end",
"def erase_head()\n aux = @head[:prev]\n aux[:next] = nil\n @head = aux\n end",
"def delete_head\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # Set the head to the original head's next, destroying any reference to the original\n @head = @head.next\n else\n # If the head is the only node, just set its value to nil\n @head.value = nil\n end\n\n # Decrement the SLL by 1 in all cases\n @size -= 1 if size > 0\n # Return the new or empty head\n @head\n end",
"def move_duplicates(a)\n\n n = a.length\n\n h = Hash.new\n\n if a.length < 1\n return nil\n end\n\n if a.length < 2\n return a\n end\n\n dup_arr = []\n\n (0..n-1).each do |i|\n if h[a[i]]\n h[a[i]] = h[a[i]] + 1\n else\n h[a[i]] = 1\n end\n end\n\n h.each do |key,val|\n\n if h[key] > 1\n dup_arr.push(key)\n end\n end\n\n return dup_arr\n\n\nend",
"def delete(head, val)\n current = head\n prev = nil\n while (current != nil)\n if current.value == val\n # if it's a first element\n if prev == nil\n return head.next\n # else any element which is not first but 2nd, 3rd and so forth\n else\n prev.next = prev.next.next\n break\n end\n else\n prev = current\n current = current.next\n end\n end\n return head\nend",
"def hasCycle(head,hash={})\n return false if head.nil? || head.next.nil?\n return true if hash.has_key?(head.next)\n hash[head] = 1\n head = head.next\n hasCycle(head,hash)\nend",
"def removeKFromList(l, k)\n\n return [] if l.nil?\n\n if l.next.nil?\n return (l.value == k ? nil : l)\n end\n\n head = l\n prev = nil\n\n until false\n\n # print head.value\n\n if head.value == k\n if prev.nil?\n l = l.next\n else\n prev.next = head.next\n end\n else\n prev = head\n end\n break if head.next.nil?\n head = head.next\n end\n\n # print l.to_json\n\n l\n\nend",
"def remove_duplicates(list)\n list.inject({}){ |ele, n| ele[n] = nil; ele }.keys\nend",
"def remove(x)\n if x == head\n self.head = head.next\n x.next = nil\n else\n\n el = head\n while el and el != x\n prev = el \n el = el.next\n end\n\n raise ListError, \"Element not found\" unless el\n\n prev.next = el.next\n el.next = nil\n end\n x\n end",
"def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend",
"def eliminate_by(k)\n elem = self.head\n prev = elem\n\n k = k-1\n\n while prev != elem.next \n\n k.times do\n prev = elem\n elem = elem.next\n end\n\n prev.next = elem.next\n elem = prev.next\n end\n\n return prev.data\n\n end",
"def remove_duplicates(nums)\n beginning_index = nil\n \n nums.each_with_index do |num, index|\n next if index == 0\n \n if num == nums[index - 1] \n nums[index - 1] = nil\n end\n end\n \n nums.compact!\n \n nums.count\nend",
"def remove_duplicates(nums)\n nums_size, cursor = 0, 0\n\n while cursor < nums.size\n num = nums[cursor]\n cursor += 1\n while nums[cursor] == num\n cursor += 1\n end\n\n nums[nums_size] = num; nums_size += 1\n end\n\n nums_size\nend",
"def remove_elements(head, val)\n loop do\n return unless head\n break if head.val != val\n head = head.next\n end\n\n current_node = head\n next_node = head.next\n\n while next_node\n if next_node.val == val\n next_node = next_node.next\n current_node.next = next_node\n else\n current_node = next_node\n next_node = next_node.next\n end\n end\n\n head\nend",
"def delete(value)\r\n return nil if !@head\r\n if @head.data == value\r\n @head = @head.next \r\n return nil\r\n end \r\n cursor = @head\r\n while cursor.next && cursor.next.data != value\r\n cursor = cursor.next\r\n end\r\n cursor.next = cursor.next.next if cursor.next\r\n end",
"def delete(value:)\n if @head.value == value\n if @head.next.nil?\n @head.value = nil\n return value\n else\n @head = @head.next\n return value\n end\n else\n prev = @head\n temp = @head.next\n\n while !temp.nil?\n if temp.value == value\n prev.next = temp.next\n return value\n end\n\n prev = temp\n temp = temp.next\n end\n end\n\n return false # Not great to return different types but this is for fun\n end",
"def uniq_by_last(list)\n seen = Hash.new\n uniq_list = list.to_a.reverse.reject do |line|\n dupe = seen.include?(line)\n seen[line] = true\n dupe\n end.reverse\n uniq_list\nend",
"def remove_next prev_node\n\t\treturn nil unless self.length > 0\n\n unless prev_node\n # remove head.\n self.head = self.head.next\n else\n self.hash.delete(prev_node.next.data)\n if prev_node.next == prev_node\n self.head = nil\n else\n old = prev_node.next\n prev_node.next = prev_node.next&.next\n if (old == self.head)\n self.head = old.next\n end\n end\n end\n\n \tself.length -= 1\n\tend",
"def removeKFromList(l, k)\n # Removes any element in l that has a value of k\n newList = ListNode.new(0)\n newListCopy = newList\n while l\n if l.value != k\n addedNode = ListNode.new(l.value)\n newList.next = addedNode\n newList = newList.next\n end\n l = l.next\n end\n newListCopy = newListCopy.next\n newListCopy\n \nend",
"def delete(value, current=@head)\r\n return unless current\r\n return @head = @head.next if @head.data == value\r\n\r\n if current.next.data == value\r\n current.next = current.next.next\r\n return\r\n end\r\n\r\n delete(value, current.next)\r\n end",
"def make_most_recent_used(node)\n return if node == @tail\n\n if node == @head\n @head = node.next\n @head.prev = nil\n else\n node.prev.next = node.next\n node.next.prev = node.prev\n end\n append_at_end(node)\n end",
"def remove_first\n old_head = @head\n @head = @head.next_node unless @head.nil?\n @head.prev_node = nil unless @head.nil?\n old_head\n end",
"def remove!(other)\n a = head\n b = other.head\n\n while a and b\n\n while a.data < b.data\n prev = a\n a = a.next\n end\n\n while b.data < a.data\n b = b.next\n end\n\n if prev.nil?\n prev = a\n a = a.next\n prev.next = nil\n self.head = a \n b = b.next\n else\n a = a.next\n prev.next = a\n b = b.next\n end\n end\n self\n end",
"def remove(value)\n if head.value == value\n @head = head.next\n else\n current_node = head.next\n prev_node = head\n while current_node\n if current_node.value == value\n prev_node.next = current_node.next\n return\n else\n prev_node = current_node\n current_node = current_node.next\n end\n end\n nil\n end\n end",
"def remove_duplicates(list)\n if list.length == 0\n return []\n end\n \n length = list.length\n i = 0\n j = 0\n while i < length-1\n if list[i] != list[i+1]\n list[j] = list[i]\n j += 1\n end\n i += 1\n end\n list[j] = list[length - 1]\n \n ((j+1)..(length-1)).each do |index|\n list.pop()\n end\n \n # list.each_with_index do |item,index|\n # if item == nil\n # list.delete_at(index)\n # end\n # end\n \n # list = list[0..j]\n return list\nend",
"def remove_duplicates(nums)\n return 0 if nums.empty?\n cur = nums.first\n primary = 1\n nums.each_with_index do |num, _idx|\n next if num == cur\n nums[primary] = num\n cur = num\n primary += 1\n end\n primary\nend",
"def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn nil\n\t\telse\n\t\t\t@head = old_head.next_node\n\t\tend\n\n\t\t# puts old_head.value\n\t\treturn old_head\n\n\tend",
"def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend",
"def delete_duplicates(el)\n location = @cache.index(el)\n @cache.delete_at(location) if location\n end",
"def unique(list)\n hash = {}\n list.select do |n|\n #if it exists in the hash already you don't want that element\n if hash[n]\n false\n puts hash\n puts \"false\"\n else\n #if it doesn't, you put it in the hash and also keep the element\n hash[n] = n\n true\n puts hash\n puts \"true\"\n end\n end\n end",
"def remove_elements(head, val)\n return head if head.nil?\n\n tail = head.next\n\n if head.val == val\n remove_elements(tail, val) # throw away current head\n else\n head.next = remove_elements(tail, val)\n head # keep/return current head\n end\nend",
"def remove_duplicates(nums)\n #提供的array為已經排序過的array\n #將重複的移除,使陣列中每個元素都不重複\n #右邊元素=左邊元素時,全部往左移\n #將左移過後多出來的元素設為nil\n #刪除nil元素用 陣列.delete(nil)\n #回傳新陣列長度\n \n i = 0\n j = 0\n k = 0\n\n numssize = nums.size\n\n while i < (numssize - j)\n nums[i] = nums[ i + j ]\n if nums[i] == nums[i + j +1]\n j += 1\n while nums[i + j] == nums[i + j +1]\n j += 1\n end\n nums[i + j] = nums[ i + j + 1]\n end\n i += 1\n end\n\n for k in (numssize - j)...numssize\n nums[k] = nil \n end\n\n nums.delete(nil)\n\n newsize = nums.size\nend",
"def removeHead\n if @length == 1\n @head.nextNode = nil\n @tail.val = nil\n @length = 0\n elsif @length > 1\n @head.nextNode = @head.nextNode.nextNode\n @length -= 1\n end\n end",
"def delete(obj)\n if @head == nil\n nil\n elsif obj == @head.value\n item = @head\n if @head == @tail\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous = nil\n end\n @size -= 1\n item\n else\n node = @head.next\n while node && obj != node.value\n node = node.next\n end\n\n if node == @tail\n item = @tail\n @tail = @tail.previous\n @tail.next = nil\n @size -= 1\n item\n elsif node\n item = node\n node.previous.next = node.next\n node.next.previous = node.previous\n @size -= 1\n item\n else\n nil\n end\n end\n end",
"def extract_head\r\n aux = @head.value\r\n @head = @head.next\r\n @head.prev = nil\r\n return aux\r\n end",
"def rehash\n capacity = @capacity\n entries = @entries\n\n @entries = Entries.new @capacity\n\n i = -1\n while (i += 1) < capacity\n next unless old = entries[i]\n while old\n old.next = nil if nxt = old.next\n\n index = key_index(old.key_hash = old.key.hash)\n if entry = @entries[index]\n old.next = entry\n end\n @entries[index] = old\n\n old = nxt\n end\n end\n\n self\n end",
"def merge_k_lists(arr)\n new_head, cur = null, null\n\n until arr.empty?\n next_val, idx = nil, 0\n\n arr.each_with_index do |node, i|\n next if node == nil\n if next_val == nil || node.val < next_val\n next_val = node.val\n idx = i\n end\n end\n\n if arr[idx] == nil\n arr.delete_at(idx)\n next\n elsif new_head == nil\n new_head = ListNode.new(next_val)\n cur = new_head\n else\n cur.next = ListNode.new(next_val)\n cur = cur.next\n end\n arr[idx] = arr[idx].next\n end\n new_head\nend",
"def merge_sorted_ll(head1, head2)\n # handle edge case for one or more or two heads being null here\n\n head1.value > head2.value ? current_node = head2 : current_node = head1\n\n if current_node == head1\n pointer1 = head1.next\n pointer2 = head2\n else\n pointer1 = head1\n pointer2 = head2.next\n end\n\n while pointer1 || pointer2\n if pointer1 && pointer2\n if pointer1.value > pointer2.value\n current_node.next = pointer2\n current_node = pointer2\n pointer2 = pointer2.next\n else\n current_node.next = pointer1\n current_node = pointer1\n pointer1 = pointer1.next\n end\n else\n if pointer1\n current_node.next = pointer1\n current_node = pointer1\n pointer1 = pointer1.next\n else\n current_node.next = pointer2\n current_node = pointer2\n pointer2 = pointer2.next\n end\n end\n end\nend",
"def remove_duplicates(list)\n if list.length < 2\n return list\n else\n i = 0\n list.each do |num|\n if num == list[(i+1)]\n list.delete_at(i)\n end\n i += 1\n end\n return list\n end\nend",
"def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"def remove_nth_from_end(head, n)\n nodes = traverse(head).each_with_index.with_object({}) do |(node, index), hash|\n hash[index] = node\n end\n\n node_to_remove = nodes.size - n\n if node_to_remove.zero?\n head.next\n else\n nodes[node_to_remove - 1].next = nodes[node_to_remove].next\n head\n end\nend",
"def e31_delete(node, input)\n while node.next != nil\n if node.value == input\n node.value = node.next.value\n node.next = node.next.next\n else\n node = node.next\n end\n end #while ends\n end",
"def check_rehash!\n return if @size.to_f/@cardinality < LOAD_FACTOR_THRESHOLD\n\n @cardinality *= 2\n old_arr = @arr.dup\n @arr = []\n old_arr.each do |r|\n next unless r\n\n self.add(r.number, r.name)\n el = r\n while (el = el.next_rec)\n self.add(el.number, el.name)\n end\n end\n end",
"def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end",
"def remove_duplicates(nums)\n size, cursor = 0, 0\n while cursor < nums.size # iterating through each number in nums starting from the first number at index 0.\n num = nums[cursor] # as I iterate through each number, I will assign it to a variable called \"num\", i.e \"num\" will be constantly rewritten to the value that I am currently at as I iterate through the numbers.\n cursor += 1 # so that I can iterate.\n while nums[cursor] == num # if the duplicates are next to each other\n cursor += 1 # I iterate to the next number.\n end\n nums[size] = num # use num(which exclude the duplicates) again and assign it to nums[size] (which is the actual number). this step is just a checker so that the next step (size += 1) will be accurate, it is not actually removing the duplicates inline, i.e return nums will not give you the array without duplicates.\n size += 1 # After filtering out the duplicates, increase the counter by 1 every time we move on to another number.\n end\n return size\nend",
"def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend",
"def delete(element)\n i = element.hash % @table.size\n return unless @table[i]\n if @table[i].item == element\n result = @table[i].item\n @table[i] = @table[i].next\n @count -= 1\n return result\n end\n node = @table[i]\n while node.next\n if element == node.next.item\n result = node.next.item\n node.next = node.next.next\n @count -= 1\n return result\n end\n node = node.next\n end\n return nil\n end",
"def delete_middle_node(linked_list)\n p1 = linked_list.first\n p2 = linked_list.first\n\n until p2 == linked_list.last || p2 == linked_list.last.prev\n p1 = p1.next\n p2 = p2.next.next\n end\n linked_list.remove(p1.key)\n\n # p1.key.to_s\n linked_list.to_s\nend",
"def find_dup(a) \n 0.upto(a.length - 1).each {|i|\n while a[i] != i + 1 && !a[i].nil?\n if a[a[i] - 1] == a[i]\n return a[i]\n end\n aux = a[i]\n a[i] = a[aux - 1]\n a[aux - 1] = aux \n end\n }\n a.inspect\nend",
"def remove_duplicates(list)\n length = list.length\n i = 0\n while i < length - 1\n if list[i] == list[i + 1]\n list.delete_at(i + 1)\n end \n i += 1\n end \n return list \nend",
"def remove(key)\n slot = key % BUCKET_MOD\n head = @buckets[slot]\n return unless head\n if head.key == key\n @buckets[slot] = head.next\n else\n head = head.next while head.next && head.next.key != key\n if head.next && head.next.key == key\n head.next = head.next.next\n end\n end\n end",
"def delete(value)\n current_node = @head\n\n if current_node.value == value\n @head = current_node.next\n else\n\n previous_node = current_node\n current_node = current_node.next\n\n loop do \n break if current_node.value == value\n previous_node = current_node\n current_node = current_node.next\n end\n\n previous_node.next = current_node.next\n end\n end"
] |
[
"0.79479873",
"0.79371727",
"0.77724236",
"0.7760853",
"0.7725404",
"0.7674425",
"0.75274533",
"0.7507289",
"0.7482287",
"0.7428985",
"0.741406",
"0.7380211",
"0.73590076",
"0.73262995",
"0.72735965",
"0.71397805",
"0.7090933",
"0.70181376",
"0.70041484",
"0.6996934",
"0.69438183",
"0.6923819",
"0.69057995",
"0.6829584",
"0.67358977",
"0.65796185",
"0.64351594",
"0.6314422",
"0.6284149",
"0.6215391",
"0.61949885",
"0.6178369",
"0.61609083",
"0.61589235",
"0.60636055",
"0.6026279",
"0.58919114",
"0.5873903",
"0.5864561",
"0.5856935",
"0.5823883",
"0.58236647",
"0.58196646",
"0.5783153",
"0.5774282",
"0.57666165",
"0.57578564",
"0.5726622",
"0.5687337",
"0.56805474",
"0.566279",
"0.56574076",
"0.56458616",
"0.56314015",
"0.56227344",
"0.56167233",
"0.5616622",
"0.56059265",
"0.5594532",
"0.55919045",
"0.5590381",
"0.55837995",
"0.5572931",
"0.55712503",
"0.55692655",
"0.5564748",
"0.55646443",
"0.5553071",
"0.5535769",
"0.55324316",
"0.5531203",
"0.5529895",
"0.5513972",
"0.5511861",
"0.5504928",
"0.5493863",
"0.54937065",
"0.548417",
"0.5481867",
"0.5480986",
"0.54763013",
"0.54742503",
"0.54717624",
"0.5470742",
"0.54552007",
"0.5451813",
"0.5450566",
"0.5450566",
"0.5447446",
"0.54467475",
"0.5437011",
"0.54318434",
"0.54283494",
"0.5405068",
"0.5395092",
"0.5394878",
"0.53938586",
"0.53821534",
"0.5380507",
"0.53571665"
] |
0.82454383
|
0
|
if the concert is in the bands hometown return ture otherwise false
|
def hometown_show d
if (venue.city == band)
true
else
false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hometown_show\n if self.venue.city == self.band.hometown\n return true\n end\n end",
"def hometown_show?\n # self.venue.city\n # self.band.hometown\n\n self.venue.city == self.band.hometown\n end",
"def works_at_hanson_st?\n @city == HANSON\n end",
"def has_town?\n !!province_c and !!county_c and !!town_c\n end",
"def has_county?\n !!province_c and !!county_c\n end",
"def on_campus?\n %w(128.95 172.25 128.208 172.28 140.142 172.22).each do |subnet|\n return true if ip_in(subnet)\n end\n false\n end",
"def us_county?\n feature_code = featureCode.first\n parent_country = parentCountry.first\n sec_adm_level_code = 'www.geonames.org/ontology#A.ADM2'\n us_country_code = 'sws.geonames.org/6252001/'\n feature_code.respond_to?(:rdf_subject) && feature_code.rdf_subject.to_s.include?(sec_adm_level_code) && parent_country.respond_to?(:rdf_subject) && parent_country.rdf_subject.to_s.include?(us_country_code)\n end",
"def worldwide?\n self.class.worldwide?(self.countries)\n end",
"def china_mainland?(ip)\n ret = lookup(ip)\n ret.country.iso_code == \"CN\"\n end",
"def washington_state_resident?\n resident == 1 || resident == 2\n end",
"def srss?\n lat != 0.0 && long != 0.0 #there should not be an airfield, somewhere in the ocean\n end",
"def is_cesia?\n CESIA_UPN.include?(self.upn)\n end",
"def country_comparison\n country_per_cap_daily_average = self.house.address.city.region.country.avg_daily_electricity_consumed_per_capita\n if country_per_cap_daily_average\n num_days = self.end_date - self.start_date\n bill_daily_average = self.total_kwhs.fdiv(num_days)\n avg_daily_use_per_resident = bill_daily_average.fdiv(self.no_residents)\n country_per_cap_daily_average > avg_daily_use_per_resident ? res = true : res = false\n res ? self.electricity_saved = ((country_per_cap_daily_average - avg_daily_use_per_resident) * num_days) : self.electricity_saved = 0\n else\n res = false\n self.electricity_saved = 0\n end\n res\n end",
"def has_onsite_holdings?\n return false unless self[:location_facet].present?\n\n # consider each location for this record....\n self[:location_facet].each do |location_facet|\n # skip over anything that's offsite...\n next if location_facet =~ /^Offsite/\n next if location_facet =~ /ReCAP/i\n\n # skip over Online locations (e.g., just links)\n next if location_facet =~ /Online/i\n\n # If we got here, we found somthing that's onsite!\n return true\n end\n\n # If we dropped down to here, we only found offsite locations.\n false\n end",
"def go_home?\n @in_coffin\n end",
"def unit?\n !data[\"street_address\"].nil?\n end",
"def view_obs?\n location.blank? ? true : !(location =~ /^.*\\b(United States|USA)\\b.*$/i).nil?\n end",
"def poopy?\n\t\t@stuff_in_intestine >= 8\n\tend",
"def contact_with_ground?\n \n end",
"def has_home?(venue)\n catIds = venue.categories.map {|e| e.id}\n return catIds.length > 0 && catIds.include?(HOME_CAT_ID) && catIds.first != HOME_CAT_ID\n end",
"def canadian?\n\t\t\tprovince = [\"AB\",\"BC\",\"MB\",\"NB\",\"NF\",\"NT\",\"NS\",\"NU\",\"ON\",\"PE\",\"QC\",\"SK\",\"YT\"]\n\t\t\tprovince.include?(state)\n\t\tend",
"def is_home?(venue)\n catIds = venue.categories.map {|e| e.id}\n return catIds.length > 0 && catIds.first == HOME_CAT_ID\n end",
"def same_land?(other)\n land == other.land\n end",
"def in_european_union?; end",
"def include?(pnt)\n pnt.lat >= south && pnt.lng >= west && pnt.lat < north && pnt.lng < east\n end",
"def mobocratical_corrivalship?()\n apometaboly_peaklike(oversourly)\n end",
"def lat_long_dubious?\n lat && location && !location.lat_long_close?(lat, long)\n end",
"def is_connected_east?\r\n return true if @connected_directions.include?(:east)\r\n return false\r\n end",
"def is_belong_to?(country, target_continent)\n my_html = Nokogiri::HTML(country.country_doc)\n doc = my_html.at(\"table tr td div.region1 a\")\n belong = false\n\n if doc != nil then\n region = doc.text\n if str_include?(region, target_continent)\n belong = true\n end\n end\n return belong\n end",
"def century? = unit == 'century'",
"def my_street(drain)\n if user_signed_in?\n return true if drain.streets.include? current_user.street\n else\n false\n end\n end",
"def follows? neighborhood\n neighborhood.in? neighborhoods\n end",
"def has_offsite_holdings?\n return false unless self[:location_facet].present?\n\n # string regexp against the location field\n self[:location_facet].each do |location_facet|\n return true if location_facet =~ /^Offsite/\n return true if location_facet =~ /ReCAP/i\n # (this should not really happen)\n return true if location_facet =~ /scsb/i\n end\n\n # No offsite location found\n false\n end",
"def contains?(loc)\n return loc.country == self.name\n end",
"def nationwide?\n delivery_type == DELIVERY_TYPE::NATIONWIDE\n end",
"def geo_coded?\n !!(self.lat && self.lng)\n end",
"def geo_coded?\n !!(self.lat && self.lng)\n end",
"def geo_coded?\n !!(self.lat && self.lng)\n end",
"def in_journey?\n @entry_station != nil\n end",
"def notional?\n (capital_project.notional?)\n end",
"def has_city_workplace? \n if self.city_workplace.nil? # City doesn't have a city workplace\n return false \n else \n return true\n end\n end",
"def is_at_facility?(venue)\n self.venues.include?(venue)\n end",
"def has_province?\n !!province_c\n end",
"def columbia?\n # Columbia bib ids are numeric, or numeric with 'b' prefix for Law,\n # ReCAP partner data is \"SCSB-xxxx\"\n !id.start_with?('SCSB')\n end",
"def geocoded?\r\n super && (self.latitude != 0 && self.longitude != 0)\r\n end",
"def hometown_setting?\n # here the only tricky part is figuring out that the Film class calls this\n # \"setting\" and the Festival class calls this \"location\"\n self.film.setting == self.festival.location\n end",
"def certain?\n level = @url_generator.level\n if @parser.just_country?(@result) ||\n @parser.not_correct_country?(@result)\n false\n elsif @parser.city_present?(level) || @parser.state_present?(level) ||\n @parser.pc_present?(level)\n false\n else\n true\n end\n end",
"def full_house?\n @card_value_hash.value?(3) && @card_value_hash.value?(2)\n end",
"def at_home?\n\t\tif(@location == @home) # == comparison operator has been re-defined in the Point class\n\t\t\tthen true\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def same_country?\n @same_country\n end",
"def full_house?\n if three_of_a_kind?\n triple_high = three_of_a_kind?[1]\n (12).downto(0) do |i|\n if @ranks[i] >= 2\n if i != triple_high\n return [7, triple_high, i, -1, -1, -1]\n end\n end\n end\n end\n return false\n end",
"def suitable?\n @confines.all?(&:true?)\n end",
"def sogr?\n (capital_project.sogr?)\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 ctan_loc?\n self.ctan != nil && ! self.ctan.empty?\n end",
"def in?(location)\n location['longitude'] >= @lo_long &&\n location['longitude'] <= @hi_long &&\n location['latitude'] >= @lo_lat &&\n location['latitude'] <= @hi_lat\n end",
"def stone? = unit == 'stone'",
"def region_comparison\n region_per_cap_daily_average = self.house.address.city.region.avg_daily_electricity_consumed_per_capita\n num_days = self.end_date - self.start_date\n bill_daily_average = self.total_kwhs.fdiv(num_days)\n avg_daily_use_per_resident = bill_daily_average.fdiv(self.no_residents)\n region_per_cap_daily_average > avg_daily_use_per_resident ? res = true : res = false\n res ? self.electricity_saved = ((region_per_cap_daily_average - avg_daily_use_per_resident) * num_days) : self.electricity_saved = 0\n res\n end",
"def rent?(furnished, rent, baller)\n baller && (furnished || rent < 2100 ) ? true : false\nend",
"def full_house?\n n_and_m_of_a_kind? 3, 2\n end",
"def check_availability_of_cargo_wagons\n @trains.each do |train|\n train.each do |element|\n if element.class != Symbol\n return false if element.wagons.any? && element.type == 'cargo'\n end\n end\n end\n end",
"def country_is?(country_symbol)\n return false if country.blank?\n country_values = COUNTRY_ABBREVIATIONS[country_symbol]\n (country_values && country_values.include?(country.downcase)) ? true : false\n end",
"def animal_in_non_retail?\n location = Location.find(@location_id)\n @category_id == 1 && location.is_retail? == nil\n end",
"def is_international?\n internation.present?\n end",
"def kelvin? = unit == 'kelvin'",
"def full_house?\n three_of_a_kind? && pair?\n end",
"def gigahertz? = unit == 'gigahertz'",
"def filter_country_ok?(cert)\n return true if (!@countries_include && !@countries_exclude)\n\n country = cert_country(cert)\n\n if @countries_exclude && @countries_exclude.include?(country)\n return false\n end\n\n if @countries_include && !@countries_include.include?(country)\n return false\n end\n\n return true\n end",
"def is_regional?\n regional_code.present?\n end",
"def contains?(loc)\n return loc.city == self.name\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def state?\n usa?\n end",
"def at_home?\n\t\tif @location.x == @dimension - 1 && @location.y == @dimension - 1\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def coarticulated?\n place.size > 1\n end",
"def is_at_facility\n self.venues\n end",
"def on_eucalyptus?\n eucalyptus != nil\n end",
"def has_land_encounters?\r\n GameData::EncounterType.each do |enc_type|\r\n next if ![:land, :contest].include?(enc_type.type)\r\n return true if has_encounter_type?(enc_type.id)\r\n end\r\n return false\r\n end",
"def affects?(country)\n (country.regions & restricted_regions).any?\n end",
"def on_eucalyptus?\n eucalyptus != nil\n end",
"def foreign?\n # !flight? && country != \"usa\" && country != \"us\"\n !flight? && !Weam.match(\"^(usa|us)$\", country)\n end",
"def players_in_landings(result)\n @round.group_to_display.players.find_all do |player|\n player_result = player.ball&.result\n if player.ball.nil?\n false\n elsif player.ball.shot.is_layup\n result == 'layup'\n elsif result == 'MC-Ch'\n player_result.to_i > 0\n else\n player_result&.sub(/\\*\\z/, '') == result\n end\n end\n end",
"def check_for_rain\n city_forecast = self.set_city_and_measure\n is_forecast_wet = city_forecast.wet?(\"13:00\",25)\n end",
"def in?(location)\n location['longitude'] >= @lo_long &&\n location['longitude'] <= @hi_long &&\n location['latitude'] >= @lo_lat &&\n location['latitude'] <= @hi_lat\n end",
"def plays_in_concert?(concert)\n concert.lineups.each do |lineup|\n return true if self.lineups.include? (lineup)\n end\n false\n end",
"def round_actual?\n !self.club.round_actual.nil?\n end",
"def electricity_saved?\n if self.house\n self.house.address.city.region.has_electricity_average? ? region_comparison : country_comparison\n else\n false\n end\n end",
"def support_branches?\n kind == 'church'\n end",
"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 notional?\n (notional)\n end",
"def on_board?(location)\n location.all? {|p| p >= 0 && p <= 7}\n end",
"def behind_minions?\n tower, = select_unit_by_distance(@battlefield.them, :tower, :farthest)\n front_minion, = tower.select_unit_by_distance(@battlefield.us, :unit, :nearest)\n\n tower.distance_to_unit(front_minion) < tower.distance_to_unit(self)\n end",
"def company?(candidate)\n info(candidate, :hourly_rate_lbl).include?(SALARY_RANGE)\n end",
"def done? city\n city == @final\n end",
"def iphone_lat_long?(lat1,long1, lat2,long2)\n close(lat1,lat2,0.6) && close(long1,long2,0.6)\nend",
"def check_availability_of_passenger_wagons\n @trains.each do |train|\n train.each do |element|\n if element.class != Symbol\n return false if element.wagons.any? && element.type == 'passenger'\n end\n end\n end\n end",
"def simple_national?\n tax_code.to_i.in?([1,2])\n end",
"def get_occupation(data, hometown)\n return_value = \"No contestants from that hometown\"\n data.each do |season_in_hash, contestant_array|\n contestant_array.each do |contestant|\n contestant.each do |x, y|\n if contestant['hometown'] == hometown\n return contestant['occupation']\n end\n end \n end\n end \n return_value\nend",
"def full_house?\n matched = self.matched_cards\n found_pair = false\n found_three = false\n for rank, matches in matched do\n found_pair = true if matches.count == 2\n found_three = true if matches.count == 3\n end\n return found_pair && found_three \n end",
"def ounce? = unit == 'ounce'"
] |
[
"0.7525953",
"0.7418681",
"0.71429586",
"0.687276",
"0.6706632",
"0.65676695",
"0.6527762",
"0.6406399",
"0.64053637",
"0.6310119",
"0.6299607",
"0.62913156",
"0.62760895",
"0.62741125",
"0.62690705",
"0.6213714",
"0.6206525",
"0.6204149",
"0.62005585",
"0.61759096",
"0.616865",
"0.6133824",
"0.6129629",
"0.61155796",
"0.61137927",
"0.60991865",
"0.6098471",
"0.6083324",
"0.6075441",
"0.60745347",
"0.60721976",
"0.60284793",
"0.59889793",
"0.5973624",
"0.59465164",
"0.5945063",
"0.5945063",
"0.5945063",
"0.5933626",
"0.5929684",
"0.59256905",
"0.5918755",
"0.59178054",
"0.58898836",
"0.58769655",
"0.58768296",
"0.5864451",
"0.5853004",
"0.5845451",
"0.58315486",
"0.5828538",
"0.58109987",
"0.57775664",
"0.5771721",
"0.57712835",
"0.57709473",
"0.57675874",
"0.576576",
"0.57643145",
"0.57615346",
"0.57497424",
"0.5736524",
"0.5731941",
"0.57241434",
"0.57231104",
"0.5720739",
"0.5720185",
"0.57131696",
"0.57078236",
"0.56998587",
"0.56842095",
"0.56842095",
"0.567678",
"0.56748086",
"0.56713116",
"0.5667332",
"0.5665366",
"0.56650746",
"0.56646824",
"0.5664114",
"0.5663712",
"0.56577784",
"0.56575394",
"0.5653943",
"0.56524587",
"0.56521046",
"0.5650432",
"0.5649997",
"0.5649574",
"0.56476665",
"0.56338036",
"0.56308275",
"0.562398",
"0.5621604",
"0.561891",
"0.5611722",
"0.5609559",
"0.5603033",
"0.55978274",
"0.55930126"
] |
0.7685509
|
0
|
This challenge took me [2] hours. Pseudocode Input= Array of numbers Output = print out fizzbuzz for numbers that are divisible by 3 and 5, fizz for number that are divisible only by 3, and buzz for numbers that are dibisible only by 5, and print just the numbers for the rest Steps= Iterate through the array of numbers check its divisibility, and put fizzbuzz that numbers that are divisible both by 3 and 5 put fizz for numbers that are divisible only by 3 put buzz for numbers that are divislb only by 5 put just the numbers for the rest print out the results in array Initial Solution def super_fizzbuzz(array) result=[] array.each do |i| if i % 3 == 0 && i % 5 == 0 result << 'FizzBuzz' elsif i % 3 == 0 result << 'Fizz' elsif i % 5 == 0 result << 'Buzz' else result << i end end p result end Refactored Solution
|
def super_fizzbuzz(array)
i=0
while i < array.length
if array[i]%5==0 && array[i]%3==0
array[i]= 'FizzBuzz'
elsif array[i]%3==0
array[i]= 'Fizz'
elsif array[i]%5==0
array[i]= 'Buzz'
end
i+=1
end
p array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def super_fizzbuzz(array)\n fizzbuzz_array = []\n counter = 0\n while counter < array.length\n if array[counter] % 3 == 0 && array[counter] % 5 != 0\n fizzbuzz_array << \"Fizz\"\n elsif array[counter] % 5 == 0 && array[counter] % 3 != 0\n fizzbuzz_array << \"Buzz\"\n elsif array[counter] % 3 == 0 && array[counter] % 5 == 0\n fizzbuzz_array << \"FizzBuzz\"\n else\n fizzbuzz_array << array[counter]\n end\n counter += 1\n end\n p fizzbuzz_array\nend",
"def super_fizzbuzz(array)\n\tarray = [1..100]\n\tarray.each do |num|\n\t\tif num % 3 == 0 \n\t\t\tprint \"Fizz\"\n\t\tend \n\t\tif num % 5 == 0 \n\t\t\tprint \"Buzz\"\n\t\tend \n\t\tif num % 15 == 0 \n\t\t\tprint \"FizzBuzz\"\n\t\tend \n\tend \nend",
"def fizzbuzz(array)\n\tfor num in array\n\t\tif num % 15 == 0\n\t\t\tputs \"fizzbuzz\"\n\t\telsif num % 3 == 0\n\t\t\tputs \"fizz\"\n\t\telsif num % 5 == 0\n\t\t\tputs \"buzz\"\n\t\telse \n\t\t\tputs num.to_s\n\t\tend\n\tend\nend",
"def super_fizzbuzz(array)\n fizzy=[]\n\tarray.each do |x| \n\t if x%3==0 && x%5==0\n\t\t fizzy << \"FizzBuzz\"\n\t elsif x%5==0\n\t\t fizzy << \"Buzz\"\n\t elsif x%3==0\n\t\t fizzy << \"Fizz\"\n\t else\n\t\t fizzy << x\n\t end\n\tend\nreturn fizzy\nend",
"def super_fizzbuzz(array)\n new_array = []\n array.each do |x|\n if x % 3 == 0 && x % 5 == 0\n new_array << \"FizzBuzz\"\n elsif x % 3 == 0\n new_array << \"Fizz\"\n elsif x % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << x\n end\n end\n new_array\nend",
"def super_fizzbuzz(array)\n buzz_array = []\n array.each do |x|\n if x % 3 == 0 && x % 5 != 0\n buzz_array.push(\"Fizz\")\n elsif x % 3 != 0 && x % 5 == 0\n buzz_array.push(\"Buzz\")\n elsif x % 3 == 0 && x % 5 == 0\n buzz_array.push(\"FizzBuzz\")\n else\n buzz_array.push(x)\n end\n end\n p buzz_array\nend",
"def super_fizzbuzz(array)\n\tnew_arr = []\n\tarray.each do |x|\n\t\tif x % 3 == 0 && x % 5 == 0\n\t\t\tnew_arr << \"FizzBuzz\"\n\t\telsif x % 5 == 0\n\t\t\tnew_arr << \"Buzz\"\n\t\telsif x % 3 == 0\n\t\t\tnew_arr << \"Fizz\"\n\t\telse\n\t\t\tnew_arr << x\n\t\tend\n\tend\n\treturn new_arr\n\nend",
"def super_fizzbuzz(array)\n\t# this iterator will keep track of the location of the current element\n\ti = 0 \n\n\t# go through each item in the array\n\tarray.each do |x| \n\t\t# see if it is divisible by 3 \t\t\n\t\tif (x % 3 == 0)\n\t\t\t# see if it is divisible by 15\n\t\t\tif (x % 15 == 0)\n\t\t\t\tarray[i] = \"FizzBuzz\"\n\t\t\telse\n\t\t\t\tarray[i] = \"Fizz\"\n\t\t\tend\n\t\t# if no divisible by 3, see if \n\t\t# divisible by 5\n\t\telsif (x % 5 == 0)\n\t\t\tarray[i] = \"Buzz\" \t\t\n\t\tend\n\n\t\ti +=1\n\tend \nend",
"def fizzBuzz\n array = [*1..100]\n array.each { |num|\n if ((num % 3) == 0) && ((num % 5) == 0)\n puts \"FizBuzz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n elsif num % 3 == 0\n puts \"Fizz\"\n else \n puts num\n end\n }\nend",
"def super_fizzbuzz(array)\n array.map! {|num| puts \"#{'Fizz' if num % 3 == 0}#{'Buzz' if num % 5 == 0}#{num if num % 5 != 0 && num % 3 != 0}\"}\nend",
"def super_fizzbuzz(array)\n\tarray.collect do |i|\n \tif i % 15 == 0\n \t\t\"FizzBuzz\"\n \telsif i % 5 == 0\n \t\t\"Buzz\"\n \telsif i % 3 == 0\n \t\t\"Fizz\"\n \telse\n \t\ti\n \tend\n \tend\nend",
"def super_fizzbuzz(array)\n length = array.length\n # print length\n i = 0\n while i < length\n if (array[i] % 3 == 0 && array[i] % 5 != 0)\n array[i] = \"Fizz\"\n elsif (array[i] % 5 == 0) && (array[i] % 3 != 0)\n array[i] = \"Buzz\"\n elsif (array[i] % 3 == 0) && (array[i] % 5 == 0)\n array[i] = \"FizzBuzz\"\n\n end\n i += 1\n end\n\n return array\n\nend",
"def fizzbuzz(n)\n output_arr = []\n\n (1..n).each do |num|\n if num % 5 == 0 && num % 3 == 0\n output_arr << 'fizzbuzz'\n elsif num % 5 == 0\n output_arr << 'buzz'\n elsif num % 3 == 0\n output_arr << 'fizz'\n else\n output_arr << num\n end\n end\n\n output_arr\nend",
"def fizzbuzz(n)\n array = (1..n).to_a\n answer = []\n for i in array do\n if (i % 15 == 0)\n answer.push('FizzBuzz')\n elsif (i % 3 == 0)\n answer.push('Fizz')\n elsif (i % 5 == 0)\n answer.push('Buzz')\n else \n answer.push(i)\n end\n end\n answer\nend",
"def super_fizzbuzz(array)\n array.map! do |num|\n if (num % 3 == 0 && num % 5 == 0 && num % 15 == 0)\n \"FizzBuzz\"\n elsif (num % 3 == 0)\n \"Fizz\"\n elsif (num % 5 == 0)\n \"Buzz\"\n else\n num\n end\n end\n array\nend",
"def super_fizzbuzz(array)\n\tnew_array = []\n\tarray.each do |num| \n\t\tif num % 15 == 0\n\t\t\tnew_array << \"FizzBuzz\"\n\t\telsif num % 3 == 0\n\t\t\tnew_array << \"Fizz\"\n\t\telsif num % 5 == 0\n\t\t\tnew_array << \"Buzz\"\n\t\telse \n\t\t\tnew_array << num\n\t\tend\n\tend\n\tnew_array\nend",
"def super_fizzbuzz(array)\n array.map! do |num|\n num =\n \t\tif (num % 3 == 0 && num % 5 == 0)\n \t \"FizzBuzz\"\n \t\telsif (num % 3 == 0)\n \t\"Fizz\"\n \telsif (num % 5 == 0)\n \t\"Buzz\"\n \telse \n \tnum\n \tend\n \tend\n p array\nend",
"def fizzbuzz\narray = []\n\tfor i in 1..100\n\t\tif i%3 == 0 && i%5 == 0\n\t\t\tarray << 'FizzBuzz'\n\t\telsif i%3 == 0\n\t\t\tarray << 'Fizz'\n\t\telsif i%5 == 0 \n\t\t\tarray << 'Buzz'\n\t\telse\n\t\t\tarray << i\n \t\t\ti+= 1\n\t\tend\n\tend\n\t\t\treturn array\nend",
"def super_fizzbuzz(array)\n\tarray.map do |num| #got rid of the ! that I had in the original solution. There's no need to alter the underlying array here.\n\t\tif num % 15 == 0\n\t\t\t\"FizzBuzz\"\n\t\telsif num % 5 == 0\n\t\t\t\"Buzz\"\n\t\telsif num % 3 == 0\n\t\t\t\"Fizz\"\n\t\telse\n\t\t\tnum\n\t\tend\n\tend\nend",
"def fizzbuzz(num)\n collection = (1..num).to_a\n collection.each do |num|\n if (num % 3 == 0) && (num % 5 != 0)\n puts \"Fizz #{num}\"\n elsif (num % 5 == 0) && (num % 3 != 0)\n puts \"Buzz #{num}\"\n elsif (num % 3 == 0) && (num % 5 == 0)\n puts \"FizzBuzz #{num}\"\n end\n end\nend",
"def super_fizzbuzz(array)\n\tfizzbuzzed_array = []\n\tarray.each do |element|\n\t\tif element % 15 == 0\n\t\t\tfizzbuzzed_array << \"FizzBuzz\"\n\t\telsif element % 3 == 0\n\t\t\tfizzbuzzed_array << \"Fizz\"\n\t\telsif element % 5 == 0\n\t\t\tfizzbuzzed_array << \"Buzz\"\n\t\telse\n\t\t\tfizzbuzzed_array << element\n\t\tend\n\tend\n\tfizzbuzzed_array\nend",
"def fizzbuzz(n)\n arr = []\n (1..n).each do |num|\n mod3 = (num % 3).zero?\n mod5 = (num % 5).zero?\n result = ''\n result += 'fizz' if mod3\n result += 'buzz' if mod5\n result.empty? ? arr.push(num) : arr.push(result)\n end\n arr\nend",
"def fizzbuzz(n)\n result = []\n (1..n).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"fizzbuzz\"\n elsif num % 3 == 0\n result << \"fizz\"\n elsif num % 5 == 0\n result << \"buzz\"\n else\n result << num\n end\n end\n result\nend",
"def fizzbuzz(num1 , num2)\n result = []\n arr = (num1..num2).to_a\n arr.each do |n|\n if n % 3 == 0 && n % 5 == 0\n result << 'FizzBuzz'\n elsif n % 3 == 0\n result << 'Fizz'\n elsif n % 5 == 0\n result << 'Buzz'\n else\n result << n\n end\n end\n puts result.join(', ')\nend",
"def super_fizzbuzz(array)\n\ti = 0\n\tarray.each do |num|\n\t\t\tarray[i] = \"Fizz\" if num % 3 == 0 && num % 5 != 0\n\t\t array[i] = \"Buzz\" if num % 5 == 0 && num % 3 != 0\n\t\t\tarray[i] = \"FizzBuzz\" if num % 3 == 0 && num % 5 == 0\n\t\t\ti += 1\n\t end\nend",
"def super_fizzbuzz(array)\n new_array = []\n array.each do |i|\n if i % 15 == 0\n new_array << \"FizzBuzz\"\n elsif i % 3 == 0\n new_array << \"Fizz\"\n elsif i % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << i\n end\n end\n\nreturn new_array\nend",
"def super_fizzbuzz(array)\n new_array = []\n array.each do |i|\n if i % 15 == 0\n new_array << \"FizzBuzz\"\n elsif i % 3 == 0\n new_array << \"Fizz\"\n elsif i % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << i\n end\n end\n\nreturn new_array\nend",
"def fizzbuzz\n fizzBuzzArray = Array.new\n for num in 1..100\n if num.to_f / 3.to_f == num/3 && num.to_f / 5.to_f == num/5 then\n\tfizzBuzzArray << 'FizzBuzz'\n elsif num.to_f / 3.to_f == num/3 then\n\tfizzBuzzArray << 'Fizz'\n elsif num.to_f / 5.to_f == num/5 then\n\tfizzBuzzArray << 'Buzz'\n else\n fizzBuzzArray << num\n end\n end\n fizzBuzzArray\nend",
"def fizzbuzz\r\n # your code goes here\r\n arr = []\r\n\r\n for i in 1 .. 30\r\n if i % 5 == 0 && i % 3 == 0\r\n arr << \"fizzbuzz\"\r\n\r\n elsif i % 3 == 0\r\n arr << \"fizz\"\r\n\r\n elsif i % 5 == 0\r\n arr << \"buzz\"\r\n\r\n else arr << i\r\n end\r\n end\r\n arr\r\nend",
"def fizzbuzz()\n numbers = Array(1..100)\n numbers.each do |num|\n if num % 15 == 0\n puts \"FizzBuzz\" \n elsif num % 3 == 0\n puts \"Fizz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n else\n puts num\n end\n end\nend",
"def super_fizzbuzz(array)\n\tarray.map! do |num|\n\t\tif num % 15 == 0\n\t\t\t\"FizzBuzz\"\n\t\telsif num % 3 == 0\n\t\t\t\"Fizz\"\n\t\telsif num % 5 == 0\n\t\t\t\"Buzz\"\n\t\telse\n\t\t\tnum\n\t\tend\n\tend\nreturn array\t\t\nend",
"def super_fizzbuzz(array)\n array.map do |value|\n if (value % 3 == 0 && value % 5 == 0)\n 'FizzBuzz'\n elsif (value % 3 == 0)\n 'Fizz'\n elsif (value % 5 == 0)\n 'Buzz'\n else\n value\n end\n end\nend",
"def fizzbuzz\n i =0\n arr=[]\n while i<=100 do\n if i%3 ==0 && i%5==0\n\t arr.push \"FizzBuzz\"\n\n\t elsif i%3==0\n\t arr.push \"Fizz\"\n\n\t elsif i%5==0\n\t arr.push \"Buzz\"\n\t else\n\t arr.push i\n\t end\n i+=1\n end\n return arr\nend",
"def fizzbuzz(n)\n array = []\n (1..n).each do |num|\n if num % 15 == 0\n array << \"fizzbuzz\"\n elsif num % 3 == 0\n array << \"fizz\"\n elsif num % 5 == 0\n array << \"buzz\"\n else\n array << num\n end\n end\n return array\nend",
"def super_fizzbuzz(array)\n\tarray.map! do |num|\n\t\tif num % 15 == 0\n\t\t\tnum = 'FizzBuzz'\n\t\telsif num % 5 == 0\n\t\t\tnum = 'Buzz'\n\t\telsif num % 3 == 0\n\t\t\tnum = 'Fizz'\n\t\telse num\n\t\tend\n\tend\n\tp array\nend",
"def super_fizzbuzz(array)\nbuzz_array=[]\narray.map { |number| \n if number % 15 == 0\n \tbuzz_array << \"FizzBuzz\"\n elsif number % 3 == 0\n \tbuzz_array << \"Fizz\"\n elsif number % 5 == 0\n \tbuzz_array << \"Buzz\" \n else\n \tbuzz_array << number\n end\n}\nreturn buzz_array\nend",
"def fizzbuzz(num1, num2)\n array = []\n (num1..num2).each do |num|\n if num % 3 == 0 && num % 5 == 0\n array << \"FizzBuzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n else\n array << num\n end\n end\n puts array.join(\", \")\nend",
"def fizzbuzz(n)\n numbers = []\n (1..n).each do |num|\n if num % 3 == 0\n value = (num % 5 == 0) ? \"fizzbuzz\" : \"fizz\"\n numbers << value\n elsif num % 5 == 0\n numbers << \"buzz\"\n else\n numbers << num\n end\n end\n numbers\nend",
"def super_fizzbuzz(array)\n array.map! do |x|\n if x % 3 == 0 && x % 5 != 0\n x = \"Fizz\"\n elsif x % 3 != 0 && x % 5 == 0\n x = \"Buzz\"\n elsif x % 3 == 0 && x % 5 == 0\n x = \"FizzBuzz\"\n else\n x\n end\n end\n p array\nend",
"def fizzbuzz\n\tnum_arr = Array.new(100) {|index| index+1}\n\tarr = Array.new(100) {''}\n\tnum_arr.each do |i|\n\n\t \tif i%3 == 0\n\t \t\tif i%5 == 0\n\t \t\t\tarr[i-1] = 'FizzBuzz'\n\t \t\telse\n\t \t\t\tarr[i-1] = 'Fizz'\n\t \t\tend\n\t \telsif i%5 == 0\n\t \t\tarr[i-1] = 'Buzz'\n\t \telse\n\t \t\tarr[i-1] = i.to_s\n\t \tend\n\t end\n \tarr\nend",
"def super_fizzbuzz(array)\n array.map! do |x| \n if x % 3 == 0 && x % 5 != 0\n x = \"Fizz\"\n elsif x % 5 == 0 && x % 3 != 0\n x = \"Buzz\"\n elsif x % 15 == 0\n x = \"FizzBuzz\"\n else x = x\n end\n end\nend",
"def fizz_buzz number \n # for i in number\n # \tif i%3 == 0 \n # \t\treturn \"fiz\"\n # \telsif i%5 == 0\n # \t\treturn \"buzz\"\n # \tend \n # end\n\n if ((number % 3 == 0) && (number % 5 == 0))\n \treturn \"FizzBuzz\"\n elsif (number % 3 == 0)\n \treturn \"Fizz\"\n elsif (number % 5 == 0)\n \treturn \"Buzz\"\n else \n \treturn number\n end\nend",
"def fizzbuzz\n zz_array = []\n 1.upto(100) do |num|\n if num % 3 == 0 && num % 5 == 0\n zz_array << 'FizzBuzz'\n elsif num % 3 == 0\n zz_array << 'Fizz'\n elsif num % 5 == 0\n zz_array << 'Buzz'\n else\n zz_array << num\n end\n end\n return zz_array\nend",
"def super_fizzbuzz(array)\n\tarray.map! {|i|\n\t\tif i % 3 == 0 && i % 5 == 0\n\t\t\ti = \"FizzBuzz\"\n\t\telsif i % 3 == 0\n\t\t\ti = \"Fizz\"\n\t\telsif i % 5 == 0\n\t\t\ti = \"Buzz\"\n\t\telse i = i\n\t\tend\n\t\t}\t\t\n\treturn array\nend",
"def fizzBuzz(max)\n arr = []\n (1...max).each do |num|\n if num % 3 == 0 && num % 5 !==0\n arr << num\n end\n if num % 3 !== 0 && num % 5 ==0\n arr << num\n end\n puts num\n end\n return arr\nend",
"def super_fizzbuzz(array)\n array.map! do |x|\n if x % 3 == 0 \n x = \"Fizz\"\n elsif x % 5 == 0 \n x = \"Buzz\"\n elsif x % 15 == 0 \n x = \"FizzBuzz\"\n else x % 3 == 0 || x % 5 == 0 || x % 15 == 0\n p x\n end\n end\nend",
"def fizzbuzz(max)\n arr =[]\n (1..max).each do |n|\n if n % 3 != 0 && n % 5 != 0\n arr.push n\n else\n val = ''\n if n % 3 == 0\n val = \"fizz\"\n end\n if n % 5 == 0\n val += \"buzz\"\n end\n arr.push val\n end\n end\n arr\nend",
"def fizzbuzz\n # TODO write your code here\n fizz_array = []\n\n for count in 1..100\n if (count%3 == 0 && count%5 == 0)\n fizz_array[count] = 'FizzBuzz'\n elsif count%3 == 0\n fizz_array[count] = 'Fizz'\n elsif count%5 == 0\n fizz_array[count] = 'Buzz'\n else\n fizz_array[count] = count\n end\n end\n\n fizz_array\nend",
"def super_fizzbuzz(array)\n array.map! do |x|\n if x % 15 == 0\n \"FizzBuzz\"\n elsif x % 5 == 0\n \"Buzz\"\n elsif x % 3 == 0\n \"Fizz\"\n else\n x\n end\n end\nend",
"def fizzbuzz(starting, ending)\n result = []\n (starting..ending).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"FizzBuzz\"\n elsif num % 3 == 0\n result << \"Fizz\"\n elsif num % 5 == 0\n result << \"Buzz\"\n else\n result << num\n end\n end\n puts result.join(\", \")\nend",
"def fizzbuzz\n\t(1..100).each do |num|\n\t if num % 3 == 0 && num % 5 == 0\n\t\tputs \"Fizzbuzz\"\n\t elsif num % 3 == 0\n\t\tputs \"Fizz\"\n\t elsif num % 5 == 0 \n\t\tputs \"Buzz\"\n\t else\n\t\tputs num\n\t end\n\tend\nend",
"def super_fizz(number)\n(0..1000).each do |number|\ndivisible_by_3 = number % 3\ndivisible_by_5 = number % 5\ndivisible_by_7 = number % 7\nif divisible_by_3 == 0\n if divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperFizzBuzz\"\n else\n puts \"FizzBuzz\"\n end\n elsif divisible_by_7 == 0\n puts \"SuperFizz\"\n else\n puts \"Fizz\"\n end\nelsif divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperBuzz\"\n else\n puts \"Buzz\"\n end\nelsif divisible_by_7 == 0\n puts \"Super\"\nelse\n puts number\nend\nend\nend",
"def fizzbuzz\n\n fb_array = (1..100).to_a\n for i in fb_array\n if i % 3 == 0\n if i % 5 == 0\n fb_array[i-1] = 'FizzBuzz'\n else \n fb_array[i-1] = 'Fizz'\n end\n elsif i % 5 == 0\n fb_array[i-1] = 'Buzz'\n end\n end\n\nend",
"def fizzbuzz(number)\n (1..number).each do |num|\n if (num % 15).zero?\n puts 'FizzBuzz'\n elsif (num % 3).zero?\n puts 'Fizz'\n elsif (num % 5).zero?\n puts 'Buzz'\n else\n puts num\n end\n end\nend",
"def super_fizzbuzz(array)\n array.map {|x|\n if x % 15 == 0\n \"FizzBuzz\"\n elsif x % 3 == 0\n \"Fizz\"\n elsif x % 5 == 0\n \"Buzz\"\n else\n x\n end\n }\nend",
"def fizzBuzz (number)\n for i in 1..number\n if (i % 15 == 0)\n puts \"fizzbuzz\"\n elsif (i % 3 ==0)\n puts \"fizz\"\n elsif (i % 5 ==0)\n puts \"buzz\"\n else\n puts i\n end\n end\nend",
"def fizzbuzz(n)\n arr = []\n (1..n).each do |i|\n case\n when (i % 3 == 0) && (i % 5 == 0) then arr << \"fizzbuzz\"\n when i % 3 == 0 then arr << \"fizz\"\n when i % 5 == 0 then arr << \"buzz\"\n else arr << i\n end\n end\n arr\nend",
"def fizzbuzz(num1, num2)\n array = (num1..num2).to_a\n fizzbuzz = array.map do |n|\n if n % 3 == 0 && n % 5 == 0\n 'FizzBuzz'\n elsif n % 5 == 0\n 'Buzz'\n elsif n % 3 == 0\n 'Fizz'\n else \n n\n end\n end\n fizzbuzz.join(' ')\nend",
"def fizzbuzz\n an_array = Array.new(100)\n for cnt in 1..100\n l3_rem = cnt%3\n l5_rem = cnt%5\n if l3_rem == 0 && l5_rem != 0\n an_array[cnt -1 ] = 'Fizz'\n elsif l3_rem != 0 && l5_rem == 0\n an_array[ cnt -1 ] = 'Buzz'\n elsif l3_rem == 0 && l5_rem == 0\n an_array[ cnt - 1] = 'FizzBuzz'\n else\n an_array[ cnt - 1] = cnt\n end\n end\n return an_array\nend",
"def fizzbuzz\n\n\tfor i in (1..100) do\n\t\tif i % 3 == 0 and i % 5 == 0\n\t\t\tputs 'FizzBuzz'\n\t\telsif i % 5 == 0\n\t\t\tputs 'Buzz'\n\t\telsif i % 3 == 0\n\t\t\tputs 'Fizz'\n\t\telse puts i\n\n\t\tend\n\tend\n\nend",
"def fizzbuzz(start_int, finish_int)\n i = start_int\n output_array = []\n\n while i <= finish_int\n if i % 3 == 0 && i % 5 == 0\n output_array << \"FizzBuzz\"\n elsif i % 3 == 0\n output_array << \"Fizz\"\n elsif i % 5 == 0\n output_array << \"Buzz\"\n else\n output_array << i\n end\n\n i += 1\n end\n output_array.join(\", \")\nend",
"def fizz(number)\t\t\t\t# creates fizz function had number argument\n\tfor\ti in 1..number\t\t\t# for loop i is the current value runs from 1 to 100 the agrument\n if i % 5 == 0 and i % 3 == 0 # if the current number is both divisible by 3\n puts \"FizzBuzz\"\t\t\t# prints FizzBuzz\n elsif i % 5 == 0\t\t\t# else if the current number is divisible by 5\n puts \"Buzz\"\t\t\t\t# prints Buzz\n elsif i % 3 == 0\t\t\t# esle if the current number is divisible by 3\n puts \"Fizz\"\t\t\t\t# prints Fizz\n else\t\t\t\t\t\t# else if none of the above conditions exist\n puts i\t\t\t\t\t# print the current number\n end\t\t\t\t\t\t# ends if\n end\t\t\t\t\t\t# ends \n end",
"def super_fizzbuzz(array)\n\tarray.map do |x|\n\t\tif (x % 15 == 0)\n\t\t\tx = \"FizzBuzz\"\n\t\telsif (x % 5 == 0)\n\t\t\tx = \"Buzz\"\n\t\telsif (x % 3 == 0)\n\t\t\tx = \"Fizz\"\n\t\telse \n\t\t\tx\n\t\tend\n\tend\nend",
"def fizzbuzz(num_1, num_2, range)\n # this line defines a for-loop that runs from 1 to the range parameter passed in\n # this will iterate on each number from 1 to the range parameter inclusive\n (1..range).each do |i|\n # this line defines an if statement with 3 conditional statements\n # 1) the remainder of the iterator number (i) / num_1 parameter is 0 (meaning even division)\n # 2) the remainder of the iterator number (i) / num_2 parameter is 0 (meaning even division)\n # 3) that both of the above conditionals are true, meaning i is evenly divided by both nums\n if i % num_1 === 0 && i % num_2 === 0\n # if the above conditionals are true this prints a string\n puts 'fizzbuzz'\n # this line will run if the previous if returns false. this defines a second\n # conditional that returns true if the remainder of i / num_1 parameter\n # is 0 (meaning even division)\n elsif i % num_1 === 0\n # if the above conditional is true this line prints a string\n puts 'fizz'\n # this line will run if the previous elsif returns false. this defines a third\n # conditional that returns true if the remainder of i / num_2 parameter\n # is 0 (meaning even division)\n elsif i % num_2 === 0\n # if the above conditional is true this line prints a string\n puts 'buzz'\n # if none of the above the above conditionals return true run line below\n else\n # this line prints the iterator number i\n puts i\n # this line ends the if-elsif-else block\n end\n # this line ends the for-loop\n end\n# this line ends the fizzbuzz method\nend",
"def fizzbuzz(num_1, num_2, range)\n#create a loop that iterates from 1 up to the value of the argument range\n# variable i gets assigned another value after each loop\n (1..range).each do |i|\n# in each iteration, if i is divided by num_1 and has 0 remainder (modulo)\n# AND if i is divided by num_2 and has 0 remainders, 'fizzbuzz' will print out\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# if condition is not met from above, then if only i divided by num_1 has 0\n#remainder, then only print out 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n# Or if only i divided by num_2 has 0 remainder, then only print out 'buzz'\n elsif i % num_2 === 0\n puts 'buzz'\n# if the three conditions above are not true then just print out value of i\n else\n puts i\n end\n #iterate the loop to the next value in the range\n end\n # when all values within the range are finished, end the loop\nend",
"def super_fizzbuzz(array)\n array.map! { |num|\n if num % 3 == 0 && num % 5 == 0\n num = \"FizzBuzz\"\n elsif num % 3 == 0\n num = \"Fizz\"\n elsif num % 5 == 0\n num = \"Buzz\"\n else\n num\n end\n }\n array\nend",
"def super_fizzbuzz(array)\r\n\r\n\treturn array.map do |number|\r\n\t\tif number % 3 == 0 && number % 5 == 0\r\n\t\t\tnumber = \"FizzBuzz\"\r\n\t\telsif number % 3 == 0 \r\n\t\t\tnumber = \"Fizz\"\r\n\t\telsif number % 5 == 0\r\n\t\t\tnumber = \"Buzz\"\r\n\t\telse\r\n\t\t\tnumber = number\r\n\t\tend\r\n\tend\r\n\r\nend",
"def fizzbuzz(num_1, num_2, range)\n # Invokes the for-loop method \"each\" to the interger range, ending the range\n # at the parameter \"range\" value.\n # Iterates the following if/elsif/else statement over each element in the index\n (1..range).each do |i|\n # Checks if the modulus of varriable \"i\" into the parameter \"num_1\" is the\n # same class as the interger 0\n # Checks if the modulus of varriable \"i\" into the parameter \"num_2\" is the\n # same class as the interger 0\n # The loogical AND operator checks if both === methods returned TRUE\n # If yes, returns TRUE. If no, returns FALSE.\n if i % num_1 === 0 && i % num_2 === 0\n # If the if statement returns TRUE, prints the string 'fizzbizz' to\n # the console\n # if the if statemnt returns FALSE, does nothing.\n puts 'fizzbuzz'\n # Calculates the modulus of the \"i\" variable into the paramater num_1.\n # Evaluates if the return to the above calculation is an interger.\n elsif i % num_1 === 0\n # If the elsif statement above returns TRUE, prints the string 'fizz' to\n # the console.\n # if the elsif statemnt above returns FLASE, does nothing.\n puts 'fizz'\n # Calculates the modulus of the \"i\" variable into the parameter num_2.\n # Evaluates if the return of the above calculation is an interger.\n elsif i % num_2 === 0\n # If the elsif statement above returns TRUE, prints the string 'buzz' to\n # the console.\n # if the eslif statemnt above returns FALSE, does nothing\n puts 'buzz'\n # If no nother if/els if statement has returned TRUE, this line will run\n else\n # Prints the current value of the varribale \"i\" to the console.\n puts i\n # Ends the if/elsif/els statements\n end\n # Ends the \".each\" method invocation\n end\n # Ends the definitions of the \"fizzbuzz\" method.\nend",
"def fizz_buzz_check\n @numbers.collect do |x|\n if multiple_of(15, x)\n 'FizzBuzz'\n elsif multiple_of(3, x)\n 'Fizz'\n elsif multiple_of(5, x)\n 'Buzz'\n else\n x\n end\n end\n end",
"def super_fizzbuzz(array)\n array.map do |i| \n if i % 15 == 0 then 'FizzBuzz'\n elsif i % 3 == 0 then 'Fizz' \n elsif i % 5 == 0 then 'Buzz'\n else i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # sets 1 to range (last number) where each number will do the following\n (1..range).each do |i|\n # if the remainder of each number i divided by the first number num_1 should have a zero AND\n # the remainder of each number i divided by the second number num_2 should have a zero\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # otherwise, if the remainder of number i divdied by num_1 should have a zero\n elsif i % num_1 === 0\n # then print 'fizz'\n puts 'fizz'\n # otherwise, if the remainder of number i divided by num_2 should have a zero\n elsif i % num_2 === 0\n # then print 'buzz'\n puts 'buzz'\n else\n # if all the conditions above are not met, then print the number i\n puts i\n end\n end\nend",
"def fizzbuzz(num1, num2)\n numbers = num1..num2\n fizzbuzz_array = []\n numbers.each do |x|\n case\n when x % 3 == 0 && x % 5 == 0\n fizzbuzz_array << \"FizzBuzz\"\n when x % 3 == 0\n fizzbuzz_array << \"Fizz\"\n when x % 5 == 0\n fizzbuzz_array << \"Buzz\"\n else\n fizzbuzz_array << x\n end\n end\n\n p fizzbuzz_array.join(\", \")\nend",
"def fizzbuzz(num_1, num_2, range)\n # 1..range will compute from the numer 1 to the variable range. .each loops this varaible while do tells it to loop. The |i| is place holder for indexes\n (1..range).each do |i|\n # The if statemenet is stating if i has a remindar equal to num_1 that is equal to 0 AND if i has a remindar equal to num_2 that is equal to zero\n if i % num_1 === 0 && i % num_2 === 0\n # print fizzbuzz if the given condition above is true\n puts 'fizzbuzz'\n # elsif is stating that if the first condition isn't met, then print this method. This elsif method states if i has a remindar that is equal to num_1 that is equal to 0\n elsif i % num_1 === 0\n # Print fizz if the given condition above is true\n puts 'fizz'\n # elsif is stating that if the given if statement is false, then go to the next elsif statement. This is stating if i has a remindar equal to num_2 that is equal to=\n elsif i % num_2 === 0\n # Print buzz if the given condition above is true\n puts 'buzz'\n # else is the final condition in a if, elsif statement. If the if and elsif statements are false, else will automatically be the final condition.\n else\n # print i if the given conditions of if, elsif are false\n puts i\n # ends the if, elsif, else fuctions\n end\n # ends the looping function\n end\n # ends the method function\nend",
"def fizzbuzz(num_1, num_2, range)\n#Iterate the process begining at the value \"1\" up to the range argument's value.\n#A new variable i is established, i starts as \"1\" and goes up by 1 up until the range value is hit.\n (1..range).each do |i|\n#Establish a conditional: If i's value can be divided by num1's value with a remainder\n#of 0 AND i's value can also be divided by num2's value with a remainder of 0, print the string 'fizzbuzz' to the terminal\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If both prongs of the above conditional are not met, but i's value can be divided by num1's value with a remainder 0 then...\n elsif i % num_1 === 0\n#...print the string 'fizz' to the terminal\n puts 'fizz'\n#If neither of the two previous conditionals are met, but i's value can be divided by num2's value with a remainder 0 then...\n elsif i % num_2 === 0\n#...print the string 'fizz' to the terminal\n puts 'buzz'\n#If none of those conditionals were satisfied then...\n else\n#...print the value of i to the terminal\n puts i\n#end the conditional\n end\n#end the iteration\n end\n#end the method\nend",
"def fizzbuzz(num_1, num_2, range)\n# Iterate through each number in a range from 1 to whatever number is input for\n# the 'range' argument, and do something for each number.\n (1..range).each do |i|\n# Use an if statement that executes code if the conditional is true. If i is\n# divisible by num_1 and num_2, then execute the code below. If not true, move\n# on to the elsif statement.\n if i % num_1 === 0 && i % num_2 === 0\n# Print 'fizzbuzz' if the conditional above is true.\n puts 'fizzbuzz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_1, then print 'fizz'. If not true, move on to next elsif statement.\n elsif i % num_1 === 0\n puts 'fizz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_2, then print 'buzz'. If not true, move on to else statement.\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the above conditional statements are true, print i.\n else\n puts i\n# End the if/elsif/else statement.\n end\n# End the for loop.\n end\n# End the fizzbuzz method definition.\nend",
"def fizzbuzz(num1, num2)\n array = []\n\n num1.upto(num2) do |num|\n if (num % 3 == 0) && (num % 5 == 0)\n array << \"FizzBuzz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n else\n array << num\n end\n end\n array.join(', ')\nend",
"def fizz_buzz(max)\n\n new_arr=[]\n\n i = 1\n while i < max\n if i % 4 == 0 && i % 6 != 0\n new_arr << i \n\n elsif i % 6 == 0 && i % 4 != 0\n new_arr << i \n else \n end\n i += 1\n end\n\n return new_arr\nend",
"def fizzbuzz(num)\n i = 1\n while i < num\n \n if i % 3 == 0 && i % 5 == 0\n p \"Fizzbuzz! nums is #{i}\"\n elsif i % 3 == 0\n p \"Fizz! num is #{i}\"\n elsif i % 5 == 0\n p \"Buzz! num is #{i}\"\n end\n i+= 1\n end\n\nend",
"def fizzbuzz(number)\n #if the number is divisible by both 3 and 5\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n #else div by only 3\n elsif number % 3 == 0\n \"Fizz\"\n #else div by only 5\n elsif number % 5 == 0\n \"Buzz\"\n #else nil\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # for each of \"range\", do the below - i iterates from 1 to range\n (1..range).each do |i|\n # if statement - calculates whether remainder = 0 when i is divided by both num_1 and num_2 \n # this is equivalent to figuring out if num_1 and num_2 both divide evenly in. \n if i % num_1 === 0 && i % num_2 === 0\n # print \"fizzbuzz \" to screen if true \n puts 'fizzbuzz'\n # if quotient is zero for num_1 but not num_2 - print fizz \n elsif i % num_1 === 0\n # print fizz \n puts 'fizz'\n #if quotient = 0 for num_2 but not num_1 - print buzz \n elsif i % num_2 === 0\n # print buzz \n puts 'buzz'\n # if none of these are true - print i \n else\n # print i \n puts i\n \n end\n \n>>>>>>> 7f31df2026bbc770e1d39fa796fd7a1c7b96e2e3\n end\n\nend",
"def fizz_buzz()\n for i in 1..100\n if i % 3 == 0 && i % 5 == 0\n puts 'FizzBuzz'\n elsif i % 3 == 0\n puts 'Fizz'\n elsif i % 5 == 0\n puts 'Buzz'\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num1, num2)\n answer = []\n index = 0\n (num1..num2).to_a.each do |num|\n answer[index] = \"\"\n answer[index] << \"Fizz\" if num % 3 == 0\n answer[index] << \"Buzz\" if num % 5 == 0\n answer[index] << num.to_s if num % 3 !=0 && num % 5 != 0 \n index += 1\n end\n puts answer.join(\", \")\nend",
"def fizzbuzz(num_1, num_2, range)\n#from integer 1 to argument range above, execute the code below for each element. variable i stands for the element in the range the program is currently using at the time.\n (1..range).each do |i|\n#conditional, if variable i modulo argument num_1 is equal to 0 AND variable i modulo argument num_2 is also equal to 0, print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the above conditional is not true, check if variable i modulo argument num_1 is equal to 0 by itself. if true, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n#if neither of the above conditionals are true, check if variable i modulo argument num_2 is equal to 0 by itself. if true, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditionals are found to be true, print the value of variable i (the number in the range the program was checking)\n else\n puts i\n end\n end\nend",
"def fizz_buzz \n\ti=1\n\t while i < 100 do\n\t \tif i%3 == 0 && i%5 == 0\n\t \t\tprint \"FizzBuzz\\n\"\n\t \telsif i%3 == 0\n\t \tprint \"fizz\\n\"\n\t \telsif i%5 == 0\n\t \t\tprint \"Buzz\\n\"\n\t \telse\n\t \tprint \"#{i}\\n\"\n\t \tend\n\t\ti += 1\n\t end\nend",
"def super_fizzbuzz(array)\n array.map do |i|\n if i%15 == 0\n i = 'FizzBuzz'\n elsif i%5 == 0\n i = 'Buzz'\n elsif i%3 == 0\n i = 'Fizz'\n else \n i\n end\n end\nend",
"def fizzbuzz(start_num, end_num)\n new_arr = []\n (start_num..end_num).each do |num|\n case \n when (num % 3 == 0) && (num % 5 == 0)\n new_arr << \"FizzBuzz\"\n when num % 5 == 0\n new_arr << \"Buzz\"\n when num % 3 == 0 \n new_arr << \"Fizz\" \n else\n new_arr << num\n end\n end\n puts new_arr.join(', ')\nend",
"def fizzBuzz2(max)\n sol = []\n\n (1...max).each do |num|\n if !(num % 5 == 0 && num % 3 == 0) && (num % 5 == 0 || num % 3 == 0)\n sol << num\n end\n end\n\n sol\nend",
"def fizz_buzz(i)\nif i % 3 == 0 && i % 5 == 0\n\t\"fizzbuzz\"\nelsif i % 3 == 0 \n\t \"fizz\"\nelsif i % 5 == 0\n \"buzz\"\nelse\n\t i \n end\nend",
"def super_fizzbuzz(array)\n # Your code goes here!\n array.map do |x|\n if x % 15 == 0 \n \"FizzBuzz\"\n elsif\n x % 3 == 0\n \"Fizz\"\n elsif \n x % 5 == 0\n \"Buzz\"\n else\n x \n end\n end\nend",
"def super_fizzbuzz(array)\n\n if !(array.is_a? Array)\n raise Argumenterror, \"That is not a valid array\"\n end\n\n result = array.map do |x|\n if (x % 5 == 0) && (x % 3 == 0)\n x = \"FizzBuzz\"\n elsif (x % 5 == 0)\n x = \"Buzz\"\n elsif (x % 3 == 0)\n x = \"Fizz\"\n else\n x = x\n end\n end\n\n return result\n\nend",
"def fizzbuzz(start, last)\n array = (start..last).map do |num|\n if (num % 3 == 0 && num % 5 == 0)\n 'FizzBuzz'\n elsif (num % 3 == 0)\n 'Fizz'\n elsif (num % 5 == 0)\n 'Buzz'\n else\n num.to_s \n end\n end\n puts array.join(', ')\nend",
"def fizzbuzz(num_1, num_2, range) #defines a method called fizzbuzz which takes 3 parameters (num_1, num_2, range)\n (1..range).each do |i| #iterates `i` over numbers 1 through a number set by parameter `range`\n if i % num_1 === 0 && i % num_2 === 0 #begins if...end loop with conditional that if the modulo of num_1 into `i` AND the modulo of num_2 into `i` both equal zero\n puts 'fizzbuzz' #then \"fizzbuzz\" will be sent to terminal\n elsif i % num_1 === 0 #if the first step is false AND the modulo of num_1 into `i` is 0 then\n puts 'fizz' #\"fizz\" will be printed to terminal\n elsif i % num_2 === 0 #if the first `if` AND the first `elsif` are false AND the modulo of num_2 into `i` is 0 then\n puts 'buzz' #\"buzz\" will be printed to terminal\n else #if all the above are false\n puts i #then variable `i` will be printed to terminal\n end #ends if statement from line 30\n end #ends .each do from line 29\nend",
"def fizzbuzz(a,b)\n numbers = (a..b).to_a\n\n numbers.each do |number|\n if number % 15 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend",
"def fizz_buzz (i)\n 1.upto 100 do |i|\n if i % 5 == 0 && i % 3 == 0 \n puts \"FizzBuzz\"\n elsif i % 5 == 0\n puts \"Buzz\" \n elsif\n puts i % 3 == 0\n else \"Fizz\"\n puts i\n end\nend\nend",
"def super_fizzbuzz(array)\n\narray.map! { |element| \n if(element % 15 == 0) \n \"FizzBuzz\" \n elsif (element % 3 == 0) \n \"Fizz\" \n elsif (element % 5 == 0) \n \"Buzz\" \n else \n element \n end\n}\n\np array\n\nend",
"def super_fizzbuzz(array)\n array.map do |num|\n if num % 15 == 0\n num = 'FizzBuzz'\n elsif num % 5 == 0\n num = 'Buzz'\n elsif num % 3 == 0\n num = 'Fizz'\n else\n num\n end\n end\nend",
"def fizzbuzz\n\t 1.upto(100) do |i|\n\tif i % 5 == 0 and i % 3 == 0\n\t puts \"FizzBuzz\"\n\telsif i % 5 == 0\n\t puts \"Buzz\"\n\telsif i % 3 == 0\n\t puts \"Fizz\"\n\telse\n\t puts i\n\tend\n\tend\nend",
"def fizz_buzz(max)\n\tnewArr = []\n i = 1\n while i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n newArr << i\n end\n i += 1\n end\n return newArr\nend",
"def fizzbuzz(num_1, num_2, range)\n #loop with .each do instead of for loop\n (1..range).each do |i|\n #Use modulo operator to get the remainder of the division i on num-1\n #if i modulo num_1 triple equals 0 AND i modulo num_2 triple equals 0\n if i % num_1 === 0 && i % num_2 === 0\n #print \"fizzbuzz\"\n puts 'fizzbuzz'\n #else if i modulo num_1 triple equals 0\n elsif i % num_1 === 0\n #print \"fizz\"\n puts 'fizz'\n #else if i modulo num_2 triple equals 0\n elsif i % num_2 === 0\n #print \"buzz\"\n puts 'buzz'\n #otherwise\n else\n #print i\n puts i\n #end\n end\n #end\n end\n #end\nend",
"def fizz_buzz(max)\n\ti = 1\n \tarry = []\n while i < max\n if i % 4 == 0 && i % 6 != 0 || i % 4 != 0 && i % 6 == 0\n arry << i\n end\n i += 1\n end\n return arry\nend"
] |
[
"0.8584148",
"0.85081327",
"0.848062",
"0.84251446",
"0.8422344",
"0.84183127",
"0.83648473",
"0.8272745",
"0.82644373",
"0.8244698",
"0.82329017",
"0.81712574",
"0.8167414",
"0.8162882",
"0.8161074",
"0.8152878",
"0.8147905",
"0.81393474",
"0.813301",
"0.8107017",
"0.80989087",
"0.80962926",
"0.80394953",
"0.80173624",
"0.79890364",
"0.7984501",
"0.7984501",
"0.7963208",
"0.7953623",
"0.7934225",
"0.79294145",
"0.79261523",
"0.7924122",
"0.7902497",
"0.7893773",
"0.78871304",
"0.78857964",
"0.7827454",
"0.7820756",
"0.78122175",
"0.7807134",
"0.7804105",
"0.7795061",
"0.778793",
"0.77812153",
"0.7780816",
"0.7779715",
"0.77753747",
"0.7763016",
"0.7735045",
"0.7734016",
"0.7733666",
"0.77175367",
"0.7711879",
"0.7710381",
"0.77004147",
"0.76986456",
"0.7694906",
"0.76943713",
"0.768821",
"0.7679458",
"0.76738805",
"0.76730055",
"0.7669257",
"0.7665198",
"0.76544917",
"0.7649071",
"0.7641375",
"0.76297545",
"0.762652",
"0.7613138",
"0.76115876",
"0.7608922",
"0.7607969",
"0.760777",
"0.76028657",
"0.75983745",
"0.75909257",
"0.75897217",
"0.75893503",
"0.75889885",
"0.75889",
"0.7585787",
"0.7584851",
"0.75832987",
"0.7583237",
"0.7569997",
"0.7567638",
"0.75650465",
"0.75574416",
"0.7555201",
"0.7553182",
"0.75531477",
"0.7549877",
"0.75472105",
"0.7546898",
"0.7546692",
"0.7545802",
"0.7534489",
"0.7534293"
] |
0.84154344
|
6
|
include PostgresHelper attr_accessor :id
|
def from_postgres(postgres_user_info)
# user = UserInfo.new
# puts "FROM POSTGRES INFO #{postgres_user_info.inspect}"
if postgres_user_info
self.id = postgres_user_info['id'] || ''
self.name = postgres_user_info['name'] || ''
self.updated_at = postgres_user_info['updated_at']? postgres_user_info['updated_at'].to_datetime : DateTime.now
self.title = postgres_user_info['title'] || ''
if (postgres_user_info['about'])
postgres_user_info['about'][0] = '['
postgres_user_info['about'][postgres_user_info['about'].length-1] = ']'
unescaped_about = PostgresHelper.unescape_from_postgres(postgres_user_info['about'])
else
end
# puts "UNESAPED ABOUT #{unescaped_about}"
# self.about =(unescaped_about)? JSON.parse(unescaped_about) : Array.new
self.about =(unescaped_about)? PostgresHelper.from_array_string_load(unescaped_about) : Array.new
self.location = (postgres_user_info['location'] && postgres_user_info['location'] != 'null')? PostgresUserInfos.from_json_load( postgres_user_info['location']) : Hash.new
self.location_id = postgres_user_info['location_id'] || ''
self.latitude = (postgres_user_info['latitude'] && !postgres_user_info['latitude'].empty?)? postgres_user_info['latitude'].to_f : nil
self.longitude = (postgres_user_info['longitude'] && !postgres_user_info['longitude'].empty?)? postgres_user_info['longitude'].to_f : nil
self.public_service = (postgres_user_info['public_service'])? postgres_user_info['public_service'] : false
self.keywords_rated = from_json_load(postgres_user_info['keywords_rated'])
# self.current_keywords = self.keywords_rated
self.current_keywords = (self.keywords_rated && !self.keywords_rated.empty?)?self.keywords_rated.keys : Array.new
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id\n __id\n end",
"def id; 1; end",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n return @id\n end",
"def id_column\n IdMethods::ID_COLUMN\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\r\n @id\r\n end",
"def primary_key\n 'id'\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def id\n @id\n end",
"def id\n 1\n end",
"def id\n @id\n end",
"def _id\n @id\n end",
"def get_id()\n @id\n end",
"def get_id()\n @id\n end",
"def id\n return self[:id]\n end",
"def id\n self[:id]\n end",
"def primary_key_attribute\n :id\n end",
"def id; self['_id']; end",
"def id; 1; end",
"def id\n\t\t@id\n\tend",
"def get_id\n\t\treturn id\n\tend",
"def id\n object_id\n end",
"def id\n self[:id]\n end",
"def id\n attributes[self.class.primary_key]\n end",
"def id\n attributes[:id] \n end",
"def get_id()\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n object.id\n end",
"def id\n object.id\n end",
"def getId\n @id\n end",
"def id\n read_attr :id\n end",
"def id ; @record.id if @record ; end",
"def id_number; end",
"def id\n @attributes[:ID]\n end",
"def id\n @attributes[:_id]\n end",
"def id()\n #This is a stub, used for indexing\n end",
"def id() end",
"def temp_id\n #reverting to just plain id, see issue #89\n self.id\n end",
"def id\n read_attribute(:pg_page_id)\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n nil\n end",
"def id\n self.struct.send(:table)[:id]\n end",
"def id\n get_val(:id)\n end",
"def id\n key\n end",
"def id\n attributes.fetch(:id)\n end",
"def id\n attributes.fetch(:id)\n end",
"def id\n attributes.fetch(:id)\n end",
"def id\n _id rescue nil\n end",
"def id\n self['id']\n end",
"def id\n self['id']\n end",
"def id\n '1234567890'\n end",
"def identity\n :id\n end",
"def getId\n return @id\n end",
"def key\n id\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n @attributes[:id]\n end",
"def id\n attribute('id', 'id')\n end",
"def id\n raise NotImplementedError\n end"
] |
[
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.7339177",
"0.73149484",
"0.7279733",
"0.723136",
"0.723136",
"0.72103226",
"0.72103226",
"0.71962595",
"0.71213704",
"0.7107414",
"0.7107414",
"0.7107414",
"0.7107414",
"0.71026754",
"0.7098007",
"0.70814466",
"0.70814466",
"0.70814466",
"0.70814466",
"0.7070094",
"0.7068259",
"0.70351493",
"0.7032344",
"0.7030412",
"0.7030412",
"0.6968021",
"0.69594085",
"0.695687",
"0.69503325",
"0.6947073",
"0.69175935",
"0.6908482",
"0.68999356",
"0.68971324",
"0.687358",
"0.6864114",
"0.6863191",
"0.6859709",
"0.6859709",
"0.6859709",
"0.6859709",
"0.6859709",
"0.6859709",
"0.6859709",
"0.6838128",
"0.6838128",
"0.680423",
"0.678523",
"0.67751694",
"0.677268",
"0.67610216",
"0.67600566",
"0.6753607",
"0.6750499",
"0.6737481",
"0.6725631",
"0.67252725",
"0.67252725",
"0.67252725",
"0.67252725",
"0.67252725",
"0.67252725",
"0.67252725",
"0.67252725",
"0.67252725",
"0.67222637",
"0.6713942",
"0.67090464",
"0.67075884",
"0.67075884",
"0.67075884",
"0.6705367",
"0.6701648",
"0.6701648",
"0.66850203",
"0.66634214",
"0.6641073",
"0.66315657",
"0.6628225",
"0.6628225",
"0.6628225",
"0.6628225",
"0.6628225",
"0.6628225",
"0.6628225",
"0.6628225",
"0.6628225",
"0.6628225",
"0.65952724",
"0.65941185"
] |
0.0
|
-1
|
For each line make the key(s) and emit them then for that line
|
def process(line)
parts = line.chomp.split(/\t/)
keys = line_key(parts)
keys.each do |k|
yield [k, *parts]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def go!\n results = {}\n dups = []\n\n @enumerable.each do |line|\n line.strip!\n sequences(line).each do |sequence|\n if results[sequence]\n dups << sequence\n else\n results[sequence] = line\n end\n end\n end\n \n # Remove dups from the results map\n dups.each { |dup| results.delete(dup) }\n \n if block_given?\n results.each do |k,v|\n yield(k,v)\n end\n end\n\n results\n end",
"def transform_keys(&block); end",
"def transform_keys!(&block); end",
"def index_source(lines, options)\n @lines = {}\n @index = Hash.new{ |h, k| h[k] = [] }\n if @field_names\n index_fields(options)\n end\n @case_sensitive = options.fetch(:case_sensitive, true)\n @trim_whitespace = options.fetch(:trim_whitespace, false)\n @line_count = 0\n @skip_count = 0\n line_num = 0\n lines.each do |row|\n line_num += 1\n next if line_num == 1 && @field_names && options[:ignore_header]\n unless @field_names\n @field_names = row.each_with_index.map{ |f, i| f || i.to_s }\n index_fields(options)\n next\n end\n field_vals = row\n line = {}\n filter = false\n @field_names.each_with_index do |field, i|\n line[field] = field_vals[i]\n line[field].strip! if @trim_whitespace && line[field]\n if @include_filter && f = @include_filter[i]\n filter = !check_filter(f, line[field])\n end\n if @exclude_filter && f = @exclude_filter[i]\n filter = check_filter(f, line[field])\n end\n break if filter\n end\n if filter\n @skip_count += 1\n next\n end\n key_values = @key_field_indexes.map{ |kf| @case_sensitive ?\n field_vals[kf].to_s : field_vals[kf].to_s.upcase }\n key = key_values.join('~')\n parent_key = key_values[0...(@parent_fields.length)].join('~')\n if @lines[key]\n @warnings << \"Duplicate key '#{key}' encountered and ignored at line #{line_num}\"\n @skip_count += 1\n else\n @index[parent_key] << key\n @lines[key] = line\n @line_count += 1\n end\n end\n end",
"def processraw str, keys\n str.readlines.collect do |l|\n spltline = l.chomp.split \"|\"\n returning Hash.new do |h|\n keys.each_index do |i|\n h[keys[i]] = spltline[i] unless keys[i] == :ignore\n end\n end\n end\n end",
"def index_source\n @lines = {}\n @index = Hash.new{ |h, k| h[k] = [] }\n if @field_names\n index_fields\n include_filter = convert_filter(@include, @field_names)\n exclude_filter = convert_filter(@exclude, @field_names)\n end\n @line_count = 0\n @skip_count = 0\n @dup_count = 0\n line_num = 0\n @data.each do |row|\n line_num += 1\n next if line_num == 1 && @field_names && @ignore_header\n unless @field_names\n if row.class.name == 'CSV::Row'\n @field_names = row.headers.each_with_index.map{ |f, i| f || i.to_s }\n else\n @field_names = row.each_with_index.map{ |f, i| f || i.to_s }\n end\n index_fields\n include_filter = convert_filter(@include, @field_names)\n exclude_filter = convert_filter(@exclude, @field_names)\n next\n end\n field_vals = row\n line = {}\n filter = false\n @field_names.each_with_index do |field, i|\n val = field_vals[i]\n val = val.to_s.strip if val && @trim_whitespace\n line[field] = val\n if include_filter && f = include_filter[i]\n filter = !check_filter(f, line[field])\n end\n if exclude_filter && f = exclude_filter[i]\n filter = check_filter(f, line[field])\n end\n break if filter\n end\n if filter\n @skip_count += 1\n next\n end\n key_values = @key_field_indexes.map{ |kf| @case_sensitive ?\n field_vals[kf].to_s :\n field_vals[kf].to_s.upcase }\n key = key_values.join('~')\n parent_key = key_values[0...(@parent_fields.length)].join('~')\n if @lines[key]\n @warnings << \"Duplicate key '#{key}' encountered at line #{line_num}\"\n @dup_count += 1\n key += \"[#{@dup_count}]\"\n end\n @index[parent_key] << key\n @lines[key] = line\n @line_count += 1\n end\n end",
"def split!\n return @keys if instance_variable_defined?('@keys')\n ranges = row_chunker.ranges_for(input_csv)\n @keys = ranges.map.with_index do |range, index|\n chunk_key = key_from_index(index, ranges.count)\n contents = csv_from_range(range)\n BulkProcessor.config.file_class.new(chunk_key).write(contents)\n chunk_key\n end\n end",
"def keys\n map { |line| line.key }\n end",
"def keygens; end",
"def process_line( key, values, line_string)\n case key\n #---------------------------------------------------------\n # List of geometric vertices, with (x, y, z [,w]) coordinates, \n # w is optional and defaults to 1.0.\n when \"v\"\n values.collect! { |v| v.to_f }\n @vertex.push( values )\n #---------------------------------------------------------\n # List of vertex normals in (x,y,z) form; normals might not be unit vectors.\n # https://en.wikipedia.org/wiki/Normal_(geometry)\n when \"vn\"\n values.collect! { |v| v.to_f }\n @normal.push( values )\n #---------------------------------------------------------\n # List of texture coordinates, in (u, [v ,w]) coordinates, these \n # will vary between 0 and 1, v and w are optional and default to 0.\n when \"vt\"\n values.collect! { |v| v.to_f }\n values = values[0..1]\n #values.size.times do |index|\n # values[index] *= -1.0 # inverse Y cord in texture file?\n #end\n @texcoord.push( values ) # u and v\n puts(\"Texture pos: [#{values.join(', ')}] From: \\'#{line_string}\\'\") if DEBUGGING\n #---------------------------------------------------------\n # Named objects and polygon groups.\n when \"o\"\n @objects << values.first\n #---------------------------------------------------------\n # Polygon group names.\n when \"g\", \"group\"\n if values.length == 0\n # p \"anonymous group detected. treat as \\\"default\\\".\"\n @current_group = get_group( \"default\" )\n else\n # Only the first group is adopted even if there are multiple group names on the line.\n @current_group = get_group( values[0] )\n end\n @current_group.mtl_name = @current_material_name\n #---------------------------------------------------------\n # Smooth shading across polygons? * can also mark shader groups with int value *\n when \"s\"\n setting = values.first # convert into boolean\n @smooth_shading = setting.include?('on') or setting.include?('true')\n #---------------------------------------------------------\n # Polygonal face element, these can be packaged in a number of ways.\n # index is offset to start drawing at tile index 0, hense minus 1\n when \"f\"\n vertex_count = values.length\n case values[0]\n when /\\d+\\/\\d+\\/\\d+/ # v/vt/vn\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n v, vt, vn = value.split( '/' )\n face.vtx_index[i] = v.to_i - 1\n face.tex_index[i] = vt.to_i - 1\n face.nrm_index[i] = vn.to_i - 1\n print(\"[#{face.vtx_index[i]}, #{face.tex_index[i]}, #{face.nrm_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n when /\\d+\\/\\/\\d+/ # v//vn\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n v, vn = value.split( '//' )\n face.vtx_index[i] = v.to_i - 1\n face.nrm_index[i] = vn.to_i - 1\n print(\"[#{face.vtx_index[i]}, #{face.nrm_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n when /\\d+\\/\\d+/ # v/vt\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n v, vt = value.split( '/' )\n face.vtx_index[i] = v.to_i - 1\n face.tex_index[i] = vt.to_i - 1\n print(\"[#{face.vtx_index[i]}, #{face.tex_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n when /\\d+/ # v\n face = Face.new( vertex_count )\n print(\"Face: \") if DEBUGGING\n values.each_with_index do |value, i|\n face.vtx_index[i] = value.to_i - 1\n print(\"[#{face.vtx_index[i]}] \") if DEBUGGING\n end\n # --------------------------------------\n else\n p \"unknown face format detected.\"\n end\n @current_group.faces.push( face )\n @current_group.face_index.push( @current_group.faces.length - 1 )\n puts(\"\") if DEBUGGING\n #---------------------------------------------------------\n when /^\\#+/, nil\n #puts \"comment or empty line.\"\n #---------------------------------------------------------\n # The .mtl file may contain one or more named material definitions. \n when \"mtllib\"\n # https://en.wikipedia.org/wiki/Materials_system\n # https://en.wikipedia.org/wiki/Wavefront_.obj_file#Material_template_library\n @material_lib = MaterialLibrary.new(values.first)\n #---------------------------------------------------------\n # The material name matches a named material definition in an external .mtl file.\n when \"usemtl\"\n @current_materials << values.first\n #---------------------------------------------------------\n else\n puts \" -Unsupported .obj token #{key} given. Ignored.\"\n end\n end",
"def process_lines\n\t#file_string is a string array,\n\t#extendable_hash is a hash that is created through this method\n\t\tneeded_lines = []\n\t\[email protected] do |line|\n\t\t\tunless line.strip.length == 0 || line[0] == '#' #filters empty lines and comments\n\t\t\t\tneeded_lines << line\n\t\t\tend\n\t\tend\n\n\t\t@hash = {}\n\t\tneeded_lines.map do |line| #splits every line at empty spaces\n\t\t\tline = line.split(\" \")\n\t\t\t@hash[line[0]] = line.drop(1) #line.drop(1) returns line without the first (0th) entry\n\t\tend\n\n\n\t\t# needed_lines.map do |line|\n\t\t# \thash[line[0]] = line.drop(1) #line.drop(1) returns line without the first (0th) entry\n\t\t# end\n\n\t\treturn @hash\n\tend",
"def <<(line)\n line.blank? ? (@lines << line) : (self[line.key] = line) ; self\n end",
"def to_hash\n Hash[ *(map { |line| [line.key, line] }).flatten ]\n end",
"def get_minimal_key(line)\n compute_minimal_keys if not @minimal_keys\n \n str = \"\"\n minimal_keys.each{|k, size|\n str += line.field(k).to_s[0..size]\n }\n return str\n end",
"def each_key(&block); end",
"def process_input(input_lines)\n input_lines.map(&:chomp).map { |line| line.split('<->').map(&:strip) }\n .map { |k, v| [k, v.split(', ')] }.to_h\nend",
"def map_keys\n inject(self.class.new) do |memo, (key, value)|\n memo[yield(key)] = value\n memo\n end\n end",
"def rekey_as_needed; end",
"def map_lines\n while (inline = input.gets)\n output.puts yield(inline)\n end\n end",
"def transform_keys(&block)\n @key_transformer = block\n end",
"def populate_keys(node, keys, size)\n f = IO.popen(\"redis-cli -h #{node[:host]} -p #{node[:port]} -n #{node[:db]} --pipe\", IO::RDWR)\n\n keys.each do |key|\n size.times.map do |x| \n f << to_redis_proto('SADD', key, ::Digest::MD5.hexdigest('f' + x.to_s))\n end\n end\n\n f.close\n end",
"def each_mesh_record\n current_data = {}\n in_record = false\n file.each_line do |line|\n case line\n when /\\A\\*NEWRECORD/\n yield(current_data) if in_record\n in_record = true\n current_data = {}\n when /\\A(?<term>[^=]+) = (?<value>.*)/\n current_data[Regexp.last_match(:term)] ||= []\n current_data[Regexp.last_match(:term)] << Regexp.last_match(:value).strip\n when /\\A\\n/\n yield(current_data) if in_record\n in_record = false\n end\n end\n # final time in case file did not end with a blank line\n yield(current_data) if in_record\n end",
"def iterate_and_prep_hash\n self.input_ticket_arr.each do |src_destination_arr|\n src_node = node_for_key(src_destination_arr[0], :src)\n destination_node = node_for_key(src_destination_arr[1], :destn)\n src_node.next_node = destination_node\n end\n end",
"def each\n items = {}\n subject = []\n source.each_line do |line|\n parsed_line = Line.parse(line)\n if parsed_line.is_a?(Line::ChecklistItem)\n raise DuplicateItemNames if items.key?(parsed_line.to_s)\n\n items.merge!(parsed_line.to_s => parsed_line.checked?)\n elsif parsed_line.is_a?(Line::Header)\n raise DuplicateSubjectNames if subject.include?(parsed_line.to_s)\n\n unless items.empty?\n yield subject, items\n items.clear\n end\n if parsed_line.nesting > subject.count + 1\n subject << parsed_line.to_s\n elsif parsed_line.nesting == subject.count + 1\n subject.pop if subject.count.positive?\n subject.push(parsed_line.to_s)\n else\n (subject.count - parsed_line.nesting + 2).times do\n subject.pop\n end\n subject.push(parsed_line.to_s)\n end\n end\n end\n\n unless items.empty?\n yield subject, items\n items.clear\n end\n end",
"def fastq_to_hash(fastq_file)\n count = 0\n sequence_a = []\n quality_a = []\n count_seq = 0\n\n File.open(fastq_file,'r') do |file|\n file.readlines.collect do |line|\n count +=1\n count_m = count % 4\n if count_m == 1\n line.tr!('@','>')\n sequence_a << line.chomp\n quality_a << line.chomp\n count_seq += 1\n elsif count_m == 2\n sequence_a << line.chomp\n elsif count_m == 0\n quality_a << line.chomp\n end\n end\n end\n sequence_hash = Hash[*sequence_a]\n quality_hash = Hash[*quality_a]\n return_hash = {}\n sequence_hash.each do |k,v|\n return_hash[k] = [v, quality_hash[k]]\n end\n return return_hash\nend",
"def text2hash (stanza_name,query_names, tax_id)\n result = {}\n #load each query result file\n query_names.each do |query_name|\n input_file = \"#{PREPARE_DIR}/text/#{query_name}/#{tax_id}.txt\"\n File.open(\"#{input_file}\") do |f|\n while line = f.gets\n # convert a line to hash object\n columns_info = get_query_columns(stanza_name, query_name)\n gene_text_data = gene_obj_mapping(line, query_name, columns_info)\n\n gene_id = gene_text_data[\"gene_id\"]\n if result[gene_id] == nil\n result[gene_id] = gene_text_data\n else\n result[gene_id].merge!(gene_text_data) do |key, oldval, newval|\n if key.to_s == 'gene_id' || key.to_s == '@id' # no repeat of tax id\n oldval\n else # concat text data\n oldval.concat(newval).uniq\n end\n end\n end\n end\n end\n end\n result\nend",
"def deep_transform_keys(&block); end",
"def batch_key(_record)\n raise \"Implement in child\"\n end",
"def build_index\n say \"Building index...\"\n\n # Get size in bytes, so we know when we've hit the end.\n file_size = File.size(@filename)\n CSV.open(@filename, :encoding => 'utf-8', :headers => true) do |csvin|\n\n # Get byte offset\n line_start = csvin.tell\n\n # Then read line\n count = 0\n while((line_start = csvin.tell) < file_size) do\n\n # Load the line\n line = csvin.shift()\n\n # Load the key up to the key size only\n key = get_minimal_key(line)\n \n # Save the file offset\n # TODO: ensure random access of the cache is possible\n $stderr.puts \"WARNING: Key at byte #{line_start} of #{@filename} collides with key at byte #{@cache[key]}.\" if @cache[key]\n @cache[key] = line_start\n\n print \"\\rLine: #{count+=1} \"\n end\n end\n print \"\\n\"\n \n say \"Finished building index\"\n end",
"def scan_line(line)\n e = { orig: line }\n entry_pattern.match(line) do |m|\n e.update(extract_groups(m))\n end\n e\n end",
"def parse_to_file(line)\n\n z_unique = File.new(@outdir+\"_unique\", 'w')\n z_non_unique = File.new(@outdir+\"_non_unique\", 'w')\n\n while [email protected]?\n entry1 = make_content(line)\n line = @filehandler.readline()\n entry2 = make_content(line)\n if entry1.q_name == entry2.q_name\n # What if on same chromosome?\n # calling helper procedure\n entries << entry1\n marker2 = true\n while entry1.q_name == entry2.q_name\n\n if entry1.t_name == entry2.t_name\n\n entries << entry2\n\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_content(line)\n marker = 1\n end\n\n else\n marker2 = false\n\n @counter_non_unique += 1\n\n out = \"#{entry1.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n\n while entry1.qname == entry2.qname\n\n out = \"#{entry2.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_content(line)\n marker = 1\n end\n end\n\n end\n\n if marker2\n is_in_range?(entries, z_unique, z_non_unique)\n end\n\n\n else\n @counter_unique += 1\n out = \"#{entry1.to_s()}\"\n z_unique.write(out+\"\\n\")\n marker = false\n end\n end\n if marker\n @counter_unique += 1\n out = \"#{entry2.to_s()}\"\n z_unique.write(out+\"\\n\")\n end\n\n puts \"Unique: #{@counter_unique} Non_unique: #{@counter_non_unique}\"\n z_non_unique.close\n z_unique.close\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 each_record\n keys.sort.each {|key| yield @records[key]}\n end",
"def each_key\n\t record = @head\r\n\t while record.next && record.next != @tail\r\n\t\t record = record.next\n\t\t yield record.key\r\n\t end\r\n end",
"def create_maps(text)\n maps = []\n array = text.split(\"\\n\")\n array.each do |x|\n # We'll need to do some validating of the blocks here\n # Check the number of pipes\n return false if x.count('|') != 4\n\n # Check for nulls is done in each method later\n elem = x.split('|')\n\n # Check the number of elements after splitting at pipe\n return false if elem.length != 5\n\n kv_map = { id: elem[0], prev_hash: elem[1], transactions: elem[2], time_stamp: elem[3], hash: elem[4] }\n kv_map.each do |key, val|\n return false if val == ''\n return false if key == ''\n end\n maps.push(kv_map)\n end\n # sneaky way to return without pissing off rubocop\n maps = maps\nend",
"def each\n res = Hash.new {|h, k| h[k] = ''}\n @file.each do |line|\n if line.chomp.empty?\n yield(res)\n res = Hash.new {|h, k| h[k] = ''}\n else\n if m = @line_regexp.match(line)\n res[m[1].downcase] = m[2]\n else \n res[\"body\"] += line.gsub(/\\A\\./, '').gsub(/\\A /, '')\n end\n end\n end\n ensure\n @file.close\n end",
"def key_store\n @key_store ||= begin\n store = {}\n CSV.foreach(@file_name) do |line|\n old_key, new_key = line\n\n store[old_key] = new_key\n end\n store\n end\n end",
"def transform_line(line, index)\n return enum_for(:transform_line, line, index) unless block_given?\n\n identifier = case @row_identifier.to_s\n when 'index'\n index\n when 'uuid'\n SecureRandom.uuid\n end\n\n masked_mappings.each do |klass, klass_mappings|\n fields = mapped_line(line, klass_mappings)\n fields['row_identifier'] = identifier unless identifier.nil?\n next if fields[:skip].to_s == 'true'\n yield(klass, fields, index)\n end\n end",
"def exchange_keys; end",
"def exchange_keys; end",
"def make_decoding_or_key_rows\n hash_of_rows = {}\n i = 0\n hash_of_rows[i += 1] = make_row until i == 12\n hash_of_rows\n end",
"def generate_keys(num)\n num.times.inject({}) do |acc, i| \n key = ::Digest::MD5.hexdigest(i.to_s)\n node = redis.node_for(key).client\n hash_key = \"redis://#{node.host}:#{node.port}/#{node.db}\"\n acc[hash_key] = [] if acc[hash_key].nil?\n acc[hash_key] << key\n acc\n end\n end",
"def entry2hash(entry)\n hash = Hash.new('')\n entry.each_line do |line|\n tag = tag_get(line)\n next if tag == 'XX'\n tag = 'R' if tag =~ /^R./\t# Reference lines\n hash[tag] += line\n end\n return hash\n end",
"def construct_hash(path, line)\n host = Socket.gethostname\n \n {\n :source_path => path,\n :line => line,\n :source_host => host,\n :timestamp => Time.now.utc.iso8601(6),\n :source => Addressable::URI.new(:scheme => 'file', :host => host, :path => path),\n :type => '',\n :fields => {},\n :tags => []\n }\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 transform!(pallet)\n @key_transforms.each do |keytrans_item|\n # Enable early termination of transforms for a key\n # by wrapping execution in a catch block.\n catch do |abort_tag|\n key, transforms = keytrans_item.flatten\n context = {\n pallet: pallet,\n key: key,\n value: pallet[key, shallow: true],\n abort: abort_tag\n }\n\n transforms.each do |t|\n transform, param = t.flatten\n if self.respond_to?(transform.to_sym)\n if new_value = self.send(transform.to_sym, param, context)\n new_value = TraceableString.new(new_value)\n new_value.file = transform.file\n new_value.line = transform.line\n new_value.column = transform.column\n new_value.byte = transform.byte\n pallet[key] = new_value\n break\n end\n end\n end\n end\n end\n @hash\n end",
"def process_mapline(line,zoneid,node_id, map)\n offset = 0\n length = 6\n lineLength = line.length\n map[zoneid] = Hash.new\n count = 0\n while offset < lineLength\n x = \"#{line[offset,2]}.#{line[offset+2,1]}\"\n y = \"#{line[offset+3,2]}.#{line[offset+5,1]}\"\n offset = offset + 6\n map[zoneid][gather_coords(x.to_f,y.to_f)] = node_id\n count +=1\n end\n return count\nend",
"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 each_key\n keys.sort.each {|key| yield key}\n end",
"def each_key_unsorted\n @records.each {|k,v| yield k}\n end",
"def convert(lines, keys)\n array = Array.new\n \n lines.each do |line|\n zipped = keys.zip(line)\n \n # Filter value (Integer, Boolean, \"\" for nil, or String#strip)\n for pair in zipped\n value = pair.pop \n pair << filter(value)\n end\n \n array << Hash[zipped]\n end\n\n return array\n end",
"def uniqueSequences file\n\n seqIDs = {}\n printSeq = 1\n File.open(file,\"r\") do |f|\n while l = f.gets\n if l[0] == \">\"\n key = l.split(\"\\n\")[0].split(\" \")[0]\n if seqIDs.has_key? key\n printSeq = 0\n else\n seqIDs[\"#{key}\"] = 0\n printSeq = 1\n puts l\n end\n elsif printSeq == 1\n puts l\n end\n end\n end\n\n end",
"def _lex_trans_keys; end",
"def _lex_trans_keys; end",
"def _lex_trans_keys; end",
"def _lex_trans_keys; end",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend",
"def doing_phrase_lines\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 = line.to_textual.de_comma\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 sequence_lense = \"\"\n description = \"\"\n reference = \"\"\n anagram = 0\n name = 0\n phrase = 1\n research = 0\n external = 0\n internal = 0\n created_at = \"2011-12-12 12:12:00\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{sequence_lense}\\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 raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end",
"def organizeData data_filename\n if validFile? data_filename\n else\n Logger.instance.logError(\"The file \" + data_filename + \" is invalid.\")\n raise ArgumentError, \"The file is invalid. Make sure the file exists and is readable\"\n end\n\n data_file = File.open(data_filename)\n\n data_hash = Hash.new\n data_arr = []\n $result_hash = Hash.new\n\n data_file.each do |segment|\n value = segment.split(\"\\t\") # tab is our delimeter\n if value.size != 3\n Logger.instance.logError(\"The segment \" + segment + \" is not in the format [lat] [long] [streetname] delimited by tabs.\")\n else\n if float?(value[0]) and float?(value[1])\n data_hash[Coordinate.new(value[0],value[1])] = value[2].chomp\n else\n Logger.instance.logError(\"Either \" + value[0] + \" or \" + value[1] + \" is not a float.\")\n end\n end\n end\n\n data_file.close\n\n sorted_data = data_hash.sort{|a,b| a[0] <=> b[0]}\n \n cur_coo = Coordinate.new\n sorted_data << [cur_coo,\"END\"] # a special marker at the end so we know we have looked at all the elements\n \n sorted_data.each do |coo|\n if coo[0] != cur_coo\n if data_arr.size > 1\n combo = data_arr.combination(2).to_a # get all possible pairs\n combo.each do |s1,s2|\n if s1 < s2\n key = s1.capitalize + \"_\" + s2.capitalize # capitalize for case-insensitive search\n Logger.instance.log(\"Added key \" + key)\n elsif s2 < s1\n key = s2.capitalize + \"_\" + s1.capitalize\n Logger.instance.log(\"Added key \" + key)\n else\n next\n end\n if $result_hash.has_key? key\n a = $result_hash[key]\n $result_hash[key] << cur_coo if !a.index cur_coo\n else\n $result_hash[key] = [cur_coo]\n end\n end\n end\n data_arr.clear\n data_arr << coo[1]\n cur_coo = coo[0]\n else\n data_arr << coo[1]\n end\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 fill_hash_record_from_line(column_names, headers, line)\n hash_record = {}\n fields = line.split(@sep)\n\n fields.each_with_index do |field, field_id|\n hash_record[headers[field_id]] = field if column_names.include?(headers[field_id])\n end\n\n hash_record\n end",
"def print_lines\n\ti = 2\n$mon_hash.each {|key, value|\n$ws[i, 1] = key\n$ws[i, 2] = value\ni+=1\n}\n$ws.save\nend",
"def add_all\n outputhash = Hash.new\n\n # Count up all values\n @output.each do |key, value|\n count = 0\n value.each{|k,v| count+= v}\n outputhash[key] = count\n end\n\n keeparr = Array.new\n outputhash.sort_by{|k, v| v}.reverse[0..@keys_to_format].each{|i| keeparr.push(i[0])}\n @output = @output.keep_if{|k, v| keeparr.include?(k)}\n end",
"def insert_from_line( line )\n begin\n row = line.chomp.parse_csv\n @cached << record( row )\n rescue\n print '#'\n end\n\n flush_inserts if @cached.size >= CACHE_SIZE\n end",
"def transform_keys!\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def processLine (docNumber, line)\n line = line.to_s\n # Cleans line of white space\n line.chomp!\n #checks for punctuation and numbers\n line.gsub!($remove_punctuation, '')\n line.gsub!($numbers, \"\")\n line.gsub!(/-/, ' ')\n line.downcase!\n #splits the line into words\n words = line.split(' ').to_a\n # Handles each word\n words.each do |word|\n # Check if in hash\n if $index.has_key? word\n if $index[word].has_key? docNumber\n $index[word][docNumber] += 1\n else\n $index[word][docNumber] = 1\n end\n # Make new internal hash\n else\n $index[word] = Hash.new\n $index[word][docNumber] = 1\n end\n end\nend",
"def deep_transform_keys!(&block); end",
"def fastq_to_fasta(fastq_file)\n count = 0\n sequence_a = []\n count_seq = 0\n\n File.open(fastq_file,'r') do |file|\n file.readlines.collect do |line|\n count +=1\n count_m = count % 4\n if count_m == 1\n line.tr!('@','>')\n sequence_a << line.chomp\n count_seq += 1\n elsif count_m == 2\n sequence_a << line.chomp\n end\n end\n end\n sequence_hash = Hash[*sequence_a]\nend",
"def each\n parsed_line = \"\"\n @lines.each do |line|\n parsed_line += line\n if parsed_line.count('\"') % 2 == 0\n yield create_row(parsed_line)\n parsed_line = \"\"\n end\n end\n end",
"def hashNQS()\n @hash_nqs={}\n nqsReader=File.open(@nqsFile,\"r\")\n nqsReader.each do |line|\n cols=line.split(/\\s+/)\n \n name=cols[0]\n next if name==\"readName\"\n length=cols[1]\n dist=cols[2]\n qual=cols[3].to_i\n pass=cols[4]\n \n str_result=length+'.'+pass\n str=name+'.'+dist\n if @hash_nqs[str]==nil\n @hash_nqs[str]=str_result\n end\n end\n nqsReader.close\n $stderr.puts @hash_nqs.size\nend",
"def hash\n swap\n scatter\n completed_string\n end",
"def combine_with_keystream(message, &combiner)\n prepared = prepare(message)\n \n keystream_generator.reset!\n processed = \"\"\n prepared.each_char do |c|\n if c =~ /[A-Z]/\n keystream_letter = keystream_generator.generate_letter \n processed << combiner.call(c.ord, keystream_letter.ord)\n else\n processed << c\n end\n end\n\n processed\n end",
"def key_splitter(lines)\n lines[0].split(\"\\t\")\n end",
"def concordance(infile_name)\n @hash.clear\n line_number = 1\n File.readlines(infile_name).each do |line|\n words = wordify line\n word_number = 1\n words.each do |word|\n @hash[word] = [] if @hash[word].nil?\n @hash[word] << ConcordanceTuple.new(line_number, word_number)\n word_number += 1\n end\n line_number += 1\n end\n end",
"def process(row)\n if row\n @surrogate_key += 1\n row[destination] = @surrogate_key\n row\n end\n end",
"def dump_line(sea_dir, bams, stats)\n line = {}\n line[:name] = sea_dir.split(\"/\")[-1]\n line[:start] = Helpers::start_end_time_output(sea_dir).split(\",\")[0]\n line[:end] = Helpers::start_end_time_output(sea_dir).split(\",\")[1]\n line[:ref] = Helpers::gather_meta_data(sea_dir).split(\",\")[0]\n line[:bfast] = Helpers::gather_meta_data(sea_dir).split(\",\")[1]\n line[:picard] = Helpers::gather_meta_data(sea_dir).split(\",\")[2]\n line[:mode] = Helpers::gather_meta_data(sea_dir).split(\",\")[3]\n line[:gatk] = Helpers::gather_meta_data(sea_dir).split(\",\")[4]\n line[:bam_path] = bams[0]\n tags = stats.size == 4 ? [ \"F3\" ] : [ \"F3\", \"R3\" ]\n tags.each do |tag|\n KEYS_PER_TAG.each do |k|\n key = k.gsub(/XX/, tag)\n if stats[key].nil?\n return \"I cannot find key: #{key}, n_keys: #{stats.size}. Bye.\"\n end\n line[key] = stats[key].gsub(/,/,\"\")\n end\n end\n line\nend",
"def process_phrase_line\n file_name = \"./tmp/database_doings/doing_phrases/phrases_sorted.txt\"\n open(file_name) do |f|\n f.each do |line|\n sequence_text = line.to_textual.de_comma \n sequence_creation = line.to_textual.de_comma.de_space\n sequence_complete = line.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 = \"meanings in nameings\"\n reference = \"code moniker in sequencer app\"\n anagram = 0\n name = 0\n phrase = 1\n research = 0\n external = 0\n internal = 0\n p \"#{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 end\n end\n end",
"def process_lines(io)\n counter = 0\n io.each_line do |line|\n yield @redis, line\n counter = counter + 1\n end\n return counter \n end",
"def modify_keys\n each_with_object self.class.new do |hash_pair, hsh|\n hsh[ yield( hash_pair ) ] = self[ hash_pair[0] ]\n end\n end",
"def line_cache; end",
"def insert_keys(keys, subtree)\n keys.each do |clef|\n key = REXML::Element.new('key')\n subtree << key\n\n path = REXML::Element.new('path')\n path.add_text(clef.path)\n key << path\n end\n end",
"def kv_encode(h); h.map {|k,v| k.to_s + \":\" + v.to_s + 10.chr }.join end",
"def index!(words)\n ### FILL IN YOUR CODE HERE\n @line += 1\n if words == nil\n else\n words.each { |word|\n if !@hash[word].include?(@line)\n @hash[word].push(@line)\n else\n\n end\n }\n end\n end",
"def generate()\n\t\t\t@out = []\n\t\t\t@context = []\n\n\t\t\ttrim_nil_lines\n\n\t\t\[email protected]_with_index do |line, i|\n\t\t\t\twrite_with_context(line.line, line.context, next_context(i))\n\t\t\tend\n\t\t\twrite_with_context(nil, [], [])\n\t\t\treturn @out.join\n\t\tend",
"def tag_processed(hash, keys) \n # Generate a flat md5 of the keys in question\n md5 = generate_md5(hash, keys)\n $logger.info \"MD5 Generated: #{md5}\"\n previous = redis.getset(md5, 1).to_i\n $logger.info \"Previous Redis Value: #{previous}\"\n # Set the TTL on the key\n redis.expire(md5, @ttl)\n previous\n end",
"def key_map\r\n hash = {}\r\n hash['to'] = self.to\r\n hash['from'] = self.from\r\n hash['content'] = self.content\r\n hash\r\n end",
"def _lex_key_spans; end",
"def _lex_key_spans; end",
"def _lex_key_spans; end",
"def _lex_key_spans; end",
"def process_fna(fna_file)\n fna_hash = Hash.new\n input = File.new(fna_file,'r')\n first_loop = true\n dna_seq = \"\"\n id = \"\"\n count = 0\n while(line = input.gets)\n if(line[0..0] == '>')\n if(first_loop == false)\n fna_hash[id] = dna_seq\n end\n position=line.split(\"|\")\n id = position[3][0..-3]\n dna_seq = \"\"\n first_loop = false\n else\n count = count+1\n dna_seq.concat(line[0..-2])\n end\n end\n fna_hash[id] = dna_seq\n return(fna_hash)\nend",
"def load_pubkey\n #filter line data\n load_raw_line([:key_data,:key_type,:note]) \n \n # sanitize old raw line\n self.raw_line = self.gen_raw_line\n end",
"def each_line_with_index\n c = 0\n each_line do |l|\n yield l, c\n c += 1\n end\n end",
"def handle_add_line_to_value(line, t, values)\n if values[t] == nil\n values[t] = Generator.new(line)\n else\n values[t].append_value(line)\n end\n return values\n end",
"def mark_key\n return nil if SCORE.key.nil? || SCORE.key == \"C\"\n data_key = LINote::TONALITES[SCORE.key]\n \"\\t\\\\key #{data_key['llp']} \\\\major\"\n end",
"def handle_add_line_to_values(line, values, open_tags)\n line.match(OPEN_TAG)\n open_tags.each do |t|\n next if t == $1\n if values[t] == nil\n values[t] = line\n else\n values[t] += line\n end\n end\n return values\n end",
"def insert_line (json, gd_id)\n json.default = [];\n\n # Get the oclc value, look up a str_id for it and write to oclc load file together with the gd_id and marc_field.\n json['oclc'].each do |oclc|\n marc_field = oclc.keys.first;\n val = oclc[marc_field].to_s;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['oclc'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n # Get the sudoc value, look up a str_id for it and write to sudoc load file together with the gd_id and marc_field.\n json['sudoc'].each do |sudoc|\n marc_field = sudoc.keys.first;\n val = HTPH::Hathinormalize.sudoc(sudoc[marc_field].to_s);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['sudoc'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n # ... and so on for isbn, issn, lccn, title, enumc, pubdate and publisher.\n json['isbn'].each do |isbn|\n marc_field = isbn.keys.first;\n val = isbn[marc_field].to_s;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['isbn'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['issn'].each do |issn|\n marc_field = issn.keys.first;\n val = issn[marc_field].to_s;\n next if val.empty?;\n next if val == '1'; # Common crud. Perhaps no longer.\n\n str_id = get_str_id(val);\n @loadfiles['issn'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['lccn'].each do |lccn|\n marc_field = lccn.keys.first;\n val = lccn[marc_field].to_s;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['lccn'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['title'].each do |title|\n marc_field = title.keys.first;\n val = HTPH::Hathinormalize.title(title[marc_field]);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['title'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['enumc'].each do |enumc|\n marc_field = enumc.keys.first;\n val = HTPH::Hathinormalize.enumc(enumc[marc_field]);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['enumc'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['pubdate'].each do |pubdate|\n marc_field = pubdate.keys.first;\n val = pubdate[marc_field].to_s;\n # Date normalization?\n next if val.nil?\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['pubdate'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['publisher'].each do |publisher|\n marc_field = publisher.keys.first;\n val = HTPH::Hathinormalize.agency(publisher[marc_field]);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['publisher'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\nend",
"def build_key(h)\n keys.inject('') {|acc, key| acc = \"#{acc}\\x01#{h[key]}\"}[1..-1]\n end",
"def readRaw\n puts \"Reading raw data..\"\n # data = {uid => {iid => [hour1, hour2, ...]}}}\n data = {}\n while line = $stdin.gets do\n uid, iid, hour = line.chomp.split(',').map {|e| e.to_i}\n data[uid] = {} unless data.key?(uid)\n data[uid][iid] = [] unless data[uid].key?(iid)\n data[uid][iid] += [hour]\n end\n data.each_pair do |u, ihs|\n ihs.each_key {|i| ihs[i].uniq.sort}\n end\n return data\nend"
] |
[
"0.63806945",
"0.6258037",
"0.5987613",
"0.5751157",
"0.56689036",
"0.5575979",
"0.5573288",
"0.55653423",
"0.5522806",
"0.5427221",
"0.54171056",
"0.5382973",
"0.53793085",
"0.5358747",
"0.5358154",
"0.53499544",
"0.52597004",
"0.5239695",
"0.5228768",
"0.52137387",
"0.52075994",
"0.5170601",
"0.51513875",
"0.51440245",
"0.5142593",
"0.5136815",
"0.5116386",
"0.510071",
"0.5094658",
"0.5064776",
"0.5049436",
"0.50408167",
"0.5040042",
"0.5038754",
"0.5034478",
"0.5028431",
"0.5014183",
"0.50104874",
"0.5000759",
"0.5000759",
"0.49901158",
"0.49822307",
"0.4980597",
"0.49791214",
"0.49755877",
"0.49693385",
"0.49657568",
"0.49648634",
"0.49596995",
"0.49592683",
"0.49459907",
"0.4937326",
"0.49159327",
"0.49159327",
"0.49159327",
"0.49159327",
"0.49096963",
"0.49096963",
"0.49070016",
"0.49033117",
"0.48964652",
"0.48961452",
"0.48926878",
"0.48910573",
"0.48598814",
"0.48569876",
"0.48482668",
"0.4848122",
"0.48418617",
"0.48398328",
"0.48217514",
"0.4819502",
"0.4815626",
"0.48150998",
"0.48134148",
"0.48118636",
"0.48099953",
"0.48029372",
"0.4800307",
"0.47853795",
"0.47825387",
"0.4770276",
"0.47673368",
"0.47671595",
"0.47610477",
"0.4753153",
"0.47492942",
"0.47456503",
"0.47456503",
"0.47456503",
"0.47456503",
"0.4740164",
"0.4736879",
"0.4732532",
"0.47318396",
"0.4728923",
"0.4727761",
"0.47274566",
"0.47269928",
"0.4726687"
] |
0.66406846
|
0
|
Detects whether this application is suitable for autoreconfiguration
|
def detect
@version ? id(@version) : nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def config\n mode == \"autoinst_config\"\n end",
"def detect\n @auto_reconfiguration_version, @auto_reconfiguration_uri = SpringAutoReconfiguration.find_auto_reconfiguration(@app_dir, @configuration)\n @auto_reconfiguration_version ? id(@auto_reconfiguration_version) : nil\n end",
"def autorestart\n return nil unless @property_hash.has_key? 'autorestart'\n return nil unless @property_hash['autorestart'] == '0' || @property_hash['autorestart'] == '1'\n \n @property_hash['autorestart'] == '1' ? :true : :false\n end",
"def config_tool_needed?\n false\n end",
"def auto_instrument?\n !Contrib::Rails::Utils.railtie_supported?\n end",
"def auto_instrument?\n !Contrib::Rails::Utils.railtie_supported?\n end",
"def requires_manual_intervention?\n false\n end",
"def autosign?\n auto = Puppet[:autosign]\n return false if ['false', false].include?(auto)\n return true if ['true', true].include?(auto)\n\n raise ArgumentError, \"The autosign configuration '%s' must be a fully qualified file\" % auto unless auto =~ /^\\//\n if FileTest.exist?(auto)\n return auto\n else\n return false\n end\n end",
"def needs_customization?\n return false\n end",
"def configure_early?\n true\n end",
"def should_build?\n config.auto_build && !dev_server_running?\n end",
"def app_configured?; end",
"def agent_should_start?\n return false if already_started? || disabled?\n\n if defer_for_delayed_job?\n ::NewRelic::Agent.logger.debug('Deferring startup for DelayedJob')\n return false\n end\n\n if defer_for_resque?\n ::NewRelic::Agent.logger.debug('Deferring startup for Resque in case it daemonizes')\n return false\n end\n\n unless app_name_configured?\n NewRelic::Agent.logger.error('No application name configured.',\n 'The Agent cannot start without at least one. Please check your ',\n 'newrelic.yml and ensure that it is valid and has at least one ',\n \"value set for app_name in the #{NewRelic::Control.instance.env} \",\n 'environment.')\n return false\n end\n\n return true\n end",
"def installed?\n false\n end",
"def backup_minister_installed?\n software_installed?(APP_NAME)\n end",
"def supports?\n web_inf? && !JavaBuildpack::Util::JavaMainUtils.main_class(@application)\n end",
"def auto_instrument?\n !Datadog::Contrib::Rails::Utils.railtie_supported?\n end",
"def check_configure\n apply_task_params(true)\n enable_variants\n unless Cache.instance[\"configuration_data\"][\"configured\"]\n if @script.autoconf\n configure\n end\n end\n end",
"def app_starting?\n @launching\n end",
"def just_set_up?\n AppConfig[:just_set_up] == true\n end",
"def rakeAppAndRvm\n\t\t\t(rakeApp? && rvm?)\n\t\tend",
"def needs_rebundle?\n # Right now compression is the only option that requires rebundling\n @options_hash != options_hash.hash\n end",
"def auto_registration?\n false\n end",
"def configured?\n true\n end",
"def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end",
"def configured?; false; end",
"def app_name_configured?\n names = Agent.config[:app_name]\n return names.respond_to?(:any?) && names.any?\n end",
"def isautoboot\n\n\t\tif !exists?\n\t\t\tcase resource[:ensure]\n\t\t\t\twhen :absent then return #do nothing\n\t\t\t\twhen :running then install(true)\n\t\t\t\telse install(false)\n\t\t\tend\n\t\tend\n\t\n\t\treturn dom.autostart.to_s\n\n\tend",
"def installer?\n @kind == :installer\n end",
"def first_run?\n not File.exists? '/boot/config/.boxcar'\n end",
"def auto_config? name\n return auto_config[name] if !auto_config[name].nil?\n end",
"def bootstrapped?\n raise \"Invalid Bootstrapper\"\n end",
"def env_already_loaded?\n defined? Rails\n end",
"def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end",
"def code_reloading?\n !!CODE_RELOADING[environment] # rubocop:disable Style/DoubleNegation\n end",
"def should_load?\n test_framework? || trace_observer_configured?\n end",
"def installer_AdobeUberInstaller?\n installer_type == \"AdobeUberInstaller\"\n end",
"def suitable?\n false\n end",
"def suitable?\n false\n end",
"def agent_should_start?\n !blacklisted_constants? &&\n !blacklisted_executables? &&\n !in_blacklisted_rake_task?\n end",
"def can_post_install?\n return false unless has_os?\n\n ![\"vmware_esxi\", \"hyperv\", \"suse11\", \"suse12\"].include?(os_image_type.downcase)\n end",
"def has_installer?\n !installer_path.nil?\n end",
"def check_install?\n @default_options[ :check_install ]\n end",
"def auto_start?\n autostart\n end",
"def installable?\n uninstallable_reasons.empty?\n end",
"def system_load_ok?\n true\n end",
"def ready?\n # In test, we're always ready :-)\n return true if ENV['INSTANA_GEM_TEST']\n\n @state == :announced\n end",
"def needed_if_relevant?\n false\n end",
"def assert_usable_configuration!\n if Rails.version > \"3.1.0\" && !Rails.application.config.assets.initialize_on_precompile \n raise(\"Cannot precompile js-routes unless environment is initialized. Please set config.assets.initialize_on_precompile to true.\")\n end\n true\n end",
"def already_configured?\n return unless File.exist?('.config.fgi.yml')\n puts 'There is already a FGI config on this project.'\n exit!\n end",
"def activated?\n loaded = Gem.loaded_specs[name]\n loaded && loaded.version == version\n end",
"def live_installation\n mode == \"live_installation\"\n end",
"def installation\n mode == \"installation\" || mode == \"autoinstallation\" ||\n mode == \"live_installation\"\n end",
"def pending_configuration_changes?\n return true if context.restart_required?\n return false if self.context_only\n (context.exec('_get-restart-required', [], :terse => true, :echo => false) =~ /^true$/)\n end",
"def check_apps\n flag = false\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n begin\n\t\tFile.open(Conf,'r').each do |filename|\n\t\t filename.chomp!\n\t\n\t\t\t# Skip this app if we were provided with a filepath argument, and this\n\t\t\t# app doesn't match it.\n\t\n\t next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tflag = true if (ps.cmdline =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tps_out.each do |line|\n\t\t\t\t\tflag = true if (line =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n rescue Exception\n raise $!\n end\n\n if (flag)\n raise \"Iowa application(s) are already running; can not start application(s).\"\n end\nend",
"def needed_if_relevant?\n false\n end",
"def activated?\n @activated ||=\n begin\n loaded = Gem.loaded_specs[name]\n loaded && loaded.version == version\n end\n end",
"def is?(application)\n JavaBuildpack::Util::JavaMainUtils.manifest(application).key?(SPRING_BOOT_VERSION) ||\n @jar_finder.is?(application)\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 without_autobuild?\n Threaded.executing?(:without_autobuild)\n end",
"def _reload_libs?\n defined? RELOAD_LIBS\n end",
"def loadable?\n %w(test development).include?(Rails.env) || !loaded?\n end",
"def watchman_trigger_installed?\n watchman_triggers.any?{|trigger| trigger['name'] == 'trigger_rebuild'}\nend",
"def _reload_libs?\n defined? RELOAD_LIBS\n end",
"def configuration?\n get_mode.to_s.include?('config')\n end",
"def configured?\n @configuration != nil\n end",
"def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end",
"def installer_package?\n installer_type.blank?\n end",
"def application?\n gem_dir\n end",
"def application?\n gem_dir\n end",
"def needs_manifest?\n needs_external_csv? || enabled_questionings.any?(&:media_prompt?)\n end",
"def static_boot_eligible?\n provider.static_boot_eligible?\n end",
"def autorun?\n fail NotImplementedError\n end",
"def needed?\n return true if snapshot? && File.exist?(name) && (update_snapshot? || old?)\n super\n end",
"def installer_appdmg?\n installer_type == \"appdmg\"\n end",
"def has_early_replacement_assets?\n sogr? && !notional? && !assets.early_replacement.empty?\n end",
"def candidates_exist_for_all_forced_changes?\n forced_packages_missing_candidates.empty?\n end",
"def package_manager\n false\n end",
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def ready?\n\t\t$stderr.puts \"#{@name}: ready? not overridden!\"\n\tend",
"def tooling?\n true\n end",
"def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end",
"def haveBootstrapped?\n self.class.loadChefLib\n MU.log \"Chef config\", MU::DEBUG, details: ::Chef::Config.inspect\n nodelist = ::Chef::Node.list()\n nodelist.has_key?(@server.mu_name)\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 candidates_exist_for_all_uninstalled?\n packages_missing_candidates.empty?\n end",
"def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end",
"def setup?\n @setup\n end",
"def have_exact_prebuild_cache?\n\n # check if need build frameworks\n return false if local_manifest == nil\n \n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n needed = (added + changed + deleted + missing)\n \n return needed.empty?\n end",
"def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend",
"def autoload\n false\n end",
"def need_backup_setup?\n backup_sources.active.empty?\n end",
"def standalone?\n not $SLICED_APP\n end",
"def standalone?\n not $SLICED_APP\n end",
"def installed?\n case @spec\n when Gem::Resolver::VendorSpecification then\n true\n else\n this_spec = full_spec\n\n Gem::Specification.any? do |s|\n s == this_spec\n end\n end\n end",
"def installed?\n raise NotImplementedError\n end",
"def is_configurable?\n (self.status == 4 or self.status == 6 or self.status == 9) and !self.try(:asset).try(:name).eql?('readme.doc')\n end",
"def verify_configuration\n if options.config_check?\n unless File.exists?(\"#{Rails.root}/config/initializers/cambium.rb\")\n help_message('cambium_prereqs')\n exit\n end\n end\n end",
"def developer?\n config[\"developer\"] == true\n end",
"def auto_gradable?\n actable.present? && actable.self_respond_to?(:auto_gradable?) ? actable.auto_gradable? : false\n end",
"def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end",
"def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end"
] |
[
"0.65026486",
"0.64635855",
"0.6415782",
"0.63724494",
"0.62873393",
"0.62873393",
"0.627237",
"0.6206193",
"0.61715835",
"0.61633694",
"0.6135164",
"0.6128465",
"0.6035531",
"0.6029668",
"0.6028354",
"0.6022398",
"0.6014299",
"0.6008568",
"0.6000775",
"0.5985345",
"0.59755445",
"0.5974563",
"0.59735316",
"0.59600407",
"0.5944142",
"0.59206396",
"0.5917071",
"0.58895594",
"0.58834857",
"0.58780044",
"0.58488464",
"0.58351564",
"0.58293355",
"0.5777276",
"0.5770086",
"0.5748066",
"0.5740327",
"0.57280153",
"0.57280153",
"0.5727839",
"0.5722829",
"0.5709651",
"0.56947696",
"0.56858134",
"0.5677635",
"0.56723905",
"0.5670266",
"0.5661383",
"0.56606627",
"0.5648889",
"0.56427455",
"0.5640898",
"0.5633282",
"0.5624584",
"0.5623992",
"0.5617477",
"0.56158686",
"0.56127036",
"0.5604202",
"0.5598491",
"0.5591859",
"0.55911076",
"0.55884016",
"0.5583821",
"0.5582143",
"0.5581572",
"0.5575441",
"0.55658454",
"0.55645597",
"0.55645597",
"0.55632466",
"0.55632216",
"0.55618787",
"0.5548996",
"0.55373067",
"0.5532696",
"0.55216724",
"0.55186373",
"0.5517292",
"0.55073637",
"0.5488708",
"0.5488355",
"0.5481718",
"0.5476366",
"0.5475426",
"0.5470573",
"0.54703236",
"0.5465591",
"0.54641396",
"0.54640734",
"0.54604673",
"0.5458794",
"0.5458794",
"0.545695",
"0.5456945",
"0.5456524",
"0.54529333",
"0.54499966",
"0.5449027",
"0.54462165",
"0.5445564"
] |
0.0
|
-1
|
Downloads the Autoreconfiguration JAR
|
def compile
JavaBuildpack::Util.download(@version, @uri, 'Auto Reconfiguration', jar_name(@version), @lib_directory)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def perform_download_configuration!\n find_nginx!\n if not @nginx_conf\n error \"Could not find the NginX configuration file in #{y(@nginx_conf)}\"\n exit\n end\n \n local_nginx_dir = File.join(local.gitpusshuten_dir, 'nginx')\n FileUtils.mkdir_p(local_nginx_dir)\n Spinner.return :message => \"Downloading NginX configuration file to #{y(local_nginx_dir)}..\" do\n e.scp_as_root(:download, @nginx_conf, local_nginx_dir)\n g('Done!')\n end\n end",
"def download_and_install_agent(dt_home)\n LibertyBuildpack::Util.download_zip(@version, @uri, 'Dynatrace Appmon Agent', dt_home)\n rescue => e\n raise \"Unable to download the Dynatrace Appmon Agent jar. Ensure that the agent jar at #{@uri} is available and accessible. #{e.message}\"\n end",
"def download_driver_http\n File.write(\n @target_path,\n open(@params[:jdbc_driver_jar]).read\n )\n end",
"def download_installer\n puts pe_installer_url\n unless `curl #{pe_installer_url} -o ./file_cache/installers/#{installer_filename}`\n fail \"Error downloading the PE installer\"\n end\n gzip_installer if PRE_RELEASE\nend",
"def autoproj_gemfile_path; File.join(autoproj_install_dir, 'Gemfile') end",
"def extract\n return config.instance_dir if extracted?\n\n jar_file = download\n\n FileUtils.mkdir_p config.instance_dir\n FileUtils.cp jar_file, config.binary_path\n self.extracted_version = config.version\n\n config.instance_dir\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def download_install_insight_agent(dashboard_address, java_home, container_home)\n\n dashboard_agent_uri = dashboard_address + INSIGHT_AGENT_PATH\n dashboard_host = URI(dashboard_address).host\n # print \"-----> Downloading Insight Agent from: #{dashboard_agent_uri}\\n\"\n JavaBuildpack::Util.download('Insight Agent', dashboard_agent_uri, '', INSIGHT_JAR_NAME, DOWNLOAD_DIR)\n installer_jar = DOWNLOAD_DIR + INSIGHT_JAR_NAME\n if File.exists?(installer_jar)\n run_insight_installer(installer_jar, dashboard_host, java_home, container_home)\n else\n print \"-----> Unable to download Insight Agent from: #{dashboard_agent_uri}\\n\"\n end\n\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def compile\n download_start_time = Time.now\n print \"-----> Downloading Spring Boot CLI #{@version} from #{@uri} \"\n\n JavaBuildpack::Util::ApplicationCache.new.get(@uri) do |file| # TODO: Use global cache #50175265\n puts \"(#{(Time.now - download_start_time).duration})\"\n expand(file, @configuration)\n end\n link_classpath_jars\n end",
"def download_jar(jar_name, target_directory = @lib_directory, description = @component_name)\n download(description) { |file| FileUtils.cp file.path, File.join(target_directory, jar_name) }\n end",
"def _load_automatic(&block)\n dir = URI.join(@uri, \"dists/#{@suite}/\")\n\n file = signed_download(URI.join(dir, 'Release'), URI.join(dir, 'Release.gpg'))\n\n release = DebParseRelease.new(@app, dir, file)\n c = Collector.new\n c.run_each(@all_archs.product(@components)) do |ac|\n pinfo = release.download(\"#{ac[1]}/binary-#{ac[0]}/Packages\")\n\n parser = DebPackagesParser.new(@app, @uri, pinfo)\n block.call(parser)\n end\n c.wait_throw\n end",
"def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end",
"def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def download_and_install_agent(jr_home)\n LibertyBuildpack::Util.download_zip(@version, @uri, 'JRebel Agent', jr_home)\n rescue => e\n raise \"Unable to download the JRebel zip. Ensure that the zip at #{@uri} is available and accessible. #{e.message}\"\n end",
"def download_and_install_agent(dynatrace_home)\n LibertyBuildpack::Util.download_zip(@version, @uri, 'Dynatrace OneAgent', dynatrace_home)\n rescue => e\n raise \"Unable to download the Dynatrace OneAgent. Ensure that the agent at #{@uri} is available and accessible. #{e.message}\"\n end",
"def download\n # Turned off ssl verification\n # This should be acceptable because it won't happen on a user's machine, just CI\n\n # define a progress-bar printer\n chunk_size = 1024 * 1024 * 1024\n total_size = 0\n dots = 0\n dot_printer = lambda do |size|\n total_size += size\n needed_dots = (total_size / chunk_size).to_i\n unprinted_dots = needed_dots - dots\n @output.print(\".\" * unprinted_dots) if unprinted_dots.positive?\n dots = needed_dots\n end\n\n URI.open(package_url, ssl_verify_mode: 0, progress_proc: dot_printer) do |url|\n File.open(package_file, 'wb') { |file| file.write(url.read) }\n end\n rescue Net::OpenTimeout, Net::ReadTimeout, OpenURI::HTTPError, URI::InvalidURIError => e\n @output.puts \"\\nArduino force-install failed downloading #{package_url}: #{e}\"\n end",
"def download_build(entry, java_home, version)\n installer = File.join(Dir.tmpdir, \"ibmjava\" + version.to_s + \"-installer\")\n properties = File.join(Dir.tmpdir, \"installer.properties\")\n\n # Create installer properties for silent installation\n file properties do\n content \"INSTALLER_UI=silent\\nUSER_INSTALL_DIR=#{java_home}\\nLICENSE_ACCEPTED=TRUE\\n\"\n action :create\n end\n\n # Download the IBM Java installer from source url to the local machine\n remote_file installer do\n src_url = entry['uri']\n source src_url.to_s\n mode '0755'\n checksum entry['sha256sum']\n action :create\n end\n\n # check_sha(installer, entry['sha256sum'])\n\n # Install IBM Java build\n execute \"#{installer} -i silent -f #{properties}\"\n\n file properties do\n action :delete\n end\n\n file installer do\n action :delete\n end\n end",
"def autoproj_gem_home; @private_autoproj || Gem.user_dir end",
"def package_url\n \"https://github.com/arduino/arduino-cli/releases/download/#{@desired_version}/#{package_file}\"\n end",
"def download_resource(loader, src_url)\n # play nice with remote web servers\n sleep(rand / 100) if src_url =~ /^[[:alpha:]]+:/\n begin\n loader.spec_invoke(:data_source, src_url, nil)\n rescue Exception => e\n # FIXME: log\n $stderr.puts \"[NOKOGIRI] Cannot download resource : #{e.message}\"\n $stderr.puts e.backtrace[0,2].join(\"\\n\")\n nil\n end\n end",
"def fetch_configuration(payload)\n begin\n json = asset_store.get(json_key(payload))\n rescue => e\n warn \"Failed to locate existing repository JSON file: #{e.class}: #{e}\"\n end\n path = File.join(\n working_directory(payload),\n 'repository.json'\n )\n if(json)\n FileUtils.mv(json.path, path)\n else\n File.write(path, '{}')\n end\n path\n end",
"def try_loading_installation_manifest(ws = self.ws)\n Autoproj::InstallationManifest.from_workspace_root(ws.root_dir)\n rescue ConfigError\n end",
"def config_file\n File.join(install_directory,'installer','rails_installer.yml')\n end",
"def download!\n\t\traise_if_error C.glyr_opt_download(to_native, true)\n\tend",
"def download_and_extract_package\n @fetcher.get_package_file(@package_name, @version)\n Gem::Package::TarReader.new( Zlib::GzipReader.open @fetcher.temp_package_file_path ) do |tar|\n tar.each do |entry|\n next unless entry.file? and entry.full_name.match(\"DESCRIPTION\")\n @package_desc = entry.read\n end\n end\n FileUtils.rm_rf @fetcher.temp_package_file_path\n end",
"def download\n api_url = build_url\n RestClient::Request.execute(method: 'GET', url: api_url, open_timeout: 20)\n end",
"def sync\n # source directory already exists? if not then create\n cat_dir = Settings.catalog_dir\n if !File.directory?(cat_dir)\n raise BakerError, \"error in catalog.rb\"\n # File.makedirs(cat_dir)\n end\n local_path = DownloadManager.regional_download(self.catalog_urls, self.local_region, cat_dir, true)\n if !local_path\n raise BakerError, \"Catalog synchronization failed when downloading.\"\n end\n success = DownloadManager.extract(local_path)\n if !success\n puts BakerError, \"Catalog synchronization failed when extracting.\"\n end\n end",
"def download_iso\n IsoRepo.get(iso_url)\n end",
"def artifact_download_url_for(node, source)\n # TODO: Move this method into the nexus-cli\n config = data_bag_config_for(node, source)\n nexus_path = config['path']\n group_id, artifact_id, version, extension, classifier = source.split(':')\n uri_for_url = URI(config['url'])\n builder = uri_for_url.scheme =~ /https/ ? URI::HTTPS : URI::HTTP\n is_content_path_enabled = use_content_path node\n query_string = \"g=#{group_id}&a=#{artifact_id}&v=#{version}&e=#{extension}&r=#{config['repository']}&c=#{classifier}\"\n if is_content_path_enabled\n if version.downcase.include? 'snapshot'\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"#{nexus_path}/service/local/artifact/maven/redirect\", :query => query_string).to_s\n else\n ##\n Chef::Log.info \"g-#{group_id} a-#{artifact_id} v-#{version} e-#{extension} c-#{classifier} repo #{config['repository']} url #{config['url']} path #{config['path']}\"\n gav_path=get_gav_path(group_id, artifact_id, version)\n f_name = get_download_fname(artifact_id, version, classifier, extension)\n if nexus_path ==''\n content_url=\"#{config['repository']}/#{gav_path}/#{f_name}\"\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"/#{content_url}\").to_s\n else\n # remove leading trailing /\n path = nexus_path.gsub(/^\\//, '')\n path = \"#{path.gsub(/\\/$/, '')}/content/repositories/#{config['repository']}\"\n content_path = \"#{path}/#{gav_path}\"\n content_url = \"#{content_path}/#{f_name}\"\n Chef::Log.info \"download url #{content_url}\"\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"/#{content_url}\").to_s\n end\n end\n else\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"#{nexus_path}/service/local/artifact/maven/redirect\", :query => query_string).to_s\n end\n end",
"def download(full_spec, path) # :nodoc:\n end",
"def pkg_binary; \"pacaur\" end",
"def fetch_artifact_zip(download_path, url)\n # rubocop:disable Security/Open\n open(download_path, 'wb') do |file|\n file.print URI.open(url, 'Authorization' => \"token #{ENV['PERSONAL_TOKEN']}\").read\n end\n # rubocop:enable Security/Open\nend",
"def autoloader; end",
"def do_download\n checksum = if new_resource.checksum\n new_resource._?(:checksum, '--checksum=sha-256=').join\n end\n header = if new_resource.header\n \"--header='#{new_resource._?(:header)[1]}'\"\n end\n aria2(checksum, header,\n new_resource._?(:path, '-o'),\n new_resource._?(:directory, '-d'),\n new_resource._?(:split_size, '-s'),\n new_resource._?(:connections, '-x'),\n new_resource._?(:check_cert, '--check-certificate=false'),\n new_resource.source)\n end",
"def buildconf_package\n return @buildconf_package if @buildconf_package\n\n vcs = ws.manifest.main_package_set.vcs.to_hash\n @buildconf_package = Autoproj::Daemon::PackageRepository.new(\n \"main configuration\",\n vcs,\n buildconf: true,\n local_dir: ws.config_dir,\n ws: ws\n )\n end",
"def do_download\n retrier(tries: 10, sleep: ->(n) { 4**n }) { installed?('aria2') }\n cmd = [which('aria2c')] << args.flatten.join(' ')\n Chef::Log.info shell_out!(cmd.flatten.join(' ')).stdout\n end",
"def install_sdk(sdk_url)\n require 'zip'\n sdk_zip_path=File.join(Dir.tmpdir,'sdk.zip')\n if sdk_url.start_with?('file:')\n # require specific file scheme: the path part is \"relative\", or absolute if there are 4 slash\n raise 'use format: file:///<path>' unless sdk_url.start_with?('file:///')\n sdk_zip_path=sdk_url.gsub(%r{^file:///},'')\n else\n redirect_remain=2\n begin\n Aspera::Rest.new(base_url: sdk_url).call(operation: 'GET',save_to_file: sdk_zip_path)\n rescue Aspera::RestCallError => e\n if e.response.is_a?(Net::HTTPRedirection)\n if redirect_remain > 0\n redirect_remain-=1\n sdk_url=e.response['location']\n retry\n else\n raise \"too meny redirect\"\n end\n else\n raise e\n end\n end\n end\n # SDK is organized by architecture\n filter=\"/#{Environment.architecture}/\"\n ascp_path=nil\n # first ensure license file is here so that ascp invokation for version works\n self.path(:aspera_license)\n self.path(:aspera_conf)\n Zip::File.open(sdk_zip_path) do |zip_file|\n zip_file.each do |entry|\n # get only specified arch, but not folder, only files\n if entry.name.include?(filter) and !entry.name.end_with?('/')\n archive_file=File.join(folder_path,File.basename(entry.name))\n File.open(archive_file, 'wb') do |output_stream|\n IO.copy_stream(entry.get_input_stream, output_stream)\n end\n if entry.name.include?('ascp')\n FileUtils.chmod(0755,archive_file)\n ascp_path=archive_file\n end\n end\n end\n end\n File.unlink(sdk_zip_path) rescue nil # Windows may give error\n ascp_version='n/a'\n raise \"error in sdk: no ascp included\" if ascp_path.nil?\n cmd_out=%x{#{ascp_path} -A}\n raise \"An error occured when testing ascp: #{cmd_out}\" unless $? == 0\n # get version from ascp, only after full extract, as windows requires DLLs (SSL/TLS/etc...)\n m=cmd_out.match(/ascp version (.*)/)\n ascp_version=m[1] unless m.nil?\n File.write(File.join(folder_path,PRODUCT_INFO),\"<product><name>IBM Aspera SDK</name><version>#{ascp_version}</version></product>\")\n return ascp_version\n end",
"def AxeDownload(download)\n uri = URI('https://axeweb.intel.com/axe/api/testlist/295/latest/combined')\n puts uri\n req = Net::HTTP::Get.new(uri)\n req.basic_auth 'autoclient', 'gr@ph1c$'\n \n if download\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - Start download\\n\"\n res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|\n http.request(req)\n }\n #puts res.body\n \n unless res.kind_of? Net::HTTPSuccess\n puts \"Error downloading results from Axe\"\n exit(9)\n end\n open('result.json', 'wb') do |fileAXE|\n fileAXE << res.body\n end\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - End download\\n\"\n end\nend",
"def download_path\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(URL))\n end",
"def download_install_file(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/do/#{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.\"\n puts se.message\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n end\n return nil\nend",
"def connectorj_jar\n ::File.basename(new_resource.url, '.tar.gz') + if connectorj_ver.split('.')[0].to_i >= 8\n '.jar'\n else\n '-bin.jar'\n end\n end",
"def jar(name)\n \"https://clojars.org/#{name}\"\n end",
"def bundle_download(app_name, fname, bundle_name=nil)\n\t\tdata = get(\"/apps/#{app_name}/bundles/#{bundle_name || 'latest'}\")\n\t\tFile.open(fname, \"wb\") { |f| f.write data }\n\tend",
"def download\n @config.each do |config|\n download_backup(config[:host],config[:port],config[:user],config[:password],config[:name],config[:path],config[:format])\n end\n return true\n end",
"def download_archive_to_temp\n return @temp_archive_path if !@temp_archive_path.nil?\n\n Chef::Config[:verify_api_cert] = false # FIXME\n Chef::Config[:ssl_verify_mode] = :verify_none # FIXME\n\n rest = Chef::ServerAPI.new(@target, Chef::Config)\n archive = with_http_rescue do\n rest.streaming_request(@target)\n end\n @archive_type = '.tar.gz'\n Inspec::Log.debug(\"Archive stored at temporary location: #{archive.path}\")\n @temp_archive_path = archive.path\n end",
"def archive_download_url\n raise \"Not implemented yet!\"\n end",
"def backup_config_file\n File.join(source_directory,'installer','rails_installer_defaults.yml')\n end",
"def download_build(file)\n temp = Tempfile.new(['gadgets', \"#{file}.rb\"])\n temp.write(url_request(url_of_file(File.join('lib', 'one_gadget', 'builds', \"#{file}.rb\"))))\n temp.tap(&:close)\n end",
"def create_installer(install_file, id)\n puts \"Downloading install file\"\n File.open(install_file, \"w+\"){ |f|\n f.write(download_install_file(\"logicmonitorsetup\", {\"id\" => id.to_s, \"arch\" => get_arch,}))\n }\n puts \"Download complete\"\nend",
"def download\n open(download_url, \"rb\")\n end",
"def load_repo_config; end",
"def download(required_version = :latest)\n required_version = latest if required_version == :latest\n download_file_name = \"selenium-server-#{required_version}.jar\"\n\n return download_file_name if File.exist? download_file_name\n\n begin\n download_location = available_assets[download_file_name]['browser_download_url']\n released = Net::HTTP.get_response(URI.parse(download_location))\n redirected = URI.parse released.header['location']\n\n File.open(download_file_name, 'wb') do |destination|\n download_server(redirected, destination)\n end\n rescue StandardError\n FileUtils.rm_rf download_file_name\n raise\n end\n\n download_file_name\n end",
"def download\n ark_path = ::File.basename(new_resource.path)\n prefix_path = ::File.dirname(new_resource.path)\n\n directory prefix_path do\n action :create\n recursive true\n end\n\n ark ark_path do\n checksum new_resource.checksum\n prefix_home prefix_path\n prefix_root prefix_path\n url new_resource.url\n version new_resource.version\n end\nend",
"def download_strategy\n CurlDownloadStrategy\n end",
"def slave_jar\n ::File.join(Chef::Config[:file_cache_path], 'slave.jar')\n end",
"def _fetch\n curl @url, '-o', @tarball_path\n end",
"def download_file_from_tranche(tranche_hash)\n path_to_download_utility = \"#{Rails.root}/app/tranche/pc-tranche-get.jar\"\n save_location = \"#{Rails.root}/tmp/#{tranche_hash.shell_escape}\"\n command = \"java -jar #{path_to_download_utility} #{tranche_hash} #{save_location}\"\n system(command)\n compress_folder(save_location)\n end",
"def jenkins_download(opts)\n\tputs \"### Downloading jenkins image ###\"\n\trun_in_shell \"docker pull #{opts[:source]}\"\n\tputs \"#################################\"\nend",
"def retrieve_bundle\n VCR.use_cassette('bundle_download') do\n bundle_resource = RestClient::Request.execute(method: :get,\n url: 'https://cypress.healthit.gov/measure_bundles/fixture-bundle-2020.zip',\n user: ENV.fetch('VSAC_USERNAME', nil),\n password: ENV.fetch('VSAC_PASSWORD', nil),\n raw_response: true,\n headers: { accept: :zip })\n\n return bundle_resource.file\n end\n end",
"def download_and_install_features\n server_xml = File.join(current_server_dir, SERVER_XML)\n feature_manager = FeatureManager.new(@app_dir, @java_home, @configuration)\n feature_manager.download_and_install_features(server_xml, liberty_home)\n end",
"def install_jdk\n release = find_openjdk(@configuration)\n uri = release['binaries'][0]['package']['link']\n @version = release['release_name']\n download_start_time = Time.now\n\n print \"-----> Downloading OpenJDK #{@version} from #{uri} \"\n\n LibertyBuildpack::Util::Cache::ApplicationCache.new.get(uri) do |file| # TODO: Use global cache\n puts \"(#{(Time.now - download_start_time).duration})\"\n expand file\n end\n end",
"def download(build, installer_name)\n #delete the installer if there is with the similar name to make sure we are running the correct one\n\tFile.delete(installer_name) if File.exist?(installer_name)\n\traise \"Could not determine the latest build\\n\" if build <= 0 #Expected value is more than zero\n\tdownload_result = `scp [email protected]://opt//ctk//builds//numbered//sequenceL-Root-#{build}/#{$os_name}//installer.run #{installer_name}`\n\traise \"Error! The installer was not downloaded\\n\" unless File.exist?(installer_name)\n\t#error if the installer size is less than 5 MB\n\traise \"The installer is broken!\" unless File.size(installer_name)/(1024*1024) > 5\n\nend",
"def retrieve\n raise RetrieverError.new(\"download retriever is unavailable\") unless available?\n ::FileUtils.remove_entry_secure @repo_dir if File.exists?(@repo_dir)\n ::FileUtils.remove_entry_secure workdir if File.exists?(workdir)\n ::FileUtils.mkdir_p @repo_dir\n ::FileUtils.mkdir_p workdir\n file = ::File.join(workdir, \"package\")\n\n # TEAL FIX: we have to always-download the tarball before we can\n # determine if contents have changed, but afterward we can compare the\n # previous download against the latest downloaded and short-circuit the\n # remaining flow for the no-difference case.\n @logger.operation(:downloading) do\n credential_command = if @repository.first_credential && @repository.second_credential\n ['-u', \"#{@repository.first_credential}:#{@repository.second_credential}\"]\n else\n []\n end\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = [\n 'curl',\n '--silent', '--show-error', '--location', '--fail',\n '--location-trusted', '-o', file, credential_command,\n @repository.url\n ].flatten\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => workdir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, 'curl', e)\n raise\n end\n end\n\n note_tag(file)\n\n @logger.operation(:unpacking) do\n path = @repository.to_url.path\n if path =~ /\\.gz$/\n extraction = \"xzf\"\n elsif path =~ /\\.bz2$/\n extraction = \"xjf\"\n else\n extraction = \"xf\"\n end\n Dir.chdir(@repo_dir) do\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = ['tar', extraction, file]\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => @repo_dir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, @cmd.first, e)\n raise\n end\n end\n end\n true\n end",
"def download(download_dir)\n @downloaded_file = File.join(download_dir,\"label_mapping.tsv.gz\")\n \n @log.info \"Downloading from SIDER to #{@downloaded_file}\" if @log\n system(\"curl -o #{@downloaded_file} -i ftp://sideeffects.embl.de/SIDER/latest/label_mapping.tsv.gz\")\n system(\"gunzip #{@downloaded_file}\")\n \n @file = File.join(download_dir,\"label_mapping.tsv\")\n end",
"def download_ais(prog_id)\n return download_data(\"http://ais.channel4.com/asset/#{prog_id}\")\n end",
"def download_and_unzip(base_url, system_id, filename, save_to_dir)\n download_url = File.join(base_url, system_id, filename)\n LibertyBuildpack::Util.download_zip('3.+', download_url, 'DynamicPULSE Agent', save_to_dir)\n rescue => e\n raise \"[DynamicPULSE] Can't download #{filename} from #{download_url}. Please check dynamicpulse-remote.xml. #{e.message}\"\n end",
"def download_and_unpack_archive(uri, root)\n # all file types filtered here should be handled inside block.\n if uri.end_with?('.tgz', '.tar.gz', '.zip', 'jar')\n if uri.include? '://'\n print \"-----> Downloading from #{uri} ... \"\n else\n filename = File.basename(uri)\n print \"-----> Retrieving #{filename} ... \"\n end\n download_start_time = Time.now\n LibertyBuildpack::Util::Cache::ApplicationCache.new.get(uri) do |file|\n puts \"(#{(Time.now - download_start_time).duration})\"\n install_archive(file, uri, root)\n end\n else\n # shouldn't happen, expect index.yml or component_index.yml to always\n # name files that can be handled here.\n puts \"Unknown file type, not downloaded, at #{uri}\"\n end\n end",
"def download_driver_s3\n bucket_name = @params[:jdbc_driver_jar].match(\n %r{^s3\\://([a-zA-Z0-9]|\\.|\\-)+}i\n )[0].gsub(/s3\\:\\/\\//i, '')\n\n object_key = @params[:jdbc_driver_jar].gsub(\n %r{^s3\\://([a-zA-Z0-9]|\\.|\\-)+\\/}i,\n ''\n )\n\n aws_creds =\n if ENV['AWS_ACCESS_KEY_ID']\n Aws::Credentials.new(\n ENV['AWS_ACCESS_KEY_ID'],\n ENV['AWS_SECRET_ACCESS_KEY']\n )\n else\n Aws::InstanceProfileCredentials.new\n end\n\n s3 = Aws::S3.new(\n region: ENV['AWS_REGION'],\n credentials: aws_creds\n )\n\n s3.get_object(\n response_target: @target_path,\n bucket: bucket_name,\n key: object_key\n )\n end",
"def initialize_reprepro_conf_dir(release_prefix)\n if !@reprepro_lock.owned?\n raise ThreadError.new\n end\n \n conf_dir = File.join(deb_repository, release_prefix, \"conf\")\n if File.exist? conf_dir\n Packager.info \"Reprepo repository exists: #{conf_dir}\"\n else\n Packager.info \"Initializing reprepo repository in #{conf_dir}\"\n system(\"sudo\", \"mkdir\", \"-p\", conf_dir, :close_others => true)\n\n user = Etc.getpwuid(Process.uid).name\n Packager.info \"Set owner #{user} for #{deb_repository}\"\n system(\"sudo\", \"chown\", \"-R\", user, deb_repository, :close_others => true)\n system(\"sudo\", \"chown\", \"-R\", user, deb_repository + \"/\", :close_others => true)\n system(\"sudo\", \"chmod\", \"-R\", \"755\", conf_dir, :close_others => true)\n end\n\n distributions_file = File.join(conf_dir, \"distributions\")\n if !File.exist?(distributions_file)\n File.open(distributions_file,\"w\") do |f|\n Config.linux_distribution_releases.each do |release_name, release|\n f.write(\"Codename: #{release_name}\\n\")\n f.write(\"Architectures: #{Config.architectures.keys.join(\" \")} source\\n\")\n f.write(\"Components: main\\n\")\n f.write(\"UDebComponents: main\\n\")\n f.write(\"Tracking: minimal\\n\")\n f.write(\"Contents:\\n\\n\")\n end\n end\n end\n end",
"def downloadDefaultConfig(solrversion,zkHost,configname, to_dir)\n begin\n Chef::Log.info(\"Remove the directory #{to_dir}.\")\n FileUtils.rm_rf(to_dir)\n solrmajorversion = \"#{solrversion}\"[0,1]\n command = \"#{node['installation_dir_path']}/solr#{solrmajorversion}/server/scripts/cloud-scripts/zkcli.sh -zkhost #{zkHost} -cmd downconfig -confdir #{to_dir} -confname #{configname} 2>&1\"\n Chef::Log.info(\"downloadDefaultConfig command : #{command}\")\n\n result = `#{command}`\n\n # Commented out as in usual scenario the config will be not be there on zookeeper and it will fail\n # if $? != 0\n # puts \"***FAULT:FATAL=#{result}\"\n # e = Exception.new(\"no backtrace\")\n # e.set_backtrace(\"\")\n # raise e\n # end\n\n Chef::Log.info(\"Successfully downloaded config '#{configname}'\")\n rescue Exception => msg\n raise \"Error while downloading zookeeper config : #{msg}\"\n end\n end",
"def downloaded_path\n @downloaded_path ||= File.join(install_path, file_name(url))\n return @downloaded_path\n end",
"def maven_auto_artifact (module_name)\n builder = artifacts_builder\n builder.collect(File.join(build_repository, module_name, \"target\"), /classes/, /test-classes/, /maven-archiver/)\n builder.to_set\nend",
"def download\n if File.exist?\"#{Rails.root}/public/MEAN_Angular_#{current_user.email}.sh\"\n @mean_angular_script = \"MEAN_Angular_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/MEAN_AngularJS_#{current_user.email}.sh\"\n @mean_angularjs_script = \"MEAN_AngularJS_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/Python_Django_#{current_user.email}.sh\"\n @python_django_script = \"Python_Django_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/Ruby_on_Rails_#{current_user.email}.sh\"\n @ruby_on_rails_script = \"Ruby_on_Rails_#{current_user.email}.sh\"\n end\n end",
"def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end",
"def fetch type, version, extension=\"tar.gz\"\n core_url = \"#{@base}/#{type}-#{version}.#{extension}\"\n tmp = Galaxy::Temp.mk_auto_file \"galaxy-download\"\n @log.info \"Fetching #{core_url} into #{tmp}\"\n if @base =~ /^http:/\n begin\n output = Galaxy::HostUtils.system(\"curl -D - #{core_url} -o #{tmp} -s\")\n rescue Galaxy::HostUtils::CommandFailedError => e\n raise \"Failed to download archive #{core_url}: #{e}\"\n end\n status = output.first\n (protocol, response_code, response_message) = status.split\n unless response_code == '200'\n raise \"Failed to download archive #{core_url}: #{status}\"\n end\n else\n open(core_url) do |io|\n File.open(tmp, \"w\") { |f| f.write(io.read) }\n end\n end\n return tmp\n end",
"def bootstrap(project, ref)\n package_url = \"http://builds.delivery.puppetlabs.net/#{project}/#{ref}/artifacts\"\n\n # First fetch the params file\n params_file = \"#{package_url}/#{ref}.yaml\"\n puts \"Fetching params file from '#{params_file}'...\"\n system(\"wget #{params_file}\")\n unless $?.success?\n fail \"Could not download params file '#{params_file}'. Perhaps project or ref were incorrect?\"\n end\n\n data = YAML.load_file(File.basename(params_file))\n\n # Next fetch the signing bundle\n signing_bundle = \"#{data[:project]}-#{data[:version]}-signing_bundle.tar.gz\"\n puts \"Fetching signing bundle from '#{package_url}/#{signing_bundle}'...\"\n system(\"wget #{package_url}/#{signing_bundle}\")\n\n unless $?.success?\n fail \"Could not download signing bundle '#{signing_bundle}'. Perhaps project or ref were incorrect?\"\n end\n\n # Unpack and clone the bundle\n puts \"Unpacking signing bundle...\"\n system(\"tar xf #{signing_bundle}\")\n\n puts \"Cloning signing bundle...\"\n system(\"git clone --recursive #{signing_bundle.gsub('.tar.gz', '')} #{data[:project]}-#{data[:version]}\")\n return [data[:project], data[:version]]\nend",
"def download_fitnesse(path)\n puts \"Downloading fitnesse.jar version #{FITNESSE_VERSION} ...\"\n Dir.chdir(path) do\n `wget --quiet #{FITNESSE_DOWNLOAD} -O fitnesse.jar`\n end\n end",
"def install_launch_agent(config_path, root_dir, time)\n doc = ERB.new(IO.read(\"config/org.danlynn.clamav.plist.erb\")).result(binding)\n File.open(launch_agent_path, 'w') {|f| f.write(doc) }\n `launchctl unload #{launch_agent_path}`\n `launchctl load #{launch_agent_path}`\n puts \"*** REMEMBER: The new LaunchAgent which executes clamav.rb on an interval WON'T activate until you logout then log back into this account!\"\n exit 0\nend",
"def download_sources(url)\n filename = \"v#{version}.tar.gz\"\n cached_sources = File.join(SOURCES_CACHE_DIR, filename)\n\n if CfObsBinaryBuilder::CACHE_SOURCES\n FileUtils.mkdir_p(SOURCES_CACHE_DIR)\n if !File.exist?(cached_sources)\n system(\"wget #{url} -O #{cached_sources}\")\n end\n FileUtils.copy(cached_sources, filename)\n else\n system(\"wget #{url} -O #{filename}\")\n end\n end",
"def cached_installer_path\n \"./file_cache/installers/puppet-enterprise-#{pe_version}-el-7-x86_64.tar.gz\"\nend",
"def download_plugins\n return nil unless download_plugins?\n plugin_downloader = Puppet::Configurer::Downloader.new(\n \"plugin\",\n Puppet[:plugindest],\n Puppet[:pluginsource],\n Puppet[:pluginsignore]\n )\n\n plugin_downloader.evaluate.each { |file| load_plugin(file) }\n end",
"def fetch_file(url)\n url =~ %r{/([^/]*)\\.(tar\\.gz|tar\\.bz2|tgz|zip|tbz)$}\n name = $1\n ext = $2\n filename = \"#{name}.#{ext}\"\n archive = File.join(env.path, \"archives\", filename)\n\n rbvm_md5 = config_md5[filename]\n\n if File.exists?(archive)\n archive_md5 = Digest::MD5.file(archive)\n if rbvm_md5\n if archive_md5.to_s == rbvm_md5\n log(\"Using existing archive for #{filename}.\", \"info\")\n fetch = false\n else\n log(\"Existing archive has bad MD5, backup and download again.\", \"error\")\n FileUtils.mv(archive, File.join(env.path, \"archives\", \"#{filename}-#{Time.now.strftime(\"%Y%m%d%H%M%S\")}.orig\"))\n archive_md5 = nil\n fetch = true\n end\n else\n log(\"Unknown archive: #{archive}\", \"warn\")\n fetch = false\n end\n else\n fetch = true\n end\n\n if fetch\n catch_error(\"Failed to fetch: #{url}\") do\n log(\"#{name} - #fetching\", 'info')\n exec_cmd(\"curl\", \"-s\", \"-S\", \"-L\", \"--create-dirs\", \"-C\", \"-\", \"-o\", archive, url)\n end\n end\n\n return archive\n end",
"def install(autoinst, iso_url)\n prepare\n setup_iso(iso_url)\n setup_autoinst(autoinst)\n setup_definition(:install)\n build(autoinst)\n end",
"def download_and_save_file(url, path)\n options = {}\n\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n if proxy\n uri = URI.parse(proxy)\n proxy_host = uri.scheme + \"://\" + uri.host + \":\" + uri.port.to_s\n proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.userinfo\n options[:proxy_http_basic_authentication] = [proxy_host,proxy_user,proxy_pass]\n end\n\n open_and_save_file(path, open(url, options).read)\nend",
"def download_artifact(path)\n download_file = \"#{name}.#{Time.new.to_i}\"\n begin\n URI.download path, download_file\n if File.exist?(download_file)\n FileUtils.mkdir_p(File.dirname(name))\n FileUtils.mv(download_file, name)\n end\n ensure\n File.delete(download_file) if File.exist?(download_file)\n end\n end",
"def get_artifact(job_name,filename)\n @artifact = job.find_artifact(job_name)\n response = make_http_request(Net::HTTP::Get.new(@artifact))\n if response.code == \"200\"\n File.write(File.expand_path(filename), response.body)\n else\n raise \"Couldn't get the artifact\"\n end\n end",
"def download_external_best_bets\n\tunless ENV['FUNNELBACK_PASSWORD']\n\t\tabort('The FUNNELBACK_PASSWORD enviornment variable is not set')\n\tend\n\tbegin\n\t\thttp = Net::HTTP.new(ENV['FUNNELBACK_DOMAIN'],ENV['FUNNELBACK_PORT'])\n\t\treq = Net::HTTP::Get.new(\"/search/admin/download-conf.cgi?collection=website&f=best_bets.cfg&dir=profile-folder-_default_preview\")\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\treq.basic_auth ENV['FUNNELBACK_USERNAME'], ENV['FUNNELBACK_PASSWORD']\n\t\tresponse = http.request(req)\n\trescue\n \terb :loaderror\n else\n\t \topen(\"data/best-bets-external.txt\", \"wb\") { |file|\n \tfile.write(response.body)\n \t}\n end\nend",
"def install\n libexec.install \"phyutility.jar\"\n bin.write_jar_script libexec/\"phyutility.jar\", \"phyutility\"\n pkgshare.install \"examples\", \"manual.pdf\"\n end",
"def download_slideshow\n Down.download bucket_url.url\n end",
"def download(url, download_to=File.expand_path(\".\")+File::SEPARATOR)\n $LOG.info \" Starting download of fillings from SEC url [\"+url+\"]\"\n files=[]\n content = open(url).read\n @links = Set.new\n uri=URI(url)\n @base_path=\"\"\n @base_path=(uri.scheme+\"://\"+uri.host+((uri.port==80 && \"\") || \":\"+uri.port.to_s)) unless uri.host.nil?\n parse(content)\n download_to += File::SEPARATOR unless download_to.end_with?(File::SEPARATOR)\n mkdir(download_to)\n @links.each do |link|\n file=download_to + link.split(\"/\")[-1]\n dump_to_file(file, open(link).read)\n files << file\n end unless uri.host.nil?\n files\n end",
"def datadir\n prefix/\"cocoapods-cache-proxy-server\"\n end",
"def reference_book_configurations()\n return Rails.cache.fetch(\"odsa_reference_book_configs\", expires_in: 6.hours) do\n config_dir = File.join(\"public\", \"OpenDSA\", \"config\")\n base_url = request.protocol + request.host_with_port + \"/OpenDSA/config/\"\n configs = []\n Dir.foreach(config_dir) do |entry|\n if entry.include?(\"_generated.json\") or not File.extname(entry) == '.json'\n next\n end\n url = base_url + File.basename(entry)\n begin\n title = JSON.parse(File.read(File.join(config_dir, entry)))[\"title\"]\n configs << {\n title: title,\n name: File.basename(entry, '.json'),\n url: url,\n }\n rescue\n error = Error.new(:class_name => 'book_config_parse_fail',\n :message => \"Failed to parse #{entry}\")\n error.save!\n end\n end\n configs.sort_by! { |x| x[:title] }\n end\n end",
"def load_config()\n @config = get_xml(@xml_api_config_path)\n @config_doc = REXML::Document.new(@config)\n \n @config_doc = REXML::Document.new(@config)\n if !@config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].nil?\n @repository_url = @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text || \"\"\n end\n @repository_urls = []\n if !@config_doc.elements[\"/project/scm/locations\"].nil?\n @config_doc.elements.each(\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation\"){|e| @repository_urls << e.elements[\"remote\"].text }\n end\n if !@config_doc.elements[\"/project/scm/browser/location\"].nil?\n @repository_browser_location = @config_doc.elements[\"/project/scm/browser/location\"].text\n end\n if !@config_doc.elements[\"/project/description\"].nil?\n @description = @config_doc.elements[\"/project/description\"].text || \"\"\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 download(description = @component_name, &block)\n super_download @version, @uri, description, &block\n end",
"def download_wordpress\n package = \"/tmp/wordpress-#{@config[:wp_version]}.zip\"\n # Download package file\n if ::File.exists?(package)\n @task.say_warning \"WordPress is already downloaded...\", false, true\n else ::File.exists?(package)\n @task.say_info \"Downloading WordPress...\", false, true\n\n @task.get \"https://wordpress.org/wordpress-#{@config[:wp_version]}.zip\" do |content|\n @task.create_file package, content\n end\n end\n # Return package file\n package\n end",
"def remote_repository\n \"http://www.aQute.biz/repo\"\n end",
"def download_apigateway_importer(s3_bucket, s3_key)\r\n s3 = Aws::S3::Client.new\r\n\r\n # current version\r\n current_s3_version = File.open(@versionpath, 'rb').read if File.exist?(@versionpath)\r\n\r\n # online s3 version\r\n desired_s3_version = s3.head_object(bucket: s3_bucket, key: s3_key).version_id\r\n\r\n # compare local with remote version\r\n if current_s3_version != desired_s3_version || !File.exist?(@jarpath)\r\n puts \"Downloading aws-apigateway-importer jar with S3 version #{desired_s3_version}\"\r\n s3.get_object(response_target: @jarpath, bucket: s3_bucket, key: s3_key)\r\n File.write(@versionpath, desired_s3_version)\r\n end\r\n end"
] |
[
"0.59470683",
"0.5711322",
"0.5667881",
"0.559568",
"0.55104804",
"0.5493774",
"0.5492138",
"0.54642326",
"0.54256034",
"0.5386822",
"0.5372146",
"0.5370584",
"0.5353639",
"0.5330559",
"0.5316289",
"0.529656",
"0.5285697",
"0.5260086",
"0.5244875",
"0.52281433",
"0.5212693",
"0.52079743",
"0.51932377",
"0.5173656",
"0.5149787",
"0.5148921",
"0.5144728",
"0.5095294",
"0.50926083",
"0.50792706",
"0.5070746",
"0.5069694",
"0.50665003",
"0.5037668",
"0.5035589",
"0.50197154",
"0.49971884",
"0.4993433",
"0.49908188",
"0.4979672",
"0.4962079",
"0.49519944",
"0.49302042",
"0.49276036",
"0.4927371",
"0.49117318",
"0.4905799",
"0.48993772",
"0.4893055",
"0.4885123",
"0.48842323",
"0.4881547",
"0.48795515",
"0.48770034",
"0.48748437",
"0.48714486",
"0.48643917",
"0.485992",
"0.48479736",
"0.4844506",
"0.48442802",
"0.48434222",
"0.48368546",
"0.48306584",
"0.48152897",
"0.48149586",
"0.48106205",
"0.480909",
"0.47899356",
"0.47894543",
"0.4788643",
"0.47806942",
"0.4779095",
"0.47738892",
"0.47718522",
"0.47702464",
"0.4767469",
"0.47476432",
"0.47328103",
"0.47238046",
"0.47220162",
"0.47216853",
"0.47211468",
"0.47177717",
"0.47129032",
"0.4704486",
"0.469406",
"0.46914452",
"0.46866384",
"0.46865007",
"0.46745795",
"0.46724957",
"0.46697965",
"0.46547824",
"0.46506786",
"0.46416846",
"0.46414685",
"0.46305963",
"0.46301457",
"0.46276572"
] |
0.61372584
|
0
|
that does not equal 0.0 is true
|
def to_b
!zero?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def approximate?\n !exact?\n end",
"def near_zero_or_less?(value)\n (value < 0.0 or near_zero?(value))\n end",
"def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end",
"def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def is_set?\n (@value - NEGATIVE) >= 0.5\n end",
"def nonpositive?\n return self <= 0\n end",
"def finite?\n @special._equal?(0)\n end",
"def nan?\n @special._equal?(2)\n end",
"def ∅?; self.real.zero?; end",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def zero?\n value == 0 \n end",
"def nan?() end",
"def format_if_result_is_zero(result)\n if result == 0 || result == 0.0\n result = 0\n end\n return result\nend",
"def nan?\n end",
"def zero?\n cents == 0 \n end",
"def divide_by_zero(num_2)\n if num_2 == 0 || num_2 == 0.0\n puts \"Sorry, dividing by zero is invalid.\"\n return false\n else\n return true\n end\nend",
"def zero?\n @digits.to_i == 0 and self.finite?\n end",
"def zero?\n cents == 0\n end",
"def zero?\n cents == 0\n end",
"def values_positive?\n is_ok = self.start_value > 0.0\n \n if is_ok\n self.value_changes.each do |offset, setting|\n setting.value > 0.0\n end\n end\n return is_ok\n end",
"def absolutely_priced?\n if sales_price.nil? or sales_price.blank? or sales_price == BigDecimal.new(\"0.0\")\n return false\n else\n return true\n end\n end",
"def zero?\n # @digits.to_i == 0 and self.finite?\n @digits == 0 && @special._equal?(0)\n end",
"def scalar?\n lhs == 0 and rhs == 0\n end",
"def near_one?(value)\n near_zero?(value - 1.0)\n end",
"def numeric?\n !!Float(self) rescue false\n end",
"def zero?\n @value.zero?\n end",
"def nonnegative?\n return self >= 0\n end",
"def zero?(a)\n a == 0\n end",
"def isFloat?\n !!Float(exp) rescue false\n end",
"def zero?\n toReturn = true\n \n @coefs.each do |coef|\n if coef != ' '\n toReturn = false\n break\n end\n end\n end",
"def zero?\r\n return true if @x == 0 and @y ==0\r\n return false\r\n end",
"def zero?\n x.zero? && y.zero? \n end",
"def numeric(x)\n true if Float(x) rescue false\n end",
"def nonzero?\n !zero?\n end",
"def assert_flequal(exp, actual, msg='')\r\n if exp == 0.0\r\n error = 1e-7\r\n else\r\n error = exp.abs/1e7\r\n end\r\n \r\n assert((exp - actual).abs < error, \r\n \"#{msg} Expected #{'%f' % exp} got #{'%f' % actual}\")\r\n end",
"def allow_nan?()\n #This is a stub, used for indexing\n end",
"def zero?\n end",
"def zero?() end",
"def zero?() end",
"def approx_same_values_as?(other)\n delta = s_copy.sub(other).to_a.inject(0.0) do |result, element|\n result + element**2.0\n end\n delta < EPSILON\n end",
"def nan?(value)\n value.is_a?(Float) && value.nan?\n end",
"def finite?\n @special != 'i' && !self.nan?\n end",
"def is_miss?\n sum < 10 && sum >= 0\n end",
"def zero?\n @total.zero?\n end",
"def zero?\n @total.zero?\n end",
"def non_negative_float(value, epsilon: nil)\n result = to_float(value) or return\n result unless epsilon ? (result < -epsilon) : result.negative?\n end",
"def numeric?(object)\n true if Float(object) rescue false\nend",
"def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend",
"def zero?\n moneys.all? {|_, money| money.zero?}\n end",
"def numeric?(object)\n true if Float(object) rescue false\n end",
"def nonzero?() end",
"def nonzero?\n cents != 0 ? self : nil\n end",
"def numeric?(num)\n !!Float(num) rescue false\nend",
"def positive?\n self > ZERO\n end",
"def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end",
"def is_valid_cost?(cost)\n return cost.class == Float && cost >= 0.0\n end",
"def zero?\n return amount.zero?\n end",
"def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end",
"def like_f?\n return false unless self.to_f?\n\n num = self.without_leading_zeros\n (num.to_i != num.to_f) || num.include?(\".\")\n end",
"def assert_no_0_values reclist, att \n values = get_values reclist, att\n outliers = values.reject{|x,y| x != 0}\n log_v \" There are #{outliers.size} 0s in #{reclist.first.class}'s #{att} \" if outliers.size > 0\n log_v \"Outliers: #{outliers.collect{|x,y| x}*', '}\" if outliers.size > 0 and outliers.size < 10\n end",
"def pure? \r\n\t\tif self.positives == 0 && self.negatives != 0\r\n\t\t\treturn true\r\n\t\telsif self.negatives == 0 && self.positives != 0\r\n\t\t\treturn true\r\n\t\telse return false\r\n\t\tend\r\n\tend",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def ==(f)\n self.toFloat() == f.toFloat()\n end",
"def float?(num)\n num.to_f.to_s == num\nend",
"def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend",
"def zero?\n to_d.zero?\n end",
"def zero?\n to_d.zero?\n end",
"def nan?\n @special == 'n'\n end",
"def zero?\n amount == 0 \n end",
"def float?(object)\n return true if Float(object)\n rescue \n return false\nend",
"def nan\n BigDecimal('0')/BigDecimal('0')\n end",
"def valid_number?(num)\n if num == '0' || num == \"0.0\" || num.to_f.nonzero?\n return true\n else\n return false\n end\nend",
"def is_float?\n self.to_f.to_s == self\n end",
"def float?\n self.class.float?(self)\n end",
"def test_neither_element_is_zero\n\t\tp = Print.new\n\t\trefute(p.one_type_is_zero?([1,1]))\n\tend",
"def zero?(x, y=nil)\n x.zero? || x.abs < value(y || x)\n end",
"def numeric?\n false\n end",
"def float?(num)\n num.to_f().to_s()==num\nend",
"def nonzero?\n return !zero?\n #return pvr!=0 || pbr!=0 || ppr!=0 || mrs!=0 || idr!=0 || mid!=0 || ifr!=0 || other!=0\n end",
"def !=(other_vector, precision = 6)\n @x.round(precision) != other_vector.x.round(precision) or\n @y.round(precision) != other_vector.y.round(precision)\n end",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def float?(num)\n num == num.to_f.to_s\nend",
"def test_negative_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"def negative?\n self < ZERO\n end",
"def has_leading_zeros?(value)\n if value.to_s.match(/\\./) # float value\n value.to_s.to_f.to_s.length != value.to_s.length\n else # integer value\n value.to_s.to_i.to_s.length != value.to_s.length\n end\n end",
"def is_invalid?(num_1, num_2, num_3)\r\n\tflatlined = false\r\n\r\n\tif num_2 == num_1 || num_2 == num_3 || num_2.to_f.nan? || num_2 == 0 || !num_2.valid_float?\r\n\t\tflatlined = true\r\n\tend\r\n\r\n\treturn flatlined\r\nend",
"def test_both_are_zero\n\t\tp = Print.new\n\t\trefute(p.one_type_is_zero?([0,0]))\n\tend",
"def check_for_float(company)\n float(company) unless\n company.floated? ||\n (initial_offering.percentage_owned(company) > BigDecimal.new('0.5'))\n end",
"def zero?()\n #This is a stub, used for indexing\n end",
"def verifica(numero)\n true if (Float(numero)) && (Float(numero) > 1.0) rescue false\nend",
"def zero?\n @quantity.zero?\n end",
"def numeric_empty(num)\n false\n end",
"def handle_nan(result)\n result.nan? ? 0.0 : result\n end",
"def handle_nan(result)\n result.nan? ? 0.0 : result\n end",
"def normal?\n\t !self.significant?\n\t end",
"def test_positive_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end",
"def valid_float_number?(num)\n num.to_f.to_s == num\nend",
"def less_than_or_equal_to_zero(num)\n\treturn num <= 0 ? true : false\nend"
] |
[
"0.6914562",
"0.68451107",
"0.6831074",
"0.6765833",
"0.67067766",
"0.6676411",
"0.65820336",
"0.6564516",
"0.6544035",
"0.6541917",
"0.6541917",
"0.6529434",
"0.6527969",
"0.65264046",
"0.6502138",
"0.64989376",
"0.64906037",
"0.64870113",
"0.6482905",
"0.6482905",
"0.64794844",
"0.64789045",
"0.6472878",
"0.64625365",
"0.64612514",
"0.6457894",
"0.6451988",
"0.6446757",
"0.6410044",
"0.63882875",
"0.63844866",
"0.6383618",
"0.63752615",
"0.6350313",
"0.6349564",
"0.63430315",
"0.63233566",
"0.6308965",
"0.62975675",
"0.62975675",
"0.6285959",
"0.62811357",
"0.6238079",
"0.62302274",
"0.6228604",
"0.6228604",
"0.6197485",
"0.61969376",
"0.61811996",
"0.6158145",
"0.61577034",
"0.61495906",
"0.6131048",
"0.6126656",
"0.6126294",
"0.6121071",
"0.61075294",
"0.6079387",
"0.60789704",
"0.60598916",
"0.605486",
"0.60519326",
"0.6034293",
"0.6034293",
"0.6021062",
"0.6020055",
"0.6004009",
"0.6004009",
"0.600042",
"0.5993956",
"0.59874815",
"0.5986174",
"0.5984103",
"0.59797555",
"0.59703803",
"0.59699124",
"0.59679985",
"0.59669346",
"0.5963255",
"0.59582174",
"0.5949435",
"0.5947182",
"0.5947182",
"0.59459156",
"0.594324",
"0.59375095",
"0.59349734",
"0.59303325",
"0.5920003",
"0.59100497",
"0.5899187",
"0.5885663",
"0.5876429",
"0.58692735",
"0.58591783",
"0.58591783",
"0.58405834",
"0.5838938",
"0.5830219",
"0.5830123",
"0.58294547"
] |
0.0
|
-1
|
Rounds float to the precision specified 100.5235.round_to => 101.0 100.5235.round_to(1) => 101.5 100.5235.round_to(3) => 101.524
|
def round_to(precision=0)
mulitplier = 10.0 ** (precision)
(((((self)*mulitplier).round).to_f)/mulitplier)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def round_to(decimal_places)\n to_f.round(decimal_places)\n end",
"def round(number, precision)\n ((number * 10**precision).round.to_f) / (10**precision)\n end",
"def round(float, decimal_places)\n sprintf(\"%.#{decimal_places}f\", float)\n end",
"def round_float(float, places); end",
"def float_round(number)\n\t\tnumber.round if number.respond_to? :round\n\tend",
"def round(float)\n float.round\n end",
"def round_to(decimal_places)\n (self * 10**decimal_places).round.to_f / 10**decimal_places\n end",
"def round_f (num)\n (num * 100).round / 100.0\nend",
"def human_round number, base_precision = 0\n #FIXME there is an algorithm for this. What is it?\n precision = base_precision\n if number < 10\n precision = base_precision + 1\n end\n if number < 1\n precision = base_precision + 2\n end\n f_number = sprintf \"%.#{precision}f\", number\nend",
"def round(n, precision)\n factor = 10**precision.to_i\n (n * factor).round.to_f / factor\n end",
"def round(num, decimals=3)\n return \"\" unless num\n \"%.#{decimals}f\" % num\n end",
"def round(value, decimal)\n round_to_significance(value, decimal_to_significance(decimal), :round)\n end",
"def round value\n Float(format('%.5g', value))\n end",
"def ROUND(value, precision = 0)\n value.round(precision)\n end",
"def round(precision = nil)\n\t\tif precision\n\t\t\tmagnitude = 10.0 ** precision\n\t\t\t(self * magnitude).round / magnitude\n\t\telse\n\t\t\tprecisionless_round\n\t\tend\n\tend",
"def round(n=0)\n sprintf(\"%#{n}.#{n}f\", self).to_f\n end",
"def my_round(num)\r\n # your code goes here\r\n num.round\r\nend",
"def round(value)\n numeric_transformation(value) {|n| n.round}\n end",
"def round(precision = nil)\n if precision\n magnitude = 10.0 ** precision\n (self * magnitude).round / magnitude\n else\n super()\n end\n end",
"def dround(x)\r\n ((1000.0*x).round/1000.0).to_f\r\nend",
"def round(value)\n # If the number is within epsilon of X.5, round up.\n return value.ceil if (value % 1) - 0.5 > -0.00001\n value.round\n end",
"def round_to(value, significance)\n round_to_significance(value, significance, :round)\n end",
"def round_up_number(float)\n\tn = 3.142\n\tn.ceil\nend",
"def round(precision = 0)\n return 0 if @numerator == 0\n return @numerator if @denominator == 1\n\n adj = (10 ** precision.abs).to_i\n adj = Rational(1, adj) if precision < 0\n\n value = self * adj\n\n value = if self > 0\n (value + Rational(1,2)).floor\n else\n (value - Rational(1,2)).ceil\n end\n\n result = Rational(value, adj)\n\n return result.numerator if result.denominator == 1\n result\n end",
"def round_float(fp_number, d_place)\n assert_nothing_raised do\n return (fp_number * 10**d_place).round.to_f / 10**d_place\n end\n end",
"def round_float(f)\n retval = f == f.to_i ? f.to_i : f\n return retval\n end",
"def round\n @round || (to ? to.round - 1 : 0)\n end",
"def round(value)\n # If the number is within epsilon of X.5, round up (or down for negative\n # numbers).\n mod = value % 1\n mod_is_half = (mod - 0.5).abs < Script::Value::Number.epsilon\n if value > 0\n !mod_is_half && mod < 0.5 ? value.floor : value.ceil\n else\n mod_is_half || mod < 0.5 ? value.floor : value.ceil\n end\n end",
"def FLOOR(value, precision = 0)\n value.floor(precision)\n end",
"def round_prec(digits)\n #This is a stub, used for indexing\n end",
"def round(rounding_mode = T.unsafe(nil), rounding_precision = T.unsafe(nil)); end",
"def round_down_number(float)\n\tn = 4.9\n\tn.floor\nend",
"def ieee754_round (number)\r\n [number].pack('f').unpack('f*')[0].to_i\r\n end",
"def round_of(no,n=0)\n (no * (10.0 ** n)).round * (10.0 ** (-n))\n end",
"def round(degrees_F = 68, exponent = 2) \r\n ((convert degrees_F) * 10.0 ** exponent).round / 10.0 ** exponent\r\n# convert degrees_F.round(exponent) \r\nend",
"def round(int, scale = 10)\n (int + scale - 1) / scale * scale\nend",
"def rounder5(to_round)\n to_round.round(5)\n end",
"def format_rounded(number)\n if number > 20\n number.to_i\n else\n sprintf('%0.1f', number)\n end\n end",
"def round_up_number(float)\n float.ceil\nend",
"def round_up_number(float)\n float.ceil\nend",
"def round_up_number(float)\nend",
"def round_numbers\n numbers = [5.45, 3.99, 4.67, 1.49, 3.14, 9.41]\nend",
"def round_rate(rate)\n Float(format('%.5g', rate))\n end",
"def rounding_method; end",
"def round_up(number)\n multiple = (number * 100).round().to_int\n (multiple % 5 == 0 ? multiple: multiple + 5 - (multiple % 5)) / 100.00\n end",
"def jround(num, sf, pre = \"\", is_percent: false, show_percent: true, min_places: nil)\n num = num || 0\n num *= 100 if is_percent\n after = (is_percent and show_percent) ? \"%%\" : \"\"\n places = (0 == num) ? 1 : (Math.log10 num).floor + 1\n if places > sf\n return (\"%#{pre}.#{sf}g#{after}\" % num)\n else\n fto = min_places ? [min_places, sf - places].min : sf - places\n return (\"%#{pre}.#{fto}f#{after}\" % num)\n end #if places > sf\nend",
"def round_down_number(float)\n float.floor\nend",
"def round_down_number(float)\n float.floor\nend",
"def round(digits = nil)\n rounded_value = digits ? value.round(digits) : value.round\n self.class.new(rounded_value, unit)\n end",
"def round() end",
"def format(precision) # :nodoc:\r\n (precision == nil || precision == 0) ? \"%s\" : \"%.#{precision}f\"\r\n end",
"def value_round(resolution,value)\n y=1\n resolution.times {|n| y=y*10}\n if resolution == 0\n value = (value.round)/y\n else\n value = (value.round)/(y*1.0)\n end\nend",
"def nice_number(x, round = true)\n exp = Math.log10(x).floor\n f = x / 10 ** exp\n if round\n if f < 1.5; nf = 1\n elsif f < 3; nf = 2\n elsif f < 7; nf = 5\n else nf = 10\n end\n else\n if f <= 1; nf = 1\n elsif f <= 2; nf = 2\n elsif f <= 5; nf = 5\n else nf = 10\n end\n end\n nf * 10 ** exp\n end",
"def precision(f)\n return (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE\n end",
"def round_factor(factor,sigFigs)\n radix = (10.0**sigFigs)\n\t (factor * radix).round / radix\n end",
"def on_call_round(context, expression)\n number = on_call_number(context, expression)\n\n return number.nan? ? number : number.round.to_f\n end",
"def number_with_precision(number, precision=3)\n \"%01.#{precision}f\" % number\n rescue\n number\n end",
"def round_to_coin(coin)\n coef = 1.0/coin\n val = (cents * coef).floor / coef\n Money.new(val, currency)\n end",
"def round_down_number(float)\nend",
"def round_numbers\n numbers = [5.45, 3.99, 4.67, 1.49, 3.14, 9.41]\n\n # numbers.map { |number| number.round }\n numbers.map(&:round)\nend",
"def round(rounding_mode = self.class.rounding_mode)\n if self.class.infinite_precision\n build_new(to_d.round(currency.decimal_places, rounding_mode), currency)\n else\n self\n end\n end",
"def number_with_precision\n\t\t\"%.2f\" % number\n\tend",
"def round; self.dup.round!; end",
"def round(digits=0)\n\t\t\ta = to_ary\n\t\t\tself.class.make(a[0].round, a[1].round)\n\t# self.class.make(a[0].round(digits), a[1].round(digits))\n\t\tend",
"def round_down_number(float)\n float.to_i\nend",
"def rounded_number\n\t\t(number * 20).ceil / 20.to_f\n\tend",
"def floor(value, decimal)\n round_to_significance(value, decimal_to_significance(decimal), :floor)\n end",
"def round(value)\n ( (value.to_f + @min_margin) / @multiple_of ).ceil * @multiple_of\n end",
"def round\n self.dup.round!\n end",
"def mround(zeroes = false)\n if !zeroes\n y = self.round(2)\n y.modulo(1) == 0 ? y.to_i.to_s : '%.2f' % y\n else\n '%.2f' % self\n end\n end",
"def neat_numbers(number, roundto = 2) # round to 0 or 2)\n number = if roundto == 2\n format '%.2f', number\n else\n number.round\n end\n # regex to add commas\n number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\\\1,').reverse\n end",
"def round_to(num, target_divisor)\n num + (num % target_divisor)\nend",
"def round_to(num, target_divisor)\n num + (num % target_divisor)\nend",
"def round_five_down(n)\n n.to_s[/\\d+\\.\\d{3}/][-1] == \"5\" ? n.to_s[/\\d+\\.\\d{2}/].to_f : n.round(2)\n end",
"def convert_third_of_inning(decimal, whole_num, original)\n if decimal == 0.1\n whole_num += 0.33\n whole_num.to_s\n elsif decimal == 0.2\n whole_num += 0.66\n whole_num.to_s\n else\n original\n end\n end",
"def round_up_number(float)\n float.to_i + 1\nend",
"def int_or_float( n ) # demo\n if (n - n.round).abs < 0.00000000001 # alternative n % 1 == 0, but this also helps with bad float maths\n n.round\n else\n return n\n end\nend",
"def round\n raise StandardError.new(\"Not enough numbers on stack\") if @stack.length<1\n num = pop\n result = num.round\n push(result)\n return result\n end",
"def round\n end",
"def round_to_nearest_cash_value; end",
"def solution(value)\n value.round(2)\nend",
"def decimals(n, rounded=true)\n digits 10, n, rounded\n end",
"def roundcent(amount)\n return ((amount * 100).round)/100\n end",
"def golden_ratio(precision)\n x = fib(99)/fib(98).to_f\n x.round(precision)\n end",
"def neat_numbers(number, roundto = 2) #round to 0 or 2)\n if roundto == 2\n number = sprintf \"%.2f\", number\n else\n number = number.round\n end\n #regex to add commas\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\n end",
"def neat_numbers(number, roundto = 2) #round to 0 or 2)\n if roundto == 2\n number = sprintf \"%.2f\", number\n else\n number = number.round\n end\n #regex to add commas\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\n end",
"def neat_numbers(number, roundto = 2) #round to 0 or 2)\n if roundto == 2\n number = sprintf \"%.2f\", number\n else\n number = number.round\n end\n #regex to add commas\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\n end",
"def neat_numbers(number, roundto = 2) #round to 0 or 2)\n if roundto == 2\n number = sprintf \"%.2f\", number\n else\n number = number.round\n end\n #regex to add commas\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\n end",
"def neat_numbers(number, roundto = 2) #round to 0 or 2)\n if roundto == 2\n number = sprintf \"%.2f\", number\n else\n number = number.round\n end\n #regex to add commas\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\n end",
"def round_tax (t)\n r = BigDecimal( 0.05.to_s )\n (t / r).round * r\n end",
"def ceil(value, decimal)\n round_to_significance(value, decimal_to_significance(decimal), :ceil)\n end",
"def to_format(value, currency)\n format(\"%.#{precision(currency)}f\", value.to_f)\n end",
"def round_to_hour(f)\r\n (f/0.125).round*0.125\r\n end",
"def round_to_hour(f)\r\n (f/0.125).round*0.125\r\n end",
"def round_to_hour(f)\r\n (f/0.125).round*0.125\r\n end",
"def first_3_digits_round_down(num, n)\n num.to_s.chars.map.with_index{ |c, i| n > 2 ? \"0\" : c }.join.to_i\nend",
"def floor_to(value, significance)\n round_to_significance(value, significance, :floor)\n end",
"def number_solution(value)\n value.round(2)\nend",
"def round_payment(n)\n n.round(2)\nend",
"def divide_two_places(big_float, small_float)\n quotient = big_float / small_float\n quotient.round(2)\nend"
] |
[
"0.8028547",
"0.7857059",
"0.77214545",
"0.7714461",
"0.76052624",
"0.75774676",
"0.75214744",
"0.75100905",
"0.74549985",
"0.73176146",
"0.7287837",
"0.7190709",
"0.7159201",
"0.71151817",
"0.70879894",
"0.7054623",
"0.6994332",
"0.6974736",
"0.6947288",
"0.68917876",
"0.68838847",
"0.68384045",
"0.6776956",
"0.6751273",
"0.66716135",
"0.666186",
"0.65971386",
"0.6590534",
"0.65547305",
"0.6523931",
"0.65211505",
"0.6499024",
"0.64742416",
"0.6472378",
"0.64251",
"0.6407439",
"0.63780874",
"0.63766974",
"0.6365908",
"0.6365908",
"0.6336129",
"0.6321313",
"0.6317909",
"0.6247317",
"0.6189118",
"0.6169996",
"0.61380124",
"0.61380124",
"0.61227036",
"0.6101034",
"0.6100389",
"0.6099347",
"0.6068058",
"0.60531515",
"0.60067755",
"0.5998424",
"0.5980072",
"0.5956939",
"0.5954026",
"0.5942541",
"0.5938113",
"0.5933995",
"0.5930069",
"0.5925017",
"0.59075063",
"0.5905218",
"0.5897535",
"0.5892133",
"0.5857416",
"0.58502513",
"0.5844877",
"0.5797308",
"0.5797308",
"0.5796315",
"0.57925344",
"0.57777536",
"0.577206",
"0.5717352",
"0.5694042",
"0.5691035",
"0.56882",
"0.56700546",
"0.5665599",
"0.56505716",
"0.56357706",
"0.56357706",
"0.56357706",
"0.56357706",
"0.56357706",
"0.5635549",
"0.5633553",
"0.5621842",
"0.56149435",
"0.56149435",
"0.56149435",
"0.56074154",
"0.5606235",
"0.55873513",
"0.5556258",
"0.55545926"
] |
0.79195976
|
1
|
returns boolean value for common boolean string values
|
def to_b
return true if self =~ BOOLEAN_REGEX
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def value_is_boolean?(string)\n return %w[true false yes no y n].include?(string.downcase)\n end",
"def result\n val = value.sub(/^boolean-/, '')\n val.casecmp(\"true\").zero?\n end",
"def to_bool\n dc = to_s.downcase\n\n if TRUE_WORDS.include?(dc)\n true\n elsif FALSE_WORDS.include?(dc)\n false\n end\n end",
"def to_bool\n return true if ['true', '1', 'yes', 'on', 't'].include? self\n return false if ['false', '0', 'no', 'off', 'f'].include? self\n return false\n end",
"def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end",
"def true_string?(field)\n field == 'true' || field == true\n end",
"def _boolinze(val)\n return true if ['true', '1'].include?(val)\n return false if ['false', '0'].include?(val)\n val\n end",
"def string_to_bool(value)\n return false if value.nil? || value.casecmp('no').zero?\n return true if value.casecmp('yes').zero?\n value # if it doesn't match anything\n end",
"def to_bool(str)\n str = str.to_s.downcase\n return true if str == 'yes' or str == 'true' or str == 'on'\n return true if str.to_i > 0\n return false\n end",
"def to_bool\n %w(true t yes y on 1).include?(self.downcase)\n end",
"def coerce_str_to_bool(*keys)\n coerce(*keys){ |str_bool| (str_bool == 'on' || str_bool == 'true')}\n end",
"def to_bool(questionable_string)\n\tbool = true\n\tunless questionable_string == \"true\"\n\t\tbool = false\n\tend\n\tbool\nend",
"def to_boolean(string)\n string == 'true'\nend",
"def str_to_bool(str)\n if str.size > 0 and str[0].chr == '!'\n command = str[1, str.length]\n value = `#{command}`\n else\n value = str\n end\n\n case value.downcase.strip\n when \"false\", \"0\", \"nil\", \"\", \"no\", \"off\"\n nil\n when \"true\", \"1\", \"yes\", \"on\"\n true\n else\n value\n end\n end",
"def truthy?(string)\n string.to_s.casecmp('true').zero?\nend",
"def truthy?(string)\n string.to_s.casecmp('true').zero?\nend",
"def str_to_bool(str)\n if str.size > 0 and str[0].chr == '!'\n command = str[1, str.length]\n value = `#{command}`\n else\n value = str\n end\n\n case value.downcase.strip\n when \"false\", \"0\", \"nil\", \"\", \"no\", \"off\"\n nil\n when \"true\", \"1\", \"yes\", \"on\"\n true\n when /\\n/\n value.strip.split(/\\n+/)\n else\n value\n end\n end",
"def to_boolean(str)\n str == 'true'\nend",
"def parse_bool() true end",
"def tbool(b)\n t(b ? \"common._yes\" : \"common._no\")\n end",
"def bool_from_str(s)\n raise exc unless valid_bool_str?(s)\n case s\n when *FALSE_STRS\n false\n else\n true\n end\n end",
"def to_bool\n return false if self.downcase == \"false\"\n return true\n end",
"def is_true?\n [true, \"true\", 1, \"1\", \"T\", \"t\"].include?(\n self.value.class == String ? self.value.downcase : self.value\n )\n end",
"def to_boolean\n if ['true', 'True', 'TRUE', '1'].include?(self)\n return true\n else\n return false\n end\n end",
"def parse_boolean_value(value)\n value.to_s.downcase == 'true'\n end",
"def valid_bool_str?(str)\n BOOL_STRS.include?(str)\n end",
"def to_boolean\r\n\t !!(self.to_s =~ /^(true|t|yes|y|1)$/i)\r\n\tend",
"def boolString(value)\n if value == \"0\"\n return \"false\"\n else\n return \"true\"\n end\n end",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def to_boolean(val)\n val && (val.to_s.match(/(true|t|yes|y|1)$/i) != nil)\n end",
"def to_boolean(str)\n !(str == 'false' || str == '0')\nend",
"def bool?(b)\n not ['true', 'false'].index(b.to_s).nil?\n end",
"def true?(obj)\n [\"true\",\"1\"].include? obj.to_s.downcase\n end",
"def post_process_boolean( val )\n\t\t\treturn TRUE_VALUES.include?( val.to_s.downcase )\n\t\tend",
"def convert_string_to_bool(value)\n case value\n when \"true\"\n true\n when \"false\"\n false\n when Array\n value.map { |elem| convert_string_to_bool(elem) }\n when Hash\n value.each do |key, elem|\n value[key] = convert_string_to_bool(elem)\n end\n value\n else\n value\n end\n end",
"def to_bool str\r\n ActiveRecord::Type::Boolean.new.type_cast_from_user(str)\r\n end",
"def bool(val)\n case val.to_s.downcase\n when 'y', 'yes', 'on', 't', 'true'\n true\n when 'n', 'no', 'off', 'f', 'false'\n false\n else\n nil\n end\nend",
"def convert_str_to_boolean(str)\n str == \"y\" ? true : false\nend",
"def convert_boolean_strings\n %i{ambiguous_ref_bases use_all_contigs include_low_hmes polyploidy}.each do | symbol |\n if @options.key?(symbol)\n @options[symbol] = @options[symbol] == 'false' ? false : true\n end\n end\n end",
"def to_bool(value)\n value.to_s.downcase == 'true' ? true : false\n end",
"def boolean(value)\n value.strip =~ /^(y|t)$/i ? true : false\n end",
"def parse_bool() false end",
"def parse_bool() false end",
"def boolean_attribute?(name) \n BOOLEAN_ATTRIBUTES.include?(name.to_s)\n end",
"def is_truthy? value\n %w( true t 1 yes y ).include? value.to_s.downcase\n end",
"def value_to_boolean(value)\n if value.is_a?(String) && value.empty?\n nil\n else\n TRUE_VALUES.include?(value)\n end\n end",
"def match_boolean( val )\n\t\trval = nil\n\t\tif ( val =~ /^(t(?:rue)?|y(?:es)?)|1$/i )\n\t\t\trval = true\n\t\telsif ( val =~ /^(no?|f(?:alse)?)|0$/i )\n\t\t\trval = false\n\t\tend\n\n\t\treturn rval\n\tend",
"def string_to_boolean(string)\n case string\n when /^(true|t|yes|y|1)$/i then true\n when /^(false|f|no|n|0)$/i then false\n else raise \"Cannot convert string to boolean: #{string}\"\n end\nend",
"def result_to_get?\n if not @result.nil?\n if @result.downcase == 'true'\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def truthy?\n case strip.downcase\n when \"1\", \"true\", \"yes\", \"on\", \"enabled\", \"affirmative\"\n true\n else\n false\n end\n end",
"def true_xor_false?\n#\t\tself.include?('true') ^ self.include?('false') ^\n#\t\t\tself.include?(true) ^ self.include?(false)\n\t\tcontains_true = contains_false = false\n\t\teach {|v|\n#\t\t\t( v.to_boolean ) ? contains_true = true : contains_false = true\n\t\t\teval(\"contains_#{v.to_boolean}=true\")\n\t\t}\n\t\tcontains_true ^ contains_false\n\tend",
"def clean_bool dirty_vals\n vals = []\n array = separate(dirty_vals)\n array.each { |dirty_val| \n val = get_b(dirty_val)\n #if val.nil? and (!dirty_val.nil? and dirty_val.strip!='')\n # val = dirty_val.match(/(not applicable|n\\/a|not available)/i).nil?\n #end\n vals << val\n }\n if vals.empty? or vals.uniq == [nil]\n return nil\n elsif vals.include? true\n return true\n else\n return false\n end\n end",
"def bool_to_string(value)\n return 'yes' if value == true\n return 'no' if value == false\n value # if it doesn't match anything\n end",
"def value_to_boolean(value)\n if value.is_a?(String) && value.blank?\n nil\n else\n TRUE_VALUES.include?(value)\n end\n end",
"def get_boolean_value\n\t\tend",
"def object_to_boolean(value)\n return [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)\n end",
"def value_to_boolean(value)\n return value if value==true || value==false\n case value.to_s.downcase\n when \"true\", \"t\", \"1\" then true\n else false\n end\n end",
"def to_bool\n is_a?(::TrueClass) || self == :true || self == :yes || self == :on\n end",
"def to_boolean(default = nil)\n return true if ['true', '1', 'yes', 'on', 't'].include? self\n return false if ['false', '0', 'no', 'off', 'f'].include? self\n return default\n end",
"def boolean(key, default=false)\n\t\tvalue = self.fetch(key.downcase, nil)\n\t\tif value\n\t\t\tif value.strip =~ /^(true|t|yes|y|on|1|enable|enabled|positive|pro|allow|active|activate|accept|trust)$/i\n\t\t\t\treturn true\n\t\t\tend\n\t\t\tif value.strip =~ /^(false|f|no|n|off|0|disable|disabled|negative|con|deny|inactive|deactivate|reject|distrust|mistrust)$/i\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\treturn default\n\tend",
"def to_boolean(string)\r\n if string.downcase == 'y'\r\n string = true\r\n elsif string.downcase == 'n'\r\n string = false\r\n end\r\nend",
"def booleans#:doc:\n barcode.encoding.split(//).map{|c| c == '1' }\n end",
"def to_boolean\n # SECURE: BNS 2012-10-09: But may behave oddly for multi-line input\n return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)\n return false if self == false || self.nil? || self =~ (/^(false|f|no|n|0)$/i)\n fail ArgumentError, \"invalid value for Boolean: \\\"#{self}\\\"\"\n end",
"def true?(obj)\n obj.to_s.downcase == \"true\"\n end",
"def config_boolean_true?(boolean_field)\n data[boolean_field].to_i == 1\n end",
"def boolean?\n proc do |o|\n o.is_a? String and o.is_b?\n end\n end",
"def true?\n self.value == '1'\n end",
"def parse_to_true_false_string(only_yes = false)\n raise MissingValueError.new(var: var) if vals.empty?\n raise TooManyValuesError.new(var: var) if vals.length > 1\n val = vals.first\n return \"TRUE\" if /^(1|yes|true)$/i.match?(val)\n return \"FALSE\" if /^(0|no|false)$/i.match?(val) && !only_yes\n raise BadYesError.new(var: var, val: val) if only_yes\n raise BadBooleanError.new(var: var, val: val)\n end",
"def to_boolean(value)\n case value\n when :true, 'true'\n true\n else\n false\n end\n end",
"def literal_true\n 'true'\n end",
"def clean_up_boolean(_, q_val)\n %w(t true).include? q_val\n end",
"def boolean\n Util.from_bytes :boolean, value\n end",
"def true?\n self.value == '1'\n end",
"def is_true_value?(value)\n /true|yes|on|y|n|s|si|cierto/ === value \n end",
"def getBoolean\n if @type == 'a'\n return getBooleanValue().rjust(16, '0')\n end\n\n if @type == 'c'\n return '111'+getBooleanComp()+getBooleanDest()+getBooleanJump()\n end\n\n return \"\"\n end",
"def convert_to_boolean(val)\n return val if val.is_a?(TrueClass) || val.is_a?(FalseClass)\n val = val.to_s.clean\n return nil if val.blank?\n if val.match?(/\\A(false|f|n|no)\\z/i)\n false\n elsif val.match?(/\\A(true|t|y|yes)\\z/i)\n true\n end\n end",
"def parse_to_true_false_string(only_yes = false)\n raise MissingValueError.new(var: var) if vals.empty?\n raise TooManyValuesError.new(var: var) if vals.length > 1\n\n val = vals.first\n return \"TRUE\" if /^(1|yes|true)$/i.match?(val)\n return \"FALSE\" if /^(0|no|false)$/i.match?(val) && !only_yes\n raise BadYesError.new(var: var, val: val) if only_yes\n\n raise BadBooleanError.new(var: var, val: val)\n end",
"def boolify(val)\n\nend",
"def normalize(boolean_str)\n\t\t\tTrue.include?(boolean_str) ? (:true) : (:false)\n\t\tend",
"def to_bool() true end",
"def parse_boolean(string)\n case string.strip\n when \"Yes\"\n true\n when \"No\"\n false\n end\nend",
"def bool_to_word bool\n if bool == \"true\"\n \"Yes\"\n else\n \"No\"\n end\nend",
"def true?(val)\n TRUE_VALUES.include? val\n end",
"def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end",
"def truthy?(val)\n v = val&.downcase\n v == \"t\" || v == \"y\" || v == \"1\"\nend",
"def true_or_false\n example = (\n (true || false ) == true\n # I replaced the empty string on the right with true\n )\n\n q1 = (\n (true && true || false) == ''\n )\n\n q2 = (\n (true && false || false) == ''\n )\n\n q3 = (\n (true || false || false) == ''\n )\n\n q4 = (\n (true && (false || false)) == ''\n )\n\n q5 = (\n (false && (true || false)) == ''\n )\n\n q6 = (\n (true && false || false) == ''\n )\n q7 = (\n ((false || false || true) && (true && true && false)) == ''\n )\n\n q8 = (\n ((false || false) && (false && false) || (true && false) || (false && true)) == ''\n )\n\n q1 && q2 && q3 && q4 && q5 && q6 && q7 && q8\nend",
"def get_boolean value #:nodoc:\n # some exceptions\n value = false if value == :low or value == 0 or value == nil or value == :off or value == :ground or value == :gnd\n !! value # double invert value in to boolean form\n end",
"def formatted_value_boolean(value)\n (BOOLEAN_TRUE.include?(value) ? I18n.t('true') : I18n.t('false'))\n end",
"def to_bool(strict = true)\n return false if blank? || self =~ /(false|f|no|n|0)$/i\n\n if strict\n return true if self =~ /(true|t|yes|y|1)$/i\n raise ArgumentError, \"invalid value for Boolean: \\\"#{self}\\\"\"\n else\n return true\n end\n end",
"def truthy?(value)\n !(['0', 'false', ''].include?(value.to_s.strip))\n end",
"def rs_cassandra_bool_config(config_val)\n if config_val.is_a?(String) then\n return config_val\n elsif config_val then\n return \"true\"\n else\n return \"false\"\n end\nend",
"def boolval \n\n\t$cst.add_branch(\"boolval\")\n\n\tmatch_token(\"T_BOOLEAN\", $tokens[$index])\n\t\n\t$cst.ascend\n\nend",
"def test_string_should_convert_into_boolean\n ['true', 'True', 'TRUE', '1'].each do |x|\n assert x.to_boolean\n end\n assert !\"false\".to_boolean \n end",
"def boolean_to_string(b)\n if b \n \"true\"\n else\n \"false\"\n end\nend",
"def lookup_boolean_attribute (attname, workitem, default=false)\n\n result = lookup_downcase_attribute(attname, workitem)\n return default if result == nil\n\n (result == 'true')\n end",
"def test_bool_comparison() \n assert_equal(true, @@parser.test_run(\"\n bool chief():\n return 15 < 10^2 and 20 != 15*3\n end\"))\n\n assert_equal(false, @@parser.test_run(\"\n bool chief():\n return 100 < 10*2 or 15 + 25 < 30\n end\"))\n end",
"def typus_boolean(attribute = 'default')\n boolean = Typus::Configuration.config[self.name]['fields']['options']['booleans'][attribute] rescue nil\n boolean = \"true, false\" if boolean.nil?\n return { :true => boolean.split(', ').first.humanize, \n :false => boolean.split(', ').last.humanize }\n end",
"def parse_bool_constant\n if peek?(:KW_TRUE)\n ExprBool.new(expect(:KW_TRUE))\n else\n ExprBool.new(expect(:KW_FALSE))\n end\n end",
"def to_bool(value)\n ActiveModel::Type::Boolean.new.cast(value.to_s.strip)\n end"
] |
[
"0.7796263",
"0.77290726",
"0.7416112",
"0.74141365",
"0.73810846",
"0.7299423",
"0.7279104",
"0.726054",
"0.7188894",
"0.7154388",
"0.7118743",
"0.705926",
"0.7050487",
"0.703741",
"0.7032188",
"0.7032188",
"0.7017373",
"0.7006849",
"0.699303",
"0.69724864",
"0.6963494",
"0.6910272",
"0.687658",
"0.68723845",
"0.68620133",
"0.68501157",
"0.68499905",
"0.6835115",
"0.6815727",
"0.68043584",
"0.68018514",
"0.6792013",
"0.67742455",
"0.67647207",
"0.6714387",
"0.67095566",
"0.669541",
"0.6685527",
"0.6670511",
"0.6625113",
"0.6621042",
"0.6620558",
"0.6605972",
"0.6605972",
"0.6596269",
"0.6594188",
"0.6583266",
"0.65829515",
"0.65826356",
"0.6576566",
"0.65236366",
"0.651606",
"0.65140325",
"0.6508725",
"0.6491641",
"0.64899385",
"0.64895594",
"0.6473306",
"0.6465954",
"0.6458576",
"0.6451662",
"0.6440987",
"0.6437756",
"0.6426001",
"0.64181584",
"0.6413604",
"0.6413531",
"0.64062303",
"0.64048755",
"0.6392483",
"0.63877934",
"0.6376771",
"0.63698626",
"0.63685226",
"0.6368092",
"0.636186",
"0.636183",
"0.63563067",
"0.6354101",
"0.63300943",
"0.63226336",
"0.6322224",
"0.63212097",
"0.6308991",
"0.6297519",
"0.6285588",
"0.62764966",
"0.6270446",
"0.62683815",
"0.62604976",
"0.6254364",
"0.62531936",
"0.6252534",
"0.62522656",
"0.62482315",
"0.6246396",
"0.62403256",
"0.62384796",
"0.62374264",
"0.62370974"
] |
0.6471406
|
58
|
Takes known US formatted date/time strings (MM/DD/YYYY TIME) and converts them to international format (YYYY/MM/DD TIME). Also cleans up C JSON Date (really a time integer) value. safe_date_string("12/31/2010") => '20101231' safe_date_string("12/31/2010T23:30:25") => '20101231T23:30:25' safe_date_string("12/31/2010 23:30:25") => '20101231 23:30:25' safe_date_string("\/Date(1310669017000)\/") =>
|
def safe_datetime_string
safe_date = nil
if self =~ US_DATE_REGEX
safe_date = us_date_to_iso_str
elsif self =~ JSON_DATE_REGEX
safe_date = json_date_to_time.to_s
else
safe_date = self
end
safe_date
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def normalize_date_strings(date_strings, separator = '/')\n return date_strings if RUBY_VERSION < '1.9'\n date_strings = [*date_strings] # ensure Array\n date_strings.map! do |ds|\n fragments = ds.split(separator)\n [fragments[1], fragments[0], fragments[2]].join(separator)\n end\n end",
"def test_Convert_Date_003_InvalidDatesAsStrings\n\n require 'date'\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Convert_Date_003_InvalidDatesAsStrings\")\n puts2(\"#######################\")\n\n puts2(\"Testing invalid dates expressed as STRINGS\\n\\n\")\n\n sDateString = \"6/31/08\"\n puts2(\"\\nTrying an invalid month specific date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"14/04/2010\"\n puts2(\"\\nTrying an invalid month specific date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"12-88-2010\"\n puts2(\"\\nTrying an invalid date in any month\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"02/29/2001\"\n puts2(\"\\nTrying an invalid Leap Year date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n end",
"def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend",
"def parse_date(date_string)\n result = sugarcube_detect(date_string).first\n if result\n return result.date\n else\n return iso8601(date_string)\n end\n end",
"def parse_date(s)\n begin\n if s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([2-9]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/19#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([0-1]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/20#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/\n date = DateTime.parse(\"#{$2}/#{$1}/#{$3}\")\n elsif s =~ /^(\\d\\d\\d\\d)-(\\d\\d)$/\n if (1...13).include?($2.to_i) and (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n elsif s =~ /^(\\d\\d\\d\\d)$/\n if (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n else\n date = DateTime.parse(s)\n end\n rescue\n return nil\n end\n return date.strftime(\"%Y-%m-%d\")\n end",
"def handle_date_parse_input(string)\n string\n end",
"def interpretDate(dateString)\n\t\t\n\t\tbegin\n\t\t\n\t\tif (dateString =~ /^\\d\\d?\\/\\d\\d?\\/(\\d\\d)$/ )\n\t\t #puts \"Format: m/d/y\"\n\t\t searchDate = Date.strptime(dateString, '%m/%d/%y')\n\t\telsif (dateString =~ /^\\d\\d?\\/\\d\\d?\\/(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m/d/Y\"\n\t\t searchDate = Date.strptime(dateString, '%m/%d/%Y')\n\t\telsif (dateString =~ /^\\d\\d?\\.\\d\\d?\\.(\\d\\d)$/ )\n\t\t #puts \"Format: m.d.y\"\n\t\t searchDate = Date.strptime(dateString, '%m.%d.%y')\n\t\telsif (dateString =~ /^\\d\\d?\\.\\d\\d?\\.(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m.d.Y\"\n\t\t searchDate = Date.strptime(dateString, '%m.%d.%Y')\n\t\telsif (dateString =~ /^\\d\\d?\\-\\d\\d?\\-(\\d\\d)$/ )\n\t\t #puts \"Format: m-d-y\"\n\t\t searchDate = Date.strptime(dateString, '%m-%d-%y')\n\t\telsif (dateString =~ /^\\d\\d?\\-\\d\\d?\\-(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m-d-Y\"\n\t\t searchDate = Date.strptime(dateString, '%m-%d-%Y')\n\t\telse\n\t\t\tflash[:message] = \"Unrecognized date format. Use mm.dd.yy or mm.dd.yyyy.\"\n\t\t return nil\n\t\tend\n\t\t\n\t\trescue ArgumentError => bang\n\t\t\tflash[:message] = \"Invalid date. (Use month first, then day, then year).\"\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\t\n\tend",
"def string_to_date(string)\n super(handle_date_parse_input(string))\n end",
"def convert_date_time(date_time_string)\n date_time = date_time_string\n\n days = 0 # Number of days since epoch\n seconds = 0 # Time expressed as fraction of 24h hours in seconds\n\n # Strip leading and trailing whitespace.\n date_time.sub!(/^\\s+/, '')\n date_time.sub!(/\\s+$/, '')\n\n # Check for invalid date char.\n return nil if date_time =~ /[^0-9T:\\-\\.Z]/\n\n # Check for \"T\" after date or before time.\n return nil unless date_time =~ /\\dT|T\\d/\n\n # Strip trailing Z in ISO8601 date.\n date_time.sub!(/Z$/, '')\n\n # Split into date and time.\n date, time = date_time.split(/T/)\n\n # We allow the time portion of the input DateTime to be optional.\n unless time.nil?\n # Match hh:mm:ss.sss+ where the seconds are optional\n if time =~ /^(\\d\\d):(\\d\\d)(:(\\d\\d(\\.\\d+)?))?/\n hour = $1.to_i\n min = $2.to_i\n sec = $4.to_f || 0\n else\n return nil # Not a valid time format.\n end\n\n # Some boundary checks\n return nil if hour >= 24\n return nil if min >= 60\n return nil if sec >= 60\n\n # Excel expresses seconds as a fraction of the number in 24 hours.\n seconds = (hour * 60* 60 + min * 60 + sec) / (24.0 * 60 * 60)\n end\n\n # We allow the date portion of the input DateTime to be optional.\n return seconds if date == ''\n\n # Match date as yyyy-mm-dd.\n if date =~ /^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/\n year = $1.to_i\n month = $2.to_i\n day = $3.to_i\n else\n return nil # Not a valid date format.\n end\n\n # Set the epoch as 1900 or 1904. Defaults to 1900.\n # Special cases for Excel.\n unless @date_1904\n return seconds if date == '1899-12-31' # Excel 1900 epoch\n return seconds if date == '1900-01-00' # Excel 1900 epoch\n return 60 + seconds if date == '1900-02-29' # Excel false leapday\n end\n\n\n # We calculate the date by calculating the number of days since the epoch\n # and adjust for the number of leap days. We calculate the number of leap\n # days by normalising the year in relation to the epoch. Thus the year 2000\n # becomes 100 for 4 and 100 year leapdays and 400 for 400 year leapdays.\n #\n epoch = @date_1904 ? 1904 : 1900\n offset = @date_1904 ? 4 : 0\n norm = 300\n range = year -epoch\n\n # Set month days and check for leap year.\n mdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n leap = 0\n leap = 1 if year % 4 == 0 && year % 100 != 0 || year % 400 == 0\n mdays[1] = 29 if leap != 0\n\n # Some boundary checks\n return nil if year < epoch or year > 9999\n return nil if month < 1 or month > 12\n return nil if day < 1 or day > mdays[month -1]\n\n # Accumulate the number of days since the epoch.\n days = day # Add days for current month\n (0 .. month-2).each do |m|\n days += mdays[m] # Add days for past months\n end\n days += range *365 # Add days for past years\n days += ((range) / 4) # Add leapdays\n days -= ((range + offset) /100) # Subtract 100 year leapdays\n days += ((range + offset + norm)/400) # Add 400 year leapdays\n days -= leap # Already counted above\n\n # Adjust for Excel erroneously treating 1900 as a leap year.\n days = days + 1 if !@date_1904 and days > 59\n\n return days + seconds\n end",
"def convert_to_date(string)\n return nil if (string.nil? || string.class != String)\n tmp = Chronic.parse(string)\n tmp ? tmp.to_date : nil\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end",
"def date_from_string(date)\n\n#remove st rd nd and th\n\nfirstParse = Chronic.parse(date)\nr1 = /[a-zA-Z]/\n\nif firstParse #check if chronic managed to find anything\n\n #daY Less than 12, assume chronic wrong, aslong as also no characters such as December, \n #where it would be right\n if firstParse.day <= 12 and !r1.match(date) \n\t\n\t #swap month with day\n\t firstParse = firstParse.change(:day => firstParse.month, :month => firstParse.day)\n\n end #of if <= 12\n\n return firstParse\n \n else\n \n\treturn Date.new\n \n end #of if firstParse\nend",
"def convert_date(date)\r\n if ( date == nil )\r\n return nil\r\n end\r\n string_date = date.to_s\r\n t = string_date.rindex('T')\r\n string_date = string_date.slice(0,t)\r\n string_date \r\nend",
"def sanitize_data!\n convert_datetimes_intelligently!\n end",
"def parse_date(date_string)\n selected_format = DATE_FORMATS.select{|date_format| date_string =~ date_format[:format]}[0]\n Date.strptime(date_string, selected_format[:type]) if selected_format\n end",
"def resolve_date(date_str)\n u_count = date_str.count 'u'\n # Replace unknown digits with 0.\n date = date_str.tr('u', '0').to_i\n if u_count.positive? && date != 0\n delta = 10**u_count # 10^u_count, exponent\n date + (delta / 2) if delta <= ESTIMATE_TOLERANCE\n elsif date != 0\n date\n end\n end",
"def normalize_date( object, attribute, params )\n value = params[object][attribute]\n if value.match('\\d\\d\\d\\d-\\d\\d-\\d\\d')\n # all fine - iso format used\n return\n elsif value.size == 4\n # only year given\n params[object][attribute] = value + \"-01-01\"\n elsif value.match('\\d\\d?\\.\\d\\d?\\.\\d\\d$')\n # wrong format, probably something like 20.10.84\n date = value.split('.')\n year = (date[2].to_i < 10) ? date[2].to_i + 2000 : date[2].to_i + 1900\n date = Date.new( year, date[1].to_i, date[0].to_i ) \n params[object][attribute] = date.to_s\n elsif value.match('\\d?\\d\\.\\d?\\d\\.\\d\\d\\d\\d')\n # wrong format\n date = value.split('.')\n params[object][attribute] = date[2] + \"-\" + date[1] + \"-\" + date[0]\n else\n date = ParseDate.parsedate( value, true )\n params[object][attribute] = date[0].to_s + \"-\" + date[1].to_s + \"-\" + date[2].to_s\n end\n end",
"def reformat_date_for_save(date_string)\n return if date_string.nil?\n month = \"1\"\n day = \"1\"\n year = \"1900\"\n #match = date_string.gsub(\"-\",\"/\").match(/(\\d+)\\/|\\-(\\d+)\\/|\\-(\\d+)/)\n match = date_string.gsub(\"-\", \"/\").split(\"/\")\n month_numbers = {\"Jan\" => \"1\", \"Feb\" => \"2\", \"Mar\" => \"3\", \"Apr\" => \"4\", \"May\" => \"5\", \"Jun\" => \"6\",\n \"Jul\" => \"7\", \"Aug\" => \"8\", \"Sep\" => \"9\", \"Oct\" => \"10\", \"Nov\" => \"11\", \"Dec\" => \"12\"}\n format_codes = GlobalSettings[:default_date_format].gsub(\"-\", \"/\").gsub(\" \", \"/\").split(\"/\")\n format_codes.each_with_index do |fmt, idx|\n case fmt.downcase\n when '%m'\n month = match[idx]\n when '%d'\n day = match[idx]\n when '%y'\n year = match[idx]\n when '%b'\n month = month_numbers[match[idx]]\n end\n end\n \"#{year}-#{month}-#{day}\"\n end",
"def parse_usa_date(date, time_string = nil)\n date = date.to_s.strip\n\n # TODO: Many tests pass either a Date, a Time, or an YYYY-MM-DD formatted\n # string as a parameter. This conditional will handle those cases. We should\n # probably go through and clean up the tests at some point.\n date = format_usa_date(Date.parse(date)) if date =~ /\\A\\d{4}-\\d{2}-\\d{2}/\n\n return unless usa_formatted_date?(date)\n\n date_string = Date.strptime(date, \"%m/%d/%Y\").to_s\n date_string += \" #{time_string}\" if time_string\n\n Time.zone.parse(date_string)\n rescue ArgumentError\n nil\n end",
"def handle_date(attrs, key, warnings)\n if attrs.has_key?(key) && attrs[key].present?\n begin\n # check if it's US looking date\n if attrs[key].respond_to?(:match) && attrs[key].match(/\\d{1,2}\\/\\d{1,2}\\/\\d{4}/)\n attrs[key] = Date.strptime(attrs[key], '%m/%d/%Y').to_s # converts to YYYY-MM-DD\n end\n\n # try to parse it as Rails will\n Date.parse(attrs[key])\n rescue => e\n warnings[key.to_sym] ||= []\n warnings[key.to_sym] << \"#{e}, use YYYY-MM-DD or MM/DD/YYYY format\"\n end\n end\n end",
"def parse_i18n_date(date_str)\n Date.strptime(date_str, I18n.t('date.formats.default'))\n end",
"def parse_date_str (d)\r\n\t\t## Preconditions:\r\n\t\t# check format of date\r\n\t\tdate_arr = d.split(DATE_SPLIT_REGEX)\r\n\t\trtassert(date_arr.size() == 3, ArgumentError,\r\n\t\t\t\"cant recognise format of date '#{d}'\")\r\n\t\t# convert to hyphens as Ruby gets confused with slashes\r\n\t\tdate_str = date_arr.join('-')\r\n\t\t## Main:\r\n\t\t# try each of the supplied date formats\r\n\t\tDATE_FMTS.each { |fmt|\r\n\t\t\tbegin\r\n\t\t\t\tdate_obj = Date.strptime(date_str, fmt)\r\n\t\t\t\treturn date_obj\r\n\t\t\trescue ArgumentError\r\n\t\t\t\t# pass\r\n\t\t\tend\r\n\t\t}\r\n\t\t# try a brute force approach\r\n\t\tbegin\r\n\t\t\tdate_obj = Date.parse(date_str)\r\n\t\t\treturn date_obj \r\n\t\trescue\r\n\t\t\tpp date_arr\r\n\t\t\traise ArgumentError, \"can't recognise format of date '#{d}'\" \r\n\t\tend\r\n\tend",
"def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end",
"def time_converter(string)\n # need to convert to UTC first before converting to date\n date = Time.at(string.to_i).utc.to_date\nend",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def parse_date(string)\n Date.strptime(string.to_s, '%m/%d/%Y') rescue nil\n end",
"def sanitize_date_time(value)\n value.strftime(\"%Y-%m-%d\")\n end",
"def date_mathable(datestr)#i.e. '2011-02-20'\r\n date_time = datestr.split(\" \")\r\n if date_time.length == 1\r\n arg = datestr.split('-')\r\n arg = arg.length == 1 ? datestr.split('.') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n date = Time.local(y,m,d)\r\n return date\r\n elsif date_time.length == 2\r\n arg = date_time[0].split('-')\r\n arg = arg.length == 1 ? date_time[0].split('.') : arg\r\n arg = arg.length == 1 ? date_time[0].split('/') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n arg2 = date_time[1].split(':')\r\n hour = Integer( trim_lead(arg2[0],'0') )\r\n min = arg2[1] == '00' ? 0 : Integer( trim_lead(arg2[1],'0') )\r\n sec = arg2[2] == '00' ? 0 : Integer( trim_lead(arg2[2],'0') )\r\n date = y >= 1000 ? Time.local(y,m,d,hour,min,sec) : Time.local(d,y,m,hour,min,sec)\r\n return date\r\n end \r\n end",
"def parse_date(date_str)\n new_date = Date.parse(date_str)\nend",
"def date_s_to_i(date_str)\n require 'time'\n \n if not validate_date_str(date_str)\n raise BlankGenerationConversionException, \"Invalid date value #{date_str}\"\n end\n \n Time.parse(date_str).to_i\nend",
"def set_date_string(input)\n\n now = Time.new\n date = Time.new\n\n #Handle minute notation.\n if input.downcase[-1] == \"m\" then\n date = now - (60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle hour notation.\n if input.downcase[-1] == \"h\" then\n date = now - (60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle day notation.\n if input.downcase[-1] == \"d\" then\n date = now - (24 * 60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle PowerTrack format, YYYYMMDDHHMM\n if input.length == 12 and numeric?(input) then\n return input\n end\n\n #Handle \"YYYY-MM-DD 00:00\"\n if input.length == 16 then\n return input.gsub!(/\\W+/, '')\n end\n\n #Handle ISO 8601 timestamps, as in Twitter payload \"2013-11-15T17:16:42.000Z\"\n if input.length > 16 then\n date = Time.parse(input)\n return get_date_string(date)\n end\n\n return 'Error, unrecognized timestamp.'\n\n end",
"def string_to_time(string)\n super(handle_date_parse_input(string))\n end",
"def _date_parse(string)\n super(handle_date_parse_input(string))\n end",
"def d(date_string)\n Date.parse(date_string)\nend",
"def format_date(str)\n# str.gsub(/^(\\d\\d\\d\\d)[-|\\/](\\d\\d)[-|\\/](\\d\\d)$/, '\\3.\\2.\\1')\n str.sub(/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/, '\\3.\\2.\\1')\n .sub(/^(\\d\\d\\d\\d)\\/(\\d\\d)\\/(\\d\\d)$/, '\\3.\\2.\\1')\nend",
"def USDateParse(date)\n if (date == nil); raise 'Nil date'; end\n date = Date.strptime(date,'%m/%d/%Y')\n year_2000 = Date.new(2000,1,1)\n year_2100 = Date.new(2100,1,1)\n if date <= year_2000 or date >= year_2100\n date = date + 2000.years\n if date <= year_2000 or date >= year_2100\n raise \"Invalid Date\"\n end\n end\n return date\n end",
"def normalize_date(date)\r\n if date.chars.length==3\r\n norm_date = Date.strptime(date, '%m-%d')\r\n else\r\n norm_date = Date.strptime(date, '%m-%d-%y')\r\n end\r\n norm_date = norm_date.to_s\r\nend",
"def validateDate(date)\n\n year = '[1-2][90][0-9][0-9]'\n month = '0[1-9]|10|11|12'\n day = '[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1]'\n hour = '[0-1][0-9]|2[0-3]|[1-9]'\n minute = '[0-5][0-9]'\n second = '[0-5][0-9]'\n case date\n when /^(#{year})(#{month})(#{day})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' 00:00:00'\n when /^(#{year})(#{month})(#{day})(#{hour})(#{minute})(#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})\\s(#{hour})[\\:](#{minute})[\\:](#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})$/\n day = \"%02d\" % $3\n month = \"%02d\" % $2\n\n # Return the identified string\n $1 + ':' + month + ':' + day + ' 00:00:00'\n\n else\n\n # This wasn't a date we recognize\n false\n\n end\n end",
"def format_date(string)\n string.sub(/\\A(\\d\\d\\d\\d)(\\-|\\/)(\\d\\d)(\\-|\\/)(\\d\\d)/, '\\5.\\3.\\1')\nend",
"def parse_date\r\n if params[:record]\r\n external_key = \"\";\r\n invalid_year = false;\r\n params[:record].dup.each { |key, value|\r\n if key.include?(\"1i\")\r\n invalid_year = value.to_i < 1000\r\n external_key = key.split(\"(\")[0]\r\n end\r\n\r\n if invalid_year\r\n invalid_year = false\r\n params[:record].delete_if { |key, value|\r\n key.include?(external_key)\r\n }\r\n\r\n params[:record][external_key] = params[:record].delete(external_key)\r\n end\r\n }\r\n end\r\n end",
"def normalize_date(date)\n if zone = active_workspace_configuration[\"TimeZone\"]\n Time.parse(date).in_time_zone(zone).to_date rescue Date.parse(date)\n else\n Date.parse(date)\n end\n end",
"def test_Convert_Date_002_DatesAsStrings\n\n require 'date'\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Convert_Date_002_DatesAsStrings\")\n puts2(\"#######################\")\n\n puts2(\"Testing dates expressed as STRINGS\\n\\n\")\n\n # Array of date strings to test\n aDateStrings = [\n \"12/31/2000\",\n \"1/1/01\",\n \"01/02/01\",\n \"1/3/1\",\n \"1/4/01\",\n \"1/5/01\",\n \"1/6/01\",\n \"2/1/01\",\n \"3/1/01\",\n \"4/1/01\",\n \"5/1/01\",\n \"6/1/01\",\n \"7/1/01\",\n \"8/1/01\",\n \"9/1/01\",\n \"10/1/01\",\n \"11/1/01\",\n \"12/1/01\"\n ]\n\n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n end\n\n end",
"def parse_date(date_string)\n match = date_string.match(/([0-9]{1,2})\\/([0-9]{1,2})\\/([0-9]{4})/)\n month = match[1].to_i\n day = match[2].to_i\n year = match[3].to_i\n Date.new(year, month, day)\nend",
"def parse_datetime(string)\n res = DATE_PARSERS.detect do |parser|\n return parser.parse(string).feed_utils_to_gm_time\n rescue StandardError => e\n Feedjira.logger.debug { \"Failed to parse date #{string}\" }\n Feedjira.logger.debug(e)\n nil\n end\n\n Feedjira.logger.warn { \"Failed to parse date #{string}\" } if res.nil?\n\n res\n end",
"def test_String_009_format_dateString_mmddyyyy\n \n #require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_009_format_dateString_mmddyyyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS to the 1900's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1/1/01\",\n \"01/02/01\",\n \"11/1/01\",\n \"1/10/01\",\n \"12/31/2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\"/\" ,\"19\"))\n end\n \n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS to the 2300's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1.1.01\",\n \"01.02.01\",\n \"11.1.01\",\n \"1.10.01\",\n \"12.31.2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\".\" ,\"23\"))\n end\n \n end",
"def date(string)\n return if string.blank?\n return string if string.is_a?(Date)\n\n Date.parse(string)\n rescue Date::Error\n components = string\n .split(\"-\")\n .map(&:to_i)\n .reject(&:zero?)\n .compact\n\n return if components.empty?\n\n Date.new(*components)\n rescue ArgumentError\n nil\n end",
"def format_date(string)\n string.sub(/\\A(\\d{4})([\\-\\/])(\\d{2})\\2(\\d{2})\\z/, '\\4.\\3.\\1')\nend",
"def datetime_escape(string)\n Time.parse(string)\n end",
"def read_date(date)\r\n case date\r\n when /(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/ # format DD.MM.YYYY nebo DD. MM. YYYY\r\n date.scan(/(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[1]}-#{sep[0]}\"\r\n return new_date\r\n end\r\n when /(\\d{2})\\/(\\d{2})\\/(\\d{4})/\r\n date.scan(/(\\d{2})\\/(\\d{2})\\/(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[0]}-#{sep[1]}\"\r\n return new_date\r\n end\r\n when /(\\d{4})\\-(\\d{2})\\-(\\d{2})/ # format YYYY-MM-DD\r\n return date\r\n else\r\n puts \"ERROR! Neplatny format \\\"#{date}\\\" (prijejte format do funkce \\\"read_date\\\")\"\r\n end\r\nend",
"def coerce_datetime(datetime_string)\n case datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})$/\n datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})/\n datetime = datetime_escape(datetime_string)\n datetime.strftime(Sparkql::FunctionResolver::STRFTIME_DATE_FORMAT)\n else\n datetime_string\n end\n end",
"def convert_to_date(str_date)\n Date.parse(str_date) if str_date\n end",
"def date_str_for_display\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return display_str_for_bc if orig_date_str.match(BC_REGEX)\n # decade next in case there are 4 digits, e.g. 1950s\n return display_str_for_decade if orig_date_str.match(DECADE_4CHAR_REGEXP) || orig_date_str.match(DECADE_S_REGEXP)\n\n result = sortable_year_for_yyyy_or_yy\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).date_str_for_display if no_brackets\n end\n # parsing below this line gives string inapprop for year_str_valid?\n unless self.class.year_str_valid?(result)\n result = display_str_for_century\n result ||= display_str_for_early_numeric\n end\n # remove leading 0s from early dates\n result = \"#{result.to_i} A.D.\" if result && result.match(/^0\\d+$/)\n result\n end",
"def convertStrToDate(str, format)\n return Date.strptime(str, format)\nend",
"def fix_date(date=nil)\n if date == nil\n # no full date, use current\n yy, mm, dd = Time.now.strftime(\"%Y/%m/%d\").split('/')\n elsif date.size == 3\n # we got full date\n if date[0].size == 4\n # yyyy/mm/dd\n yy = date[0].strip\n mm = date[1].strip\n dd = date[2].strip.rjust(2,'0')\n else\n # dd/mm/yyyy\n dd = date[0].strip.rjust(2,'0')\n mm = date[1].strip\n yy = date[2].strip\n end\n case mm.downcase\n when 'enero' :\n mm = '01'\n when 'febrero' :\n mm = '02'\n when 'marzo' :\n mm = '03'\n when 'abril' :\n mm = '04'\n when 'mayo' :\n mm = '05'\n when 'junio' :\n mm = '06'\n when 'julio' :\n mm = '07'\n when 'agosto' :\n mm = '08'\n when 'setiembre' :\n mm = '09'\n when 'septiembre' :\n mm = '09'\n when 'octubre' :\n mm = '10'\n when 'noviembre' :\n mm = '11'\n when 'diciembre' :\n mm = '12'\n else\n mm.rjust(2,'0')\n end\n end\n return yy, mm, dd\n end",
"def parse_iso_8601_date(string)\n if string =~ ISO_8601_DATE\n Date.parse(string) rescue nil\n end\n end",
"def format_date_nicely(date)\nend",
"def recovered?(date_string)\n date_string.strip[6..9].to_i > 1900\n rescue => e\n puts \"error with: #{date_string}\"\n raise e\n end",
"def to_date(string)\n Date.parse(string)\n rescue\n nil\n end",
"def sortable_year_string_from_date_str\n return if orig_date_str == '0000-00-00' # shpc collection has these useless dates\n # B.C. first in case there are 4 digits, e.g. 1600 B.C.\n return sortable_year_str_for_bc if orig_date_str.match(BC_REGEX)\n\n result = sortable_year_for_yyyy_or_yy\n result ||= sortable_year_for_decade # 19xx or 20xx\n result ||= sortable_year_for_century\n result ||= sortable_year_str_for_early_numeric\n unless result\n # try removing brackets between digits in case we have 169[5] or [18]91\n no_brackets = remove_brackets\n return DateParsing.new(no_brackets).sortable_year_string_from_date_str if no_brackets\n end\n result if self.class.year_str_valid?(result)\n end",
"def convert_dates_from(data)\n case data\n when nil\n nil\n when ActiveSupport::JSON::DATE_REGEX\n begin\n Date.parse(data)\n rescue ArgumentError\n data\n end\n when ActiveSupport::JSON::DATETIME_REGEX\n begin\n Time.zone.parse(data).utc.to_datetime\n rescue ArgumentError\n data\n end\n when Array\n data.map! { |d| convert_dates_from(d) }\n when Hash\n data.each do |key, value|\n data[key] = convert_dates_from(value)\n end\n else\n data\n end\n end",
"def parse_date(date)\n case date\n when /\\A\\s*(\\d+)-(\\d+)-(\\d+)(?:[ T](\\d+):(\\d+):(\\d+) *([-+]\\d\\d):?(\\d\\d))?\\b/\n Time.new($1, $2, $3, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3}, +(\\d+) (\\w{3}) (\\d+) (\\d+):(\\d+):(\\d+) *(?:([-+]\\d\\d):?(\\d\\d))\\b/\n Time.new($3, $2, $1, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3} (\\w{3}) +(\\d+) (\\d+) (\\d+):(\\d+):(\\d+) *(?:([-+]\\d\\d):?(\\d\\d))\\b/\n Time.new($3, $1, $2, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3} (\\w{3}) +(\\d+) (\\d+):(\\d+):(\\d+) (\\d+)\\b/\n Time.new($6, $1, $2, $3, $4, $5)\n else\n raise ArgumentError, \"bad date: #{date}\"\n end\n end",
"def parse_date(string)\n begin\n Date.parse(string)\n rescue ArgumentError\n nil\n end\n end",
"def normalize_date( date )\n\n # look for the expected pattern (YYYY-MM-DD)\n matches = /^(\\d{4}-\\d{2}-\\d{2})/.match( date )\n return matches[ 1 ] if matches\n\n # look for YYYY-MM and append '-01' if we find it\n matches = /^(\\d{4}-\\d{2})/.match( date )\n return \"#{matches[ 1 ]}-01\" if matches\n\n # look for YYYY and append '-01-01' if we find it\n matches = /^(\\d{4})/.match( date )\n return \"#{matches[ 1 ]}-01-01\" if matches\n\n # give up and return what we were provided\n return date\n\n end",
"def convert_datetime(date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return nil if self[attribute + '(1i)'].nil? || self[attribute + '(2i)'].nil? || self[attribute + '(3i)'].nil? || self[attribute + '(4i)'].nil? || self[attribute + '(5i)'].nil? \n return Time.local(self[attribute + '(1i)'].to_i, self[attribute + '(2i)'].to_i, self[attribute + '(3i)'].to_i, self[attribute + '(4i)'].to_i, self[attribute + '(5i)'].to_i) \n end",
"def parse_datetime_string\r\n dt = String.new\r\n self.date_of_birth.split('/').each{|x| dt = dt + (x.to_i < 10 ? '0'+ x + '/' : x + \"/\")}\r\n self.date_of_birth = DateTime.strptime(dt, \"%m/%d/%Y/\")\r\n self\r\n end",
"def cleanField(text = \"\")\n text.gsub!(\"Twentieth Century\", \"\") # date parser hates this...\n text.gsub!(\"-\",\" - \")\n \n text.scan(/(\\b\\d{4}s)/).each {|s| text.gsub!(s.first, convertDecades(s.first) )} #we need to convert decades with s'es (1930s) into ranges. \n text.scan(/(c\\d{4})/).each { |s| text.gsub!(s.first, s.first.delete(\"c\") )} #we need to remove c in copyright dates c1990 \n text.scan(/(\\d{4},)/).each {|s| text.gsub!(s.first, s.first.delete(\",\") )} #we need to remove commas after dates, like 1990,\n text.scan(/(\\d\\/)\\d{4}/).each { |p| text.gsub!( p.first, \"0#{p.first.gsub(\"/\", \"-\")}\" ) }\n \n \n text\n \n end",
"def process_date(date)\n #store our values in a hash, making it easier to access\n date_hash = Hash.new\n #if the date is only a year we'll process that\n if date.length == 4\n date_hash[\"year\"] = \"2011\"\n\n #otherwise we'll process it as a normal date.We assume normal date formatting'\n else\n separated_date = date.split(\"-\")\n date_hash[\"year\"] = separated_date[0]\n #case incase they forget that month should be before day.\n #so if the \"month\" is greater than 12 we know the meant day instead\n if separated_date[1].to_i >12\n date_hash[\"month\"] = separated_date[2].gsub(\"0\",\"\")\n date_hash[\"day\"] = separated_date[1].gsub(\"0\",\"\")\n #else proceed as normal\n else\n date_hash[\"month\"] = separated_date[1].gsub(\"0\",\"\")\n date_hash[\"day\"] = separated_date[2].gsub(\"0\",\"\")\n end\n\n end\n\n\n return date_hash\n end",
"def pdf_date_translate(value)\n # Strip optional date tag. If the remainder is just four digits, pass it\n # back as a year value in a form that Date#parse will accept. If the\n # remainder doesn't have at least five digits then assume this is not an\n # ASN.1 style date and that, hopefully, Date#parse can handle it.\n value = value.to_s.strip.upcase.delete_prefix('D:')\n return \"#{$1}/01\" if value.match(/^(#{YEAR})$/)\n return value unless value.match(/^\\d{5}/)\n\n # Strip the optional timezone from the end so that *tz* is either *nil*,\n # 'Z', \"-hh:mm\" or \"+hh:mm\". (The single quotes are supposed to be\n # required, but this will attempt to handle variations that aren't too\n # off-the-wall.)\n tz = nil\n value.sub!(ASN_1_TIMEZONE) do |match|\n tz = (match == ZULU) ? match : $1 + [$2, $4].compact_blank.join(':')\n '' # Remove the matched substring from *value*.\n end\n\n # Get optional date and time parts. Because Date#parse won't accept\n # something like \"2021-12\" but will correctly interpret \"2021/12\" as\n # \"December 2021\", '/' is used as the date separator.\n result = []\n # noinspection RubyResolve\n value.sub!(ASN_1_DATETIME) do\n result << [$1, $3, $5 ].compact_blank.join('/') # Date parts\n result << [$7, $9, $10].compact_blank.join(':') # Time parts\n result << tz # Time zone\n end\n result.compact_blank!.join(' ')\n end",
"def parsed_date(date_string, default)\n Date.parse(date_string)\n rescue ArgumentError, TypeError # Help out to find what issue - user typing issues.eg date instead of sentence\n default\n end",
"def formalize_date(pubdate_str)\n # Allowed sample date formats: DEC 2:2021; 25-Dec:2019; Jul:2019; :2019\n wos_formats = ['%b %d:%Y', '%d-%b:%Y', '%b:%Y', ':%Y']\n parsed = nil\n wos_formats.each do |format|\n begin\n parsed = Date.strptime(pubdate_str, format)\n break\n rescue StandardError => e\n Rails.logger.warn \"Repository Work formalize date error #{e.message}\"\n nil\n end\n end\n return parsed.to_s\n end",
"def convert_to_datetime(string)\n return nil if (string.nil? || string.class != String)\n Chronic.parse(string)\n end",
"def parse_date(input, msg = T.unsafe(nil)); end",
"def date_string_to_readable(db_date)\n\n # Parse string (db date) to DateTime\n date = date_string_to_object(db_date)\n\n # Format it to a more readable string\n string = \"#{date.day}/#{date.month}/#{date.year}\"\n string << \" #{date.hour}:#{date.minute}\"\n\n return string\nend",
"def parse_date(datestring)\n days = 0\n if datestring =~ /^\\+(\\d+)$/\n days = (60 * 60 * 24 * $1.to_i)\n newdate = Time.now + days\n else\n newdate = Chronic.parse(datestring, {context: :future, ambiguous_time_range: 8})\n end\n # parsed = newdate.strftime('%D %l:%M%p').gsub(/\\s+/,' ');\n # return parsed =~ /1969/ ? false : parsed\n return newdate\n end",
"def decode_date(value)\n return nil if value.blank?\n value.is_a?(String) ? value.gsub(' ', '0').to_date : value.to_date\n rescue\n nil\n end",
"def format_date\n begin\n self.eob_date = Date.strptime(self.unformatted_eob_date, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_eob_date.blank?\n self.dos = Date.strptime(self.unformatted_dos, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_dos.blank?\n self.check_date = Date.strptime(self.unformatted_check_date, \"%m/%d/%Y\").to_time(:utc) if !self.unformatted_check_date.blank?\n rescue\n errors.add :base, \"Invalid Date(s)\"\n end\n end",
"def clean_date(date)\n mo_day_year = date.split(\" \")[0]\n \n return mo_day_year.split(\"/\")\nend",
"def convert_to_datetime(string)\n return nil if string.blank?\n Chronic.parse(string)\n end",
"def date(date)\n Date.strptime(date,\"%m/%d/%y\")\n rescue ArgumentError => e \n raise unless e.to_s =~ /invalid date/\n raise BadTime, e.to_s\n end",
"def decode_json(json_str)\n convert_dates_from(JSON.parse(json_str, symbolize_names: true))\n end",
"def check_date(date)\n check = /^\\d{2}\\/\\d{2}\\/\\d{4}/\n unless date =~ check\n return ''\n else\n return date\n end\n end",
"def isoify_dates!(hash)\n hash.replace isoify_dates hash\n end",
"def scrub_date(hash)\n scrubbed_hash = {}\n hash.each do |key, value|\n scrubbed_hash[key.gsub(/[a-z]/, '')] = value\n end\n scrubbed_hash\n end",
"def solrize_date(date)\n date.strftime('%Y-%m-%dT00:00:00Z')\n end",
"def split_date(string)\n case string\n when /\\sat\\s/\n split = string.split(\" at \")\n { date: normalize_date_pair([split.first]), time: split.last.split(\" - \") }\n when /\\s-\\s/\n { date: normalize_date_pair(string.split(\" - \")), time: nil }\n when /^after /\n { date: normalize_date_pair([string.gsub(\"after\", \"\").strip]), time: nil }\n else\n { date: normalize_date_pair([string]), time: nil }\n end\n end",
"def post_process_date( val )\n\t\t\treturn Date.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def extract_yyyymmdd_from_datestring( date )\n\n return nil if date.blank?\n\n #puts \"==> DATE IN [#{date}]\"\n begin\n\n # try yyyy-mm-dd (at the start of the string)\n dts = date.match( /^(\\d{4}-\\d{1,2}-\\d{1,2})/ )\n return dts[ 0 ] if dts\n\n # try yyyy/mm/dd (at the start of the string)\n dts = date.match( /^(\\d{4}\\/\\d{1,2}\\/\\d{1,2})/ )\n return dts[ 0 ].gsub( '/', '-' ) if dts\n\n # try yyyy-mm (at the start of the string)\n dts = date.match( /^(\\d{4}-\\d{1,2})/ )\n return dts[ 0 ] if dts\n\n # try yyyy/mm (at the start of the string)\n dts = date.match( /^(\\d{4}\\/\\d{1,2})/ )\n return dts[ 0 ].gsub( '/', '-' ) if dts\n\n # try mm/dd/yyyy (at the start of the string)\n dts = date.match( /^(\\d{1,2}\\/\\d{1,2}\\/\\d{4})/ )\n return DateTime.strptime( dts[ 0 ], \"%m/%d/%Y\" ).strftime( \"%Y-%m-%d\" ) if dts\n\n # try yyyy (anywhere in the string)\n dts = date.match( /(\\d{4})/ )\n return dts[ 0 ] if dts\n\n rescue => ex\n #puts \"==> EXCEPTION: #{ex}\"\n # do nothing...\n end\n\n # not sure what format\n return nil\n end",
"def parse_date(date)\n date.to_date\n rescue\n Date.strptime(date, '%m/%d/%Y') rescue nil\n end",
"def date_range_from_string(date_str)\n if date_str == nil || date_str.length < 4\n return nil\n end\n\n if date_str.length == 4\n # single year\n return date_str\n end\n\n # multiple year, take the first two\n years = date_str.split(\"/\")\n if years.count < 2\n return years[0]\n end\n return years[0] + \"/\" + years[1]\n end",
"def format_date(string)\n string.sub(/\\A(\\d{4})-(\\d{2})-(\\d{2})\\z/, '\\3.\\2.\\1')\nend",
"def is_valid_date?(string_date, format=\"%d/%m/%Y\")\n begin\n time = Date.strptime(string_date, format)\n rescue ArgumentError\n return false\n end\n true\n end",
"def convertDate(date)\n dateHash = date\n dateFormat = Date.parse dateHash\n dateString = dateFormat.strftime('%A, %b %d')\n return dateString \nend",
"def format_date(string)\n string.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)/, '\\3.\\2.\\1')\nend",
"def sanitize_time(time)\n Time.local(time.year, time.month, time.day, time.hour, time.min, time.sec) unless time.nil?\n end",
"def convert_date(date)\n d = date.split('/')\n \"#{d[2]}-#{d[0]}-#{d[1]}\".to_date\n end",
"def correct_format(string)\n parts = string.split(\"-\")\n if parts[0].include?(\"AM\") then parts[0] = \"#{set_24hour(parts[0].split(\":\").first, false)}:30\" else parts[0] = \"#{set_24hour(parts[0].split(\":\").first)}:30\" end \n if parts[1].include?(\"AM\") then parts[1] = \"#{set_24hour(parts[1].split(\":\").first, false)}:30\" else parts[1] = \"#{set_24hour(parts[1].split(\":\").first)}:30\" end\n parts[2] = what_day(parts[2])\n return \"#{parts[0]}-#{parts[1]}-#{parts[2]}\"\n end",
"def parse_date(date_str)\n split = date_str.split('-')\n Date.new(split[0].to_i, split[1].to_i, split[2].to_i)\nend"
] |
[
"0.64009744",
"0.6249786",
"0.6082967",
"0.60786235",
"0.60703707",
"0.60011",
"0.59392226",
"0.59177995",
"0.589846",
"0.585969",
"0.5844215",
"0.5844215",
"0.58311677",
"0.58273405",
"0.58135545",
"0.58114177",
"0.57983214",
"0.57799935",
"0.5759994",
"0.5758653",
"0.5758551",
"0.5756638",
"0.5734369",
"0.57230735",
"0.57026863",
"0.5698485",
"0.56663465",
"0.56663465",
"0.56114584",
"0.5592881",
"0.5588396",
"0.55871475",
"0.55860484",
"0.5581348",
"0.5575414",
"0.5564204",
"0.5560467",
"0.555153",
"0.55410415",
"0.5535025",
"0.5532034",
"0.55256855",
"0.5519613",
"0.5491467",
"0.54907215",
"0.5481719",
"0.54777926",
"0.5473908",
"0.5446634",
"0.54449475",
"0.5437969",
"0.5426274",
"0.54176784",
"0.5413667",
"0.54086417",
"0.53799206",
"0.537369",
"0.5370633",
"0.5367761",
"0.53648496",
"0.5359106",
"0.53404224",
"0.5339244",
"0.5338352",
"0.53337586",
"0.53330994",
"0.53135085",
"0.5310241",
"0.530947",
"0.530595",
"0.52975476",
"0.52896094",
"0.528709",
"0.5286371",
"0.5285602",
"0.5281228",
"0.5273384",
"0.52669966",
"0.52658856",
"0.52637327",
"0.52576995",
"0.5257197",
"0.52471787",
"0.5244334",
"0.5224547",
"0.52197605",
"0.52138335",
"0.520153",
"0.51990545",
"0.5193814",
"0.5192261",
"0.5189795",
"0.5187122",
"0.5180887",
"0.518002",
"0.5176771",
"0.5169275",
"0.5168967",
"0.51530766",
"0.5142698"
] |
0.6890183
|
0
|
Use safe_datetime_string help with those pesky US date formats in Ruby 1.9 or to change an integer string to date
|
def to_date
return self.to_i.to_date if self =~ DIGIT_ONLY_REGEX
if self =~ US_DATE_REGEX
Date.strptime(self.tr(DATE_TR,'-'), US_DATE_FORMAT)
elsif self =~ JSON_DATE_REGEX
json_date_to_time.to_date
else
Date.strptime(self.tr(DATE_TR,'-'), ISO_DATE_FORMAT)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end",
"def safe_datetime_string\n safe_date = nil\n if self =~ US_DATE_REGEX\n safe_date = us_date_to_iso_str\n elsif self =~ JSON_DATE_REGEX\n safe_date = json_date_to_time.to_s\n else\n safe_date = self\n end\n safe_date\n end",
"def string_to_date(string)\n super(handle_date_parse_input(string))\n end",
"def handle_date_parse_input(string)\n string\n end",
"def parse_date(input, msg = T.unsafe(nil)); end",
"def d(date_string)\n Date.parse(date_string)\nend",
"def parse_date(s)\n begin\n if s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([2-9]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/19#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([0-1]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/20#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/\n date = DateTime.parse(\"#{$2}/#{$1}/#{$3}\")\n elsif s =~ /^(\\d\\d\\d\\d)-(\\d\\d)$/\n if (1...13).include?($2.to_i) and (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n elsif s =~ /^(\\d\\d\\d\\d)$/\n if (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n else\n date = DateTime.parse(s)\n end\n rescue\n return nil\n end\n return date.strftime(\"%Y-%m-%d\")\n end",
"def date_s_to_i(date_str)\n require 'time'\n \n if not validate_date_str(date_str)\n raise BlankGenerationConversionException, \"Invalid date value #{date_str}\"\n end\n \n Time.parse(date_str).to_i\nend",
"def coerce_datetime(datetime_string)\n case datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})$/\n datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})/\n datetime = datetime_escape(datetime_string)\n datetime.strftime(Sparkql::FunctionResolver::STRFTIME_DATE_FORMAT)\n else\n datetime_string\n end\n end",
"def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end",
"def test_Convert_Date_003_InvalidDatesAsStrings\n\n require 'date'\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Convert_Date_003_InvalidDatesAsStrings\")\n puts2(\"#######################\")\n\n puts2(\"Testing invalid dates expressed as STRINGS\\n\\n\")\n\n sDateString = \"6/31/08\"\n puts2(\"\\nTrying an invalid month specific date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"14/04/2010\"\n puts2(\"\\nTrying an invalid month specific date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"12-88-2010\"\n puts2(\"\\nTrying an invalid date in any month\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"02/29/2001\"\n puts2(\"\\nTrying an invalid Leap Year date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n end",
"def parse_datetime_string\r\n dt = String.new\r\n self.date_of_birth.split('/').each{|x| dt = dt + (x.to_i < 10 ? '0'+ x + '/' : x + \"/\")}\r\n self.date_of_birth = DateTime.strptime(dt, \"%m/%d/%Y/\")\r\n self\r\n end",
"def change_date(date)\n require 'date'\n date = DateTime.parse(date)\nend",
"def parse_date_str (d)\r\n\t\t## Preconditions:\r\n\t\t# check format of date\r\n\t\tdate_arr = d.split(DATE_SPLIT_REGEX)\r\n\t\trtassert(date_arr.size() == 3, ArgumentError,\r\n\t\t\t\"cant recognise format of date '#{d}'\")\r\n\t\t# convert to hyphens as Ruby gets confused with slashes\r\n\t\tdate_str = date_arr.join('-')\r\n\t\t## Main:\r\n\t\t# try each of the supplied date formats\r\n\t\tDATE_FMTS.each { |fmt|\r\n\t\t\tbegin\r\n\t\t\t\tdate_obj = Date.strptime(date_str, fmt)\r\n\t\t\t\treturn date_obj\r\n\t\t\trescue ArgumentError\r\n\t\t\t\t# pass\r\n\t\t\tend\r\n\t\t}\r\n\t\t# try a brute force approach\r\n\t\tbegin\r\n\t\t\tdate_obj = Date.parse(date_str)\r\n\t\t\treturn date_obj \r\n\t\trescue\r\n\t\t\tpp date_arr\r\n\t\t\traise ArgumentError, \"can't recognise format of date '#{d}'\" \r\n\t\tend\r\n\tend",
"def parse_date(date, fmt = nil)\n return nil if(date.blank?)\n return DateTime.strptime(date, fmt) if(fmt) # format given\n return DateTime.new(date.to_i) if(date.size < 5) # this short should be a year\n DateTime.parse(date)\n end",
"def parse_date(date_str)\n new_date = Date.parse(date_str)\nend",
"def _date_parse(string)\n super(handle_date_parse_input(string))\n end",
"def convertStrToDate(str, format)\n return Date.strptime(str, format)\nend",
"def rescue_and_retry_datetime(object, error)\n raise DateTimeDataError, object unless error.message == 'invalid date'\n\n DateTime.strptime(object, '%m/%d/%Y').to_s\n rescue ArgumentError\n raise DateTimeDataError, object\n end",
"def resolve_date(date_str)\n u_count = date_str.count 'u'\n # Replace unknown digits with 0.\n date = date_str.tr('u', '0').to_i\n if u_count.positive? && date != 0\n delta = 10**u_count # 10^u_count, exponent\n date + (delta / 2) if delta <= ESTIMATE_TOLERANCE\n elsif date != 0\n date\n end\n end",
"def test_string_should_convert_to_date\n \n [\"44.12.2013\", \"37.12.2012\", \"1.12.2012\", \"21.1.2012\"].each do |d|\n assert_raise ArgumentError do \n d.to_date \n end\n end \n \n assert_equal Date.new(2012,1,1), \"01.01.2012\".to_date \n assert_equal Date.new(2012,12,27), \"27.12.2012\".to_date \n assert_equal Date.new(2012,12,24), \"Christmas is on 24.12.2012 in year 2012\".to_date \n \n end",
"def parsed_date(date_string, default)\n Date.parse(date_string)\n rescue ArgumentError, TypeError # Help out to find what issue - user typing issues.eg date instead of sentence\n default\n end",
"def parse_date(date_string)\n selected_format = DATE_FORMATS.select{|date_format| date_string =~ date_format[:format]}[0]\n Date.strptime(date_string, selected_format[:type]) if selected_format\n end",
"def handle_date(attrs, key, warnings)\n if attrs.has_key?(key) && attrs[key].present?\n begin\n # check if it's US looking date\n if attrs[key].respond_to?(:match) && attrs[key].match(/\\d{1,2}\\/\\d{1,2}\\/\\d{4}/)\n attrs[key] = Date.strptime(attrs[key], '%m/%d/%Y').to_s # converts to YYYY-MM-DD\n end\n\n # try to parse it as Rails will\n Date.parse(attrs[key])\n rescue => e\n warnings[key.to_sym] ||= []\n warnings[key.to_sym] << \"#{e}, use YYYY-MM-DD or MM/DD/YYYY format\"\n end\n end\n end",
"def set_date_string(input)\n\n now = Time.new\n date = Time.new\n\n #Handle minute notation.\n if input.downcase[-1] == \"m\" then\n date = now - (60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle hour notation.\n if input.downcase[-1] == \"h\" then\n date = now - (60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle day notation.\n if input.downcase[-1] == \"d\" then\n date = now - (24 * 60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle PowerTrack format, YYYYMMDDHHMM\n if input.length == 12 and numeric?(input) then\n return input\n end\n\n #Handle \"YYYY-MM-DD 00:00\"\n if input.length == 16 then\n return input.gsub!(/\\W+/, '')\n end\n\n #Handle ISO 8601 timestamps, as in Twitter payload \"2013-11-15T17:16:42.000Z\"\n if input.length > 16 then\n date = Time.parse(input)\n return get_date_string(date)\n end\n\n return 'Error, unrecognized timestamp.'\n\n end",
"def parse_date(date)\n date = DateTime.parse(date.to_s)\n rescue ArgumentError\n raise ArgumentError, \"#{date} is not a valid date\"\n end",
"def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend",
"def usualParser(dateTimeString, inputFormat)\n ft = formatConvertor(inputFormat)\n puts ft\n begin\n dt = DateTime.strptime(dateTimeString, ft)\n print \"#{dt}\"\n rescue\n puts \"Invalid String or String does not match the specified format\"\n end\nend",
"def datetime_escape(string)\n Time.parse(string)\n end",
"def recovered?(date_string)\n date_string.strip[6..9].to_i > 1900\n rescue => e\n puts \"error with: #{date_string}\"\n raise e\n end",
"def convert_to_date(string)\n return nil if (string.nil? || string.class != String)\n tmp = Chronic.parse(string)\n tmp ? tmp.to_date : nil\n end",
"def to_date(string)\n Date.parse(string)\n rescue\n nil\n end",
"def normalize_date( object, attribute, params )\n value = params[object][attribute]\n if value.match('\\d\\d\\d\\d-\\d\\d-\\d\\d')\n # all fine - iso format used\n return\n elsif value.size == 4\n # only year given\n params[object][attribute] = value + \"-01-01\"\n elsif value.match('\\d\\d?\\.\\d\\d?\\.\\d\\d$')\n # wrong format, probably something like 20.10.84\n date = value.split('.')\n year = (date[2].to_i < 10) ? date[2].to_i + 2000 : date[2].to_i + 1900\n date = Date.new( year, date[1].to_i, date[0].to_i ) \n params[object][attribute] = date.to_s\n elsif value.match('\\d?\\d\\.\\d?\\d\\.\\d\\d\\d\\d')\n # wrong format\n date = value.split('.')\n params[object][attribute] = date[2] + \"-\" + date[1] + \"-\" + date[0]\n else\n date = ParseDate.parsedate( value, true )\n params[object][attribute] = date[0].to_s + \"-\" + date[1].to_s + \"-\" + date[2].to_s\n end\n end",
"def convert_day_to_date string\r\n Date.strptime(string.to_s,\"%Y%m%d\")\r\n end",
"def parse_date(date_string)\n result = sugarcube_detect(date_string).first\n if result\n return result.date\n else\n return iso8601(date_string)\n end\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def parse_date(string)\n Date.strptime(string.to_s, '%m/%d/%Y') rescue nil\n end",
"def date(date)\n Date.strptime(date,\"%m/%d/%y\")\n rescue ArgumentError => e \n raise unless e.to_s =~ /invalid date/\n raise BadTime, e.to_s\n end",
"def convert_to_date(str_date)\n Date.parse(str_date) if str_date\n end",
"def parse_date(date_str)\n split = date_str.split('-')\n Date.new(split[0].to_i, split[1].to_i, split[2].to_i)\nend",
"def time_converter(string)\n # need to convert to UTC first before converting to date\n date = Time.at(string.to_i).utc.to_date\nend",
"def post_process_date( val )\n\t\t\treturn Date.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def flexible_value_to_date(value, options = {})\n allow_string = options[:allow_string]\n string_condition = allow_string.kind_of?(Regexp) ? allow_string : String\n case value\n when Hash\n if value[:year].blank? || value[:month].blank? || value[:day].blank?\n nil\n else\n begin\n Date.new(value[:year].to_i,value[:month].to_i, value[:day].to_i)\n rescue\n nil\n end\n end\n else\n if allow_string\n case value\n when string_condition\n begin\n Date.parse(value)\n rescue\n nil\n end\n end\n else\n nil\n end\n end\n end",
"def parse_date(date_string)\n match = date_string.match(/([0-9]{1,2})\\/([0-9]{1,2})\\/([0-9]{4})/)\n month = match[1].to_i\n day = match[2].to_i\n year = match[3].to_i\n Date.new(year, month, day)\nend",
"def coerce_date(value)\n case value\n when Date\n value\n when String\n Date.parse(value)\n else\n raise ArgumentError, \"expected: Date or String, got: \" +\n value.inspect\n end\n end",
"def date(string)\n return if string.blank?\n return string if string.is_a?(Date)\n\n Date.parse(string)\n rescue Date::Error\n components = string\n .split(\"-\")\n .map(&:to_i)\n .reject(&:zero?)\n .compact\n\n return if components.empty?\n\n Date.new(*components)\n rescue ArgumentError\n nil\n end",
"def convert_datetime(date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return nil if self[attribute + '(1i)'].nil? || self[attribute + '(2i)'].nil? || self[attribute + '(3i)'].nil? || self[attribute + '(4i)'].nil? || self[attribute + '(5i)'].nil? \n return Time.local(self[attribute + '(1i)'].to_i, self[attribute + '(2i)'].to_i, self[attribute + '(3i)'].to_i, self[attribute + '(4i)'].to_i, self[attribute + '(5i)'].to_i) \n end",
"def datetime_data(object)\n return object unless object.present?\n\n DateTime.strptime(object, '%Y-%m-%d').to_s\n rescue ArgumentError => e\n rescue_and_retry_datetime(object, e)\n end",
"def read_date(date)\r\n case date\r\n when /(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/ # format DD.MM.YYYY nebo DD. MM. YYYY\r\n date.scan(/(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[1]}-#{sep[0]}\"\r\n return new_date\r\n end\r\n when /(\\d{2})\\/(\\d{2})\\/(\\d{4})/\r\n date.scan(/(\\d{2})\\/(\\d{2})\\/(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[0]}-#{sep[1]}\"\r\n return new_date\r\n end\r\n when /(\\d{4})\\-(\\d{2})\\-(\\d{2})/ # format YYYY-MM-DD\r\n return date\r\n else\r\n puts \"ERROR! Neplatny format \\\"#{date}\\\" (prijejte format do funkce \\\"read_date\\\")\"\r\n end\r\nend",
"def parse_iso_8601_date(string)\n if string =~ ISO_8601_DATE\n Date.parse(string) rescue nil\n end\n end",
"def coerce_date(value, options = {})\n value = coerce_string(value)\n begin\n Date.strptime(value, options.fetch(:format, \"%Y-%m-%d\"))\n rescue ArgumentError\n nil\n end\n end",
"def convert_date_time(date_time_string)\n date_time = date_time_string\n\n days = 0 # Number of days since epoch\n seconds = 0 # Time expressed as fraction of 24h hours in seconds\n\n # Strip leading and trailing whitespace.\n date_time.sub!(/^\\s+/, '')\n date_time.sub!(/\\s+$/, '')\n\n # Check for invalid date char.\n return nil if date_time =~ /[^0-9T:\\-\\.Z]/\n\n # Check for \"T\" after date or before time.\n return nil unless date_time =~ /\\dT|T\\d/\n\n # Strip trailing Z in ISO8601 date.\n date_time.sub!(/Z$/, '')\n\n # Split into date and time.\n date, time = date_time.split(/T/)\n\n # We allow the time portion of the input DateTime to be optional.\n unless time.nil?\n # Match hh:mm:ss.sss+ where the seconds are optional\n if time =~ /^(\\d\\d):(\\d\\d)(:(\\d\\d(\\.\\d+)?))?/\n hour = $1.to_i\n min = $2.to_i\n sec = $4.to_f || 0\n else\n return nil # Not a valid time format.\n end\n\n # Some boundary checks\n return nil if hour >= 24\n return nil if min >= 60\n return nil if sec >= 60\n\n # Excel expresses seconds as a fraction of the number in 24 hours.\n seconds = (hour * 60* 60 + min * 60 + sec) / (24.0 * 60 * 60)\n end\n\n # We allow the date portion of the input DateTime to be optional.\n return seconds if date == ''\n\n # Match date as yyyy-mm-dd.\n if date =~ /^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/\n year = $1.to_i\n month = $2.to_i\n day = $3.to_i\n else\n return nil # Not a valid date format.\n end\n\n # Set the epoch as 1900 or 1904. Defaults to 1900.\n # Special cases for Excel.\n unless @date_1904\n return seconds if date == '1899-12-31' # Excel 1900 epoch\n return seconds if date == '1900-01-00' # Excel 1900 epoch\n return 60 + seconds if date == '1900-02-29' # Excel false leapday\n end\n\n\n # We calculate the date by calculating the number of days since the epoch\n # and adjust for the number of leap days. We calculate the number of leap\n # days by normalising the year in relation to the epoch. Thus the year 2000\n # becomes 100 for 4 and 100 year leapdays and 400 for 400 year leapdays.\n #\n epoch = @date_1904 ? 1904 : 1900\n offset = @date_1904 ? 4 : 0\n norm = 300\n range = year -epoch\n\n # Set month days and check for leap year.\n mdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n leap = 0\n leap = 1 if year % 4 == 0 && year % 100 != 0 || year % 400 == 0\n mdays[1] = 29 if leap != 0\n\n # Some boundary checks\n return nil if year < epoch or year > 9999\n return nil if month < 1 or month > 12\n return nil if day < 1 or day > mdays[month -1]\n\n # Accumulate the number of days since the epoch.\n days = day # Add days for current month\n (0 .. month-2).each do |m|\n days += mdays[m] # Add days for past months\n end\n days += range *365 # Add days for past years\n days += ((range) / 4) # Add leapdays\n days -= ((range + offset) /100) # Subtract 100 year leapdays\n days += ((range + offset + norm)/400) # Add 400 year leapdays\n days -= leap # Already counted above\n\n # Adjust for Excel erroneously treating 1900 as a leap year.\n days = days + 1 if !@date_1904 and days > 59\n\n return days + seconds\n end",
"def date_string_to_readable(db_date)\n\n # Parse string (db date) to DateTime\n date = date_string_to_object(db_date)\n\n # Format it to a more readable string\n string = \"#{date.day}/#{date.month}/#{date.year}\"\n string << \" #{date.hour}:#{date.minute}\"\n\n return string\nend",
"def date_mathable(datestr)#i.e. '2011-02-20'\r\n date_time = datestr.split(\" \")\r\n if date_time.length == 1\r\n arg = datestr.split('-')\r\n arg = arg.length == 1 ? datestr.split('.') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n date = Time.local(y,m,d)\r\n return date\r\n elsif date_time.length == 2\r\n arg = date_time[0].split('-')\r\n arg = arg.length == 1 ? date_time[0].split('.') : arg\r\n arg = arg.length == 1 ? date_time[0].split('/') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n arg2 = date_time[1].split(':')\r\n hour = Integer( trim_lead(arg2[0],'0') )\r\n min = arg2[1] == '00' ? 0 : Integer( trim_lead(arg2[1],'0') )\r\n sec = arg2[2] == '00' ? 0 : Integer( trim_lead(arg2[2],'0') )\r\n date = y >= 1000 ? Time.local(y,m,d,hour,min,sec) : Time.local(d,y,m,hour,min,sec)\r\n return date\r\n end \r\n end",
"def date(input, format); end",
"def decode_date(value)\n return nil if value.blank?\n value.is_a?(String) ? value.gsub(' ', '0').to_date : value.to_date\n rescue\n nil\n end",
"def string_to_time(string)\n super(handle_date_parse_input(string))\n end",
"def date_from_string(date)\n\n#remove st rd nd and th\n\nfirstParse = Chronic.parse(date)\nr1 = /[a-zA-Z]/\n\nif firstParse #check if chronic managed to find anything\n\n #daY Less than 12, assume chronic wrong, aslong as also no characters such as December, \n #where it would be right\n if firstParse.day <= 12 and !r1.match(date) \n\t\n\t #swap month with day\n\t firstParse = firstParse.change(:day => firstParse.month, :month => firstParse.day)\n\n end #of if <= 12\n\n return firstParse\n \n else\n \n\treturn Date.new\n \n end #of if firstParse\nend",
"def datetime_convert(v)\n case v\n when nil, 0 then nil\n when Numeric then day_convert(v)\n when IsoYear then day_convert(v)\n when IsoDay then day_convert(v)\n when IsoDate then v.to_s\n when START_PATTERN[:complete] then datetime_clean($1)\n when START_PATTERN[:day] then $1\n when START_PATTERN[:year] then day_convert(v)\n else datetime_parse(v)\n end\n end",
"def convert_to_datetime(string)\n return nil if string.blank?\n Chronic.parse(string)\n end",
"def test_String_009_format_dateString_mmddyyyy\n \n #require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_009_format_dateString_mmddyyyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS to the 1900's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1/1/01\",\n \"01/02/01\",\n \"11/1/01\",\n \"1/10/01\",\n \"12/31/2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\"/\" ,\"19\"))\n end\n \n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS to the 2300's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1.1.01\",\n \"01.02.01\",\n \"11.1.01\",\n \"1.10.01\",\n \"12.31.2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\".\" ,\"23\"))\n end\n \n end",
"def strptime(str=\"-4712-01-01\", fmt='%F', sg=nil)\n super(str, fmt)\n end",
"def parse_date(string)\n begin\n Date.parse(string)\n rescue ArgumentError\n nil\n end\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def parse_i18n_date(date_str)\n Date.strptime(date_str, I18n.t('date.formats.default'))\n end",
"def convert_to_datetime(string)\n return nil if (string.nil? || string.class != String)\n Chronic.parse(string)\n end",
"def convert_date(date)\r\n if ( date == nil )\r\n return nil\r\n end\r\n string_date = date.to_s\r\n t = string_date.rindex('T')\r\n string_date = string_date.slice(0,t)\r\n string_date \r\nend",
"def sanitize_date_time(value)\n value.strftime(\"%Y-%m-%d\")\n end",
"def sqlify_date(raw_date)\n m, d, y = raw_date.split('/')\n \"%04d-%02d-%02d\" % [y, m, d]\nend",
"def coerce_date(value, options = {})\n value = coerce(value, String)\n begin\n Date.strptime(value, \"%Y-%m-%d\")\n rescue ArgumentError\n nil\n end\n end",
"def interp_date (d, after_1925=true)\r\n\t\t# TODO: add argument for preferred/hinted format?\r\n\t\t# Main:\r\n\t\tdate_obj = false\r\n\t\t# handle already converted values and serial values\r\n\t\t# NOTE: to test for a ruby class in a \"case/when\" statement, you pass in the\r\n\t\t# object. When clauses are tested with === and obj.class === obj (but\r\n\t\t# obj === obj.class\r\n\t\tcase d\r\n\t\t\t# if no value\r\n\t\t\twhen NilClass\r\n\t\t\t\treturn nil\r\n\t\t\t# if already converted\r\n\t\t\twhen Date\r\n\t\t\t\tdate_obj = d\r\n\t\t\t# convert serial values\r\n\t\t\twhen Float\r\n\t\t\t\tdate_obj = serial_to_date(d)\r\n\t\t\twhen Fixnum\r\n\t\t\t\treturn serial_to_date(d)\r\n\t\t\t# otherwise must be a string\r\n\t\t\twhen String\r\n\t\t\t\td = d.strip()\r\n\t\t\t\t# if they leave it unknown\r\n\t\t\t\tif UNKNOWN_STR_REGEX.match(d)\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\t\t# is it a serial value as a string?\r\n\t\t\t\tif (INT_REGEX.match(d) || FLOAT_REGEX.match(d))\r\n\t\t\t\t\tpp d\r\n\t\t\t\t\tpp d.class\r\n\t\t\t\t\tdate_obj = serial_to_date(d)\r\n\t\t\t\telse\r\n\t\t\t\t\t# otherwise must be a date string\r\n\t\t\t\t\tdate_obj = parse_date_str(d)\r\n\t\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\tif date_obj\r\n\t\t\t# we have a date, do we have to adjust years?\r\n\t\t\tif after_1925\r\n\t\t\t\tif date_obj.year <= 25\r\n\t\t\t\t\treturn Date.new(y=date_obj.year+2000, m=date_obj.month,\r\n\t\t\t\t\t\td=date_obj.day)\r\n\t\t\t\telsif (date_obj.year < 100) and (25 < date_obj.year)\r\n\t\t\t\t\treturn Date.new(y=date_obj.year+1900, m=date_obj.month,\r\n\t\t\t\t\t\td=date_obj.day) \r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn date_obj\r\n\t\telse\r\n\t\t\t# if you get here, it's in a format we don't understand or handle\r\n\t\t\traise ArgumentError, \"can't make date from #{d.class}\"\r\n\t\tend\r\n\tend",
"def normalize_date(date)\r\n if date.chars.length==3\r\n norm_date = Date.strptime(date, '%m-%d')\r\n else\r\n norm_date = Date.strptime(date, '%m-%d-%y')\r\n end\r\n norm_date = norm_date.to_s\r\nend",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def interpretDate(dateString)\n\t\t\n\t\tbegin\n\t\t\n\t\tif (dateString =~ /^\\d\\d?\\/\\d\\d?\\/(\\d\\d)$/ )\n\t\t #puts \"Format: m/d/y\"\n\t\t searchDate = Date.strptime(dateString, '%m/%d/%y')\n\t\telsif (dateString =~ /^\\d\\d?\\/\\d\\d?\\/(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m/d/Y\"\n\t\t searchDate = Date.strptime(dateString, '%m/%d/%Y')\n\t\telsif (dateString =~ /^\\d\\d?\\.\\d\\d?\\.(\\d\\d)$/ )\n\t\t #puts \"Format: m.d.y\"\n\t\t searchDate = Date.strptime(dateString, '%m.%d.%y')\n\t\telsif (dateString =~ /^\\d\\d?\\.\\d\\d?\\.(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m.d.Y\"\n\t\t searchDate = Date.strptime(dateString, '%m.%d.%Y')\n\t\telsif (dateString =~ /^\\d\\d?\\-\\d\\d?\\-(\\d\\d)$/ )\n\t\t #puts \"Format: m-d-y\"\n\t\t searchDate = Date.strptime(dateString, '%m-%d-%y')\n\t\telsif (dateString =~ /^\\d\\d?\\-\\d\\d?\\-(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m-d-Y\"\n\t\t searchDate = Date.strptime(dateString, '%m-%d-%Y')\n\t\telse\n\t\t\tflash[:message] = \"Unrecognized date format. Use mm.dd.yy or mm.dd.yyyy.\"\n\t\t return nil\n\t\tend\n\t\t\n\t\trescue ArgumentError => bang\n\t\t\tflash[:message] = \"Invalid date. (Use month first, then day, then year).\"\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\t\n\tend",
"def strf_date(date_time)\n begin\n date_time.strftime('%Y-%m-%d')\n rescue\n date_time\n end\n end",
"def to_date string\n \n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def try_and_convert_date(value, format = nil)\n if value.is_a?(String)\n fdate = format_date(value, format)\n fdate || value\n else\n value\n end\n end",
"def get_datetime(str)\n return nil if str == \"\"\n return DateTime.strptime(str, \"%d-%m-%Y\")\n end",
"def format_date_nicely(date)\nend",
"def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end",
"def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end",
"def parse_date(datestring)\n days = 0\n if datestring =~ /^\\+(\\d+)$/\n days = (60 * 60 * 24 * $1.to_i)\n newdate = Time.now + days\n else\n newdate = Chronic.parse(datestring, {context: :future, ambiguous_time_range: 8})\n end\n # parsed = newdate.strftime('%D %l:%M%p').gsub(/\\s+/,' ');\n # return parsed =~ /1969/ ? false : parsed\n return newdate\n end",
"def coerce_date(value, options = {})\n value = coerce_string(value, options)\n return if value.nil?\n begin\n Date.strptime(value, \"%Y-%m-%d\")\n rescue ArgumentError\n nil\n end\n end",
"def formalize_date(pubdate_str)\n # Allowed sample date formats: DEC 2:2021; 25-Dec:2019; Jul:2019; :2019\n wos_formats = ['%b %d:%Y', '%d-%b:%Y', '%b:%Y', ':%Y']\n parsed = nil\n wos_formats.each do |format|\n begin\n parsed = Date.strptime(pubdate_str, format)\n break\n rescue StandardError => e\n Rails.logger.warn \"Repository Work formalize date error #{e.message}\"\n nil\n end\n end\n return parsed.to_s\n end",
"def parse_datetime(string)\n res = DATE_PARSERS.detect do |parser|\n return parser.parse(string).feed_utils_to_gm_time\n rescue StandardError => e\n Feedjira.logger.debug { \"Failed to parse date #{string}\" }\n Feedjira.logger.debug(e)\n nil\n end\n\n Feedjira.logger.warn { \"Failed to parse date #{string}\" } if res.nil?\n\n res\n end",
"def datetime_validate(value)\n begin\n return DateTime.parse(value)\n rescue ArgumentError, NoMethodError\n logger.warn(\"Invalid DateTime format for #{value}\")\n end\n end",
"def typecast_to_primitive(value)\n if value.respond_to?(:to_date)\n value.to_date\n elsif value.is_a?(::Hash) || value.respond_to?(:to_mash)\n typecast_hash_to_date(value)\n else\n ::Date.parse(value.to_s)\n end\n rescue ArgumentError\n value\n end",
"def parse_and_validate_date_if_necessary(value, type)\n # note: cannot use 'case type' as that expands to === which checks for instances of rather than type equality\n if type == Date\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}$/)\n Date.strptime(value, \"%Y-%m-%d\")\n elsif type == DateTime\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/)\n DateTime.strptime(value, \"%Y-%m-%dT%H:%M:%SZ\")\n else\n value\n end\n end",
"def parse_datetime(str)\n parts = str.scan(/.{2}/)\n year = Time.now.year.to_s[0..1] + parts[0]\n month = parts[1]\n day = parts[2]\n hour = parts[3]\n minute = parts[3]\n \"#{year}-#{month}-#{day} #{hour}:#{minute}\"\n end",
"def normalize_date_strings(date_strings, separator = '/')\n return date_strings if RUBY_VERSION < '1.9'\n date_strings = [*date_strings] # ensure Array\n date_strings.map! do |ds|\n fragments = ds.split(separator)\n [fragments[1], fragments[0], fragments[2]].join(separator)\n end\n end",
"def parse_exact_date(string, today)\n tokens = string.split(DELIMITER)\n\n if tokens.length >= 2\n if tokens[0] =~ NUMBER_WITH_ORDINAL\n parse_exact_date_parts(tokens[0], tokens[1], tokens[2], today)\n elsif tokens[1] =~ NUMBER_WITH_ORDINAL\n parse_exact_date_parts(tokens[1], tokens[0], tokens[2], today)\n end\n end\n end",
"def conforms_to_dateTime_format(str)\n dateTimeRegex = /\\A(?:(?!0000)\\d{4})(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\\d|3[0-1])(T([01]\\d|2[0-3]):[0-5]\\d:([0-5]\\d|60)(\\.\\d+)?(Z|(\\+|-)((0\\d|1[0-3]):[0-5]\\d|14:00)))?)?)?\\z/\n dateTimeRegex.match(str)\n end",
"def strptime(str=\"-4712-01-01T00:00:00+00:00\", fmt='%FT%T%z', sg=nil)\n super(str, fmt)\n end",
"def parse_date(date)\n date.to_date\n rescue\n Date.strptime(date, '%m/%d/%Y') rescue nil\n end",
"def parse_date(value)\n ::Date.parse(value)\n end"
] |
[
"0.7155179",
"0.7124238",
"0.7088141",
"0.70011497",
"0.67767096",
"0.6746792",
"0.67281824",
"0.6715919",
"0.669914",
"0.6672858",
"0.66674703",
"0.6661269",
"0.66478705",
"0.6622896",
"0.65794486",
"0.65308654",
"0.652221",
"0.6521958",
"0.6506142",
"0.6484642",
"0.64496714",
"0.64315027",
"0.64298403",
"0.64230996",
"0.64211357",
"0.6416692",
"0.6388024",
"0.63828015",
"0.63794905",
"0.63775474",
"0.6351156",
"0.6335373",
"0.6330113",
"0.63292336",
"0.6317479",
"0.63124275",
"0.63124275",
"0.6310779",
"0.6297657",
"0.62957823",
"0.6284588",
"0.62787616",
"0.626832",
"0.62668025",
"0.62521565",
"0.6249853",
"0.62490225",
"0.6236053",
"0.62221456",
"0.6217322",
"0.6213479",
"0.62128496",
"0.6206126",
"0.62044716",
"0.620078",
"0.6185739",
"0.6184356",
"0.6178012",
"0.6173369",
"0.61659425",
"0.61634195",
"0.61609066",
"0.6130928",
"0.6116918",
"0.6112903",
"0.6112903",
"0.6112903",
"0.6108966",
"0.6103583",
"0.6101386",
"0.60981923",
"0.60959387",
"0.609454",
"0.6091548",
"0.6091544",
"0.60886174",
"0.60886174",
"0.608352",
"0.6080943",
"0.6076979",
"0.60488486",
"0.60488486",
"0.6045474",
"0.6036328",
"0.60361236",
"0.6033449",
"0.6030387",
"0.60257345",
"0.6024248",
"0.59996504",
"0.59910595",
"0.59793544",
"0.59676343",
"0.5965472",
"0.59617335",
"0.5958006",
"0.5945164",
"0.59445137",
"0.5936927",
"0.5934674",
"0.5916339"
] |
0.0
|
-1
|
Use safe_datetime_string help with those pesky US date formats in Ruby 1.9 or to change an integer string to date
|
def to_time
return self.to_i.to_time if self =~ DIGIT_ONLY_REGEX
if self =~ US_DATE_REGEX
Time.parse(us_date_to_iso_str)
elsif self =~ JSON_DATE_REGEX
json_date_to_time
else
Time.parse(self)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end",
"def safe_datetime_string\n safe_date = nil\n if self =~ US_DATE_REGEX\n safe_date = us_date_to_iso_str\n elsif self =~ JSON_DATE_REGEX\n safe_date = json_date_to_time.to_s\n else\n safe_date = self\n end\n safe_date\n end",
"def string_to_date(string)\n super(handle_date_parse_input(string))\n end",
"def handle_date_parse_input(string)\n string\n end",
"def parse_date(input, msg = T.unsafe(nil)); end",
"def d(date_string)\n Date.parse(date_string)\nend",
"def parse_date(s)\n begin\n if s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([2-9]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/19#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([0-1]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/20#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/\n date = DateTime.parse(\"#{$2}/#{$1}/#{$3}\")\n elsif s =~ /^(\\d\\d\\d\\d)-(\\d\\d)$/\n if (1...13).include?($2.to_i) and (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n elsif s =~ /^(\\d\\d\\d\\d)$/\n if (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n else\n date = DateTime.parse(s)\n end\n rescue\n return nil\n end\n return date.strftime(\"%Y-%m-%d\")\n end",
"def date_s_to_i(date_str)\n require 'time'\n \n if not validate_date_str(date_str)\n raise BlankGenerationConversionException, \"Invalid date value #{date_str}\"\n end\n \n Time.parse(date_str).to_i\nend",
"def coerce_datetime(datetime_string)\n case datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})$/\n datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})/\n datetime = datetime_escape(datetime_string)\n datetime.strftime(Sparkql::FunctionResolver::STRFTIME_DATE_FORMAT)\n else\n datetime_string\n end\n end",
"def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end",
"def test_Convert_Date_003_InvalidDatesAsStrings\n\n require 'date'\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Convert_Date_003_InvalidDatesAsStrings\")\n puts2(\"#######################\")\n\n puts2(\"Testing invalid dates expressed as STRINGS\\n\\n\")\n\n sDateString = \"6/31/08\"\n puts2(\"\\nTrying an invalid month specific date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"14/04/2010\"\n puts2(\"\\nTrying an invalid month specific date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"12-88-2010\"\n puts2(\"\\nTrying an invalid date in any month\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n sDateString = \"02/29/2001\"\n puts2(\"\\nTrying an invalid Leap Year date\")\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n\n end",
"def parse_datetime_string\r\n dt = String.new\r\n self.date_of_birth.split('/').each{|x| dt = dt + (x.to_i < 10 ? '0'+ x + '/' : x + \"/\")}\r\n self.date_of_birth = DateTime.strptime(dt, \"%m/%d/%Y/\")\r\n self\r\n end",
"def change_date(date)\n require 'date'\n date = DateTime.parse(date)\nend",
"def parse_date_str (d)\r\n\t\t## Preconditions:\r\n\t\t# check format of date\r\n\t\tdate_arr = d.split(DATE_SPLIT_REGEX)\r\n\t\trtassert(date_arr.size() == 3, ArgumentError,\r\n\t\t\t\"cant recognise format of date '#{d}'\")\r\n\t\t# convert to hyphens as Ruby gets confused with slashes\r\n\t\tdate_str = date_arr.join('-')\r\n\t\t## Main:\r\n\t\t# try each of the supplied date formats\r\n\t\tDATE_FMTS.each { |fmt|\r\n\t\t\tbegin\r\n\t\t\t\tdate_obj = Date.strptime(date_str, fmt)\r\n\t\t\t\treturn date_obj\r\n\t\t\trescue ArgumentError\r\n\t\t\t\t# pass\r\n\t\t\tend\r\n\t\t}\r\n\t\t# try a brute force approach\r\n\t\tbegin\r\n\t\t\tdate_obj = Date.parse(date_str)\r\n\t\t\treturn date_obj \r\n\t\trescue\r\n\t\t\tpp date_arr\r\n\t\t\traise ArgumentError, \"can't recognise format of date '#{d}'\" \r\n\t\tend\r\n\tend",
"def parse_date(date, fmt = nil)\n return nil if(date.blank?)\n return DateTime.strptime(date, fmt) if(fmt) # format given\n return DateTime.new(date.to_i) if(date.size < 5) # this short should be a year\n DateTime.parse(date)\n end",
"def parse_date(date_str)\n new_date = Date.parse(date_str)\nend",
"def convertStrToDate(str, format)\n return Date.strptime(str, format)\nend",
"def _date_parse(string)\n super(handle_date_parse_input(string))\n end",
"def rescue_and_retry_datetime(object, error)\n raise DateTimeDataError, object unless error.message == 'invalid date'\n\n DateTime.strptime(object, '%m/%d/%Y').to_s\n rescue ArgumentError\n raise DateTimeDataError, object\n end",
"def resolve_date(date_str)\n u_count = date_str.count 'u'\n # Replace unknown digits with 0.\n date = date_str.tr('u', '0').to_i\n if u_count.positive? && date != 0\n delta = 10**u_count # 10^u_count, exponent\n date + (delta / 2) if delta <= ESTIMATE_TOLERANCE\n elsif date != 0\n date\n end\n end",
"def test_string_should_convert_to_date\n \n [\"44.12.2013\", \"37.12.2012\", \"1.12.2012\", \"21.1.2012\"].each do |d|\n assert_raise ArgumentError do \n d.to_date \n end\n end \n \n assert_equal Date.new(2012,1,1), \"01.01.2012\".to_date \n assert_equal Date.new(2012,12,27), \"27.12.2012\".to_date \n assert_equal Date.new(2012,12,24), \"Christmas is on 24.12.2012 in year 2012\".to_date \n \n end",
"def parsed_date(date_string, default)\n Date.parse(date_string)\n rescue ArgumentError, TypeError # Help out to find what issue - user typing issues.eg date instead of sentence\n default\n end",
"def parse_date(date_string)\n selected_format = DATE_FORMATS.select{|date_format| date_string =~ date_format[:format]}[0]\n Date.strptime(date_string, selected_format[:type]) if selected_format\n end",
"def handle_date(attrs, key, warnings)\n if attrs.has_key?(key) && attrs[key].present?\n begin\n # check if it's US looking date\n if attrs[key].respond_to?(:match) && attrs[key].match(/\\d{1,2}\\/\\d{1,2}\\/\\d{4}/)\n attrs[key] = Date.strptime(attrs[key], '%m/%d/%Y').to_s # converts to YYYY-MM-DD\n end\n\n # try to parse it as Rails will\n Date.parse(attrs[key])\n rescue => e\n warnings[key.to_sym] ||= []\n warnings[key.to_sym] << \"#{e}, use YYYY-MM-DD or MM/DD/YYYY format\"\n end\n end\n end",
"def set_date_string(input)\n\n now = Time.new\n date = Time.new\n\n #Handle minute notation.\n if input.downcase[-1] == \"m\" then\n date = now - (60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle hour notation.\n if input.downcase[-1] == \"h\" then\n date = now - (60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle day notation.\n if input.downcase[-1] == \"d\" then\n date = now - (24 * 60 * 60 * input[0..-2].to_f)\n return get_date_string(date)\n end\n\n #Handle PowerTrack format, YYYYMMDDHHMM\n if input.length == 12 and numeric?(input) then\n return input\n end\n\n #Handle \"YYYY-MM-DD 00:00\"\n if input.length == 16 then\n return input.gsub!(/\\W+/, '')\n end\n\n #Handle ISO 8601 timestamps, as in Twitter payload \"2013-11-15T17:16:42.000Z\"\n if input.length > 16 then\n date = Time.parse(input)\n return get_date_string(date)\n end\n\n return 'Error, unrecognized timestamp.'\n\n end",
"def parse_date(date)\n date = DateTime.parse(date.to_s)\n rescue ArgumentError\n raise ArgumentError, \"#{date} is not a valid date\"\n end",
"def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend",
"def usualParser(dateTimeString, inputFormat)\n ft = formatConvertor(inputFormat)\n puts ft\n begin\n dt = DateTime.strptime(dateTimeString, ft)\n print \"#{dt}\"\n rescue\n puts \"Invalid String or String does not match the specified format\"\n end\nend",
"def datetime_escape(string)\n Time.parse(string)\n end",
"def recovered?(date_string)\n date_string.strip[6..9].to_i > 1900\n rescue => e\n puts \"error with: #{date_string}\"\n raise e\n end",
"def convert_to_date(string)\n return nil if (string.nil? || string.class != String)\n tmp = Chronic.parse(string)\n tmp ? tmp.to_date : nil\n end",
"def to_date(string)\n Date.parse(string)\n rescue\n nil\n end",
"def convert_day_to_date string\r\n Date.strptime(string.to_s,\"%Y%m%d\")\r\n end",
"def normalize_date( object, attribute, params )\n value = params[object][attribute]\n if value.match('\\d\\d\\d\\d-\\d\\d-\\d\\d')\n # all fine - iso format used\n return\n elsif value.size == 4\n # only year given\n params[object][attribute] = value + \"-01-01\"\n elsif value.match('\\d\\d?\\.\\d\\d?\\.\\d\\d$')\n # wrong format, probably something like 20.10.84\n date = value.split('.')\n year = (date[2].to_i < 10) ? date[2].to_i + 2000 : date[2].to_i + 1900\n date = Date.new( year, date[1].to_i, date[0].to_i ) \n params[object][attribute] = date.to_s\n elsif value.match('\\d?\\d\\.\\d?\\d\\.\\d\\d\\d\\d')\n # wrong format\n date = value.split('.')\n params[object][attribute] = date[2] + \"-\" + date[1] + \"-\" + date[0]\n else\n date = ParseDate.parsedate( value, true )\n params[object][attribute] = date[0].to_s + \"-\" + date[1].to_s + \"-\" + date[2].to_s\n end\n end",
"def parse_date(date_string)\n result = sugarcube_detect(date_string).first\n if result\n return result.date\n else\n return iso8601(date_string)\n end\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def parse_date(string)\n Date.strptime(string.to_s, '%m/%d/%Y') rescue nil\n end",
"def date(date)\n Date.strptime(date,\"%m/%d/%y\")\n rescue ArgumentError => e \n raise unless e.to_s =~ /invalid date/\n raise BadTime, e.to_s\n end",
"def convert_to_date(str_date)\n Date.parse(str_date) if str_date\n end",
"def parse_date(date_str)\n split = date_str.split('-')\n Date.new(split[0].to_i, split[1].to_i, split[2].to_i)\nend",
"def time_converter(string)\n # need to convert to UTC first before converting to date\n date = Time.at(string.to_i).utc.to_date\nend",
"def post_process_date( val )\n\t\t\treturn Date.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def flexible_value_to_date(value, options = {})\n allow_string = options[:allow_string]\n string_condition = allow_string.kind_of?(Regexp) ? allow_string : String\n case value\n when Hash\n if value[:year].blank? || value[:month].blank? || value[:day].blank?\n nil\n else\n begin\n Date.new(value[:year].to_i,value[:month].to_i, value[:day].to_i)\n rescue\n nil\n end\n end\n else\n if allow_string\n case value\n when string_condition\n begin\n Date.parse(value)\n rescue\n nil\n end\n end\n else\n nil\n end\n end\n end",
"def coerce_date(value)\n case value\n when Date\n value\n when String\n Date.parse(value)\n else\n raise ArgumentError, \"expected: Date or String, got: \" +\n value.inspect\n end\n end",
"def parse_date(date_string)\n match = date_string.match(/([0-9]{1,2})\\/([0-9]{1,2})\\/([0-9]{4})/)\n month = match[1].to_i\n day = match[2].to_i\n year = match[3].to_i\n Date.new(year, month, day)\nend",
"def date(string)\n return if string.blank?\n return string if string.is_a?(Date)\n\n Date.parse(string)\n rescue Date::Error\n components = string\n .split(\"-\")\n .map(&:to_i)\n .reject(&:zero?)\n .compact\n\n return if components.empty?\n\n Date.new(*components)\n rescue ArgumentError\n nil\n end",
"def convert_datetime(date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return nil if self[attribute + '(1i)'].nil? || self[attribute + '(2i)'].nil? || self[attribute + '(3i)'].nil? || self[attribute + '(4i)'].nil? || self[attribute + '(5i)'].nil? \n return Time.local(self[attribute + '(1i)'].to_i, self[attribute + '(2i)'].to_i, self[attribute + '(3i)'].to_i, self[attribute + '(4i)'].to_i, self[attribute + '(5i)'].to_i) \n end",
"def datetime_data(object)\n return object unless object.present?\n\n DateTime.strptime(object, '%Y-%m-%d').to_s\n rescue ArgumentError => e\n rescue_and_retry_datetime(object, e)\n end",
"def read_date(date)\r\n case date\r\n when /(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/ # format DD.MM.YYYY nebo DD. MM. YYYY\r\n date.scan(/(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[1]}-#{sep[0]}\"\r\n return new_date\r\n end\r\n when /(\\d{2})\\/(\\d{2})\\/(\\d{4})/\r\n date.scan(/(\\d{2})\\/(\\d{2})\\/(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[0]}-#{sep[1]}\"\r\n return new_date\r\n end\r\n when /(\\d{4})\\-(\\d{2})\\-(\\d{2})/ # format YYYY-MM-DD\r\n return date\r\n else\r\n puts \"ERROR! Neplatny format \\\"#{date}\\\" (prijejte format do funkce \\\"read_date\\\")\"\r\n end\r\nend",
"def coerce_date(value, options = {})\n value = coerce_string(value)\n begin\n Date.strptime(value, options.fetch(:format, \"%Y-%m-%d\"))\n rescue ArgumentError\n nil\n end\n end",
"def parse_iso_8601_date(string)\n if string =~ ISO_8601_DATE\n Date.parse(string) rescue nil\n end\n end",
"def convert_date_time(date_time_string)\n date_time = date_time_string\n\n days = 0 # Number of days since epoch\n seconds = 0 # Time expressed as fraction of 24h hours in seconds\n\n # Strip leading and trailing whitespace.\n date_time.sub!(/^\\s+/, '')\n date_time.sub!(/\\s+$/, '')\n\n # Check for invalid date char.\n return nil if date_time =~ /[^0-9T:\\-\\.Z]/\n\n # Check for \"T\" after date or before time.\n return nil unless date_time =~ /\\dT|T\\d/\n\n # Strip trailing Z in ISO8601 date.\n date_time.sub!(/Z$/, '')\n\n # Split into date and time.\n date, time = date_time.split(/T/)\n\n # We allow the time portion of the input DateTime to be optional.\n unless time.nil?\n # Match hh:mm:ss.sss+ where the seconds are optional\n if time =~ /^(\\d\\d):(\\d\\d)(:(\\d\\d(\\.\\d+)?))?/\n hour = $1.to_i\n min = $2.to_i\n sec = $4.to_f || 0\n else\n return nil # Not a valid time format.\n end\n\n # Some boundary checks\n return nil if hour >= 24\n return nil if min >= 60\n return nil if sec >= 60\n\n # Excel expresses seconds as a fraction of the number in 24 hours.\n seconds = (hour * 60* 60 + min * 60 + sec) / (24.0 * 60 * 60)\n end\n\n # We allow the date portion of the input DateTime to be optional.\n return seconds if date == ''\n\n # Match date as yyyy-mm-dd.\n if date =~ /^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/\n year = $1.to_i\n month = $2.to_i\n day = $3.to_i\n else\n return nil # Not a valid date format.\n end\n\n # Set the epoch as 1900 or 1904. Defaults to 1900.\n # Special cases for Excel.\n unless @date_1904\n return seconds if date == '1899-12-31' # Excel 1900 epoch\n return seconds if date == '1900-01-00' # Excel 1900 epoch\n return 60 + seconds if date == '1900-02-29' # Excel false leapday\n end\n\n\n # We calculate the date by calculating the number of days since the epoch\n # and adjust for the number of leap days. We calculate the number of leap\n # days by normalising the year in relation to the epoch. Thus the year 2000\n # becomes 100 for 4 and 100 year leapdays and 400 for 400 year leapdays.\n #\n epoch = @date_1904 ? 1904 : 1900\n offset = @date_1904 ? 4 : 0\n norm = 300\n range = year -epoch\n\n # Set month days and check for leap year.\n mdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n leap = 0\n leap = 1 if year % 4 == 0 && year % 100 != 0 || year % 400 == 0\n mdays[1] = 29 if leap != 0\n\n # Some boundary checks\n return nil if year < epoch or year > 9999\n return nil if month < 1 or month > 12\n return nil if day < 1 or day > mdays[month -1]\n\n # Accumulate the number of days since the epoch.\n days = day # Add days for current month\n (0 .. month-2).each do |m|\n days += mdays[m] # Add days for past months\n end\n days += range *365 # Add days for past years\n days += ((range) / 4) # Add leapdays\n days -= ((range + offset) /100) # Subtract 100 year leapdays\n days += ((range + offset + norm)/400) # Add 400 year leapdays\n days -= leap # Already counted above\n\n # Adjust for Excel erroneously treating 1900 as a leap year.\n days = days + 1 if !@date_1904 and days > 59\n\n return days + seconds\n end",
"def date_string_to_readable(db_date)\n\n # Parse string (db date) to DateTime\n date = date_string_to_object(db_date)\n\n # Format it to a more readable string\n string = \"#{date.day}/#{date.month}/#{date.year}\"\n string << \" #{date.hour}:#{date.minute}\"\n\n return string\nend",
"def date_mathable(datestr)#i.e. '2011-02-20'\r\n date_time = datestr.split(\" \")\r\n if date_time.length == 1\r\n arg = datestr.split('-')\r\n arg = arg.length == 1 ? datestr.split('.') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n date = Time.local(y,m,d)\r\n return date\r\n elsif date_time.length == 2\r\n arg = date_time[0].split('-')\r\n arg = arg.length == 1 ? date_time[0].split('.') : arg\r\n arg = arg.length == 1 ? date_time[0].split('/') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n arg2 = date_time[1].split(':')\r\n hour = Integer( trim_lead(arg2[0],'0') )\r\n min = arg2[1] == '00' ? 0 : Integer( trim_lead(arg2[1],'0') )\r\n sec = arg2[2] == '00' ? 0 : Integer( trim_lead(arg2[2],'0') )\r\n date = y >= 1000 ? Time.local(y,m,d,hour,min,sec) : Time.local(d,y,m,hour,min,sec)\r\n return date\r\n end \r\n end",
"def decode_date(value)\n return nil if value.blank?\n value.is_a?(String) ? value.gsub(' ', '0').to_date : value.to_date\n rescue\n nil\n end",
"def date(input, format); end",
"def string_to_time(string)\n super(handle_date_parse_input(string))\n end",
"def date_from_string(date)\n\n#remove st rd nd and th\n\nfirstParse = Chronic.parse(date)\nr1 = /[a-zA-Z]/\n\nif firstParse #check if chronic managed to find anything\n\n #daY Less than 12, assume chronic wrong, aslong as also no characters such as December, \n #where it would be right\n if firstParse.day <= 12 and !r1.match(date) \n\t\n\t #swap month with day\n\t firstParse = firstParse.change(:day => firstParse.month, :month => firstParse.day)\n\n end #of if <= 12\n\n return firstParse\n \n else\n \n\treturn Date.new\n \n end #of if firstParse\nend",
"def datetime_convert(v)\n case v\n when nil, 0 then nil\n when Numeric then day_convert(v)\n when IsoYear then day_convert(v)\n when IsoDay then day_convert(v)\n when IsoDate then v.to_s\n when START_PATTERN[:complete] then datetime_clean($1)\n when START_PATTERN[:day] then $1\n when START_PATTERN[:year] then day_convert(v)\n else datetime_parse(v)\n end\n end",
"def convert_to_datetime(string)\n return nil if string.blank?\n Chronic.parse(string)\n end",
"def test_String_009_format_dateString_mmddyyyy\n \n #require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_009_format_dateString_mmddyyyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS to the 1900's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1/1/01\",\n \"01/02/01\",\n \"11/1/01\",\n \"1/10/01\",\n \"12/31/2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\"/\" ,\"19\"))\n end\n \n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS to the 2300's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1.1.01\",\n \"01.02.01\",\n \"11.1.01\",\n \"1.10.01\",\n \"12.31.2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\".\" ,\"23\"))\n end\n \n end",
"def strptime(str=\"-4712-01-01\", fmt='%F', sg=nil)\n super(str, fmt)\n end",
"def parse_date(string)\n begin\n Date.parse(string)\n rescue ArgumentError\n nil\n end\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def good_date(dd)\n dd = dd.to_s\n dd = \"0\" + dd if dd.length<2\n dd\n end",
"def parse_i18n_date(date_str)\n Date.strptime(date_str, I18n.t('date.formats.default'))\n end",
"def convert_to_datetime(string)\n return nil if (string.nil? || string.class != String)\n Chronic.parse(string)\n end",
"def convert_date(date)\r\n if ( date == nil )\r\n return nil\r\n end\r\n string_date = date.to_s\r\n t = string_date.rindex('T')\r\n string_date = string_date.slice(0,t)\r\n string_date \r\nend",
"def sanitize_date_time(value)\n value.strftime(\"%Y-%m-%d\")\n end",
"def coerce_date(value, options = {})\n value = coerce(value, String)\n begin\n Date.strptime(value, \"%Y-%m-%d\")\n rescue ArgumentError\n nil\n end\n end",
"def sqlify_date(raw_date)\n m, d, y = raw_date.split('/')\n \"%04d-%02d-%02d\" % [y, m, d]\nend",
"def interp_date (d, after_1925=true)\r\n\t\t# TODO: add argument for preferred/hinted format?\r\n\t\t# Main:\r\n\t\tdate_obj = false\r\n\t\t# handle already converted values and serial values\r\n\t\t# NOTE: to test for a ruby class in a \"case/when\" statement, you pass in the\r\n\t\t# object. When clauses are tested with === and obj.class === obj (but\r\n\t\t# obj === obj.class\r\n\t\tcase d\r\n\t\t\t# if no value\r\n\t\t\twhen NilClass\r\n\t\t\t\treturn nil\r\n\t\t\t# if already converted\r\n\t\t\twhen Date\r\n\t\t\t\tdate_obj = d\r\n\t\t\t# convert serial values\r\n\t\t\twhen Float\r\n\t\t\t\tdate_obj = serial_to_date(d)\r\n\t\t\twhen Fixnum\r\n\t\t\t\treturn serial_to_date(d)\r\n\t\t\t# otherwise must be a string\r\n\t\t\twhen String\r\n\t\t\t\td = d.strip()\r\n\t\t\t\t# if they leave it unknown\r\n\t\t\t\tif UNKNOWN_STR_REGEX.match(d)\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\t\t# is it a serial value as a string?\r\n\t\t\t\tif (INT_REGEX.match(d) || FLOAT_REGEX.match(d))\r\n\t\t\t\t\tpp d\r\n\t\t\t\t\tpp d.class\r\n\t\t\t\t\tdate_obj = serial_to_date(d)\r\n\t\t\t\telse\r\n\t\t\t\t\t# otherwise must be a date string\r\n\t\t\t\t\tdate_obj = parse_date_str(d)\r\n\t\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\tif date_obj\r\n\t\t\t# we have a date, do we have to adjust years?\r\n\t\t\tif after_1925\r\n\t\t\t\tif date_obj.year <= 25\r\n\t\t\t\t\treturn Date.new(y=date_obj.year+2000, m=date_obj.month,\r\n\t\t\t\t\t\td=date_obj.day)\r\n\t\t\t\telsif (date_obj.year < 100) and (25 < date_obj.year)\r\n\t\t\t\t\treturn Date.new(y=date_obj.year+1900, m=date_obj.month,\r\n\t\t\t\t\t\td=date_obj.day) \r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn date_obj\r\n\t\telse\r\n\t\t\t# if you get here, it's in a format we don't understand or handle\r\n\t\t\traise ArgumentError, \"can't make date from #{d.class}\"\r\n\t\tend\r\n\tend",
"def normalize_date(date)\r\n if date.chars.length==3\r\n norm_date = Date.strptime(date, '%m-%d')\r\n else\r\n norm_date = Date.strptime(date, '%m-%d-%y')\r\n end\r\n norm_date = norm_date.to_s\r\nend",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def interpretDate(dateString)\n\t\t\n\t\tbegin\n\t\t\n\t\tif (dateString =~ /^\\d\\d?\\/\\d\\d?\\/(\\d\\d)$/ )\n\t\t #puts \"Format: m/d/y\"\n\t\t searchDate = Date.strptime(dateString, '%m/%d/%y')\n\t\telsif (dateString =~ /^\\d\\d?\\/\\d\\d?\\/(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m/d/Y\"\n\t\t searchDate = Date.strptime(dateString, '%m/%d/%Y')\n\t\telsif (dateString =~ /^\\d\\d?\\.\\d\\d?\\.(\\d\\d)$/ )\n\t\t #puts \"Format: m.d.y\"\n\t\t searchDate = Date.strptime(dateString, '%m.%d.%y')\n\t\telsif (dateString =~ /^\\d\\d?\\.\\d\\d?\\.(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m.d.Y\"\n\t\t searchDate = Date.strptime(dateString, '%m.%d.%Y')\n\t\telsif (dateString =~ /^\\d\\d?\\-\\d\\d?\\-(\\d\\d)$/ )\n\t\t #puts \"Format: m-d-y\"\n\t\t searchDate = Date.strptime(dateString, '%m-%d-%y')\n\t\telsif (dateString =~ /^\\d\\d?\\-\\d\\d?\\-(\\d\\d\\d\\d)$/ )\n\t\t #puts \"Format: m-d-Y\"\n\t\t searchDate = Date.strptime(dateString, '%m-%d-%Y')\n\t\telse\n\t\t\tflash[:message] = \"Unrecognized date format. Use mm.dd.yy or mm.dd.yyyy.\"\n\t\t return nil\n\t\tend\n\t\t\n\t\trescue ArgumentError => bang\n\t\t\tflash[:message] = \"Invalid date. (Use month first, then day, then year).\"\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\t\n\tend",
"def strf_date(date_time)\n begin\n date_time.strftime('%Y-%m-%d')\n rescue\n date_time\n end\n end",
"def to_date string\n \n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def try_and_convert_date(value, format = nil)\n if value.is_a?(String)\n fdate = format_date(value, format)\n fdate || value\n else\n value\n end\n end",
"def get_datetime(str)\n return nil if str == \"\"\n return DateTime.strptime(str, \"%d-%m-%Y\")\n end",
"def format_date_nicely(date)\nend",
"def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end",
"def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end",
"def coerce_date(value, options = {})\n value = coerce_string(value, options)\n return if value.nil?\n begin\n Date.strptime(value, \"%Y-%m-%d\")\n rescue ArgumentError\n nil\n end\n end",
"def parse_date(datestring)\n days = 0\n if datestring =~ /^\\+(\\d+)$/\n days = (60 * 60 * 24 * $1.to_i)\n newdate = Time.now + days\n else\n newdate = Chronic.parse(datestring, {context: :future, ambiguous_time_range: 8})\n end\n # parsed = newdate.strftime('%D %l:%M%p').gsub(/\\s+/,' ');\n # return parsed =~ /1969/ ? false : parsed\n return newdate\n end",
"def formalize_date(pubdate_str)\n # Allowed sample date formats: DEC 2:2021; 25-Dec:2019; Jul:2019; :2019\n wos_formats = ['%b %d:%Y', '%d-%b:%Y', '%b:%Y', ':%Y']\n parsed = nil\n wos_formats.each do |format|\n begin\n parsed = Date.strptime(pubdate_str, format)\n break\n rescue StandardError => e\n Rails.logger.warn \"Repository Work formalize date error #{e.message}\"\n nil\n end\n end\n return parsed.to_s\n end",
"def parse_datetime(string)\n res = DATE_PARSERS.detect do |parser|\n return parser.parse(string).feed_utils_to_gm_time\n rescue StandardError => e\n Feedjira.logger.debug { \"Failed to parse date #{string}\" }\n Feedjira.logger.debug(e)\n nil\n end\n\n Feedjira.logger.warn { \"Failed to parse date #{string}\" } if res.nil?\n\n res\n end",
"def datetime_validate(value)\n begin\n return DateTime.parse(value)\n rescue ArgumentError, NoMethodError\n logger.warn(\"Invalid DateTime format for #{value}\")\n end\n end",
"def typecast_to_primitive(value)\n if value.respond_to?(:to_date)\n value.to_date\n elsif value.is_a?(::Hash) || value.respond_to?(:to_mash)\n typecast_hash_to_date(value)\n else\n ::Date.parse(value.to_s)\n end\n rescue ArgumentError\n value\n end",
"def parse_and_validate_date_if_necessary(value, type)\n # note: cannot use 'case type' as that expands to === which checks for instances of rather than type equality\n if type == Date\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}$/)\n Date.strptime(value, \"%Y-%m-%d\")\n elsif type == DateTime\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/)\n DateTime.strptime(value, \"%Y-%m-%dT%H:%M:%SZ\")\n else\n value\n end\n end",
"def parse_datetime(str)\n parts = str.scan(/.{2}/)\n year = Time.now.year.to_s[0..1] + parts[0]\n month = parts[1]\n day = parts[2]\n hour = parts[3]\n minute = parts[3]\n \"#{year}-#{month}-#{day} #{hour}:#{minute}\"\n end",
"def normalize_date_strings(date_strings, separator = '/')\n return date_strings if RUBY_VERSION < '1.9'\n date_strings = [*date_strings] # ensure Array\n date_strings.map! do |ds|\n fragments = ds.split(separator)\n [fragments[1], fragments[0], fragments[2]].join(separator)\n end\n end",
"def conforms_to_dateTime_format(str)\n dateTimeRegex = /\\A(?:(?!0000)\\d{4})(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\\d|3[0-1])(T([01]\\d|2[0-3]):[0-5]\\d:([0-5]\\d|60)(\\.\\d+)?(Z|(\\+|-)((0\\d|1[0-3]):[0-5]\\d|14:00)))?)?)?\\z/\n dateTimeRegex.match(str)\n end",
"def parse_exact_date(string, today)\n tokens = string.split(DELIMITER)\n\n if tokens.length >= 2\n if tokens[0] =~ NUMBER_WITH_ORDINAL\n parse_exact_date_parts(tokens[0], tokens[1], tokens[2], today)\n elsif tokens[1] =~ NUMBER_WITH_ORDINAL\n parse_exact_date_parts(tokens[1], tokens[0], tokens[2], today)\n end\n end\n end",
"def strptime(str=\"-4712-01-01T00:00:00+00:00\", fmt='%FT%T%z', sg=nil)\n super(str, fmt)\n end",
"def parse_date(date)\n date.to_date\n rescue\n Date.strptime(date, '%m/%d/%Y') rescue nil\n end",
"def parse_date(value)\n ::Date.parse(value)\n end"
] |
[
"0.7155501",
"0.71236235",
"0.708873",
"0.70003843",
"0.6775027",
"0.6745972",
"0.67268485",
"0.6716436",
"0.66986847",
"0.6672011",
"0.66675776",
"0.6659969",
"0.66472286",
"0.6620941",
"0.65776044",
"0.6530306",
"0.6522448",
"0.6521635",
"0.6505954",
"0.6484742",
"0.64495003",
"0.643056",
"0.64278966",
"0.6421253",
"0.64205676",
"0.64152485",
"0.63874257",
"0.63808495",
"0.63792944",
"0.6377523",
"0.6351997",
"0.63362736",
"0.6330004",
"0.6328773",
"0.63156813",
"0.63131917",
"0.63131917",
"0.63100326",
"0.62965554",
"0.6296156",
"0.628371",
"0.6280005",
"0.6268539",
"0.6267288",
"0.62507486",
"0.6250322",
"0.6248795",
"0.6236079",
"0.6221641",
"0.62158674",
"0.62136734",
"0.62120503",
"0.62050223",
"0.6203605",
"0.6199604",
"0.6185501",
"0.6183823",
"0.6178683",
"0.6172232",
"0.61662424",
"0.6163843",
"0.6159777",
"0.6130448",
"0.6116526",
"0.6113241",
"0.6113241",
"0.6113241",
"0.6107275",
"0.6104052",
"0.61003786",
"0.60982126",
"0.6095522",
"0.609431",
"0.6090261",
"0.6089812",
"0.6087315",
"0.6087315",
"0.6081777",
"0.60798067",
"0.60776496",
"0.6049546",
"0.6049546",
"0.60459703",
"0.6036468",
"0.60346544",
"0.603317",
"0.6028904",
"0.60253435",
"0.6025282",
"0.5997295",
"0.5990223",
"0.59790915",
"0.5968121",
"0.59642476",
"0.5960537",
"0.5956211",
"0.59439313",
"0.59435433",
"0.59361535",
"0.5933722",
"0.5915955"
] |
0.0
|
-1
|
Remove none numeric characters then run default ruby float cast
|
def to_f
gsub(SCRUB_NUMBER_REGEX, EMPTY_STRING).core_to_f
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend",
"def convert_float(str)\n return nil if !str\n str.gsub! /[^0-9.]/, \"\"\n neg = str.match /\\((.*?)\\)/\n float = str.to_f\n neg ? -float : float\n end",
"def convert_float( text_value )\r\n (!text_value.empty?) ? text_value.to_f : 0.0\r\nend",
"def get_float(node)\n node.content.squish.gsub(/[^\\d\\.]+/, '').to_f if node.present? && node.content.present?\n end",
"def to_float_or_int(v)\n v.match('\\.').nil? ? Integer(v) : Float(v)\n end",
"def numeric?; float?; end",
"def to_float(value)\n return value.to_f if value.is_a?(Numeric)\n value = value.to_s if value.is_a?(Symbol)\n value.to_f if value.is_a?(String) && value.match?(NUMBER_PATTERN)\n end",
"def to_float(string)\n string.to_f\n rescue\n 0.0\n end",
"def jeff_parse_float(val)\n if val.nil?\n Float(0)\n else\n val.to_s.gsub(\",\", \"\").to_f\n end\n end",
"def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend",
"def to_a str\n str.split(' ').map{|v| Float(v) rescue v}\nend",
"def atof(string_float)\n sum = 0\n float_sum = 0\n decimal_split = string_float.split('.')\n if (decimal_split[0] != nil)\n sum = atoi(decimal_split[0])\n end\n\n if (decimal_split[1] != nil)\n decimal_split[1].each_byte.reverse_each do |char|\n float_sum = (float_sum * 0.1) + ((char - ZERO_ASCII_CODE)*0.1)\n end\n end\n\n return sum + float_sum\nend",
"def parse_float(value)\n Float(value.to_s.gsub(',','.'))\n rescue ArgumentError\n nil\n end",
"def float_or_nil(str)\n return nil if IGNORE_LIST.include?(str)\n return nil if str == -1\n Float(str || '')\n rescue ArgumentError\n nil\n end",
"def numericize\n\t\tcollect(&:to_f)\n\tend",
"def xml2value(content_string) Float(content_string.strip) end",
"def to_non_shorthand(value_string)\n return_float = 0\n if !value_string.nil? && value_string != \"N/A\"\n if value_string.include?(\"B\")\n return_float = value_string.delete(\"B\").to_f * 1000000000\n elsif value_string.include?(\"M\")\n return_float = value_string.delete(\"M\").to_f * 1000000\n elsif value_string.include?(\"K\")\n return_float = value_string.delete(\"K\").to_f * 1000000\n end\n end\n return_float\n end",
"def call\n clean_value = remove_commas\n PURE_NUMERIC_REGEX.match?(clean_value) ? clean_value : @original_value\n end",
"def convert_to_numeric(val)\n return BigDecimal(val, Float::DIG) if val.is_a?(Float)\n return val if val.is_a?(Numeric)\n # Eliminate any commas, $'s (or other currency symbol), or _'s.\n cursym = Regexp.quote(FatTable.currency_symbol)\n clean_re = /[,_#{cursym}]/\n val = val.to_s.clean.gsub(clean_re, '')\n return nil if val.blank?\n case val\n when /(\\A[-+]?\\d+\\.\\d*\\z)|(\\A[-+]?\\d*\\.\\d+\\z)/\n BigDecimal(val.to_s.clean)\n when /\\A[-+]?[\\d]+\\z/\n val.to_i\n when %r{\\A([-+]?\\d+)\\s*[:/]\\s*([-+]?\\d+)\\z}\n Rational($1, $2)\n end\n end",
"def typecast_to_numeric(value, method)\n if value.is_a?(String)\n value = value.strip.gsub(/,/, '.').gsub(/[^\\d\\-\\.]/, '').gsub(/\\.(?!\\d*\\Z)/, '')\n value.empty? ? nil : value.send(method)\n elsif value.respond_to?(method)\n value.send(method)\n else\n nil\n end\n end",
"def __s2f(other)\n return other if other.is_a? Numeric\n if /^0[Xx][0-9a-fA-F]+$/ =~ other\n other.to_i(0).to_f\n else\n other.to_f\n end\n end",
"def float(key, default=0.0)\n\t\tstr = self.fetch(key.downcase, nil)\n\t\tif not str.nil?\n\t\t\treturn str.to_f\n\t\tend\n\t\treturn default\n\tend",
"def test_parse_float_string\n assert_equal 0.0, parse_float_string(\"\\x00\\x00\\x00\\x80\")\n assert_equal -100.0, parse_float_string(\"\\x00\\x00\\xc8\\xc2\").round(2)\n assert_equal -122.44, parse_float_string(\"\\x48\\xe1\\xf4\\xc2\").round(2)\n end",
"def coerce_float(value, _options = {})\n Float(value) rescue nil\n end",
"def typecast_value_float(value)\n Float(value)\n end",
"def to_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = TO_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 313:11: 'float:'\n match( \"float:\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end",
"def coerce_float(value, options = {})\n Float(value) rescue nil\n end",
"def coerce_float(value, options = {})\n Float(value) rescue nil\n end",
"def convert_i_f(value)\n if (value =~ /\\./)\n value = value.to_f\n elsif\n value = value.to_i\n end\n return value\nend",
"def _floatify(str, increment = true)\n if (( inf = str.to_s.match(/^([+-])?inf/i) ))\n (inf[1] == \"-\" ? -1.0 : 1.0) / 0.0\n elsif (( number = str.to_s.match(/^\\((-?\\d+)/i) ))\n number[1].to_i + (increment ? 1 : -1)\n else\n Float str.to_s\n end\n rescue ArgumentError\n raise Redis::CommandError, \"ERR value is not a valid float\"\n end",
"def numeric(object)\n object.to_s =~ /(^[-+]?[0-9]+$)|(\\.0+)$/ ? object.to_i : Float(object)\n end",
"def to_f(general_votes_cell)\n general_votes_cell.gsub(/[^0-9]/, '').to_f\n end",
"def to_float_or_int str\n Integer(str) rescue Float(str) rescue nil\n end",
"def atof(s)\n sep = s.split('.')\n\n integer = atoi(sep[0]) # convert integer to int\n mantissa = atoi(sep[1]) # convert mantissa to int\n neg = false\n\n # Remember if float is negative\n if integer < 0 \n neg = true\n integer = integer.abs\n end\n\n mantissaLength = sep[1].length\n place = 10.0 ** mantissaLength\n\n sum = integer / 1.0 # convert integer to float\n\n # Add the mantissa to the integer\n for i in 0..mantissaLength-1\n tmp = (mantissa % 10)/place\n sum += tmp\n place /= 10.0\n mantissa /= 10\n end\n\n sum = neg ? -sum : sum # Make number negative if necessary\n\n # Fix funky float operations\n return (sum*(10**mantissaLength)).round / (10.0 ** mantissaLength)\nend",
"def hex_to_float(txt)\n # Numerals::Format[:hexbin].read(txt, type: Float)\n # txt.scanf(\"%A\").first\n Float(txt)\nend",
"def convert_strings_to_floats(user_id)\n float_array = []\n strip_usd_from_the_strings(user_id).each do |fare|\n float_array << fare.to_f\n end\n float_array\nend",
"def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend",
"def convertToNum(price)\n \treturn Float(price.gsub(/\\s+/, \"\").gsub(\"USD \",\"\"))\n end",
"def Float(p0) end",
"def replace_invalid_chars(price)\n decimalised = price[/[.]/] ? price : \"0.\" + price \n decimalised.gsub(/[£p]/, '').to_f\nend",
"def typecast_to_float(value)\n typecast_to_numeric(value, :to_f)\n end",
"def test_002_convert_float2\r\n\tresult = convert_float( '')\r\n\tassert close_enough( 0.0, result )\r\n end",
"def to_f\n case @kind\n when :float_lit, :float_exp_lit,\n :integer_lit, :integer_exp_lit,\n :single_string_lit, :double_string_lit\n @value.to_f\n else\n self.to_i.to_f\n end\n end",
"def parse(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\nend",
"def integer_or_float(x)\n if x.include?(\".\")\n return x.to_f\n else\n return x.to_i\n end\nend",
"def check_type (num)\n # convert to float if validated number contains a decimal\n if num =~ /\\./\n return num = Float(num)\n else\n return num = Integer(num)\n end\nend",
"def is_number? string\n true if Float(string) rescue false\nend",
"def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend",
"def clean_value(value)\n case value\n when Symbol then value.to_s\n when TrueClass then 1\n when FalseClass then 0\n when /^\\d+$/ then value.to_i # Integer\n when /^\\d+(\\.\\d+)?([eE]\\d+)?$/ then value.to_f # Float\n when blank? then nil\n else value\n end \n end",
"def _is_numeric?(str)\n Float(str) != nil rescue false\n end",
"def float\n Util.from_bytes :float, value\n end",
"def from_german_to_f\n self.gsub(',', '.').to_f\n end",
"def check_value(text)\n\n #this method recieves a string representing a payment value in the format 19,470.99\n #Then it takes off the comma (\",\") and parse it to float format as 19470.99\n begin\n return text.gsub(\",\",\"\").to_f\n rescue\n return nil\n end\n\n end",
"def parse_gross(gross)\n gross.gsub(/[$,]/, '').to_f\nend",
"def is_numeric?(val)\n Float val rescue false\n end",
"def parse_float attr_name, xpath\n v = parse_value xpath\n v = v.to_f if v.respond_to?(:to_f)\n send(\"#{attr_name}=\", v)\n end",
"def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end",
"def cast_to_num(str)\n Integer(str)\n rescue ArgumentError\n Float(str)\n rescue ArgumentError\n nil\n end",
"def literal_float(value)\n if value.finite?\n super\n elsif value.nan?\n \"'NaN'\"\n elsif value.infinite? == 1\n \"'Infinity'\"\n else\n \"'-Infinity'\"\n end\n end",
"def get_float(key)\n get(key, \"f\")\n end",
"def get_float\n gets.chomp.to_f\nend",
"def float_or_interger(str)\n if str.include?\".\"\n num =str.to_f\n else\n num = str.to_i\n end\n return num\nend",
"def convert_value(value_node)\n if value_node.nil?\n return\n end\n if value_node['type'] == 'REAL' || value_node['value'].include?('.')\n return value_node['value'].to_f\n else\n return value_node['value'].to_i\n end\n end",
"def type_cast(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\n end",
"def cast\n return to_f if numeric? && index(\".\")\n return to_i if numeric?\n if boolean?\n return true if self =~ /\\Atrue\\z/i\n return false if self =~ /\\Afalse\\z/i\n end\n self\n end",
"def string_to_number(string)\n string.to_f\nend",
"def extract_decimal_from_default(default)\n Float(default).to_s\n rescue\n nil\n end",
"def decimal_pelado(num)\n num.sub! ',', '' if num.is_a?(String) && num.include?(',')\n num.to_f\nend",
"def bill_clean(bill) \n\tbill.gsub(/[a-zA-Z]/, \"\").gsub(\"$\", \"\").to_f\nend",
"def typecast(value)\n case value\n when %r{\\Atrue\\z}i then true\n when %r{\\Afalse\\z}i then false\n when %r{\\A\\s*\\z}i then nil\n else\n begin\n begin\n Integer(value)\n rescue StandardError\n Float(value)\n end\n rescue StandardError\n unescape_value(value)\n end\n end\n end",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def number\n number = number.to_s\n if number.includes?('.')\n number = number.to_f\n else\n number = number.to_i\n end\nend",
"def numeric?(string)\n Float(string) != nil rescue false\n end",
"def _f(str)\n _n(str).gsub(/([\\d]+\\.?)(.*)/, '\\2')\n end",
"def to_float(num)\n return num unless num.is_a? Numeric\n num.to_f\n end",
"def numberfy(input_string)\n if input_string.include?(\".\")\n input_string.to_f\n else input_string.to_i\n end\nend",
"def no_float(str)\n\t(str.to_f) == 0\ntotal_cents = ((str).to_f * 100).to_i\nend",
"def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend",
"def to_Float\n begin\n fl = Float stripn\n return fl\n rescue ArgumentError\n return false\n end\n end",
"def time_to_float(input)\n return input.respond_to?(:to_time) ? input.to_time.to_f : input.to_f\n end",
"def value_to_float(value)\n if @slop.strict?\n begin\n Float(value.to_s)\n rescue ArgumentError\n raise InvalidArgumentError, \"#{value} could not be coerced into Float\"\n end\n else\n value.to_s.to_f\n end\n end",
"def float_dec(x)\n Numerals::Format[:free, :exact_input].write(x)\nend",
"def unpack_float(value)\n value.to_f\n end",
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17L boondocks\")\n assert_equal(:float, token)\n assert_equal('0xabcdef.123p-17L', value)\n assert_equal(' boondocks', rest)\n end",
"def consume_numeric; end",
"def user_values(values)\n values.each_with_object({}) do |row_value, data|\n key, value = row_value.strip.split(/:\\s?/)\n data[key] = Float(value)\n end\nend",
"def is_numeric(str)\n Float(str) != nil rescue false\n end",
"def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend",
"def parse_number(num)\n if num.is_float?\n num.to_f\n else\n num.to_i\n end\n end",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def float?(str)\n true if Float(str) rescue false\n end",
"def to_stringified_float(int)\r\n # your code goes here\r\n # use of methods\r\n\r\n int.to_f.to_s\r\nend",
"def convert_to_euros_1(dollars)\n dollars * 0.95 if dollars.is_a?(Numeric)\nend",
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17boondocks\")\n assert_equal(:float, token)\n assert_equal('0xabcdef.123p-17', value)\n assert_equal(' boondocks', rest)\n end",
"def numeric(input)\n return Float(input) != nil rescue false\n end",
"def float_format(string)\n custom = split_float string\n output_array = add_commas custom[:integer_part]\n output_array.join + \".\" + custom[:decimal_part]\nend",
"def float2maxima(value)\n str = value.to_s ;\n str.gsub!(/^0\\./,'.') ;\n str.gsub!(/^-0\\./,'-.') ;\n return str ;\n end",
"def parse(text)\n text.gsub(/[\\s%]/, '').strip.to_f\n end",
"def to_numeric(anything)\n\n num = BigDecimal.new(anything.to_s)\n if num.frac == 0\n num.to_i\n else\n num.to_r\n end\n end",
"def handle_float(float, lineno_column)\n Literal.new float.to_f\n end"
] |
[
"0.79024374",
"0.7483114",
"0.72769636",
"0.7184323",
"0.6987389",
"0.69836974",
"0.6949767",
"0.6880023",
"0.6833504",
"0.6828915",
"0.6790639",
"0.6778442",
"0.67424923",
"0.67006284",
"0.6693914",
"0.6593933",
"0.6585941",
"0.65810823",
"0.65718967",
"0.65576327",
"0.6544261",
"0.6524869",
"0.648034",
"0.6479435",
"0.64715916",
"0.6441247",
"0.64401644",
"0.64401644",
"0.64330244",
"0.64302945",
"0.6425312",
"0.639084",
"0.6374067",
"0.6337666",
"0.63359624",
"0.632444",
"0.63091534",
"0.6305977",
"0.6301764",
"0.63000506",
"0.628458",
"0.6230741",
"0.6179049",
"0.6139377",
"0.61308235",
"0.612544",
"0.6125141",
"0.6099863",
"0.60920405",
"0.60894054",
"0.608555",
"0.60736996",
"0.6052133",
"0.6040119",
"0.60363287",
"0.60306484",
"0.60294664",
"0.60264677",
"0.6025741",
"0.60143846",
"0.6007445",
"0.59971184",
"0.5974029",
"0.5962331",
"0.59622407",
"0.59525007",
"0.59434164",
"0.59384847",
"0.59375745",
"0.59302926",
"0.5928736",
"0.59275514",
"0.59258366",
"0.59160477",
"0.5915559",
"0.5914871",
"0.59139013",
"0.59073424",
"0.59064776",
"0.5906271",
"0.5902036",
"0.58989877",
"0.58978903",
"0.58952343",
"0.5889334",
"0.58858776",
"0.5876195",
"0.5873456",
"0.5856599",
"0.582793",
"0.58138824",
"0.5813191",
"0.5813172",
"0.58078957",
"0.5804711",
"0.5804341",
"0.5803358",
"0.579811",
"0.57942677",
"0.5784161"
] |
0.5953416
|
65
|
For now, we assume that write does not include id
|
def write(table, row)
file = $tables[table]
# By default, set the ID to the last index + 1
# This can potentially re-use a deleted ID
# But it cannot (yet) create two rows with the same ID
id = file.size() == 0 ?
1 :
file.last_line.split(",").first.to_i + 1
# Add the id to the beginning of the row
row.unshift(id)
file.puts(serialize(row))
id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pending_write?; end",
"def write_value_using_id_strategy(writer, _key)\n writer.push_value(@object.attributes['_id'], 'id') unless @object.new_record?\n end",
"def write\n @id = store.put(self)\n end",
"def write\n write_data\n end",
"def write; end",
"def write; end",
"def write?; end",
"def write?; end",
"def write?; end",
"def write\n end",
"def before_write\n end",
"def set_write\n @write = Write.find(params[:id])\n end",
"def write_record ids, attributes, options = {}\n remote.write ids, attributes, options[:context]\n end",
"def open_for_write\n end",
"def close_write() end",
"def close_write() end",
"def close_write() end",
"def write_attrs\n self.temp_attrs[:id] = self.id\n self.temp_attrs[:created_at] ||= Time.now.utc.to_i\n\n attrs_to_write = self.temp_attrs.dup\n # Serialize nested hashes.\n self.nested_attributes.each do |name|\n val = attrs_to_write[name]\n attrs_to_write[name] = val.to_json if ! val.nil?\n end\n\n redis_hash_key_bulk_set(self.attrs.key, attrs_to_write)\n end",
"def no_write!\n @write = false\n end",
"def write object, index\n raise NotImplementedError\n end",
"def write_metadata; end",
"def close_write; end",
"def write id, seq = nil\n if seq == nil\n item = id\n if item.respond_to?(:descr)\n @f.write \">\"+item.descr+\"\\n\"\n else\n @f.write \">\"+item.id+\"\\n\"\n end\n @f.write item.seq.to_s.strip+\"\\n\"\n else\n @f.write \">\"+id+\"\\n\"\n @f.write seq.to_s.strip+\"\\n\"\n end\n end",
"def docs_to_write; end",
"def ignore_interference_by_writer; end",
"def closed_write?() end",
"def write(id, value)\n @exists = true\n @store.transaction do\n @store[id] = value\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"id\", @id)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_additional_data(@additional_data)\n end",
"def close_write(*) end",
"def save!\n unless @hash[\"id\"]\n self.class.create\n return true\n end\n\n fields = @hash.map do |k, v|\n \"#{k}=#{self.class.to_sql(v)}\"\n end.join \",\"\n\n DB.execute <<SQL\nUPDATE #{self.class.table}\nSET #{fields}\nWHERE id = #{@hash[\"id\"]}\nSQL\n true\n end",
"def save!\n if @_id\n retval = collection.update({ '_id' => @_id}, @data.to_hash)\n else\n retval = collection.save(@data.to_hash)\n end\n\n !!retval\n end",
"def test_write_list1()\n key = \"_testWriteList1_\"\n t = Scalaroid::Transaction.new()\n\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n t.write(@testTime.to_s + key + i.to_s, [$_TEST_DATA[i], $_TEST_DATA[i + 1]])\n end\n\n # now try to read the data:\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = t.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n\n t.close_connection()\n\n # commit the transaction and try to read the data with a new one:\n t.commit()\n t = Scalaroid::Transaction.new()\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = t.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n\n t.close_connection()\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 serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"chatId\", @chat_id)\n end",
"def save\n _create unless @json_dict.fetch(@id_property, false)\n end",
"def test_write_list1()\n key = \"_WriteList1_\"\n conn = Scalaroid::TransactionSingleOp.new()\n\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n conn.write(@testTime.to_s + key + i.to_s, [$_TEST_DATA[i], $_TEST_DATA[i + 1]])\n end\n\n # now try to read the data:\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = conn.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n\n conn.close_connection()\n end",
"def close_write\n\t\t\t\n\t\tend",
"def write?\n return true unless added.zero?\n return false unless update?\n !(updated + removed).zero?\n end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def save\n id ? update : insert\n end",
"def save_hashes_for_write\n \n end",
"def set_ingest_id( filename, id )\n\n begin\n File.open( \"#{filename}.id\", 'w') do |file|\n file.write( id )\n end\n return true\n rescue => e\n end\n return false\n end",
"def closed_write?()\n #This is a stub, used for indexing\n end",
"def save!\n unless @hash['id']\n self.class.create @hash\n return true\n end\n values_to_set = @hash.each_with_object([]) { |(k, v), result| result << \"#{k} = '#{v}'\" }.join(',')\n DB.execute <<SQL\nUPDATE #{self.class.table}\nSET #{values_to_set}\nWHERE id = #{@hash['id']}\nSQL\n end",
"def writer; end",
"def _writeSingleTest(key, data)\n t = Scalaroid::Transaction.new()\n\n t.write(@testTime.to_s + key, data)\n # now try to read the data:\n assert_equal(data, t.read(@testTime.to_s + key))\n # commit the transaction and try to read the data with a new one:\n t.commit()\n t = Scalaroid::Transaction.new()\n assert_equal(data, t.read(@testTime.to_s + key))\n\n t.close_connection()\n end",
"def save\n # SQL INJECTION\n # prevent malicious users\n # a'); DROP TABLE tweets; --\n sql = <<-SQL\n INSERT INTO tweets (message, username)\n VALUES (?, ?);\n SQL\n\n # binding.pry\n # persist\n if !!@id\n # update\n else\n DB[:conn].execute(sql, self.message, self.username)\n # but i don't know what i am, save the id\n @id = DB[:conn].execute(\"SELECT * FROM tweets;\").last[\"id\"]\n end\n self\n # There is! BUT I'm not going to fix it. WHY? BECAUSE SOEMONE ELSE GHAS ALREADY DONE IT!\n end",
"def write(data)\n # black hole, because we don't actually care about what gets written\n end",
"def write!(_)\n raise NotImplementedError, 'Implement #write! in child class'\n end",
"def write_params\n params.require(:write).permit(:person_id, :publication_id)\n end",
"def store(ids, user_id, conn)\n tputs \"Writing to database\"\n ids_doc = ids.inject([]) { | res, id | res << { '_id' => id } }\n begin\n conn[user_id.to_s].insert(ids_doc, :continue_on_error => true)\n rescue Mongo::OperationFailure => e\n if not e.error_code == 11000\n raise e\n end\n end\nend",
"def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end",
"def ids_writer(ids)\n primary_key = reflection.association_primary_key\n pk_type = klass.type_for_attribute(primary_key)\n ids = Array(ids).compact_blank\n ids.map! { |id| pk_type.cast(id) }\n\n records = if klass.composite_primary_key?\n query_records = ids.map { |values_set| klass.where(primary_key.zip(values_set).to_h) }.inject(&:or)\n\n query_records.index_by do |record|\n primary_key.map { |primary_key| record._read_attribute(primary_key) }\n end\n else\n klass.where(primary_key => ids).index_by do |record|\n record._read_attribute(primary_key)\n end\n end.values_at(*ids).compact\n\n if records.size != ids.size\n found_ids = records.map { |record| record._read_attribute(primary_key) }\n not_found_ids = ids - found_ids\n klass.all.raise_record_not_found_exception!(ids, records.size, ids.size, primary_key, not_found_ids)\n else\n replace(records)\n end\n end",
"def each_for_write\n \t \tbegin\n\t \t \thelper = TransHelper.new\n\t \t \thelper.trans([:Layer]) do |tr,db,tables|\n\t \t \t \tself.each do |sel_object|\n\t \t \t \t\tent = helper.get_obj(sel_object.ObjectId, :Read)\n\t \t \t \t\tlayer = helper.get_obj(ent.LayerId)\n\t \t \t \t\tif !layer.IsLocked\n\t \t \t \t\t\tent.UpgradeOpen\n\t \t \t \t \tyield ent \n\t \t \t \t end\t\n\t \t \t \tend\n\t \t \tend\n \t rescue Exception => e\n\t\t puts_ex e\n\t \t end\t\n \t end",
"def update_index\n if should_be_in_index?\n mapper.process_with([record]) do |context|\n writer.put(context)\n end\n else\n writer.delete(record.send(Kithe.indexable_settings.solr_id_value_attribute))\n end\n end",
"def public_write_was\n writer_group_ids == [UserGroup.all_users.id]\n end",
"def testWriteList1()\n key = \"_WriteList1_\"\n conn = Scalaris::TransactionSingleOp.new()\n\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n conn.write(@testTime.to_s + key + i.to_s, [$_TEST_DATA[i], $_TEST_DATA[i + 1]])\n end\n \n # now try to read the data:\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = conn.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n \n conn.close_connection()\n end",
"def testWriteList1()\n key = \"_WriteList1_\"\n conn = Scalaris::TransactionSingleOp.new()\n\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n conn.write(@testTime.to_s + key + i.to_s, [$_TEST_DATA[i], $_TEST_DATA[i + 1]])\n end\n \n # now try to read the data:\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = conn.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n \n conn.close_connection()\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"id\", @id)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_enum_value(\"targetType\", @target_type)\n writer.write_additional_data(@additional_data)\n end",
"def save\n id.nil? ? insert : update\n end",
"def write(_request, _response)\n raise NotImplementedError, 'Implement this method in your strategy'\n end",
"def update_last_id_exercice id\n File.open(path_last_id_exercice,'wb'){ |f| f.write id.to_s }\n end",
"def save input\n table = DB.from(@table) # DB[@table]\n \n # invalidate a cached range\n @@_cached_range = nil\n \n if input[:id] \n table.where(:id => input[:id]).update input.reject{|key,value| key.to_s == 'id'}\n get :id => input[:id]\n else\n self.create input\n end \n\n end",
"def closed_write?\n end",
"def write_db(id_hash)\n db = read_db() # open database for querying\n db.results_as_hash # format query results as a hash so columns available as keys\n max_id = db.execute('select max(\"id\") from tokens')[0][0] # determine current max index (id) in details table\n max_id == nil ? id = 1 : id = max_id + 1 # set index variable based on current max index value\n email = id_hash[\"email\"] # prepare email address for database insert\n fcm_id = id_hash[\"fcm_id\"] # prepare Firebase token for database insert\n db.execute('insert into tokens (id, email, fcm_id)\n values(?, ?, ?)', [id, email, fcm_id])\nend",
"def commit\n @read_lock.synchronize do\n @write_lock.synchronize do\n unless @saved\n storage.store(self.class, @id, @data.dup)\n end\n @saved = true\n end\n end\n end",
"def write_to_db\n @data.each_pair do |user_id, h|\n h.each_pair do |server_id, a|\n if a[:modified]\n # The :modified attribute doesn't need to be written into the database.\n DB.update_row_double_key(\n :shrk_roulette,\n [user_id, server_id, a[:plays], a[:streak], a[:highscore], a[:deaths]]\n )\n a[:modified] = false\n end\n end\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"draftTimeOff\", @draft_time_off)\n writer.write_object_value(\"sharedTimeOff\", @shared_time_off)\n writer.write_string_value(\"userId\", @user_id)\n end",
"def write item\n @f.write \">\"+item.id+' '+item.descr+\"\\n\"\n @f.write item.seq.strip+\"\\n\"\n end",
"def save_if_none_match\n status = orchio_put_if_none_match(to_json_direct) if valid?\n retval status\n end",
"def write(data)\n end",
"def commit\n writer.commit\n end",
"def readwrite(*fields)\n readable(*fields)\n writable(*fields)\n allow(*fields)\n nil\n end",
"def write_object(id, raw)\n if @entries.length > @btreedb.max_blob_size\n # The blob has reached the maximum size. Replace the blob with a BTree\n # node directory and distribute the blob entires into the sub-blobs of\n # the new BTree node.\n split_blob\n # Insert the passed object into the newly created BTree node.\n @btreedb.put_raw_object(raw, id)\n else\n bytes = raw.bytesize\n crc32 = Zlib.crc32(raw, 0)\n start_address = reserve_bytes(id, bytes, crc32)\n if write_to_blobs_file(raw, start_address) != bytes\n PEROBS.log.fatal 'Object length does not match written bytes'\n end\n write_index\n end\n end",
"def write\n command :write\n self\n end",
"def save\n collection = Object.const_get(self.class.name).send(:collection)\n\n if @attributes.include? '_id'\n collection.update({'_id' => @attributes['_id']}, @attributes, {:upsert => true})\n else\n id = collection.save(@attributes)\n @attributes['_id'] = id\n end\n end",
"def _do_write(io)\n instantiate_all\n @field_objs.each { |f| f.do_write(io) }\n end",
"def save\n if valid?\n write\n increment\n true\n else\n false\n end\n end",
"def write_value_using_mongoid_strategy(writer, key)\n writer.push_value(@object.attributes[key], key)\n end",
"def testWriteList1()\n key = \"_testWriteList1_\"\n t = Scalaris::Transaction.new()\n\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n t.write(@testTime.to_s + key + i.to_s, [$_TEST_DATA[i], $_TEST_DATA[i + 1]])\n end\n \n # now try to read the data:\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = t.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n \n t.close_connection()\n \n # commit the transaction and try to read the data with a new one:\n t.commit()\n t = Scalaris::Transaction.new()\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = t.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n \n t.close_connection()\n end",
"def testWriteList1()\n key = \"_testWriteList1_\"\n t = Scalaris::Transaction.new()\n\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n t.write(@testTime.to_s + key + i.to_s, [$_TEST_DATA[i], $_TEST_DATA[i + 1]])\n end\n \n # now try to read the data:\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = t.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n \n t.close_connection()\n \n # commit the transaction and try to read the data with a new one:\n t.commit()\n t = Scalaris::Transaction.new()\n (0..($_TEST_DATA.length - 2)).step(2) do |i|\n actual = t.read(@testTime.to_s + key + i.to_s)\n assert_equal([$_TEST_DATA[i], $_TEST_DATA[i + 1]], actual)\n end\n \n t.close_connection()\n end",
"def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end",
"def save_operation\n self.writeable_attributes\n end",
"def save!(*)\n super.tap do\n attributes.id = @response.body[\"id\"]\n end\n end",
"def no_read!\n @write = false\n end",
"def _close_write\n @_write_closed = true\n end",
"def __bson_dump__(io, key)\n io << Types::OBJECT_ID\n io << key.to_bson_cstring\n io << data\n end",
"def lock_write\n write_sync_mutex.lock\n\n begin\n @writer = true\n\n exclusive_mutex.lock\n\n @owner = Thread.current\n ensure\n write_sync_mutex.unlock\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTimeUtc\", @created_date_time_utc)\n writer.write_collection_of_object_values(\"deviceIdentities\", @device_identities)\n writer.write_enum_value(\"status\", @status)\n end",
"def write(*data); end",
"def db_write! args\n #TODO put this in rescue blocks so that if something chokes, we don't completely die, and put in a new table (or maybe a column for logging errors?)\n args.collect! do |o|\n o.is_a?(String) ? SQLite3::Database.quote(o) : o\n end\n \n sql = %{\n INSERT INTO %s\n (article_name, desc, revision_id, old_id, user, byte_diff, ts, description)\n VALUES ('%s', '%s', '%d', %d, '%s', %d, %d, '%s')\n } % ([@table_name] + args)#article_name, desc, rev_id, old_id, user, byte_diff, ts, description\n \n #deal with multiple threads writing to db\n key = Digest::MD5.hexdigest(Time.now.to_i.to_s + sql)\n @db_queue << [sql, key]\n key\n #return the primary id of the row that was created:\n #@db.get_first_value(\"SELECT last_insert_rowid()\")\n end",
"def save(obj)\n self.delete(obj, true)\n values = values(obj)\n return true if values[:hash_value].blank? || (!values[:range_value].nil? && values[:range_value].blank?)\n while true\n existing = Dynamoid::Adapter.read(self.table_name, values[:hash_value], { :range_key => values[:range_value] })\n ids = ((existing and existing[:ids]) or Set.new)\n new_ids = ids + Set[obj.id]\n\n if unique? && new_ids.length > 1\n raise Dynamoid::Errors::UniqueIndexError.new \"Uniqueness failure on index #{table_name}.\"\n end\n\n if existing\n if existing[:ids]\n options = {:if => {:ids => existing[:ids]}}\n else\n options = {:unless_exists => \"ids\"}\n end\n end\n begin\n return Dynamoid::Adapter.write(self.table_name, {:id => values[:hash_value], :ids => new_ids, :range => values[:range_value]}, options)\n rescue Dynamoid::Errors::ConditionalCheckFailedException\n end\n end\n end",
"def commit()\n #This is a stub, used for indexing\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"columnId\", @column_id)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_string_value(\"qualityId\", @quality_id)\n writer.write_additional_data(@additional_data)\n end",
"def write(file_name, unique_keys, data, options = {})\n mode = (!options.empty? && options[:overwrite]) ? \"w\" : \"a\"\n open(file_name + \".json\", mode) do |f|\n unless rec_exists?(file_name, unique_keys, data)\n f.puts data\n end\n end\nend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end"
] |
[
"0.6438489",
"0.631332",
"0.6303347",
"0.62978226",
"0.6260789",
"0.6260789",
"0.6219477",
"0.6219477",
"0.6219477",
"0.60446864",
"0.6018515",
"0.59657264",
"0.5910093",
"0.5906797",
"0.58926094",
"0.58926094",
"0.58926094",
"0.58605856",
"0.584262",
"0.5837871",
"0.58347183",
"0.5832078",
"0.5752647",
"0.5738467",
"0.5711662",
"0.5681727",
"0.56773055",
"0.5667657",
"0.5635153",
"0.5631209",
"0.56212944",
"0.5616331",
"0.56014895",
"0.5537464",
"0.5536343",
"0.5535686",
"0.5527413",
"0.55192256",
"0.5511388",
"0.5511388",
"0.5511388",
"0.5511388",
"0.5487414",
"0.5477273",
"0.5475112",
"0.5472917",
"0.5469503",
"0.5464008",
"0.54552203",
"0.5438587",
"0.5434828",
"0.5408392",
"0.53966254",
"0.5392456",
"0.537888",
"0.5374344",
"0.5364617",
"0.5361918",
"0.53554773",
"0.53554285",
"0.53554285",
"0.5355058",
"0.53501093",
"0.5346405",
"0.5343497",
"0.53432274",
"0.53358364",
"0.533205",
"0.53219223",
"0.53172266",
"0.5313255",
"0.5312871",
"0.531185",
"0.531012",
"0.5308916",
"0.5306002",
"0.5303292",
"0.5302667",
"0.53023565",
"0.5299939",
"0.5298006",
"0.5294177",
"0.5290656",
"0.5290656",
"0.5290163",
"0.52818304",
"0.5269951",
"0.52672815",
"0.52639276",
"0.5249676",
"0.52493817",
"0.5243789",
"0.52310294",
"0.5229423",
"0.5225828",
"0.52247626",
"0.5224355",
"0.5216089",
"0.5214136",
"0.5206716"
] |
0.548788
|
42
|
For simplicity, we will completely rewrite the table
|
def delete(table, id)
file = $tables[table]
raw_row = binary_search(file, id)
row_id = raw_row[0...10].to_i
# Read the data after the current row
cur_size = file.size()
file_offset = row_id * ROW_LENGTH
file.seek(file_offset, File::SEEK_SET)
file_end = file.read(file.size() - file_offset)
# Overwrite file starting at current row
file.seek((row_id - 1) * ROW_LENGTH, File::SEEK_SET)
file.write(file_end)
file.truncate(cur_size - ROW_LENGTH) # Shrink size of file by one row
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rebuild(table); end",
"def update_table_sql(sql)\n sql << ' '\n source_list_append(sql, @opts[:from][0..0])\n end",
"def table; end",
"def table; end",
"def table; end",
"def table; end",
"def iso_code_table\n update unless @iso_code_table\n @iso_code_table\n end",
"def copy_new_rows\n tables.each(&:copy_new_rows)\n end",
"def tableConvert(tableName, table)\n dbTableH = Hash.new\n records = Array.new\n i = 0\n \n table.each do\n |row|\n records[i] = row\n i += 1\n end\n dbTableH[tableName] = records\n \n return dbTableH\nend",
"def before_load\n data_class.rebuild_table\n super\n end",
"def copy_rows( field, \n table_struct, \n src_table_name = TABLE_NAME, \n dest_table_name = NEW_TABLE_NAME, \n num_rows = ROWS_PER_TRANSACTION)\n rows = grab_rows(field, src_table_name, num_rows)\n keys_for_delete = insert_rows(rows, field, table_struct, dest_table_name)\n keys_for_delete\nend",
"def process_rows!\n # Correct incorrect rows in the table\n table.each do |row|\n row_metric = row[\"metric\"] # perf optimization\n # TODO inject Saikuro reference\n if row_metric == :saikuro\n fix_row_file_path!(row)\n end\n tool_tables[row_metric] << row\n file_tables[row[\"file_path\"]] << row\n class_tables[row[\"class_name\"]] << row\n method_tables[row[\"method_name\"]] << row\n end\n end",
"def extend_table(new_entry, table)\n\t\ttable.unshift new_entry\n\tend",
"def prefix_table\n update unless @prefix_table\n @prefix_table\n end",
"def _table; @table end",
"def update_table\n\t$table.each do |row|\n\t\tif unbroken?(row)\n\t\t\tclear(row)\n\t\t\t$cleared_lines += 1\n\t\t\t$score += 100\n\t\tend\n\tend\nend",
"def replace(tbl2)\n raise TypeError, \"a Tb expected but #{tbl2.inspect}\" unless Tb === tbl2\n @next_recordid = tbl2.instance_variable_get(:@next_recordid)\n @recordid2index = tbl2.instance_variable_get(:@recordid2index).dup\n @free_index = tbl2.instance_variable_get(:@free_index).dup\n @tbl = Hash[tbl2.instance_variable_get(:@tbl).map {|k, v| [k, v.dup] }]\n @field_list = tbl2.instance_variable_get(:@field_list).dup\n end",
"def rebuild\n raise \"Too many entries.\" if @rebuilds >= MAX_REBUILDS old = @table\n @slots = PRIMES[@rebuilds]\n self.size = 0\n fill_table @slots\n old.each do |e|\n upsert e.key, e.value if e\n end\n @rebuilds += 1\nend",
"def stamp_new_rows\n tables.each(&:stamp_new_rows)\n end",
"def call\n Rails.logger.debug \"Replacing #{@local_table}\"\n replace\n end",
"def initialize_copy(original)\n super\n @table = @table.dup\n end",
"def initialize_copy(orig)\n super\n @__table__ = @__table__.dup\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 create_full_rst_tbl(preserve_null_pk = true)\n unless defined? @full_rst_tbl\n self.all_cols_select\n self.pk_full_list\n if preserve_null_pk\n renamed_pk_col = @pk_full_list.map { |pk| \"#{pk['col']} as #{pk['alias']}_pk\" }.join(', ')\n else\n renamed_pk_col = @pk_full_list.map do |pk|\n pkcol = @all_cols.find{|col| col.colname == pk['colname'] and col.relname==pk['relname']}\n \"COALESCE(#{pk['col']},#{pkcol.null_replacement}) as #{pk['alias']}_pk\"\n end.join(',')\n end\n targetListReplacement = \"#{renamed_pk_col},#{@all_cols_select}\"\n query = ReverseParseTree.reverseAndreplace(@parseTree, targetListReplacement, '')\n @full_rst_tbl = \"#{@table}_full_rst\"\n pk = @pk_full_list.map { |pk| \"#{pk['alias']}_pk\" }.join(', ')\n # binding.pry\n DBConn.tblCreation(@full_rst_tbl, pk, query)\n\n # unless preserve_null_pk\n # DBConn.update_null_columns(@full_rst_tbl,pk)\n # end\n # if is_plain_query()\n # query = QueryBuilder.create_tbl(@full_rst_tbl, pk, query)\n # DBConn.exec(query)\n # else\n # query = QueryBuilder.create_tbl(@full_rst_tbl, '', query)\n # DBConn.exec(query)\n\n # # not_null_query = pk_list.flat.map{|pk| \"#{pk} is not null\"}.join(' AND ')\n # # add index on not null columns\n # pk_not_null = @pk_full_list.map { |pk| \"#{pk['alias']}_pk is not null\"}.join(' OR ')\n # create_indx = \"CREATE UNIQUE INDEX idx_#{@full_rst_tbl} on #{@full_rst_tbl} (#{pk}) where #{pk_not_null}\"\n # pp create_indx\n # DBConn.exec(create_indx)\n\n # end\n end\n return @full_rst_tbl\n end",
"def initialize_copy(orig)\n super\n @table = @table.dup\n end",
"def _update_without_checking(columns)\n super(identifier_hash(columns))\n end",
"def migration_update_table\n added, removed, changed, prev_fields = field_changes\n\n if table_comments\n new_table_comment = table_comment_changes\n new_fields_comments = fields_comments_changes\n end\n\n unless added.present? || removed.present? || changed.present? ||\n new_table_comment || new_fields_comments.present? || table_name_changed || no_master_association_changed\n return\n end\n\n new_fields_comments ||= {}\n\n <<~ARCONTENT\n self.no_master_association = #{!!no_master_association}\n #{table_name_changed ? \" self.prev_table_name = '#{prev_table_name}'\" : ''}\n #{table_name_changed ? ' update_table_name' : ''}\n #{table_name_changed ? '' : \" self.prev_fields = %i[#{prev_fields.join(' ')}]\"}\n \\# added: #{added}\n \\# removed: #{removed}\n \\# changed type: #{changed}\n #{new_table_comment ? \" \\# new table comment: #{new_table_comment.gsub(\"\\n\", '\\n')}\" : ''}\n #{new_fields_comments.present? ? \" \\# new fields comments: #{new_fields_comments.keys}\" : ''}\n update_fields\n ARCONTENT\n end",
"def new_table(name, field_defs, encrypt, record_class)\r\n # Header rec consists of last record no. used, delete count, and\r\n # all field names/types. Here, I am inserting the 'recno' field\r\n # at the beginning of the fields.\r\n header_rec = ['000000', '000000', record_class, 'recno:Integer',\r\n field_defs].join('|')\r\n\r\n header_rec = 'Z' + encrypt_str(header_rec) if encrypt\r\n\r\n begin\r\n fptr = open(File.join(@db.path, name.to_s + @db.ext), 'w')\r\n fptr.write(header_rec + \"\\n\")\r\n ensure\r\n fptr.close\r\n end\r\n end",
"def resetCrawlerTable\n @db.execute \"DROP TABLE IF EXISTS #{@crawlerTable};\"\n @db.execute <<-SQL\n CREATE TABLE \"#{@crawlerTable}\" (\n name varchar(40),\n price float,\n quantity varchar(20),\n url varchar(50),\n location varchar(40),\n style varchar(50)\n );\n SQL\n end",
"def table=(_arg0); end",
"def _save_update_all_columns_hash\n v = Hash[@values]\n Array(primary_key).each{|x| v.delete(x) unless changed_columns.include?(x)}\n v\n end",
"def _save_update_all_columns_hash\n v = Hash[@values]\n Array(primary_key).each{|x| v.delete(x) unless changed_columns.include?(x)}\n v\n end",
"def fini(table)\n table.fini = true\n table.save\n end",
"def build_sql(field)\n statement_sql = ''\n keys = primary_keys(field)\n puts \" Altering #{keys.length} records for: #{field.name} => #{field.output_type}\".blue\n keys.each do |primary_key|\n record_sql = \"UPDATE #{field.table} \"\n record_sql += \"SET #{field.column} = '#{out_val(field)}' \"\n record_sql += \"#{where_and(record_sql)} #{field.primary_key_col} = #{primary_key};\\n\"\n statement_sql += record_sql\n end \n statement_sql\nend",
"def _save_update_all_columns_hash\n v = @values.dup\n Array(primary_key).each{|x| v.delete(x) unless changed_columns.include?(x)}\n v.delete(model.lock_column)\n v\n end",
"def copy_and_clear_table(params)\n table_name = params[:table]\n game = params[:game]\n team_table = params[:team_table]\n result_filter = params[:result_filter] # for Log only\n main_class = table_name.constantize\n archive_class = (\"Archive#{table_name}\").constantize\n\n main_class.where(game_id: game.id).each do |row|\n\n condition = result_filter.blank? || result_filter.include?(row.result_code) # check the result_filter\n condition &&= archive_class.find_by_id(row.id).blank? # check if this record is already archived\n if condition\n archive_instance = archive_class.new\n main_class.column_names.each do |column|\n if column == 'team_id'\n # if this team is not in game requests\n unless team_table[row.team_id]\n team = Team.find(row.team_id)\n archive_team = ArchiveTeam.create(name: team.name, alternative_name: team.alternative_name,\n image_url: team.image_url, team_id: team.id, game_id: game.id)\n team_table.merge!({team.id => archive_team.id})\n end\n\n archive_instance.send( \"#{column}=\", team_table[row.team_id] )\n else\n archive_instance.send(\"#{column}=\", row.send(column))\n end\n end\n archive_instance.save\n end\n end\n main_class.where(game_id: game.id).map(&:delete)\n end",
"def adapt_step_table(step_table_ast)\n adapted_step_table = {}\n\n # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data\n save_original_data(adapted_step_table, step_table_ast)\n clear_child_elements(adapted_step_table, [[:rows]])\n\n adapted_step_table['rows'] = []\n step_table_ast.rows.each do |row|\n adapted_step_table['rows'] << adapt_table_row(row)\n end\n adapted_step_table['line'] = step_table_ast.location.line\n adapted_step_table['column'] = step_table_ast.location.column\n\n adapted_step_table\n end",
"def [](table)\n @to_sql += table.to_sql\n @tables = [table]\n self\n end",
"def initialize_table; end",
"def vendor_table\n update unless @vendor_table\n @vendor_table\n end",
"def reset_to_new_row\n self.row = Row.new\n self.state = NEW_ROW\n self.cur_family = nil\n self.cur_qaul = nil\n self.cur_ts = nil\n self.cur_val = nil\n self.cur_labels = nil\n end",
"def insert_table(table, identifier, data)\n if existing_data = get_table(table, identifier)\n if existing_data.empty? || !existing_data.has_key?('.members')\n data.each { |key, value| existing_data[key] = value }\n return data\n else\n error_report \"Error in insert_table: Redefinition of #{identifier}\"\n raise ParseError\n end\n end\n\n table['table_data'].push([identifier, data])\n table['quick_look'][identifier] = 1\n return data\nend",
"def insert_table(table, identifier, data)\n if existing_data = get_table(table, identifier)\n if existing_data.empty? || !existing_data.has_key?('.members')\n data.each { |key, value| existing_data[key] = value }\n return data\n else\n error_report \"Error in insert_table: Redefinition of #{identifier}\"\n raise ParseError\n end\n end\n\n table['table_data'].push([identifier, data])\n table['quick_look'][identifier] = 1\n return data\nend",
"def process_row(table, row)\n Log.write_log(table.name, \"Processing row: #{row.pretty_inspect}\")\n row.each do |v|\n row.to_h.each do |k,v|\n row[k] = Utf8_Converter::convert(v) if v.kind_of?(String)\n end\n end\n pk_string = ''\n table.primary_key.each do |pk|\n pk_string << row[pk].to_s\n end\n if pk_string.empty?\n row.each {|c| pk_string << c.to_s}\n end\n if (table.__id_store__)\n default_table_row = InsertRow.new(table.__default_table__, IdStore.new(table.name, pk_string))\n else\n default_table_row = InsertRow.new(table.__default_table__)\n end\n default_table_row.prototype_table_map = table\n default_table_row.prototype_result_set = row\n table_rows = []\n\n table.each_column do |attr_name, maps_to|\n next if maps_to == IGNORE\n\n if maps_to.kind_of?(ReaktorColumn)\n #\n # ReaktorColumn\n #\n default_table_row.add(*process_reaktor_column(maps_to, attr_name, row))\n elsif maps_to.kind_of?(ReaktorRow)\n #\n # ReaktorRow\n #\n table_rows << process_reaktor_row(maps_to, attr_name, row)\n elsif maps_to.kind_of?(Class)\n #\n # Plugin\n #\n plugin = process_plugin(maps_to, attr_name, row)\n list = plugin.each\n if list.kind_of?(Array)\n list.each do |reaktor_object|\n if reaktor_object.kind_of?(ReaktorColumn)\n default_table_row.add(*process_reaktor_column(reaktor_object, attr_name, row))\n elsif reaktor_object.kind_of?(ReaktorRow)\n table_rows << process_reaktor_row(reaktor_object, attr_name, row)\n else\n STDERR.puts \"reaktor_object was a #{reaktor_object.class} class\"\n exit\n end\n end\n end\n else\n STDERR.puts \"maps_to was of class: #{maps_to.class} and not processed\"\n exit\n end\n end\n \n table.__set__.each do |set|\n t = set.value\n if set.value.kind_of?(Query)\n tsth = $dbh_pg.prepare(set.value.sql)\n begin\n tsth.execute(row[:id])\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(tsth)}.\")\n raise\n exit\n end\n r = tsth.fetch\n t = r.nil? ? r : r[0]\n else\n t = set.parse_value(nil, row)\n end\n t = Filter.apply_filters(t, row, set.filters)\n default_table_row.add(set.name, t)\n end\n table_rows.insert(0, default_table_row) unless table.__default_table__.nil?\n return table_rows\nend",
"def rebuild_table\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.ZMERGEABLEDATA1 \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" +\n \"WHERE ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER=?\",\n @uuid) do |row|\n\n # Extract the blob\n gzipped_data = row[\"ZMERGEABLEDATA1\"]\n zlib_inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)\n gunzipped_data = zlib_inflater.inflate(gzipped_data)\n\n # Read the protobuff\n mergabledata_proto = MergableDataProto.decode(gunzipped_data)\n\n # Build list of key items\n @key_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_key_item.each do |key_item|\n @key_items.push(key_item)\n end\n\n # Build list of type items\n @type_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_type_item.each do |type_item|\n @type_items.push(type_item)\n end\n\n # Build list of uuid items\n @uuid_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_uuid_item.each do |uuid_item|\n @uuid_items.push(uuid_item)\n end\n\n # Build Array of objects\n @table_objects = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n @table_objects.push(mergeable_data_object_entry)\n\n # Best way I've found to set the table direction\n if mergeable_data_object_entry.custom_map\n if mergeable_data_object_entry.custom_map.map_entry.first.key == @key_items.index(\"crTableColumnDirection\") + 1 #Oddly seems to correspond to 'self'\n @table_direction = mergeable_data_object_entry.custom_map.map_entry.first.value.string_value\n end\n end\n end\n\n # Find the first ICTable, which shuld be the root, and execute\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n if mergeable_data_object_entry.custom_map and @type_items[mergeable_data_object_entry.custom_map.type] == \"com.apple.notes.ICTable\"\n parse_table(mergeable_data_object_entry)\n end\n end\n end\n end",
"def columns; self.class.columns.dup; end",
"def table_rotation(params)\n\n\t\tself.log << \"Starting table rotation\"\n\n\t\tsql = \"truncate #{params[:cg_table]}_new\"\n\t\[email protected](sql)\n\n \tsql = \"insert into #{params[:cg_table]}_new(subjectid,sent_flag,status_flag, enrollment_id, scan_procedure_id,status_comment,dir_list, dti_sent_flag, dti_status_flag, dti_dir_list , pcvipr_sent_flag, pcvipr_status_flag, pcvipr_dir_list ,\n \t\t\t\t\t\twahlin_t1_asl_resting_sent_flag, wahlin_t1_asl_resting_status_flag, wahlin_t1_asl_resting_dir_list ,xnat_sent_flag, xnat_status_flag, xnat_dir_list ) select subjectid,sent_flag,status_flag, enrollment_id, scan_procedure_id,status_comment,dir_list, dti_sent_flag, dti_status_flag, dti_dir_list , pcvipr_sent_flag, pcvipr_status_flag, pcvipr_dir_list ,\n \t\t\t\t\t\twahlin_t1_asl_resting_sent_flag, wahlin_t1_asl_resting_status_flag, wahlin_t1_asl_resting_dir_list ,xnat_sent_flag, xnat_status_flag, xnat_dir_list from #{params[:cg_table]}\"\n \[email protected](sql)\n\n\t # recruit new adrc scans --- change \n\t sql = \"select distinct enrollments.enumber from enrollments,enrollment_vgroup_memberships, vgroups, scan_procedures_vgroups where enrollments.enumber like 'adrc%' \n and vgroups.id = enrollment_vgroup_memberships.vgroup_id \n and enrollment_vgroup_memberships.enrollment_id = enrollments.id\n and scan_procedures_vgroups.vgroup_id = vgroups.id\n and scan_procedures_vgroups.scan_procedure_id = 22 \n and enrollments.enumber NOT IN ( select subjectid from cg_adrc_upload_new)\n and vgroups.transfer_mri ='yes'\"\n\t results = @connection.execute(sql)\n\t results.each do |r|\n\t enrollment = Enrollment.where(\"enumber in (?)\",r[0])\n\t sql2 = \"insert into #{params[:cg_table]}_new (subjectid,sent_flag,status_flag, enrollment_id, scan_procedure_id,dti_sent_flag,dti_status_flag) values('\"+r[0]+\"','N','Y', \"+enrollment.first.id.to_s+\",22,'N','Y')\"\n\t results2 = @connection.execute(sql2)\n\t end\n\t # its going to grab ~70 -need to adjust v_weeks_back to cover 2015-08-05\n\t sql = \"select distinct enrollments.enumber from enrollments,enrollment_vgroup_memberships, vgroups, scan_procedures_vgroups where enrollments.enumber like 'adrc%' \n\t and vgroups.id = enrollment_vgroup_memberships.vgroup_id \n\t and enrollment_vgroup_memberships.enrollment_id = enrollments.id\n\t and scan_procedures_vgroups.vgroup_id = vgroups.id\n\t and scan_procedures_vgroups.scan_procedure_id = 65 \n\t and concat(enrollments.enumber,'_v2') NOT IN ( select subjectid from cg_adrc_upload_new)\n\t and vgroups.transfer_mri ='yes'\"\n\t results = @connection.execute(sql)\n\t results.each do |r|\n\t enrollment = Enrollment.where(\"enumber in (?)\",r[0])\n\t sql2 = \"insert into #{params[:cg_table]}_new (subjectid,sent_flag,status_flag, enrollment_id, scan_procedure_id,dti_sent_flag,dti_status_flag) values('\"+r[0]+\"_v2','N','Y', \"+enrollment.first.id.to_s+\",65,'N','Y')\"\n\t results2 = @connection.execute(sql2)\n\t end \n\n\t sql = \"select distinct enrollments.enumber from enrollments,enrollment_vgroup_memberships, vgroups, scan_procedures_vgroups where enrollments.enumber like 'adrc%' \n\t and vgroups.id = enrollment_vgroup_memberships.vgroup_id \n\t and enrollment_vgroup_memberships.enrollment_id = enrollments.id\n\t and scan_procedures_vgroups.vgroup_id = vgroups.id\n\t and scan_procedures_vgroups.scan_procedure_id = 89\n\t and concat(enrollments.enumber,'_v3') NOT IN ( select subjectid from cg_adrc_upload_new)\n\t and vgroups.transfer_mri ='yes'\"\n\t results = @connection.execute(sql)\n\t results.each do |r|\n\t enrollment = Enrollment.where(\"enumber in (?)\",r[0])\n\t sql2 = \"insert into #{params[:cg_table]}_new (subjectid,sent_flag,status_flag, enrollment_id, scan_procedure_id,dti_sent_flag,dti_status_flag) values('\"+r[0]+\"_v3','N','Y', \"+enrollment.first.id.to_s+\",89,'N','Y')\"\n\t results2 = @connection.execute(sql2)\n\t end \n\n\t sql = \"select distinct enrollments.enumber from enrollments,enrollment_vgroup_memberships, vgroups, scan_procedures_vgroups where enrollments.enumber like 'adrc%' \n\t and vgroups.id = enrollment_vgroup_memberships.vgroup_id \n\t and enrollment_vgroup_memberships.enrollment_id = enrollments.id\n\t and scan_procedures_vgroups.vgroup_id = vgroups.id\n\t and scan_procedures_vgroups.scan_procedure_id = 119\n\t and concat(enrollments.enumber,'_v4') NOT IN ( select subjectid from cg_adrc_upload_new)\n\t and vgroups.transfer_mri ='yes'\"\n\t results = @connection.execute(sql)\n\t results.each do |r|\n\t enrollment = Enrollment.where(\"enumber in (?)\",r[0])\n\t sql2 = \"insert into #{params[:cg_table]}_new (subjectid,sent_flag,status_flag, enrollment_id, scan_procedure_id,dti_sent_flag,dti_status_flag) values('\"+r[0]+\"_v4','N','Y', \"+enrollment.first.id.to_s+\",119,'N','Y')\"\n\t results2 = @connection.execute(sql2)\n\t end \n\n\t sql = \"truncate #{params[:cg_table]}_old\"\n\t @connection.execute(sql)\n\n\t sql = \"insert into #{params[:cg_table]}_old select * from #{params[:cg_table]}\" \n\t @connection.execute(sql)\n\n\t sql = \"truncate #{params[:cg_table]}\"\n\t @connection.execute(sql)\n\n\t \tsql = \"insert into #{params[:cg_table]} select * from #{params[:cg_table]}_new\"\n\t @connection.execute(sql)\n\n\t shared = Shared.new\n\t shared.apply_cg_edits(params[:cg_table])\n\n\t self.log << \"Table rotation complete\"\n\n\tend",
"def revise_table\n name = @table_extension.name\n @table_extension.extended.each do |method_name|\n define_extension_setter(name, method_name)\n define_extension_getter(name, method_name)\n define_extension_dirty(name, method_name)\n end\n @table_extension.mirrored.each do |method_name|\n define_extension_mirror_setter(name, method_name)\n end\n true\n end",
"def parse_table; end",
"def right_table; table_sync.right_table; end",
"def raw_table_to_hash tbl\n fixd_hsh = tbl.reject{|arr| arr.blank?}.inject({}) do |h,arr|\n title = arr.first.downcase.gsub(/[-\\s]/, '_').to_sym\n val = arr.last.gsub(\",\",\"\")\n h[title] = val\n h\n end\n fixd_hsh\n end",
"def table\n end",
"def fixup_columns\n @columns.each_index do |idx| \n\n if @columns[idx][:searchable].nil? then\n @columns[idx][:searchable] = @model_class.column_methods_hash[@columns[idx][:id].intern] ? true : false\n end\n @columns[idx][:query] = @columns[idx][:id] if @columns[idx][:query].nil?\n \n if @columns[idx][:sortable].nil? then\n @columns[idx][:sortable] = @columns[idx][:query] == false ? false : true\n end\n \n end\n end",
"def table_modifier_in_create(o)\n \" TEMPORARY\" if o.temporary\n end",
"def copy \n t = @tab.clone ;\n for i in 0..3\n t[i] = t[i].clone\n end\n Table.new(t) ;\n end",
"def pack\r\n raise \"Do not execute this method in client/server mode!\" if \\\r\n @db.client?\r\n\r\n lines_deleted = @db.engine.pack_table(self)\r\n\r\n update_header_vars\r\n\r\n @db.engine.remove_recno_index(@name)\r\n @db.engine.remove_indexes(@name)\r\n create_indexes\r\n create_table_class unless @db.server?\r\n\r\n return lines_deleted\r\n end",
"def get_valid_model_table(table)\n new_table = []\n unless table.empty?\n length_table = table.size\n (0..length_table - 1).each do |row_index|\n cells_added = 0\n original_row = [].concat(table[row_index])\n new_table[row_index] = [] if new_table.size <= row_index\n length_row = original_row.size\n (0..length_row - 1).each do |cell_index|\n cell = original_row[cell_index]\n new_cell_index = cell_index + cells_added\n new_row = new_table[row_index]\n until new_row[new_cell_index].nil?\n cells_added += 1\n new_cell_index = cell_index + cells_added\n end\n new_row[new_cell_index] = cell\n\n next unless cell.has_attribute?('rowspan')\n\n rowspan = cell.get_attribute('rowspan').to_i\n\n next unless rowspan > 1\n\n (1..rowspan - 1).each do |rowspan_index|\n new_row_index = row_index + rowspan_index\n new_table[new_row_index] = [] if new_table[new_row_index].nil?\n new_table[new_row_index][new_cell_index] = cell\n end\n end\n end\n end\n new_table\n end",
"def store_using_table(_table_privacy_changed = false)\n store\n end",
"def copy_table_data(from, to, remaps = [])\n old = columns(from).collect(&:name)\n current = columns(to).collect(&:name)\n remapped_columns = remaps.collect {|c| c.first.to_s}.compact\n common = (current & old).sort - remapped_columns\n from_columns = common.collect {|c| \"`#{c}`\"}\n to_columns = common.collect {|c| \"`#{c}`\"}\n remaps.each do |remap|\n remap = [remap].flatten\n next if remap.length != 2\n from_columns << remap.first\n to_columns << remap.last\n end\n from_columns_to_s = from_columns.join(', ')\n to_columns_to_s = to_columns.join(', ')\n execute \"INSERT INTO #{to}(#{to_columns_to_s}) SELECT #{from_columns_to_s} FROM #{from}\"\n end",
"def on_table?; @on_table; end",
"def expand_transition_table(row)\n (row - @transition_table.size + 1).times do |r|\n @transition_table << {}\n end\n end",
"def alter_table(name, *)\n super\n remove_cached_schema(name)\n nil\n end",
"def store_table #:nodoc:\n return if @compatibility == 0\n\n # Offset from the DBCELL record back to the first ROW of the 32 row block.\n row_offset = 0\n\n # Track rows that have cell data or modified by set_row().\n written_rows = []\n\n\n # Write the ROW records with updated max/min col fields.\n #\n (0 .. @dim_rowmax-1).each do |row|\n # Skip unless there is cell data in row or the row has been modified.\n next unless @table[row] or @row_data[row]\n\n # Store the rows with data.\n written_rows.push(row)\n\n # Increase the row offset by the length of a ROW record;\n row_offset += 20\n\n # The max/min cols in the ROW records are the same as in DIMENSIONS.\n col_min = @dim_colmin\n col_max = @dim_colmax\n\n # Write a user specifed ROW record (modified by set_row()).\n if @row_data[row]\n # Rewrite the min and max cols for user defined row record.\n packed_row = @row_data[row]\n packed_row[6..9] = [col_min, col_max].pack('vv')\n append(packed_row)\n else\n # Write a default Row record if there isn't a user defined ROW.\n write_row_default(row, col_min, col_max)\n end\n\n # If 32 rows have been written or we are at the last row in the\n # worksheet then write the cell data and the DBCELL record.\n #\n if written_rows.size == 32 or row == @dim_rowmax -1\n # Offsets to the first cell of each row.\n cell_offsets = []\n cell_offsets.push(row_offset - 20)\n\n # Write the cell data in each row and sum their lengths for the\n # cell offsets.\n #\n written_rows.each do |row|\n cell_offset = 0\n\n if @table[row]\n @table[row].each do |col|\n next unless col\n append(col)\n length = col.length\n row_offset += length\n cell_offset += length\n end\n end\n cell_offsets.push(cell_offset)\n end\n\n # The last offset isn't required.\n cell_offsets.pop\n\n # Stores the DBCELL offset for use in the INDEX record.\n @db_indices.push(@datasize)\n\n # Write the DBCELL record.\n store_dbcell(row_offset, cell_offsets)\n\n # Clear the variable for the next block of rows.\n written_rows = []\n cell_offsets = []\n row_offset = 0\n end\n end\n end",
"def flush\n conn.transaction do\n buffer.flatten.each do |row|\n # check to see if this row's compound key constraint already exists\n # note that the compound key constraint may not utilize virtual fields\n next unless row_allowed?(row)\n\n # add any virtual fields\n add_virtuals!(row)\n \n key_names = []\n key_values = []\n @key_columns.each do |name|\n key_names << \"#{name}\"\n key_values << conn.quote(row[name]) # TODO: this is probably not database agnostic\n end\n\n names = []\n values = []\n (order - @key_columns).each do |name|\n names << \"#{name}\"\n values << conn.quote(row[name]) # TODO: this is probably not database agnostic\n end\n\n all_name_values = (key_names+names).zip(key_values+values)\n\n q = <<EOF\nMERGE INTO #{table_name} d \nUSING (SELECT #{all_name_values.collect {|c,v| \"#{v} #{c}\"}.join(',')} FROM DUAL) s\nON (#{map_src_to_dest(key_names,'s','d').join(' AND ')})\nWHEN MATCHED THEN \nUPDATE SET #{[map_src_to_dest(names,'s','d'), \"d.#{@update_ts_column}=CURRENT_TIMESTAMP\"].flatten.join(',')}\nWHEN NOT MATCHED THEN\nINSERT (#{all_name_values.collect {|c,v| 'd.'+c}.join(',')},d.#{@insert_ts_column})\nVALUES (#{all_name_values.collect {|c,v| 's.'+c}.join(',')},CURRENT_TIMESTAMP)\nEOF\n #q = \"INSERT INTO `#{table_name}` (#{names.join(',')}) VALUES (#{values.join(',')})\"\n ETL::Engine.logger.debug(\"Executing upsert: #{q}\")\n conn.insert(q, \"Upsert row #{current_row}\")\n @current_row += 1\n end\n buffer.clear\n end\n end",
"def splice_table(*tables)\n table = tables.shift\n tables.each do |new_table|\n table.each_with_index do |row, i|\n table[i] = row + new_table[i]\n end\n end\n table\nend",
"def reset_table_name #:nodoc:\n self.table_name = compute_table_name\n end",
"def process_table(table)\n \n $stderr.puts \"Processing table: %-15s to default table: #{table.__default_table__}\" % table.name\n Log.write_log(table.name, \"Processing table: #{table.name}\")\n table.each_column do |attr_name, maps_to|\n if maps_to.kind_of?(ReaktorColumn)\n maps_to.fill_in_defaults(table.__default_table__, attr_name)\n end\n end\n table.__set__.each do |rc|\n rc.fill_in_defaults(table.__default_table__, nil)\n end\n if table.instance_variable_defined?(:@__query__)\n query = table.__query__\n else\n query = build_query(table.name, table.__filter_rows__)\n end\n Log.write_log(table.name, \"Query: #{query}\")\n begin\n sth = $dbh_pg.execute(query)\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n while row = sth.fetch\n next unless preconditions_met?(row, table.__precondition__)\n\n process_row(table, row).each do |r|\n reaktor_insert(r) unless r.nil?\n end\n end\nend",
"def copy_table(old_table_name, new_table_name)\r\n execute add_select_into_table(new_table_name, \"SELECT * FROM #{old_table_name}\")\r\n end",
"def prepare_table(element)\n name=element.attributes[\"name\"]\n oid=SNMPPass.oid2num(element.attributes[\"oid\"])\n\n # Read index and columns\n indexes=element.elements[\"row/linkage\"].elements.collect(\"index\") {|index| index.attributes[\"name\"]}\n columns=element.elements[\"row\"].elements.collect(\"column\") do\n |column|\n column_name=column.attributes[\"name\"]\n column_oid=column.attributes[\"oid\"]\n column_id=SNMPPass.oid2num(column_oid).last\n\n $DEBUG.puts \"TABLE: #{name} NAME: #{column_name} ID #{column_id}, OID: #{column_oid}\"\n\n #column_desc=column.elements[\"description\"].text.gsub(/^[[:blank:]\\n]*/,\"\").gsub(/[[:blank:]\\n]*$/,\"\")\n type=prepare_type(column.elements[\"syntax\"], column_name)\n [column_name,column_id,type]\n end\n\n @indexes[name]=indexes\n @columns[name]=columns\n\n table=DynamicTree.new(oid){|op, *roid| dynamic_tree_callback(name, op, *roid) }\n add_node(table)\n end",
"def copy_table(old_table_name, new_table_name)\n transaction do\n execute \"CREATE TABLE #{new_table_name} LIKE #{old_table_name}\"\n execute \"INSERT INTO #{new_table_name} SELECT * FROM #{old_table_name}\"\n end\n end",
"def initialize_table\n @total_rows.times do |row|\n row_array = Array.new(@total_columns, \"\")\n @reconstructed_table.push(row_array)\n end\n end",
"def apply_changes\n changes.each do |method, args|\n connection.send(method, new_table, *args)\n end\n end",
"def create_stats_tbl\n tblName = \"#{@table}_stat\"\n creationQuery = \"select ''::text as key, ''::text as value from t_result where 1 =2\"\n # puts creationQuery\n DBConn.tblCreation(tblName, 'key', creationQuery)\n\n parseTree = @parseTree\n\n # fromPT = parseTree['SELECT']['fromClause']\n originalTargeList = parseTree['SELECT']['targetList']\n # fields = DBConn.getAllRelFieldList(fromPT)\n keyList = []\n valueList = []\n selectList = []\n pkJoinList = []\n \n pkArray = @pkList.split(',').map { |col| col.delete(' ') }\n pkArray.each do |pkcol|\n originalTargeList.each do |targetCol|\n targetField = targetCol['RESTARGET']['val']['COLUMNREF']['fields']\n if targetField.count > 1 && targetField[1].to_s == pkcol\n pkJoinList << \"t.#{pkcol} = #{targetField[0]}.#{targetField[1]}\"\n pkArray.delete(pkcol)\n end\n end\n end\n\n stats = {\n \"min\": {\"func\": \"min($COLUMN)\", \"type\": \"text\" },\n \"max\": {\"func\": \"max($COLUMN)\", \"type\": \"text\" },\n \"count\": {\"func\": \"count($COLUMN)\", \"type\": \"int\" },\n \"dist_count\": {\"func\": \"count(distinct $COLUMN)\", \"type\": \"int\" }\n }\n @all_cols.each do |field|\n # puts field.colname\n rel_alias = field.relalias\n stats.each do |stat, info|\n # SELECT\n # UNNEST(ARRAY['address_id_max','address_id_min']) AS key,\n # UNNEST(ARRAY[max(address_id),min(address_id)]) AS value\n # FROM address\n # only add N(umeric) and D(ate) type fields\n if %w(N D).include? field.typcategory\n keyList << \"'#{field.relname}_#{field.colname}_#{stat}'\"\n value = info[:func].gsub('$COLUMN',\"result.#{field.relname}_#{field.colname}\")\n # if info[:type] == 'text'\n value = \"#{value}::text\"\n # end\n valueList << value\n # valueList << \"#{stat}(result.#{field.relname}_#{field.colname})::text\"\n end\n end\n selectList << \"#{rel_alias}.#{field.colname} as #{field.relname}_#{field.colname} \"\n\n # construnct pk join cond\n if pkArray.include?(field.colname)\n pkJoinList << \"#{@table}.#{field.colname} = #{rel_alias}.#{field.colname}\"\n end\n end\n\n # # remove the where clause in query and replace targetList\n whereClauseReplacement = []\n selectQuery = ReverseParseTree.reverseAndreplace(parseTree, selectList.join(','), whereClauseReplacement)\n resultQuery = %(with result as (#{selectQuery} join #{@table} on #{pkJoinList.join(' AND ')}))\n newTargetList = \"UNNEST(ARRAY[#{keyList.join(',')}]) AS key, UNNEST(ARRAY[#{valueList.join(',')}]) as value\"\n\n newQuery = %(#{resultQuery} SELECT #{newTargetList} FROM result)\n query = %(INSERT INTO #{tblName} #{newQuery})\n # puts query\n DBConn.exec(query)\n end",
"def add_select_into_table(new_table_name, sql_query)\r\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\r\n end",
"def copy_table_structure(rdb,tbl)\n template = \"SELECT sql, type from X.sqlite_master WHERE tbl_name = ? ORDER BY type DESC\"\n lsql = template.gsub('X',\"main\")\n rsql = template.gsub('X',quote_with_dots(rdb))\n args = [quote_with_dots(tbl)]\n lschema = sqlite_execute(lsql,args)\n rschema = sqlite_execute(rsql,args)\n if lschema.length>0\n return false\n end\n rschema.each{ |row| sqlite_execute(row[0],[]) }\n true\n end",
"def copy_table_structure(rdb,tbl)\n template = \"SELECT sql, type from X.sqlite_master WHERE tbl_name = ? ORDER BY type DESC\"\n lsql = template.gsub('X',\"main\")\n rsql = template.gsub('X',quote_with_dots(rdb))\n args = [quote_with_dots(tbl)]\n lschema = sqlite_execute(lsql,args)\n rschema = sqlite_execute(rsql,args)\n if lschema.length>0\n return false\n end\n rschema.each{ |row| sqlite_execute(row[0],[]) }\n true\n end",
"def copy_table_structure(rdb,tbl)\n template = \"SELECT sql, type from X.sqlite_master WHERE tbl_name = ? ORDER BY type DESC\"\n lsql = template.gsub('X',\"main\")\n rsql = template.gsub('X',quote_with_dots(rdb))\n args = [quote_with_dots(tbl)]\n lschema = sqlite_execute(lsql,args)\n rschema = sqlite_execute(rsql,args)\n if lschema.length>0\n return false\n end\n rschema.each{ |row| sqlite_execute(row[0],[]) }\n true\n end",
"def prepare_hgt_com_trsf_prkgrs_old()\n \n @conn.execute \\\n \"truncate table hgt_com_trsf_prkgrs\"\n \n puts \"hgt_com_trsf_prkgrs table truncated...\"\n \n #\n sql = \"select id,\n gene_id,\n TXSRC_ID,\n TXDST_ID,\n WEIGHT_TR_TX\n from HGT_COM_TRSF_TAXONS\"\n \n #puts \"sql: #{sql}\"\n \n \n tr_taxons = HgtComTrsfTaxon.find_by_sql(sql)\n \n tr_taxons.each {|tr|\n \n\n #debugging\n #next unless tr.gene_id == 111 and tr.txsrc_id == 768679 and tr.txdst_id == 374847\n \n #puts \"tr: #{tr.inspect}\"\n #puts \"tr.id: #{tr.id}, #{tr.gene_id}\"\n \n #for each chiteria\n (0..1).each {|crit|\n \n #for each criteria and\n #for each source and destination prok groups\n sql = \"select tg.PROK_GROUP_ID,\n tg.WEIGHT_PG\n from TAXON_GROUPS tg \n join PROK_GROUPS pg on pg.id = tg.PROK_GROUP_ID\n where tg.TAXON_ID = #{tr.txsrc_id} and\n pg.GROUP_CRITER_ID = #{crit}\"\n #puts \"sql: \\n #{sql}\"\n \n pg_src = TaxonGroup.find_by_sql(sql)\n \n \n sql = \"select tg.PROK_GROUP_ID,\n tg.WEIGHT_PG\n from TAXON_GROUPS tg \n join PROK_GROUPS pg on pg.id = tg.PROK_GROUP_ID\n where tg.TAXON_ID = #{tr.txdst_id} and\n pg.GROUP_CRITER_ID = #{crit}\"\n #puts \"sql: \\n #{sql}\"\n \n pg_dst = TaxonGroup.find_by_sql(sql)\n \n pg_src.each {|src|\n pg_dst.each {|dst|\n \n #puts \"src: #{src.inspect}\"\n #puts \"dst: #{dst.inspect}\"\n \n #insert alternative\n prkg = HgtComTrsfPrkgr.new \n prkg.gene_id = tr.gene_id\n prkg.hgt_com_trsf_taxon_id = tr.id\n prkg.pgsrc_id = src.prok_group_id\n prkg.pgdst_id = dst.prok_group_id\n prkg.weight_tr_pg = tr.weight_tr_tx * src.weight_pg * dst.weight_pg\n prkg.save\n \n #prkg.gene_id = tr.gene_id \n #prkg.save\n \n \n }\n }\n \n \n \n \n \n } \n }\n \n \n end",
"def to_h\n @table.dup\n end",
"def update_database\n unless @statements.empty?\n alter_table_sql = \"ALTER TABLE #{@base.quote_table_name(@table_name)}\"\n result = @base.execute(alter_table_sql + \" \" + @statements.join(', '))\n @statements.clear\n result\n end\n end",
"def to_s_ensure_table_existence(s_table_name,s_columns_declaration)\n bn=binding()\n kibuvits_typecheck bn, String, s_table_name\n kibuvits_typecheck bn, String, s_columns_declaration\n s_cldec1=Kibuvits_str.normalise_linebreaks(s_columns_declaration)\n s_cldec1=s_cldec1.gsub(/[\\s\\n\\r\\t]+/,\" \")\n ht_needles=Hash.new\n ht_needles[',']=\",'.\\n'\"\n s_cldec2=Kibuvits_str.s_batchreplace(ht_needles, s_cldec1)+\".\\n\"\n s_out=Kibuvits_cg.fill_form([s_table_name,s_cldec2],\n @s_form_func_ensure_table_existence)\n return s_out\n end",
"def kv_table(table)\n transform_table!(table).rows_hash\nend",
"def rehash(growth_multiple = DEFAULT_GROWTH_MULTIPLE)\n puts \"Rehashing\"\n new_size = (table.length * growth_multiple).to_i\n @table = table.each_with_object(HashTable.new(new_size)) do |value, result|\n result.insert(value) unless value == TOMBSTONE_MARKER\n end.dump_table\n end",
"def add_select_into_table(new_table_name, sql_query)\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\n end",
"def create_global_tbl\n # full table contains all columns without where predicate\n # so for where predicate it also contains excluded rows\n\n # create full rst_tbl and update null pk\n @t_full_tbl = @tQueryObj.create_full_rst_tbl(false)\n @f_full_tbl = @fQueryObj.create_full_rst_tbl(false)\n\n tbl = Table.new(@t_full_tbl)\n global_name = 'tf_global'\n pkList = tbl.pk_column_list.map{|c| c.colname}.join(', ')\n insert_query = \"select #{pkList}, case count(1) when 1 then 'f' else 'p' end as type \"\\\n \"from (select #{pkList} from #{@t_full_tbl} UNION ALL \"\\\n \"select #{pkList} from #{@f_full_tbl}) as tmp \"\\\n \"group by #{pkList}\"\n # puts insert_query\n # QueryBuilder.exec_create_tbl(global_name, pkList, insert_query)\n DBConn.tblCreation(global_name, pkList, insert_query)\n # update null columns to resolve null value comparasion issue\n # binding.pry\n # DBConn.update_null_columns(global_name,pkList)\n\n return global_name\n end",
"def tnTableCreation(tableName)\n pk_list = @pkList.join(',')\n pk_list = \"#{pk_list},branch_name,node_name\"\n q = QueryBuilder.create_tbl(tableName, pk_list, \"select #{@pkSelect}, 0 as test_id,''::varchar(30) as node_name, ''::varchar(30) as branch_name, ''::varchar(5) as type from #{@fTable} f where 1 = 0\")\n # pp q\n DBConn.exec(q)\n\n # q=\"ALTER TABLE #{tableName} add column test_id int, add column node_name varchar(30), add column branch_name varchar(30), add column type varchar(5);\"\n # DBConn.exec(q)\n # [email protected](',')\n # # add index\n # q=\"create index ix_#{tableName}t on #{tableName} (#{pk},branch_name);\"\n # pp q\n # DBConn.exec(q)\n end",
"def copy_table(old_table_name, new_table_name)\n transaction do\n execute \"CREATE TABLE #{new_table_name} LIKE #{old_table_name}\"\n execute \"INSERT INTO #{new_table_name} SELECT * FROM #{old_table_name}\"\n end\n end",
"def extend_sql_avoiding_table_naming_clashes!(sql, addition)\r\n used_table_aliases = table_aliases_from_join_fragment(addition)\r\n old_table_aliases = table_aliases_from_join_fragment(sql)\r\n (used_table_aliases & old_table_aliases).each do |join_table_alias|\r\n i = 0\r\n begin\r\n i += 1\r\n new_alias = \"renamed_join_table_#{i}\"\r\n end until !used_table_aliases.include?(new_alias)\r\n convert_table_name_to_new_alias!(sql, join_table_alias, new_alias)\r\n end\r\n sql << \" #{addition} \"\r\n end",
"def update_audit_table\n logger.info \"Updating audit schema with modifications in table '#{name}'\"\n\n unversioned_filter = versioning_enabled ? '1 = 1' : '`_has_violation` = 0' \n\n q_rows_to_update = <<-EOS\n SELECT #{pkey_selection(audit)} \n FROM #{audit} \n WHERE `_has_delta`= 1 AND #{unversioned_filter} \n EOS\n\n db.query(q_rows_to_update).each do |row|\n watched_row = db.query(\"SELECT * FROM #{watched} WHERE #{condition_from_hashes(row)}\").to_a[0]\n db.query(\"UPDATE #{audit} SET #{assignment_from_hash(watched_row, self)} WHERE #{condition_from_hashes(row)}\")\n end\n end",
"def create_side_table\n RailsRedshiftReplicator.connection.exec \"CREATE TABLE #{temporary_table_name} (LIKE #{replication.target_table})\"\n end",
"def reformat_for_next_generation!\n # create an array of dead cells and insert it as the first and last row of cells\n dead_cells = ([email protected]).map { Cell.new }\n # don't forget to deep copy the dead_cells\n @cells.unshift Marshal.load(Marshal.dump(dead_cells))\n @cells.push Marshal.load(Marshal.dump(dead_cells))\n\n # also insert a dead cell at the left and right of each row\n @cells.each do |row|\n row.unshift Cell.new\n row.push Cell.new\n end\n\n # validate to see if we broke the board\n validate\n end",
"def column=(_); end",
"def save\n record = self\n @table.instance_eval { save(record) }\n end",
"def fix_row(row)\n values = (1..SIZE).to_a\n values.each do |v|\n if reducable(row, v)\n row = replace_possible_with_known(row, v)\n end\n end\n row\nend",
"def fix_row(row)\n values = (1..SIZE).to_a\n values.each do |v|\n if reducable(row, v)\n row = replace_possible_with_known(row, v)\n end\n end\n row\nend",
"def row; end",
"def create_table_sql(name, generator, options)\n a, b = super(name, generator, options), table_options_sql(options)\n \"#{a}\\n#{b}\"\n\t end",
"def copy_table(old_table_name, new_table_name)\n execute add_select_into_table(new_table_name, \"SELECT * FROM #{old_table_name}\")\n end",
"def table(table, stream)\n return if already_dumped?(table)\n\n new_stream = StringIO.new\n super(table, new_stream)\n string = new_stream.string\n\n if (parent_table = @connection.parent_table(table))\n table(parent_table, stream)\n string = inject_inherits_for_create_table(string, table, parent_table)\n string = remove_parent_table_columns(string, @connection.columns(parent_table))\n\n pindexes = Hash[@connection.indexes(parent_table).map { |index| [index.columns, index] }]\n cindexes = Hash[@connection.indexes(table).map { |index| [index.columns, index] }]\n\n string = remove_parent_table_indexes(string, (pindexes & cindexes).values)\n end\n\n # We've done this table\n dumped_tables << table\n\n stream.write string\n stream\n end",
"def update!\n @model.columns.each do |column|\n if row = @attrs.find {|x| x[:name] == column.name}\n if row[:type] != type_str(column)\n puts \" M #{@model}##{column.name} [#{row[:type]} -> #{type_str(column)}]\"\n row[:type] = type_str(column)\n elsif row[:desc] == InitialDescription::DEFAULT_DESCRIPTION\n new_desc = InitialDescription.for(@model, column.name)\n if row[:desc] != new_desc\n puts \" M #{@model}##{column.name} description updated\"\n row[:desc] = new_desc\n end\n end\n else\n puts \" A #{@model}##{column.name} [#{type_str(column)}]\"\n @attrs << {\n :name => column.name,\n :type => type_str(column),\n :desc => InitialDescription.for(@model, column.name)\n }\n end\n end\n\n # find columns that no more exist in db\n orphans = @attrs.map{|x| x[:name]} - @model.columns.map(&:name)\n unless orphans.empty?\n orphans.each do |orphan|\n puts \" D #{@model}##{orphan}\"\n @attrs = @attrs.select {|x| x[:name] != orphan}\n end\n end\n\n @attrs\n end",
"def left_table; table_sync.left_table; end"
] |
[
"0.7948124",
"0.62820804",
"0.6261469",
"0.6261469",
"0.6261469",
"0.6261469",
"0.6207432",
"0.6148647",
"0.6132191",
"0.6120511",
"0.6048569",
"0.602405",
"0.5991208",
"0.59648037",
"0.5964296",
"0.58568937",
"0.5846725",
"0.5821217",
"0.5817181",
"0.5805875",
"0.5794623",
"0.5789131",
"0.5783021",
"0.57780355",
"0.5771619",
"0.57686925",
"0.5752541",
"0.57479453",
"0.5745701",
"0.5743856",
"0.57393664",
"0.57393664",
"0.57270604",
"0.57131904",
"0.56840795",
"0.5675221",
"0.5668839",
"0.56637734",
"0.56401074",
"0.5636913",
"0.5636096",
"0.56305826",
"0.56305826",
"0.562866",
"0.56214863",
"0.5617031",
"0.5598114",
"0.55959946",
"0.5592773",
"0.5591622",
"0.55723125",
"0.556054",
"0.55569357",
"0.5552215",
"0.5536377",
"0.5533254",
"0.5525405",
"0.55221176",
"0.55163604",
"0.5510919",
"0.55108184",
"0.55024815",
"0.55004",
"0.5492589",
"0.54819",
"0.54805255",
"0.54740214",
"0.5447852",
"0.5443037",
"0.5430604",
"0.54243624",
"0.5419524",
"0.54154456",
"0.5414796",
"0.5406652",
"0.5406652",
"0.5406652",
"0.54038256",
"0.5401947",
"0.54007137",
"0.5400143",
"0.5399643",
"0.53938735",
"0.53663427",
"0.5361349",
"0.53481543",
"0.5334343",
"0.5331581",
"0.5327895",
"0.5322446",
"0.5318142",
"0.531769",
"0.53098696",
"0.53063524",
"0.53063524",
"0.530075",
"0.52968055",
"0.5295179",
"0.5294547",
"0.5291494",
"0.52901703"
] |
0.0
|
-1
|
Turn row to CSV
|
def serialize(row)
row
.map { |c| db_format(c) }
.join(",")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def csv(rows)\n rows.map { |r| r.join(';') }.join(\"\\n\")\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_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 to_csv_row\n [@id, @name, @address]\n end",
"def to_csv\n self.find.map {|row| row.join(',')}.join(\"\\n\")\n end",
"def write(data_row)\n @csv << data_row.values_at(*@output_fields)\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 to_csv\n CSV.generate { |csv| to_a.each { |r| csv << r } }\n end",
"def to_csv\n @csv ||= format_csv\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 write_row(row)\n @csv << row\n\n self\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 to_csv\n value.to_csv\n end",
"def to_csv(path = nil)\n path = File.basename(@data.path, '.adt') + '.csv' if path.nil?\n FCSV.open(path, 'w', :force_quotes => true) do |csv|\n each do |record|\n csv << record.to_a\n end\n end\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 to_csv_row\n CSV::Row.new(HEADERS, [firstname, lastname, suburb, age, gender])\nend",
"def to_csv\n csvString = LineCounter.columnNames.join(',') + \"\\n\"\n self.each { |result| csvString += result.to_a.join(',') + \"\\n\"}\n csvString\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 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 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 to_csv\n self.data.to_csv\n end",
"def strip_csv_quotes(src_path, dest_path)\n\n require 'csv'\n open('LoginHistory-comma-delim.csv', 'w') do |f|\n first_line = true\n CSV.foreach('LoginHistory.csv') do |row|\n if first_line\n first_line = false\n else\n f.puts( row.join(',') )\n end\n \n end\n end\n\nend",
"def to_csv\n # id.to_s << \",\" << last_name << \",\" << first_name << \",\" << email << \",\" << birthdate.to_s\n end",
"def to_csv(options = Hash.new)\n options = options.merge(:force_quotes => true)\n # override only if first element actually has as_csv method\n return old_to_csv(options) unless self.first.respond_to? :as_csv\n # use keys from first row as header columns\n out = first.as_csv.keys.collect{|k| k.to_s.titleize }.to_csv(options)\n # collect all entries as CSV, ensure that no line break is present within values\n self.each { |r| out << r.as_csv.values.to_csv(options).gsub(/\\r?\\n/, ' ').strip! + \"\\n\" }\n # Force encoding to UTF-16LE and add Byte Order Mark for Excel compatibility\n (BOM + out).force_encoding(\"UTF-8\")\n end",
"def to_s\r\n to_csv\r\n end",
"def record_to_csv(record, options = {})\n csv_data = record.serializable_hash.values.collect { |value| escape_for_csv(value) }\n\n [*options[:methods]].each { |x| csv_data << escape_for_csv(record.send(x)) if record.respond_to?(x) } if options[:methods]\n\n csv_data.join( csv_delimiter )\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 to_csv\n Formatter::CSV.render(self)\n end",
"def to_csv(array)\n @io.rewind\n @io.truncate(0)\n @csv << array\n @io.rewind\n @io.string\n end",
"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 write_row(row)\n @data_stream << row.to_a\n end",
"def to_csv(with_rownames: false, with_colnames: true)\n a = to_a(with_rownames: with_rownames, with_colnames: with_colnames)\n CSV::generate do |csv| a.each do |row| csv << row end end\n 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 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 nombre_completo << \" - \" << debe\n end",
"def to_csv\n \"#{@key},#{@expected},#{@type}\"\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 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 <<(row)\n @faster_csv << row.map { |value| value.force_encoding(\"UTF-8\") }\n end",
"def write_row(row)\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(opts = {})\n Squib.csv(opts)\n end",
"def write_to_csv(type)\n fields = return_fields(type)\n records = get_records(type)\n file_name = generate_name(type)\n\n CSV.open(file_name, \"wb:UTF-8\") do |file|\n @logger.info \"Opened #{file_name} for export\"\n file << fields\n records.each do |record|\n arr = []\n fields.each do |field|\n arr << record.send(field)\n arr.map!(&method(:remove_quotes))\n end\n file << arr\n end\n end\n end",
"def to_csv(seperator=',')\n report = @report || generate_report\n report.map{ |row| row.join(seperator) }.join(\"\\n\")\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 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 to_csv\n [@name, @description, @prep_time, @done]\n end",
"def csv_to_s(rows, cols: nil)\n \"\".tap do\n f = CSV.new(StringIO.new(_1))\n csv_write0(f, rows, cols:)\n end\n end",
"def to_csv_rows\n # Empty CSV if time-resolved calculations are not enabled.\n unless @adapter.supported?(@graph)\n return [['Merit order and time-resolved calculation are not ' \\\n 'enabled for this scenario']]\n end\n\n CurvesCSVSerializer.new(\n [*producer_columns, *consumer_columns, *extra_columns],\n @graph.year,\n ''\n ).to_csv_rows\n end",
"def <<(row)\n # make sure headers have been assigned\n if header_row? and [Array, String].include? @use_headers.class and !@write_headers\n parse_headers # won't read data for Array or String\n end\n\n # handle HBCSV::Row objects and Hashes\n row = case row\n when self.class::Row then row.fields\n when Hash then @headers.map { |header| row[header] }\n else row\n end\n\n @headers = row if header_row?\n @lineno += 1\n\n output = row.map(&@quote).join(@col_sep) + @row_sep # quote and separate\n if @io.is_a?(StringIO) and\n output.encoding != (encoding = raw_encoding)\n if @force_encoding\n output = output.encode(encoding)\n elsif (compatible_encoding = Encoding.compatible?(@io.string, output))\n @io.set_encoding(compatible_encoding)\n @io.seek(0, IO::SEEK_END)\n end\n end\n @io << output\n\n self # for chaining\n end",
"def to_csv()\n all = general_info_csv() + \"\\r\\n\" +\n teacher_for_csv() + \"\\r\\n\" +\n contributor_to_csv() + \"\\r\\n\" +\n published_in_csv() + \"\\r\\n\" +\n text_fields_csv()\n all\n end",
"def student_to_csv(student)\n\t\tstudent.values\nend",
"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 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\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 csv\n @name + \",r,\" + @foods.join(\",\")\n end",
"def save_as_csv\n CSV.open(\"./db/#{@name}.csv\", \"wb\") {|csv| @result_scrap.to_a.each {|elem| csv << elem} }\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 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 csv\n @name + \",b,\" + @calories.to_s\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(a_separateur = ';')\n @nom + a_separateur + @devises_conversion.map(&:to_csv).join(a_separateur)\n end",
"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 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 to_csv\n initialize_generator\n csv_report_generator.records = pull_join\n csv_report_generator.generate_report\n 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 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 to_csv\r\n name\r\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 as_csv\n CSV.generate do |csv|\n csv << [self.title]\n self.columns.positioned.each do |column|\n csv << [column.name]\n column.entries.stickies_first.each do |entry|\n csv << [nil, entry.title, entry.summary, entry.content]\n end\n end\n end\n end",
"def csv_write(filename,a)\n csv_str = \"\";\n for i in 0..a.size-1 do\n for j in 0..a[i].size-2 do\n csv_str = csv_str + \"\\\"\" + a[i][j].to_s + \"\\\",\"\n end;\n csv_str = csv_str + \"\\\"\" + a[i][j+1].to_s + \"\\\"\\n\";\n end;\n File.write(filename,csv_str);\nend",
"def to_s\n @csv_out_data\n end",
"def to_s\n @csv_out_data\n end",
"def get_messages_with_handle_as_csv(handle_id)\n message_csv_str = query <<~EOF\n select datetime(message.date/1000000000 + strftime('%s', '2001-01-01'), 'unixepoch', 'localtime'),\n is_from_me,\n text\n from message\n where handle_id = '#{handle_id}'\n order by date asc;\n EOF\n\n csv = CSV.new(message_csv_str)\nend",
"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 orders_to_csv\n orders.map { |order| order.id}.join(\", \")\n end",
"def write(file_path, query_result)\n line_number = 0\n CSV.open(file_path, \"w\") do |csv|\n query_result.each do |row|\n csv << row.map{ |_,field| field.is_a?(String) ? field.gsub(\"\\n\", \" \") : field }\n line_number+=1\n end\n end\n line_number\n end",
"def csv_to_stdout(rows, cols: nil)\n CSV($stdout) { csv_write0(_1, rows, cols:) }\n end",
"def to_csv( separateur = ':' )\n DBC.require( separateur.size == 1, \"#{self}.to_csv: separateur invalide: #{separateur}\" )\n [numero.to_s,\n vie,\n attaque,\n defense,\n tete,\n tetedefense,\n torse,\n torsedefense,\n mains,\n mainsdefense,\n pantalons,\n pantalonsdefense,\n bottes,\n bottesdefense,\n arme,\n armeattaque,\n type.to_s,\n nom,\n puissance\n ].join(separateur)\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 save_to_csv\n csv_options = { col_sep: ',', quote_char: '\"' }\n CSV.open(@file_path, 'wb', csv_options) do |csv_row|\n # To store recipes, we loop over cookbook recipes array (see initializer)\n @recipes.each do |recipe|\n # CSV SHOULD NOT TAKE INSTANCES\n # We must individually separate the name and description from the instances\n # To then store them in array format into each row of the CSV\n # One row per recipe\n csv_row << [recipe.name, recipe.description]\n end\n end\n 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 to_csv\n FileOutputService.to_csv(result, file_options)\n end",
"def to_csv(newsletter_content)\n @newsletter_csv = []\n # Get the keys to use as CSV header\n @newsletter_csv.push(newsletter_content[0].keys.join(\",\")) \n \n # Iterate over the array of hashes to get the values\n newsletter_content.each do |line|\n values = []\n # Extract the values\n line.each_pair do |key, value|\n values.push(value)\n end\n \n # Add each extracted line of values comma-separated\n @newsletter_csv.push(values.join(\",\"))\n end\n\n return @newsletter_csv\n end",
"def to_csv(options={})\n CSV.generate(options) do |csv|\n csv << self.values.map{|v| v.to_csv}\n end\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 as_csv(*)\n populate_carriers!\n\n CSV.generate do |csv|\n csv << [\n 'key', 'primary_co2_emission',\n *primary_carriers.map { |c| \"primary_demand_of_#{c} (MJ)\" },\n *final_carriers.map { |c| \"final_demand_of_#{c} (MJ)\" }\n ]\n\n @graph.group_nodes(:application_group).each do |node|\n csv << node_row(node)\n end\n end\n end",
"def write(file_path, query_result)\n line_number = 0\n CSV.open(file_path, \"w\") do |csv|\n query_result.get_result.stream_each do |row|\n csv << row.map{ |_,field| field.is_a?(String) ? field.gsub(\"\\n\", \" \") : field }\n line_number+=1\n end\n end\n line_number\n end",
"def generate_csv\n\n fields = @resource.typus_fields_for(:csv)\n\n require 'csv'\n if CSV.const_defined?(:Reader)\n # Old CSV version so we enable faster CSV.\n begin\n require 'fastercsv'\n rescue Exception => error\n raise error.message\n end\n csv = FasterCSV\n else\n csv = CSV\n end\n\n filename = Rails.root.join(\"tmp\", \"export-#{@resource.to_resource}-#{Time.now.utc.to_s(:number)}.csv\")\n\n options = { :conditions => @conditions, :batch_size => 1000 }\n\n csv.open(filename, 'w', :col_sep => ';') do |csv|\n csv << fields.keys\n @resource.find_in_batches(options) do |records|\n records.each do |record|\n csv << fields.map do |key, value|\n case value\n when :transversal\n a, b = key.split(\".\")\n record.send(a).send(b)\n when :belongs_to\n record.send(key).to_label\n else\n record.send(key)\n end\n end\n end\n end\n end\n\n send_file filename\n\n end",
"def format_row(data)\n data.join(col_sep * 2) + row_sep\n end",
"def format_csv\n data.match(TIDE_REGEX)[1].gsub('<br>', \"\\n\").gsub(';', ',')\n end",
"def csv\n data = digital_object_imports.map(&:import_data)\n Bulwark::StructuredCSV.generate(data)\n end",
"def getCsvText\r\n sep = \"|\"\r\n t = \"\"\r\n \r\n t << \"Question Number\" + sep \r\n questions.size.times do |i| \r\n t << (i + 1).to_s + sep \r\n end\r\n t << \"Points\"\r\n t << \"\\n\"\r\n \r\n t << \"Correct Answer\" + sep\r\n for question in questions \r\n t << correctAnswerText(question).to_s + sep \r\n end \r\n t << \"\\n\"\r\n \r\n for user in users \r\n t << user.getName + sep\r\n for question in questions \r\n t << answerText(user, question) + sep\r\n end \r\n t << getPoints(user).to_s\r\n t << \"\\n\" \r\n end\r\n return t \r\nend",
"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 save_as_csv\n temp = get_email_list.map{|hash| hash.map{|k, v| [k, v]}}\n temp = temp.map { |data| data.join(\",\") }.join(\"\\n\")\n File.open(\"db/emails.csv\", \"w\") do |csv|\n csv.write(temp)\n end\n end",
"def csv_row\n #empty by default\n []\n end",
"def csv_row\n #empty by default\n []\n end",
"def csv\n send_data(Map.to_csv, {:filename => \"maps.csv\" })\n end"
] |
[
"0.7754217",
"0.7610371",
"0.76005054",
"0.7397962",
"0.7352303",
"0.7231261",
"0.72139144",
"0.70896906",
"0.7054959",
"0.7045105",
"0.70198977",
"0.7006398",
"0.6961379",
"0.6885295",
"0.6858983",
"0.68478465",
"0.6782315",
"0.67539245",
"0.67539245",
"0.6677587",
"0.66703045",
"0.66691643",
"0.6652399",
"0.66352147",
"0.6631354",
"0.6610785",
"0.65950364",
"0.6567535",
"0.65496606",
"0.6531169",
"0.6527093",
"0.65192133",
"0.65145266",
"0.6514516",
"0.6458981",
"0.6454596",
"0.6453439",
"0.6447682",
"0.63960075",
"0.6386626",
"0.6382823",
"0.636658",
"0.6352633",
"0.63376546",
"0.6327906",
"0.6326901",
"0.6321665",
"0.6320035",
"0.63107514",
"0.6306801",
"0.63065755",
"0.6299136",
"0.6295007",
"0.6293442",
"0.62881655",
"0.6287436",
"0.6279057",
"0.6266366",
"0.62657124",
"0.6240886",
"0.6237999",
"0.6236665",
"0.6233946",
"0.6228483",
"0.62023795",
"0.61936724",
"0.6164334",
"0.6161673",
"0.6161118",
"0.6159511",
"0.6153104",
"0.61413294",
"0.6124695",
"0.61108917",
"0.61108917",
"0.6109572",
"0.6107302",
"0.6105247",
"0.6089234",
"0.608816",
"0.6077438",
"0.6074167",
"0.6065787",
"0.60649943",
"0.6048434",
"0.60450095",
"0.6044753",
"0.60446995",
"0.6037385",
"0.60355467",
"0.6032583",
"0.60233796",
"0.6019442",
"0.60135424",
"0.60094184",
"0.60073614",
"0.6007326",
"0.60044926",
"0.60044926",
"0.6001211"
] |
0.646253
|
34
|
INTERFACE We will process metacommands separately Metacommands start with a "." For now we will support only ".exit" to escape the REPL.
|
def process_meta_command(command) # -> String
if command == :exit
puts "EXIT..."
close()
exit
end
""
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def commands; end",
"def set_commands; end",
"def subcommands(cmd); end",
"def subcommands(cmd); end",
"def subcommand() __subcommand__ end",
"def subcommands() __subcommands__ end",
"def end_commands\n abstract!\n end",
"def commandInterface\n\t\tisfinished = false\n\t\tcmd = \"\" \n\n\t\twhile !isfinished do\n\t\t\tprint \"min::\"\n\t\t\tcmd = $stdin.gets.chomp!\n\t\t\tcase cmd\n\t\t\t\twhen /end|exit|quit/i then isfinished = true \n\t\t\tend\n\t\tend\n\tend",
"def special_command?(command)\n command =~ /^(?:exit|end)/\n end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def meta_key_down\r\n command 'metaKeyDown'\r\n end",
"def commands\n\n {\n 'TODO' => \"This one shout take its sub commands from current(headers/body) variables and the key value should be the command description\n This one should depend on current context\"\n }\n\n end",
"def commands\n {\n }\n end",
"def sentinel(subcommand, *args); end",
"def add_commands\n end",
"def command_presentation\n msg = []\n msg << command_header\n msg << \"Usage:\"\n msg << usage_presentation\n\n if opts = options_presentation\n msg << \"Options:\\n#{opts}\"\n end\n if subcommands = subcommands_presentation\n msg << \"Subcommands:\\n#{subcommands_presentation}\"\n end\n msg.join(\"\\n\\n\")\n end",
"def handle_commands(command) # rubocop:todo Metrics/CyclomaticComplexity\n case command\n when '/start'\n greet_user\n when '/stop'\n send_message \"Bye, #{message.from.first_name}\"\n when '/help'\n send_message \"Please enter any of the following commands: #{@commands}\"\n when '/news'\n handle_news\n when '/subscribe'\n handle_subscribe command\n when '/update'\n handle_update\n when '/add_birthday'\n @name = message.text if @name_set and @name.empty?\n prompt_user command\n when '/add_my_birthday'\n prompt_user command\n when '/add_anniversary'\n @name = message.text if @name_set and @name.empty?\n prompt_user command\n\n end\n end",
"def meta_key_up\r\n command 'metaKeyUp'\r\n end",
"def commands\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def __subcommand__!() @__subcommand__ end",
"def help\n @@commands.each do |command| \n puts command[0]\n puts \" `#{command[1]}\"\n end \n end",
"def command_name; end",
"def subcommands!() __subcommands__! end",
"def interpret_command(*args)\n format = nil\n command = nil\n if args.last.is_a? Hash\n options = args.last\n ca = (options[:args] || []).join(' ')\n command = \"#{options[:command]} #{ca}\".strip.to_sym\n format = options[:format]\n else\n command = args.last.to_sym\n end\n\n if %i[exit quit].include?(command)\n if (@exit_command_counter == 0) && !exit_ok?\n @exit_command_counter += 1\n logger.warn { \"You have running load agents: terminate first or #{command} again\" }\n else\n puts 'Bye'\n @exit_command_counter = -1 # \"express\" exit\n end\n\n else\n @exit_command_counter = 0 # reset exit intention\n match_data = nil\n grammar.each do |rule|\n match_data = rule.match(command.to_s)\n break unless match_data.nil?\n end\n\n if match_data\n method_name = match_data[1].to_sym\n method_args = match_data.to_a\n .slice(2, match_data.length - 1)\n .collect { |e| e.blank? ? nil : e }.compact.collect(&:strip)\n if (method_args.length == 1) && (method_args.first == 'help')\n help(method_name)\n else\n # defer to application for further processing\n method_args.push(format) unless format.nil?\n send(method_name, *method_args)\n return method_name\n end\n else\n raise(UnknownCommandException, \"#{command} is unknown\")\n end\n end\n end",
"def commands\n {\n 'help' => 'Help menu',\n 'background' => 'Backgrounds the current shell session',\n 'sessions' => 'Quickly switch to another session',\n 'resource' => 'Run a meta commands script stored in a local file',\n 'shell' => 'Spawn an interactive shell (*NIX Only)',\n 'download' => 'Download files (*NIX Only)',\n 'upload' => 'Upload files (*NIX Only)',\n 'source' => 'Run a shell script on remote machine (*NIX Only)',\n 'irb' => 'Open an interactive Ruby shell on the current session',\n 'pry' => 'Open the Pry debugger on the current session'\n }\n end",
"def add_original_commands; end",
"def commands\n c = {\n \"?\" => \"Help menu\",\n \"background\" => \"Backgrounds the current session\",\n \"exit\" => \"Terminate the hardware bridge session\",\n \"help\" => \"Help menu\",\n \"irb\" => \"Drop into irb scripting mode\",\n \"load\" => \"Load one or more meterpreter extensions\",\n \"run\" => \"Executes a meterpreter script or Post module\",\n \"bgrun\" => \"Executes a meterpreter script as a background thread\",\n \"bgkill\" => \"Kills a background meterpreter script\",\n \"bglist\" => \"Lists running background scripts\",\n \"sessions\" => \"Quickly switch to another session\",\n \"status\" => \"Fetch bridge status information\",\n \"specialty\" => \"Hardware devices specialty\",\n \"reset\" => \"Resets the device (NOTE: on some devices this is a FULL FACTORY RESET)\",\n \"reboot\" => \"Reboots the device (usually only supported by stand-alone devices)\",\n \"load_custom_methods\" => \"Loads custom HW commands if any\"\n }\n\n if msf_loaded?\n c[\"info\"] = \"Displays information about a Post module\"\n end\n\n c\n end",
"def commands\n abstract!\n end",
"def commands\n {}\n end",
"def extract_command; end",
"def command(key)\n keys = configuration.instance.keys\n cmd = eval \"#{keys}.#{key}\"\n cmd.capitalize! << \"Command\"\n case cmd\n when /QuitCommand/\n QuitCommand.new(@terminal)\n else\n NoOpCommand.new\n end\n end",
"def help\n puts \"I accept the following commands:\\n- help : displays this help message\\n- list : displays a list of songs you can play\\n- play : lets you choose a song to play\\n- exit : exits this program\"\nend",
"def cmd; end",
"def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend",
"def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend",
"def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend",
"def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend",
"def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend",
"def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend",
"def test_help\n \tassert_equal(UI.parseCommand('help', HelpCmd1*\" \"),UI.main(HelpCmd1))\n \tassert_equal(UI.parseCommand('help', HelpCmdInv*\" \"),UI.main(HelpCmdInv))\n end",
"def help\n\tcommands = [\"I accept the following commands:\", \"- help : displays this help message\", \"- list : displays a list of songs you can play\", \"- play : lets you choose a song to play\", \"- exit : exits this program\"]\n\tcommands.each {|command| puts command}\nend",
"def help\n puts \"I accept the following commands:\" \n puts \"- help : displays this help message\" \n puts \"- list : displays a list of songs you can play\" \n puts \"- play : lets you choose a song to play\" \n puts \"- exit : exits this program\"\nend",
"def subcommand!() __subcommand__! end",
"def get_commands\n return nil\n end",
"def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end",
"def commands\n\t\t{ }\n\tend",
"def add_main_commands\n add_command(Vocab::item, :item, main_commands_enabled)\n add_command(Vocab::skill, :skill, main_commands_enabled)\n add_command(Vocab::equip, :equip, main_commands_enabled)\n add_command(Vocab::status, :status, main_commands_enabled)\n end",
"def postprocess\n return false if @@processed\n @@processed = true # Make sure this runs only once\n\n # Parses:\n # commands do\n # allow :kill \n # allow :custom_script, '/full/path/2/custom_script'\n # allow :git_clone, '/usr/bin/git', 'clone'\n # end\n # \n # * Tells Routines to force_array on the command name.\n # This is important b/c of the way we parse commands \n self.allow.each do |cmd|\n cmd, *args = *cmd\n \n ## Currently disabled\n ##raise AlreadyDefined.new(:commands, cmd) if @@allowed.member?(cmd)\n ##@@allowed << cmd\n \n # We can allow existing commands to be overridden but we\n # print a message to STDERR so the user knows what's up.\n if Rye::Cmd.can?(cmd)\n Rudy::Huxtable.ld \"Redefining #{cmd}\" if Rudy::Huxtable.global.verbose > 2\n end\n \n if args.last.is_a?(Proc)\n block = args.pop\n Rye::Cmd.add_command(cmd, nil, *args, &block)\n else\n # If no path was specified, we can assume cmd is in the remote path so\n # when we add the method to Rye::Cmd, we'll it the path is \"cmd\".\n path = args.shift || cmd.to_s\n \n raise PathNotString.new(:commands, cmd) if path && !path.is_a?(String)\n \n Rye::Cmd.add_command cmd, path, *args\n \n end\n \n \n ## We cannot allow new commands to be defined that conflict use known\n ## routines keywords. This is based on keywords in the current config.\n ## NOTE: We can't check for this right now b/c the routines config\n ## won't necessarily have been parsed yet. TODO: Figure it out!\n ##if Caesars.known_symbol_by_glass?(:routines, cmd)\n ## raise ReservedKeyword.new(:commands, cmd)\n ##end\n \n end\n \n ## NOTE: We now process command blocks as Procs rather than individual commands.\n ## There's currently no need to ForceRefresh here\n ##raise Caesars::Config::ForceRefresh.new(:routines)\n end",
"def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end",
"def commands\n\t\t{\n\t\t\t\"?\" => \"Help menu\",\n\t\t\t\"background\" => \"Backgrounds the current session\",\n\t\t\t\"close\" => \"Closes a channel\",\n\t\t\t\"channel\" => \"Displays information about active channels\",\n\t\t\t\"exit\" => \"Terminate the meterpreter session\",\n\t\t\t\"help\" => \"Help menu\",\n\t\t\t\"interact\" => \"Interacts with a channel\",\n\t\t\t\"irb\" => \"Drop into irb scripting mode\",\n\t\t\t\"migrate\" => \"Migrate the server to another process\",\n\t\t\t\"use\" => \"Load a one or more meterpreter extensions\",\n\t\t\t\"quit\" => \"Terminate the meterpreter session\",\n\t\t\t\"read\" => \"Reads data from a channel\",\n\t\t\t\"run\" => \"Executes a meterpreter script\",\n\t\t\t\"bgrun\" => \"Executes a meterpreter script as a background thread\",\n\t\t\t\"bgkill\" => \"Kills a background meterpreter script\",\n\t\t\t\"bglist\" => \"Lists running background scripts\",\n\t\t\t\"write\" => \"Writes data to a channel\",\n\t\t}\n\tend",
"def command_found; end",
"def commandInterface\n isfinished = false\n cmd = \"\" # command placeholder\n\n while !isfinished do\n print \"ren::\"\n cmd = $stdin.gets.chomp!\n case cmd \n when /end|quit|exit/ then isfinished = true\n when \"setdelim1\"\n print \"Set delim 1: \" # TODO Handle Newline \n @mDelim1 = $stdin.gets.chomp!\n when \"setdelim2\"\n print \"Set delim 2: \" # TODO Handle Newline\n @mDelim2 = $stdin.gets.chomp!\n when \"writeout\"\n print \"Filename : \"\n filename = $stdin.gets.chomp!\n writeOut(filename)\n else\n execute(cmd)\n puts @mResult\n end\n end\n end",
"def help(additional_info=nil)\n \n set_colors\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (\"\\e[2A\" + @c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift \"\\e[H\\e[2J\"\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n \n array += @@commands.keys.collect do |key|\n default = (@@default_method and key == @@default_method.keys[0]) ? @color_bold : \"\"\n \n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default + key.to_s + @c_reset}\"+\n \" #{default + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" unless default == \"\"}#{@c_reset}\" \n end\n array << nil\n end",
"def quitCmd\n\tputs \"Cient sent a quit command\"\nend",
"def command_start; end",
"def command_start; end",
"def command_start; end",
"def add_original_commands\n end",
"def help(additional_info=nil)\n \n set_colors\n set_screen_clear\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (@c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift @s_clear_screen_code\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n\n array += @@commands.keys.collect do |key|\n is_default = (@@default_method and key == @@default_method.keys[0])\n default_color = is_default ? @c_bold : \"\"\n\n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default_color + key.to_s + @c_reset}\"+\n \" #{default_color + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default_color + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" if is_default}#{@c_reset}\" \n end\n array << nil\n end",
"def __subcommand__() @__subcommand__&.__ident__ end",
"def help()\n\tputs \"Hier is een lijst handige commando's die je gaan helpen met je quest:\"\n\tputs \"ga (richting): Ga in de gespecificeerde richting\"\n\tputs \"open: open deuren, kisten, je hart, etc\"\n\tputs \"kijk: Krijg een beschrijving van de kamer waar je nu bent\"\n\tputs \"neem: Neem een item en stop het in je inventory\"\n\tputs \"gebruik X op X: Gebruik een item uit je inventory op een object\"\n\tputs \"inventory: Bekijk je inventory\"\n\tputs \"stop: Stop de game\"\nend",
"def commands\r\n @help_commands\r\n end",
"def commands\n load_commands unless @commands\n @commands\n end",
"def end_command(name)\n abstract!\n end",
"def process\n command = get_command()\n\n if command\n verify_command(command)\n else\n help\n end\n end",
"def subcommands\n @subcommands ||= []\n end",
"def subcommands\n @subcommands ||= []\n end",
"def command_help(m)\n m.user.send [\n \"!next - When's the next live show?\",\n \"!schedule - What shows are being recorded live in the next seven days?\",\n \"!suggest - Be heard. Suggest a title for the live show.\",\n \"!link - Know the link for that? Suggest it and make the show better.\",\n \"!current - What's playing on #{shared[:Live_Url]}? I've got you covered.\",\n \"!last_status - The last tweet by @#{shared[:Twitter_User].join(\", @\")} delievered to you in IRC. Sweet.\",\n \"!about - Was #{shared[:Bot_Nick]} coded or did it spontaniously come into existence?\",\n \"!help - Uh, this.\",\n ].join(\"\\n\")\n end",
"def supercommand!() __supercommand__ end",
"def exe(s)\n VIM.command s\nend",
"def help command\n puts \"\nThe command you entered, #{command}, is not supported.\nValid commands: \"\n @command_map.each_key{|key| puts \"\\t#{key}\\n\"}\n end",
"def execute(input)\n unless input.strip.empty? || input.strip[0] == \"!\"\n log_history_command(input.strip)\n end\n\n #Morpheus::Logging::DarkPrinter.puts \"Shell command: #{input}\"\n input = input.to_s.strip\n\n # allow pasting in commands that have 'morpheus ' prefix\n if input[0..(prog_name.size)] == \"#{prog_name} \"\n input = input[(prog_name.size + 1)..-1] || \"\"\n end\n if !input.empty?\n\n if input == 'exit'\n #print cyan,\"Goodbye\\n\",reset\n #@history_logger.info \"exit\" if @history_logger\n @exit_now_please = true\n return 0\n #exit 0\n elsif input == 'help'\n out = \"\"\n if @temporary_shell_mode\n out << \"You are in a (temporary) morpheus shell\\n\"\n else\n out << \"You are in a morpheus shell.\\n\"\n end\n out << \"See the available commands below.\\n\"\n\n out << \"\\nCommands:\\n\"\n # commands = @morpheus_commands + @shell_commands\n # @morpheus_commands.sort.each {|cmd|\n # out << \"\\t#{cmd.to_s}\\n\"\n # }\n sorted_commands = Morpheus::Cli::CliRegistry.all.values.sort { |x,y| x.command_name.to_s <=> y.command_name.to_s }\n sorted_commands.each {|cmd|\n # JD: not ready to show description yet, gotta finish filling in every command first\n # maybe change 'View and manage' to something more concise like 'Manage'\n # out << \"\\t#{cmd.command_name.to_s.ljust(28, ' ')} #{cmd.command_description}\\n\"\n out << \"\\t#{cmd.command_name.to_s}\\n\"\n }\n #puts \"\\n\"\n out << \"\\nShell Commands:\\n\"\n @shell_commands.each {|cmd|\n # out << \"\\t#{cmd.to_s.ljust(28, ' ')} #{@shell_command_descriptions ? @shell_command_descriptions[cmd] : ''}\\n\"\n out << \"\\t#{cmd.to_s}\\n\"\n }\n out << \"\\n\"\n out << \"For more information, see https://clidocs.morpheusdata.com\"\n out << \"\\n\"\n print out\n return 0\n elsif input =~ /^\\s*#/\n Morpheus::Logging::DarkPrinter.puts \"ignored comment: #{input}\" if Morpheus::Logging.debug?\n return 0\n elsif input == 'clear'\n print \"\\e[H\\e[2J\"\n return 0\n elsif input == 'reload' || input == 'reload!'\n # clear registry\n Morpheus::Cli::CliRegistry.instance.flush\n # reload code\n Morpheus::Cli.reload!\n # execute startup scripts\n if File.exist?(Morpheus::Cli::DotFile.morpheus_profile_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheus_profile_filename).execute()\n end\n if File.exist?(Morpheus::Cli::DotFile.morpheusrc_filename)\n Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheusrc_filename).execute()\n end\n # recalculate shell environment\n reinitialize()\n\n Morpheus::Logging::DarkPrinter.puts \"shell has been reloaded\" if Morpheus::Logging.debug?\n return 0\n elsif input == '!!'\n cmd_number = @history.keys[-1]\n input = @history[cmd_number]\n if !input\n puts \"There is no previous command\"\n return false\n end\n return execute(input)\n elsif input =~ /^\\!.+/\n cmd_number = input.sub(\"!\", \"\").to_i\n if cmd_number != 0\n old_input = @history[cmd_number]\n if !old_input\n puts \"Command not found by number #{cmd_number}\"\n return 0\n end\n #puts \"executing history command: (#{cmd_number}) #{old_input}\"\n # log_history_command(old_input)\n # remove this from readline, and replace it with the old command\n Readline::HISTORY.pop\n Readline::HISTORY << old_input\n return execute(old_input)\n end\n\n elsif input == \"insecure\"\n Morpheus::RestClient.enable_ssl_verification = false\n return 0\n\n elsif [\"hello\",\"hi\",\"hey\",\"hola\"].include?(input.strip.downcase)\n user_msg = input.strip.downcase\n # need a logged_in? method already damnit\n wallet = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials\n help_msg = case user_msg\n when \"hola\"\n \"¿como puedo ayudarte? tratar #{cyan}help#{reset}\"\n else\n \"how may I #{cyan}help#{reset} you?\"\n end\n greeting = \"#{user_msg.capitalize}#{wallet ? (' '+green+wallet['username'].to_s+reset) : ''}, #{help_msg}#{reset}\"\n puts greeting\n return 0\n elsif input.strip =~ /^shell\\s*/\n # just allow shell to fall through\n # we should reload the configs and history file after the sub shell process terminates though.\n # actually, that looks like it is working just fine already...?\n print cyan,\"starting a subshell\",reset,\"\\n\"\n elsif input =~ /^\\.\\s/\n # dot alias for source <file>\n log_history_command(input)\n return Morpheus::Cli::SourceCommand.new.handle(input.split[1..-1])\n end\n exit_code, err = 0, nil\n begin\n argv = Shellwords.shellsplit(input)\n cmd_name = argv[0]\n cmd_args = argv[1..-1]\n # crap hack, naming conflicts can occur with aliases\n @return_to_log_level = [\"log-level\",\"debug\"].include?(cmd_name) ? nil : Morpheus::Logging.log_level\n @return_to_coloring = [\"coloring\"].include?(cmd_name) ? nil : Term::ANSIColor::coloring?\n @return_to_benchmarking = [\"benchmark\"].include?(cmd_name) ? nil : Morpheus::Benchmarking.enabled?\n \n #if Morpheus::Cli::CliRegistry.has_command?(cmd_name) || Morpheus::Cli::CliRegistry.has_alias?(cmd_name)\n #log_history_command(input)\n # start a benchmark, unless the command is benchmark of course\n if my_terminal.benchmarking || cmd_args.include?(\"-B\") || cmd_args.include?(\"--benchmark\")\n if cmd_name != 'benchmark' # jd: this does not work still 2 of them printed.. fix it!\n # benchmark_name = \"morpheus \" + argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n benchmark_name = argv.reject {|it| it == '-B' || it == '--benchmark' }.join(' ')\n start_benchmark(benchmark_name)\n end\n end\n exit_code, err = Morpheus::Cli::CliRegistry.exec_expression(input)\n benchmark_record = stop_benchmark(exit_code, err) # if benchmarking?\n Morpheus::Logging::DarkPrinter.puts(cyan + dark + benchmark_record.msg) if benchmark_record\n # else\n # puts_error \"#{Morpheus::Terminal.angry_prompt}'#{cmd_name}' is not recognized. Use 'help' to see the list of available commands.\"\n # @history_logger.warn \"Unrecognized Command #{cmd_name}\" if @history_logger\n # exit_code, err = -1, \"Command not recognized\"\n # end\n rescue Interrupt\n # user pressed ^C to interrupt a command\n @history_logger.warn \"shell interrupt\" if @history_logger\n print \"\\nInterrupt. aborting command '#{input}'\\n\"\n exit_code, err = 9, \"aborted command\"\n rescue SystemExit => cmdexit\n # nothing to do, assume the command that exited printed an error already\n # print \"\\n\"\n if cmdexit.success?\n exit_code, err = cmdexit.status, nil\n else\n exit_code, err = cmdexit.status, \"Command exited early.\"\n end\n rescue => e\n # some other type of failure..\n @history_logger.error \"#{e.message}\" if @history_logger\n exit_code, err = Morpheus::Cli::ErrorHandler.new(my_terminal.stderr).handle_error(e) # lol\n \n ensure\n if @return_to_log_level\n Morpheus::Logging.set_log_level(@return_to_log_level)\n ::RestClient.log = Morpheus::Logging.debug? ? Morpheus::Logging::DarkPrinter.instance : nil\n @return_to_log_level = nil\n end\n if @return_to_coloring != nil\n Term::ANSIColor::coloring = @return_to_coloring\n @return_to_coloring = nil\n end\n if @return_to_benchmarking != nil\n Morpheus::Benchmarking.enabled = @return_to_benchmarking\n my_terminal.benchmarking = Morpheus::Benchmarking.enabled\n @return_to_benchmarking = nil\n end\n end\n\n return exit_code, err\n end\n\n end",
"def initialize\n register_script \"Provide on-protocol help for bot scripts and commands.\"\n\n register_command \"help\", :cmd_help, 0, 0, nil, \"Show help for the given command or a list of all commands. Parameters: [command]\"\n register_command \"script\", :cmd_script, 0, 0, nil, \"Show a description of the given script or a list of all scripts. Parameters: [script]\"\nend",
"def cmdLoop\n miqvep = MiqVmExplorerParser.new\n trap(\"INT\") { raise \"Interrupt\" }\n begin\n while true\n if $haveReadline\n input = readline(\"MiqExplorer: \", true)\n else\n $stderr.print \"MiqExplorer: \"\n input = $stdin.gets.chomp\n end\n \n #\n # Skip empty commands and comments.\n #\n next if input.length == 0\n next if input =~ /^\\s*#/\n \n #\n # Process the command.\n #\n miqvep.parse(shellParse(input))\n \n #\n # If I/O was redirected, set it back to the console.\n #\n if $miqOut != $stdout\n $miqOut.close\n $miqOut = $stdout\n end\n end\n rescue MiqOptionParser::ParseError,OptionParser::ParseError => perr\n $stderr.puts perr.message\n $log.debug perr.backtrace.join(\"\\n\")\n retry\n rescue => err\n $stderr.puts err.backtrace.join(\"\\n\")\n $stderr.puts err.to_s\n $log.debug err.backtrace.join(\"\\n\")\n retry\n end\n end",
"def interpret_exit(command)\n @finished = true\n end",
"def process; raise CommandError, \"command '#{command_name}' not implemented\" end",
"def terminal_commands\n\twhile true\n\t\tputs \"\\nType in a number to see its manual page:\"\n\t\tputs \"1. ls: view files in current directory. ls -a: see hidden files.\"\n\t\tputs \"2. mv: move a file or a directory or rename files. mv file.txt /destination/file.txt\"\n\t\tputs \"3. cd: change to a new directory. \"\n\t\tputs \"4. touch: make a new file. touch filename.txt\"\n\t\tputs \"5. cat: view a file in the terminal. cat filename.txt\"\n\t\tputs \"6. grep: find a string of characters in a file. grep 'findthis' file.txt\"\n\t\tputs \"7. return to main menu\"\n\n\t\tentered_command = gets.strip\n\t\tcase entered_command\n\t\twhen \"1\"\n\t\t\tputs `man ls`\n\t\twhen \"2\"\n\t\t\tputs `man mv`\n\t\twhen \"3\"\n\t\t\tputs `man cd`\n\t\twhen \"4\"\n\t\t\tputs `man touch`\n\t\twhen \"5\"\n\t\t\tputs `man cat`\n\t\twhen \"6\" \n\t\t\tputs `man grep`\n\t\twhen \"7\"\n\t\t\treturn\n\t\telse\n\t\t\tputs \"Please type a number 1-7\"\n\t\tend\n\tend\nend",
"def enter_command\n\t\tanswer = $screen.ask(\"command:\",$command_hist)\n\t\teval(answer)\n\t\t$screen.write_message(\"done\")\n\trescue\n\t\t$screen.write_message(\"Unknown command\")\n\tend",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end",
"def __subcommands__()\n __subcommands__!.last&.__uid__&.to_sym\n end",
"def show_help\n\tputs \"These are the following commands that this application accepts:\"\n\tputs \"\\t 'add' (child name) (toy name) - gives a child a new toy\"\n\tputs \"\\t 'remove' (toy name) (child name) - takes away the child's toy\"\n\tputs \"\\t 'ls' - lists all children and the toys they are receiving\"\n\tputs \"\\t 'ls' (child name) - lists all the toys that one child is receiving\"\n\tputs \"\\t 'delivered' (child name) - marks that the toys have been delivered to the child\"\n\tputs \"\\t 'help' - shows all of the available commands that this application accepts\"\n\n\nend",
"def auxiliary_commands\n { \"aux_extra_command\" => \"Run this auxiliary test commmand\" }\n end",
"def subcommands\n Properties[self.class] ||= {}\n return Properties[self.class][:subcmds] || []\n end",
"def help(cmd)\n %{\n q[uit] [!|unconditionally]\\texit from debugger. \n exit[!]\\talias to quit\n\n Normally we prompt before exiting. However if the parameter\n \"unconditionally\" or is given or suffixed with !, we stop\n without asking further questions. \n }\n end",
"def help_command( *args )\n\n\t\t# Subcommand help\n\t\tif !args.empty?\n\t\t\tcommand = args.shift\n\n\t\t\tif self.class.available_commands.include?( command )\n\t\t\t\theader( self.class.help(command) )\n\t\t\t\tdesc = \"\\n\" + 'Usage: ' + command + ' ' + self.class.usage(command) + \"\\n\"\n\t\t\t\tmessage( desc )\n\t\t\telse\n\t\t\t\terror \"No such command %p\" % [ command ]\n\t\t\tend\n\n\t\t# Help by itself show the table of available commands\n\t\telse\n\t\t\tcommand_table = self.class.make_command_table\n\t\t\theader \"Available Commands\"\n\t\t\tmessage( *command_table )\n\t\tend\n\n\tend",
"def method_missing(m, *args, &block)\n @commands.send(m, *args, &block)\n end",
"def command_parse(argv)\n end",
"def we_have_a_command_with_two_subcommands(options = {})\n lambda {\n @run_results = { :add => nil, :rename => nil, :base => nil }\n @app.command :remote do |c|\n\n c.switch :f\n\n c.desc \"add a remote\"\n c.command [:add,:new] do |add|\n\n Array(options[:flags]).each { |_| add.flag _ }\n Array(options[:switches]).each { |_| add.switch _ }\n add.action do |global_options,command_options,args|\n @run_results[:add] = [global_options,command_options,args]\n end\n end\n\n c.desc \"rename a remote\"\n c.command :rename do |rename|\n rename.action do |global_options,command_options,args|\n @run_results[:rename] = [global_options,command_options,args]\n end\n end\n\n c.action do |global_options,command_options,args|\n @run_results[:base] = [global_options,command_options,args]\n end\n end\n ENV['GLI_DEBUG'] = 'true'\n }\n end",
"def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end",
"def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end",
"def process_command(inp)\n @commands.each do |cmd|\n if inp =~ cmd.command_regexp\n begin\n output = cmd.execute self, $~\n puts output if output\n rescue StandardError => e\n handle_exception e\n end\n break\n end\n end\n end",
"def getcommand(msg)\n msg.message =~ /#{$COMMAND}(\\w+)/\n commandused = $1\n case commandused\n when 'roll', 'nobotch', 'special'\n if msg.message =~ /#{commandused}\\s*help\\s*$/\n # show command help\n \"#{HELP_TEXT(commandused)}\"\n elsif msg.message =~ /#{commandused}\\s+(.*)\\s*$/\n begin\n \"<b>#{$names[msg.actor]}: </b>#{substitute($1,commandused)}\"\n rescue ArgumentError => e\n \"\\\"<b>Error</b>: #{e}</b>\\\",#{[msg.actor]}\"\n end\n end\n \n when 'help'\n \"<br>I'm here to make your V20 playing much more pleasureable!<br><br>\n Commands:<br>\n <b>#{$COMMAND}roll</b> <input> - Regular ol' dice rollin!<br>\n <b>#{$COMMAND}nobotch</b> <input> - Roll dice where 1s don't botch!<br>\n <b>#{$COMMAND}special</b> <input> - Make those 10s count DOUBLE!<br><br>\n\n use '<b>help</b>' as the input for more information on any command!\"\n else\n #wat r u doin dolan pls\n \"wat r u doin stahp\"\n end\nend",
"def command_quit\n command_save\n exit(0)\n end",
"def commands\n COMMANDS\n end",
"def read_command(prompt); end"
] |
[
"0.634371",
"0.6299895",
"0.6189378",
"0.6189378",
"0.6150772",
"0.6130891",
"0.6085452",
"0.6071684",
"0.59328383",
"0.59305656",
"0.59305656",
"0.59305656",
"0.59305656",
"0.59305656",
"0.59305656",
"0.59100366",
"0.5894281",
"0.5887555",
"0.58782506",
"0.58763295",
"0.5841309",
"0.5833735",
"0.5812069",
"0.5802603",
"0.5729895",
"0.5725683",
"0.5717341",
"0.5697814",
"0.5692894",
"0.5684428",
"0.56819326",
"0.56772053",
"0.5675975",
"0.5674899",
"0.56550175",
"0.5648011",
"0.5646768",
"0.563924",
"0.56141454",
"0.56141454",
"0.56141454",
"0.56141454",
"0.56141454",
"0.56141454",
"0.5588327",
"0.55861783",
"0.55825526",
"0.5554396",
"0.5553413",
"0.5551431",
"0.55251056",
"0.5524378",
"0.5523514",
"0.5512585",
"0.55074096",
"0.5502328",
"0.550023",
"0.54930276",
"0.54783577",
"0.5472654",
"0.5472654",
"0.5472654",
"0.54654086",
"0.5463969",
"0.5443589",
"0.54337126",
"0.5431278",
"0.5420729",
"0.5420679",
"0.540336",
"0.53994656",
"0.53994656",
"0.5399344",
"0.5395729",
"0.5392966",
"0.537637",
"0.5371552",
"0.53705174",
"0.53605205",
"0.5357337",
"0.53490454",
"0.53405166",
"0.53395164",
"0.5336959",
"0.5329483",
"0.5326182",
"0.53139424",
"0.530976",
"0.53087974",
"0.5307195",
"0.53041786",
"0.53032225",
"0.53022844",
"0.5299879",
"0.5299879",
"0.5297546",
"0.5292894",
"0.5279513",
"0.5276267",
"0.5274848"
] |
0.72132796
|
0
|
rubocop:enable Metrics/MethodLength Return encoded header
|
def encode
[@signature1].pack('L*') <<
[@signature2].pack('L*') <<
[@flags].pack('L*') <<
[@version].pack('L*') <<
@master_seed <<
@encryption_iv <<
[@groups_count].pack('L*') <<
[@entries_count].pack('L*') <<
@content_hash <<
@master_seed2 <<
[@rounds].pack('L*')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def encode_header(s); s; end",
"def raw_headers; end",
"def header_data\n\t\treturn self.normalized_headers.to_s\n\tend",
"def header_str\n \"\"\n end",
"def patched_encoded\n buffer = header.encoded\n buffer << \"\\r\\n\"\n buffer << body.to_s\n buffer\n end",
"def patched_encoded\n buffer = header.encoded\n buffer << \"\\r\\n\"\n buffer << body.to_s\n buffer\n end",
"def header_signature; end",
"def encode_headers(msg)\n buffer = BytesBuffer.new('')\n msg.headers.each do |k, v|\n # header key\n buffer << pack_uint8(k.bytesize)\n buffer << k\n\n # header value\n pattern, val_len, idx = Types.pattern[v.type]\n buffer << pack_uint8(idx)\n # boolean types doesn't need to specify value\n next if !!pattern == pattern\n buffer << pack_uint16(v.value.bytesize) unless val_len\n pattern ? buffer << [v.value].pack(pattern) :\n buffer << v.value\n end\n if buffer.bytesize > MAX_HEADERS_LENGTH\n raise Aws::EventStream::Errors::EventHeadersLengthExceedError.new\n end\n buffer\n end",
"def getHeader() @header1 end",
"def id_to_header(id)\n id.to_s(16)\n end",
"def force_header_encoding(s); s; end",
"def header\n return @header\n end",
"def compose_header(key, value)\n Util.escape_zero_byte(\"#{key}: #{value}\")\n end",
"def serialize_header(buffer)\n Header.serialize(buffer, [0, request_id, 0, op_code])\n end",
"def header\n @raw.split(\"--\" + boundary)[0]\n end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def header_to_s # :nodoc:\n if (header)\n pad = \" \" * headeri\n\n return pad + header + \"\\n\" + pad + \"=\" * header.length + \"\\n\\n\"\n end\n\n return ''\n end",
"def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n case h[:type]\n when :indexed\n buffer << integer(h[:name] + 1, rep[:prefix])\n when :changetablesize\n buffer << integer(h[:value], rep[:prefix])\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name] + 1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n buffer << string(h[:value])\n end\n\n # set header representation pattern on first byte\n fb = buffer.ord | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def header(h, buffer = \"\")\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def header\n @result['_header']\n end",
"def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end",
"def encoded\n ready_to_send!\n buffer = header.encoded\n buffer << \"\\r\\n\"\n buffer << body.encoded(content_transfer_encoding)\n buffer\n end",
"def actual_header\n data.lines.first.chomp\n end",
"def headers\n end",
"def content_encoding\n\t\treturn self.headers.content_encoding\n\tend",
"def content_encoding\n\t\treturn self.headers.content_encoding\n\tend",
"def header; message[:header]; end",
"def headers; return {}; end",
"def headers; return {}; end",
"def render_header\n response_header = \"#{@version} #{@status} #{@reason}#{CRLF}\"\n\n unless @headers.empty?\n response_header << @headers.map do |header, value|\n \"#{header}: #{value}\"\n end.join(CRLF) << CRLF\n end\n\n response_header << CRLF\n end",
"def parse_header_contents; end",
"def to_s\n [@header_data, @region_code, @start_ip, @filter].pack('c2Z*Z*')\n end",
"def generate_request_header()\n request_header = super()\n #puts \"--------------- generate_request_header >> request_header >>\\n#{request_header}\"\n credentials = @credential_handler.credentials\n #puts \"--------------- generate_request_header >> credentials >>\\n#{credentials}\"\n #request_header['authToken'] = @auth_handler.get_token(credentials)\n credentials.each {|k,v| request_header[prepend_namespace(k.to_s.camelize)] = v}\n request_header.select!{|k,_| ['ApplicationToken', 'CustomerAccountId', 'CustomerId', 'DeveloperToken', 'UserName', 'Password'].map{|h| prepend_namespace(h)}.include?(k.to_s)}\n #puts \"--------------- generate_request_header >> request_header final >>\\n#{request_header}\"\n return request_header\n end",
"def header_str_with_tingyun\n if self._ty_serial\n self._ty_header_str\n else\n # Since we didn't install a header callback for a non-serial request,\n # just fall back to the original implementation.\n header_str_without_tingyun\n end\n end",
"def header(key)\n return false unless headers.key?(key)\n\n headers.fetch(key).first.to_s\n end",
"def header_signature=(_arg0); end",
"def header(_content)\n raise NotImplementedError\n end",
"def escape_header s\n encode_header(s).gsub(/[:\\n\\\\\\\\]/) { |c| CHARACTER_ESCAPES[c] }\n end",
"def id_to_header(id)\n return '' unless id.is_a?(String)\n # Only send 64bit IDs downstream for now\n id.length == 32 ? id[16..-1] : id\n end",
"def id_to_header(id)\n unless id.is_a?(Integer) || id.is_a?(String)\n Instana.logger.debug \"id_to_header received a #{id.class}: returning empty string\"\n return String.new\n end\n [id.to_i].pack('q>').unpack('H*')[0].gsub(/^0+/, '')\n rescue => e\n Instana.logger.info \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n end",
"def store_header #:nodoc:\n record = 0x0014 # Record identifier\n # length # Bytes to follow\n\n str = @header # header string\n cch = str.length # Length of header string\n encoding = @header_encoding # Character encoding\n\n\n # Character length is num of chars not num of bytes\n cch /= 2 if encoding != 0\n\n # Change the UTF-16 name from BE to LE\n str = str.unpack('v*').pack('n*') if encoding != 0\n\n length = 3 + str.length\n\n header = [record, length].pack('vv')\n data = [cch, encoding].pack('vC')\n\n prepend(header, data, str)\n end",
"def get_header(body_bytesize_length)\r\n # We would like each request to be sent with the current time\r\n date = rfc1123date()\r\n\r\n return {\r\n 'Content-Type' => 'application/json',\r\n 'Authorization' => signature(date, body_bytesize_length),\r\n 'Log-Type' => @logstashLoganalyticsConfiguration.custom_log_table_name,\r\n 'x-ms-date' => date,\r\n 'time-generated-field' => @logstashLoganalyticsConfiguration.time_generated_field,\r\n 'x-ms-AzureResourceId' => @logstashLoganalyticsConfiguration.azure_resource_id\r\n }\r\n end",
"def header_for_id(id)\n raise 'Id must be 4 bytes' unless id.gsub(' ', '').length == 4*2\n # header is really \"B1 96 B1 D3 ED AE 5F 92 #{id}\"\n # however we're chopping off one byte to fit within 12 bytes in the search code.\n\n # the byte after item id changes. maybe 06 or 02 depending on the item.\n \"B1 96 B1 D3 ED AE 5F 92 #{id}\".gsub(' ', '')\n end",
"def encode_header(cmd_parms)\n header_params = {}\n body_digest = OpenSSL::Digest::MD5.digest(cmd_parms[:body])\n body_base64 = Base64.encode64(body_digest)\n\n current_date = Time.now.strftime('%Y-%m-%d %H:%M')\n\n data = \"#{current_date}\" + \"\\n\" + \"#{cmd_parms[:path]}\" + \"\\n\" + \"#{body_base64}\"\n\n digest = OpenSSL::Digest.new('sha1')\n movingFactor = data.rstrip!\n if @password == \"\" || !(@api_key.nil?)\n hash = OpenSSL::HMAC.hexdigest(digest, @api_key, movingFactor)\n else\n hash = OpenSSL::HMAC.hexdigest(digest, Base64.strict_decode64(@password), movingFactor)\n end\n final_hmac = @email + ':' + hash\n header_params = { hmac: final_hmac, date: current_date }\n end",
"def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end",
"def header\n @message.header\n end",
"def header=(_arg0); end",
"def header\n return @message.header\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 header(name)\n @response[name]\n end",
"def rhdr\n b = rbyte\n code, value = b & 7, b >> 3\n case value\n when 0..22\n return code, value\n when 23...31\n return code, rlongint(value-22)\n else\n n = renc\n return code, rlongint(n)\n end\n end",
"def header; end",
"def header; end",
"def header; end",
"def header_length() 3 end",
"def original\n @original_header\n end",
"def header\n MAGIC + [VERSION].pack('n')\n end",
"def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"def header_str_with_newrelic\n header_str_with_tracing { header_str_without_newrelic }\n end",
"def header(prev_header)\n Bitcoin.double_sha256(filter_hash.htb + prev_header.htb).bth\n end",
"def to_s\n \"#{headers}\\r\\n\\r\\n#{body}\"\n end",
"def header_value\n return @header_value\n end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def headers=(_arg0); end",
"def make_header\n\t\t\theader = nil\n\t\t\tlength = self.payload.size\n\n\t\t\tself.log.debug \"Making wire protocol header for payload of %d bytes\" % [ length ]\n\n\t\t\t# Pack the frame according to its size\n\t\t\tif length >= 2**16\n\t\t\t\tself.log.debug \" giant size, using 8-byte (64-bit int) length field\"\n\t\t\t\theader = [ self.flags, 127, length ].pack( 'c2q>' )\n\t\t\telsif length > 125\n\t\t\t\tself.log.debug \" big size, using 2-byte (16-bit int) length field\"\n\t\t\t\theader = [ self.flags, 126, length ].pack( 'c2n' )\n\t\t\telse\n\t\t\t\tself.log.debug \" small size, using payload length field\"\n\t\t\t\theader = [ self.flags, length ].pack( 'c2' )\n\t\t\tend\n\n\t\t\tself.log.debug \" header is: 0: %02x %02x\" % header.unpack('C*')\n\t\t\treturn header\n\t\tend",
"def stringify_headers(headers); end",
"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 header\n @header ||= create_header\n end",
"def encode\n\n # Set defaults if necessary\n HEADER_DEFAULTS.each do |k, v|\n send(\"#{k}=\", v) if instance_variable_get(\"@#{k}\").nil?\n end\n\n h_type = HEADER_LENGTHS.invert[header_length]\n\n buffer = Buffer.new\n buffer.write_bitfield [h_type, 2], [channel_id, 6]\n\n if header_length >= 4\n buffer.write_uint24_be timestamp\n end\n\n if header_length >= 8\n buffer.write_uint24_be body_length\n buffer.write_uint8 message_type_id\n end\n\n if header_length == 12\n buffer.write_uint32_le message_stream_id\n end\n\n buffer.string\n end",
"def get_header(*params); raise('Stub or mock required.') end",
"def to_s\n @header + \"\\n\" + @sequence\n end",
"def header\n end",
"def header_raw(str)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n Php4r.header(str)\n return nil\n end",
"def join_headers; end",
"def decode_raw_header\n decoded_header = Ether.new\n decoded_header.read(payload)\n end",
"def to_png_header\n self\n end",
"def get\n @keys.each do |key|\n short_name = key.split('.').last\n @header << (@header.include?(short_name) ? key : short_name)\n end\n @header.join(',') + \"\\n\"\n end",
"def inspect #:nodoc:\n s = \"#<#{self.class}:0x#{(self.object_id*2).to_s(16)} \"\n @header_object.each_pair do |k,v|\n s += \"(#{k.upcase} size=#{v[1]} offset=#{v[2]}) \" unless k == \"ASF_Header_Object\"\n end\n s += \"\\b>\"\n end",
"def big_header(string)\n outstring = \"$ *********************************************************\\n$ ** **\\n$ ** #{string} \\n$ ** **\\n$ *********************************************************\\n\"\n return outstring\n end",
"def parsed_content_type_header; end",
"def header(buf)\n peek = buf.readbyte(0)\n\n header = {}\n header[:type], type = HEADREP.find do |_t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end\n\n fail CompressionError unless header[:type]\n\n header[:name] = integer(buf, type[:prefix])\n\n case header[:type]\n when :indexed\n fail CompressionError if (header[:name]).zero?\n header[:name] -= 1\n when :changetablesize\n header[:value] = header[:name]\n else\n if (header[:name]).zero?\n header[:name] = string(buf)\n else\n header[:name] -= 1\n end\n header[:value] = string(buf)\n end\n\n header\n end",
"def str_headers(env, status, headers, res_info, lines, requests, client); end",
"def headers\n\t\t\thdr = @curb.header_str\n\t\t\tself.class.recode(log?, @curb.content_type, hdr) ?\n\t\t\t\tself.class.parse_headers(hdr) :\n\t\t\t\tself.class.parse_headers(@curb.header_str) # recode failed\n\t\tend",
"def header\n @version, @flags, @numStrikes = @bytes[0, 8].unpack('nnN')\n\n @strikeOffset = (0...@numStrikes).map do |n|\n start = 8 + n * 4\n @bytes[start, 4].unpack('N')[0]\n end\n end",
"def toString()\n @header[LENGTH - 1] = checksum()\n return @header + @message\n end",
"def encode_headers(headers)\n result = StringIO.new\n headers.each do |key, value|\n next if value == nil\n if value.kind_of?(Array)\n value.each do |subvalue|\n result << (\"%s: %s\\r\\n\" % [key, subvalue])\n end\n else\n result << (\"%s: %s\\r\\n\" % [key, value])\n end\n end\n return result.string\n end",
"def generate_auth_header(params)\n auth_header_value = \"\"\n params.each_pair{|key, value|\n auth_header_value += \",\" if auth_header_value.length > 0\n auth_header_value += \"#{key.urlencode}=\\\"#{value.urlencode}\\\"\"\n }\n\n return auth_header_value\n end",
"def header_to_id(header_id)\n if !header_id.is_a?(String)\n Instana.logger.debug \"header_to_id received a #{header_id.class}: returning 0\"\n return 0\n end\n if header_id.length < 16\n # The header is less than 16 chars. Prepend\n # zeros so we can convert correctly\n missing = 16 - header_id.length\n header_id = (\"0\" * missing) + header_id\n end\n [header_id].pack(\"H*\").unpack(\"q>\")[0]\n rescue => e\n Instana.logger.info \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n end",
"def generic_Generate_Headers(body)\n\theaders = ''\n\theaders << \"Server: #{Socket.ip_address_list.select{|x| x.ipv4_private?}[0].ip_address}\\r\\n\"\n\theaders << \"Date: #{Time.now.ctime}\\r\\n\"\n\tif body.length>0\n\t\theaders << \"Content-Type => text/html\\r\\n\"\n\t\theaders << \"Content-Length => #{body.size}\\r\\n\"\n\tend\n\treturn headers\nend",
"def getHeader\n #updateToken\n {'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' + @token}\n end"
] |
[
"0.809916",
"0.73499763",
"0.7259496",
"0.68839025",
"0.68610173",
"0.6852649",
"0.68168855",
"0.67906314",
"0.6781441",
"0.6744992",
"0.6714935",
"0.67041916",
"0.66949034",
"0.66533417",
"0.6628501",
"0.66171366",
"0.66171366",
"0.66171366",
"0.66171366",
"0.66171366",
"0.66171366",
"0.66171366",
"0.66171366",
"0.66171366",
"0.66171366",
"0.6608355",
"0.6584413",
"0.6560819",
"0.6552001",
"0.65443045",
"0.65424055",
"0.65378743",
"0.6516789",
"0.6508306",
"0.6508306",
"0.65055907",
"0.64879733",
"0.64879733",
"0.64688843",
"0.6445009",
"0.6444908",
"0.64255655",
"0.6400564",
"0.6386439",
"0.63725275",
"0.6369977",
"0.6366805",
"0.6352965",
"0.6347679",
"0.63447833",
"0.63288116",
"0.63243544",
"0.632344",
"0.6319977",
"0.6319731",
"0.63164496",
"0.6290699",
"0.629028",
"0.62870735",
"0.6283131",
"0.62818384",
"0.62818384",
"0.62818384",
"0.6261662",
"0.6259533",
"0.62575215",
"0.6252833",
"0.6252214",
"0.6239048",
"0.6238671",
"0.6234692",
"0.6234531",
"0.6234531",
"0.6234531",
"0.6234531",
"0.62305504",
"0.62214863",
"0.6217988",
"0.6208111",
"0.62075436",
"0.61989623",
"0.6189266",
"0.61690694",
"0.6166721",
"0.6162164",
"0.6144063",
"0.61414534",
"0.6131461",
"0.6122963",
"0.61120677",
"0.6099373",
"0.6086358",
"0.6076685",
"0.6068149",
"0.6057831",
"0.6054664",
"0.60367507",
"0.602778",
"0.60249746",
"0.60120845",
"0.60056317"
] |
0.0
|
-1
|
GET /questionario_egressos GET /questionario_egressos.json
|
def index
checar_super
@pnome = params[:pnome]
@pdata_ini = params[:pdata_ini]
@pdata_fim = params[:pdata_fim]
@pdata_ate = params[:pdata_ate]
@data_ate = (params[:pdata_ate].to_date+1.days).to_s if params[:pdata_ate]# +1 pegar a data cheia, update_at time
@pcurso = params[:pcurso]
@prealizado = params[:prealizado]
if not(@pcurso ==nil)
filtro_curso = "nome_curso like '%"+@pcurso+"%'"
else
filtro_curso = "1=1"
end
if not(@pnome ==nil)
filtro_nome = "nome_completo like '%"+@pnome+"%'"
else
filtro_nome = "1=1"
end
osEgressos = Egresso.where(filtro_nome)
if @pdata_ini.present? && @pdata_fim.present?
asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso).where("data_fim >= (?) AND data_fim <= (?)", @pdata_ini, @pdata_fim)
else
if @pdata_ini.present? && not(@pdata_fim.present?)
asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso).where("data_fim >= (?) ", @pdata_ini)
end
if not( @pdata_ini.present?) && @pdata_fim.present?
asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso).where("data_fim <= (?) ", @pdata_fim)
end
if not( @pdata_ini.present?) && not(@pdata_fim.present?) &&@pcurso.present?
asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso)
else
asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id))
end
end
if @prealizado == "S"
@realizado = "true"
else
@realizado = "false"
end
puts @prealizado
@forms = QuestionarioEgresso.where(form_acad_id: asFormAcads.map(&:id)).where(filtro_curso).where("realizado = '"+@realizado+"'").where("updated_at <= (?)" , @pdata_ate)
@questionario_egressos = @forms.paginate(page: params[:page], per_page: 5).order("egresso_id")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_questionario_egresso\n @questionario_egresso = QuestionarioEgresso.find(params[:id])\n end",
"def create\n @questionario_egresso = QuestionarioEgresso.new(questionario_egresso_params)\n\n respond_to do |format|\n if @questionario_egresso.save\n format.html { redirect_to questionario_egressos_path, notice: 'Questionario incluído com sucesso.' }\n format.json { render :show, status: :created, location: questionario_egressos_path }\n else\n format.html { render :new }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @questionario_egresso.destroy\n respond_to do |format|\n format.html { redirect_to questionario_egressos_path(@questionario_egresso, egresso_id: @questionario_egresso.egresso_id), notice: 'Questionario excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def questionario_egresso_params\n params.require(:questionario_egresso).permit(:auxiliar, :nome_curso,:curso_id, :realizado, :form_acad_id, :egresso_id, :ig_idade, :ig_genero, :ig_cor, :ig_est_conjug, :ia_qual_curso, :ia_nome_curso, :ia_ano_iniciou, :ia_ano_concluiu, :ia_satisf_palestras, :ia_satisf_oficina, :ia_satisf_minicurso, :ia_satisf_seminario, :ia_satisf_vis_tec, :ia_satisf_estagio, :ia_satisf_prat_prof, :ia_satisf_bolsas, :ia_est_dur_curso, :ia_empresa_pq_sim, :ia_empresa_pq_nao, :ia_avalia_curso, :ia_nessec_atlzr, :ia_fazer_atlzr, :saip_esta_inst, :saip_back_inst, :saip_curso_atual, :saip_pq_back, :saip_pqnao_back, :saip_trab_atual, :saip_trab_area, :saip_tempo, :saip_vinculo, :saip_local, :saip_renda, :saip_ja_trab, :saip_prim_oport, :saip_pq_nao_esta, :saip_texto1, :saip_pq_nunca, :saip_texto2)\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def set_egresso\r\n @egresso = Egresso.find(params[:id])\r\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def update\n respond_to do |format|\n if @questionario_egresso.update(questionario_egresso_params)\n format.html { redirect_to home_path, notice: 'Questionario preenchido com sucesso.' }\n format.json { render :show, status: :ok, location: questionario_egressos_path }\n else\n format.html { render :edit }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def show\r\n\r\n relatorio_id = params[:relatorio_id]\r\n asFormAcads = FormAcad.where(relatorio_id: relatorio_id);\r\n osEgressos = Egresso.none\r\n asFormAcads.each do |aFormAcad|\r\n oEgresso = Egresso.where(id: aFormAcad.egresso_id)\r\n if not(oEgresso.first.cpf.present?)||not(oEgresso.first.email_princ.present?)||not(aFormAcad.data_fim.present?)\r\n osEgressos += oEgresso\r\n end\r\n end\r\n @osEgressos= Egresso.where(id: osEgressos.map(&:id)).paginate(page: params[:page], per_page: 5).order(\"id\")\r\n end",
"def create\r\n @egresso = Egresso.new(egresso_params)\r\n\r\n respond_to do |format|\r\n if @egresso.save\r\n format.html { redirect_to @egresso, notice: 'Egresso criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @egresso }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @egresso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def egresso_params\r\n params.require(:egresso).permit(:cpf, :nome_completo, :nome_social, :data_nasc, :genero, :link, :est_conjugal, :end_completo, :email_princ, :email_alt, :link_face, :lattes, :lkdn, :tel_res, :tel_com, :tel_cel, :num_zap, :foto, :foto_cache, :relatorio, :remove_foto, :primacesso, :skip_fields_validation)\r\n end",
"def index\n @questionarios_respostas = QuestionarioResposta.all\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def informacoes\n empregado = Empregado.find(params[:empregado_id])\n solicitacoes = Solicitacao.where(empregado_id: parametros[:empregado_id], mes_ano: parametros[:mes_ano])\n valor_ja_solicitado = solicitacoes.sum(&:valor)\n salario_disponivel = (empregado.salario || 0) - valor_ja_solicitado - solicitacoes.sum(&:taxa) # FIXME Romuloset - taxas\n\n render json: {\n valor_ja_solicitado: valor_ja_solicitado,\n salario_disponivel: salario_disponivel\n }\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end",
"def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def index\n @comentario_egresados = ComentarioEgresado.all\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end",
"def index\n @evaluaciones = Evaluacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluaciones }\n end\n end",
"def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def index\n @regra_negocios = RegraNegocio.all\n end",
"def estaciones\n\n param_estacion = params[:estacion]\n param_fecha = params[:fecha].to_i\n @info_polens = InfoPolen.where({\"ESTACIONES\" => param_estacion, \"FECHA\" => param_fecha}).order_by(:TIPOS_POLINICOS.asc)\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end",
"def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end",
"def index\n @programa_de_interes = ProgramaDeIntere.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programa_de_interes }\n end\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def get_all\n\t\trender json: {quests: Quest.all.as_json(include: :images)}\n\tend",
"def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end",
"def index\n @reprogramaciones = Reprogramacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reprogramaciones }\n end\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n @periodo_para_ingresars = PeriodoParaIngresar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periodo_para_ingresars }\n end\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def gethashespersec\n @api.request 'gethashespersec'\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def questionario_resposta_params\n params.require(:questionario_resposta).permit(:questionario_id, :participante_id, :pergunta_id, :alternativa_id)\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def index\n quizzes = Quiz.all\n render json: quizzes, except: [:updated_at, :created_at]\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def index\n render status: :ok, json: @group_question_alternatives\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def index\n @ingressos = Ingresso.all\n end",
"def index\n @pregunta_alternativas = PreguntaAlternativa.all\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def index\n @gpsquests = Gpsquest.all\n end",
"def create\n params.permit(:id_groupe, :id_question)\n ajout = GroupeService.instance.ajouterQuestion(params[:id_groupe], params[:id_question])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def index\n @question_options = QuestionOption.find_all_by_question_id(@question.id)\n\n respond_to do |format|\n format.json { render :json => @question_options.to_json }\n format.xml { render :xml => @question_options.to_xml }\n end\n end",
"def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end",
"def show\n @advogados_escritorio = AdvogadosEscritorio.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @advogados_escritorio }\n format.js\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @plato = Plato.find(params[:id])\n\n if [email protected]?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def index\n @expression_relationships = ExpressionRelationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expression_relationships }\n end\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def show\n @title_view = 'Culturas'\n @cultural_heritage_culture = CulturalHeritage::Culture.find(params[:id])\n\n points = @cultural_heritage_culture.list_point\n\n if points.length > 0\n\n count = 0\n @json = \"[[\"\n points.each do |point|\n if (count == 0)\n @json = @json << '{\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s <<\n ', \"strokeColor\": \"#FF0000\", \"strokeOpacity\": 0.3, \"strokeWeight\": 1, \"fillColor\": \"#FF0000\", \"fillOpacity\": 0.7}'\n else\n @json = @json << ', {\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s << '}'\n end\n count = count + 1\n end\n @json = @json << \"]]\"\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_culture }\n format.json { render :json => @cultural_heritage_culture }\n end\n end",
"def show \n est = @establecimiento\n respond_to do |format|\n format.html\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n render :json => {:nombre => @establecimiento.nombre, direccion: @establecimiento.direccion, :latitud => @establecimiento.latitud,\n :longitud => @establecimiento.longitud, :descripcion => @establecimiento.descripcion, :imagen => @establecimiento.foto.url(:small),\n :comentarios => @establecimiento.EstComentarios.map { |comentario| { :descripcion => comentario.descripcion, :usuario => comentario.usuario.nombre } } } \n\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n }\n end\n #No tiene restricciones, queda abierto para el API\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def index\n #@imovels = Imovel.all\n \n #Traz apenas os imoveis ativos\n # Isso vai no controller do cliente. Só os ativos aparecem\n #@imovels = Imovel.all.select { |i| i.ativo == true }\n \n @imovels = Imovel.paginate :page => params[:page], :order => 'created_at DESC', :per_page => 10\n \n # Mapa para guardar os valores das transacoes associadas a cada imovel.\n # key: imovel_id, value: lista com [0]:transacao, [1]: tipos, [2] responsavel\n @hash_informacoes_imoveis = Hash.new\n \n @imovels.each do |imovel|\n popular_imovel(imovel)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imovels }\n end\n end",
"def index\n @gatos = Gato.all\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def index\n @excuses = Excuse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @excuses }\n end\n end",
"def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end",
"def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @geopoints }\n end\n end",
"def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end",
"def index\n @reparticoes = Reparticao.all\n end",
"def index\n @costs = @ficha.costs.all\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end",
"def show\n @classroom = Classroom.find(params[:id])\n gon.questions = @classroom.questions.order(:time).map { |q| [q.time, 1 + q.reputation_for(:votes).to_i + q.answers.count*0.5] }\n totalArr = Array.new\n gon.questions.each do |q|\n index = q[0].to_i / 10\n totalArr[index] = totalArr[index].blank? ? 1 : totalArr[index] + 1;\n end\n\n gon.qpm = totalArr.each_with_index.map { |total,i| [i*10, total.to_i] }\n\n # get the 'hottest questions'\n if current_user_is_teacher\n @questions = @classroom.questions.find_with_reputation(:votes, :all, order: 'votes desc')\n else\n @questions = @classroom.questions.order('updated_at DESC').all\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classroom }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end",
"def index\n @programas = Programa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end",
"def create\n if params[:get]\n @plato = Plato.where(\"soda_id = ?\", params[:soda_id])\n\n #if [email protected]?\n # render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n #else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n #end\n\n else\n @plato = Plato.new(plato_params)\n\n if @plato.save\n render json: @plato, status: :created, location: @plato\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end\n\n end"
] |
[
"0.6630252",
"0.6577431",
"0.6296",
"0.60005254",
"0.5595407",
"0.5568901",
"0.5508309",
"0.5452108",
"0.5443397",
"0.5425567",
"0.54027015",
"0.53896606",
"0.53510714",
"0.53424025",
"0.5298733",
"0.52822226",
"0.52671903",
"0.5226774",
"0.5210258",
"0.5202801",
"0.5184251",
"0.5170963",
"0.51595473",
"0.514955",
"0.514676",
"0.51453155",
"0.51387745",
"0.5121532",
"0.5117457",
"0.510874",
"0.5084398",
"0.50682825",
"0.5067999",
"0.5066669",
"0.5060462",
"0.5057584",
"0.5054819",
"0.50426227",
"0.50340736",
"0.50314355",
"0.50314146",
"0.5028167",
"0.5022458",
"0.501872",
"0.5013606",
"0.50092703",
"0.5002786",
"0.49969602",
"0.49926746",
"0.4991859",
"0.49885345",
"0.49837792",
"0.49800172",
"0.4971038",
"0.49709493",
"0.49700287",
"0.49605894",
"0.49556398",
"0.49527386",
"0.49431902",
"0.49422476",
"0.49392107",
"0.4938289",
"0.49303487",
"0.49301285",
"0.49290997",
"0.4924816",
"0.49215233",
"0.49175298",
"0.49167544",
"0.4916482",
"0.4915477",
"0.4913687",
"0.4909651",
"0.4908926",
"0.49028566",
"0.48971853",
"0.4890569",
"0.48888138",
"0.48807585",
"0.48788342",
"0.48730776",
"0.4872752",
"0.48696882",
"0.48680383",
"0.48647216",
"0.48593453",
"0.48581243",
"0.48570624",
"0.48568547",
"0.48527983",
"0.4850008",
"0.4846001",
"0.48459375",
"0.48409188",
"0.4837401",
"0.48286274",
"0.48231965",
"0.48227882",
"0.4820937",
"0.4818825"
] |
0.0
|
-1
|
GET /questionario_egressos/1 GET /questionario_egressos/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_questionario_egresso\n @questionario_egresso = QuestionarioEgresso.find(params[:id])\n end",
"def create\n @questionario_egresso = QuestionarioEgresso.new(questionario_egresso_params)\n\n respond_to do |format|\n if @questionario_egresso.save\n format.html { redirect_to questionario_egressos_path, notice: 'Questionario incluído com sucesso.' }\n format.json { render :show, status: :created, location: questionario_egressos_path }\n else\n format.html { render :new }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @questionario_egresso.destroy\n respond_to do |format|\n format.html { redirect_to questionario_egressos_path(@questionario_egresso, egresso_id: @questionario_egresso.egresso_id), notice: 'Questionario excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def questionario_egresso_params\n params.require(:questionario_egresso).permit(:auxiliar, :nome_curso,:curso_id, :realizado, :form_acad_id, :egresso_id, :ig_idade, :ig_genero, :ig_cor, :ig_est_conjug, :ia_qual_curso, :ia_nome_curso, :ia_ano_iniciou, :ia_ano_concluiu, :ia_satisf_palestras, :ia_satisf_oficina, :ia_satisf_minicurso, :ia_satisf_seminario, :ia_satisf_vis_tec, :ia_satisf_estagio, :ia_satisf_prat_prof, :ia_satisf_bolsas, :ia_est_dur_curso, :ia_empresa_pq_sim, :ia_empresa_pq_nao, :ia_avalia_curso, :ia_nessec_atlzr, :ia_fazer_atlzr, :saip_esta_inst, :saip_back_inst, :saip_curso_atual, :saip_pq_back, :saip_pqnao_back, :saip_trab_atual, :saip_trab_area, :saip_tempo, :saip_vinculo, :saip_local, :saip_renda, :saip_ja_trab, :saip_prim_oport, :saip_pq_nao_esta, :saip_texto1, :saip_pq_nunca, :saip_texto2)\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def index\n @questionarios_respostas = QuestionarioResposta.all\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def update\n respond_to do |format|\n if @questionario_egresso.update(questionario_egresso_params)\n format.html { redirect_to home_path, notice: 'Questionario preenchido com sucesso.' }\n format.json { render :show, status: :ok, location: questionario_egressos_path }\n else\n format.html { render :edit }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end",
"def index\n @programa_de_interes = ProgramaDeIntere.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programa_de_interes }\n end\n end",
"def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def set_egresso\r\n @egresso = Egresso.find(params[:id])\r\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def show\r\n\r\n relatorio_id = params[:relatorio_id]\r\n asFormAcads = FormAcad.where(relatorio_id: relatorio_id);\r\n osEgressos = Egresso.none\r\n asFormAcads.each do |aFormAcad|\r\n oEgresso = Egresso.where(id: aFormAcad.egresso_id)\r\n if not(oEgresso.first.cpf.present?)||not(oEgresso.first.email_princ.present?)||not(aFormAcad.data_fim.present?)\r\n osEgressos += oEgresso\r\n end\r\n end\r\n @osEgressos= Egresso.where(id: osEgressos.map(&:id)).paginate(page: params[:page], per_page: 5).order(\"id\")\r\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @plato = Plato.find(params[:id])\n\n if [email protected]?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @movimentacao_de_estoque = MovimentacaoDeEstoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movimentacao_de_estoque }\n end\n end",
"def show\n @coligacao_partido = ColigacaoPartido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coligacao_partido }\n end\n end",
"def show\n question = QuestionOuverteService.instance.afficherQuestionParId(params[:id])\n (question != nil) ? (render json: question, status: :ok) : (render json: nil, status: :not_found)\n end",
"def show\n @advogados_escritorio = AdvogadosEscritorio.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @advogados_escritorio }\n format.js\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def index\n @evaluaciones = Evaluacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluaciones }\n end\n end",
"def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end",
"def create\n params.permit(:id_groupe, :id_question)\n ajout = GroupeService.instance.ajouterQuestion(params[:id_groupe], params[:id_question])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end",
"def get_random\n @question = Question.get_random\n\n unless @question\n render json: { error: \"random question can't be found\" }.to_json, status: 404\n end\n end",
"def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end",
"def informacoes\n empregado = Empregado.find(params[:empregado_id])\n solicitacoes = Solicitacao.where(empregado_id: parametros[:empregado_id], mes_ano: parametros[:mes_ano])\n valor_ja_solicitado = solicitacoes.sum(&:valor)\n salario_disponivel = (empregado.salario || 0) - valor_ja_solicitado - solicitacoes.sum(&:taxa) # FIXME Romuloset - taxas\n\n render json: {\n valor_ja_solicitado: valor_ja_solicitado,\n salario_disponivel: salario_disponivel\n }\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def new\n @agronomiaquimica = Agronomiaquimica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end",
"def show \n est = @establecimiento\n respond_to do |format|\n format.html\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n render :json => {:nombre => @establecimiento.nombre, direccion: @establecimiento.direccion, :latitud => @establecimiento.latitud,\n :longitud => @establecimiento.longitud, :descripcion => @establecimiento.descripcion, :imagen => @establecimiento.foto.url(:small),\n :comentarios => @establecimiento.EstComentarios.map { |comentario| { :descripcion => comentario.descripcion, :usuario => comentario.usuario.nombre } } } \n\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n }\n end\n #No tiene restricciones, queda abierto para el API\n end",
"def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def index\n if get_event\n @v1_questions = @event.questions\n render json: @v1_questions\n else\n @v1_questions = V1::Question.all\n render json: @v1_questions\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plannegocio }\n end\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def index\n @reprogramaciones = Reprogramacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reprogramaciones }\n end\n end",
"def index\n @periodo_para_ingresars = PeriodoParaIngresar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periodo_para_ingresars }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def questionario_resposta_params\n params.require(:questionario_resposta).permit(:questionario_id, :participante_id, :pergunta_id, :alternativa_id)\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def show\n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimo_grado_de_estudio }\n end\n end",
"def getQuartier\r\n \tarrondissement = params[:id]\r\n \trender json: Quartier.where(arrondissement_id: arrondissement)\r\n end",
"def create\r\n @egresso = Egresso.new(egresso_params)\r\n\r\n respond_to do |format|\r\n if @egresso.save\r\n format.html { redirect_to @egresso, notice: 'Egresso criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @egresso }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @egresso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def show\n @ejercicio = Ejercicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ejercicio }\n end\n end",
"def show\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estoque }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def show\n @comentariox = Comentariox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentariox }\n end\n end",
"def index\n @question_options = QuestionOption.find_all_by_question_id(@question.id)\n\n respond_to do |format|\n format.json { render :json => @question_options.to_json }\n format.xml { render :xml => @question_options.to_xml }\n end\n end",
"def show\n render json: @grupoassunto\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def new\n @liquidacion = Liquidacion.new\n\n #Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares \n @conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liquidacion }\n end\n end",
"def estaciones\n\n param_estacion = params[:estacion]\n param_fecha = params[:fecha].to_i\n @info_polens = InfoPolen.where({\"ESTACIONES\" => param_estacion, \"FECHA\" => param_fecha}).order_by(:TIPOS_POLINICOS.asc)\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end"
] |
[
"0.66807",
"0.65182376",
"0.6279607",
"0.5888648",
"0.588723",
"0.5882541",
"0.58330846",
"0.57566166",
"0.5667242",
"0.56377727",
"0.5628532",
"0.5608778",
"0.56039613",
"0.55942124",
"0.5585629",
"0.55595964",
"0.5548359",
"0.55441695",
"0.5508043",
"0.54977393",
"0.5494365",
"0.54892415",
"0.545624",
"0.5453746",
"0.5451497",
"0.54423624",
"0.5438603",
"0.54374427",
"0.5434066",
"0.54294866",
"0.5421774",
"0.5415966",
"0.54065037",
"0.5403849",
"0.5401116",
"0.53998965",
"0.5392142",
"0.53833264",
"0.5376108",
"0.53736883",
"0.53735167",
"0.5366481",
"0.5366298",
"0.5365462",
"0.53568304",
"0.53568256",
"0.53568256",
"0.5354784",
"0.5353339",
"0.53519136",
"0.5341361",
"0.5340215",
"0.5340174",
"0.5337861",
"0.533555",
"0.5334149",
"0.5333977",
"0.5329973",
"0.5329728",
"0.5326756",
"0.53233206",
"0.5323098",
"0.53140604",
"0.53096926",
"0.530613",
"0.5305957",
"0.530498",
"0.5297135",
"0.52903354",
"0.5284103",
"0.52759176",
"0.52754784",
"0.52722025",
"0.5270635",
"0.52706033",
"0.5261551",
"0.5261414",
"0.52612954",
"0.5258822",
"0.5256202",
"0.5254754",
"0.52515435",
"0.5251374",
"0.52498406",
"0.52441525",
"0.524391",
"0.5242955",
"0.5242334",
"0.52410364",
"0.5240336",
"0.52386206",
"0.52384806",
"0.52384806",
"0.52384806",
"0.52384806",
"0.5237875",
"0.5234617",
"0.5233903",
"0.523235",
"0.5231218",
"0.52311707"
] |
0.0
|
-1
|
POST /questionario_egressos POST /questionario_egressos.json
|
def create
@questionario_egresso = QuestionarioEgresso.new(questionario_egresso_params)
respond_to do |format|
if @questionario_egresso.save
format.html { redirect_to questionario_egressos_path, notice: 'Questionario incluído com sucesso.' }
format.json { render :show, status: :created, location: questionario_egressos_path }
else
format.html { render :new }
format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def questionario_egresso_params\n params.require(:questionario_egresso).permit(:auxiliar, :nome_curso,:curso_id, :realizado, :form_acad_id, :egresso_id, :ig_idade, :ig_genero, :ig_cor, :ig_est_conjug, :ia_qual_curso, :ia_nome_curso, :ia_ano_iniciou, :ia_ano_concluiu, :ia_satisf_palestras, :ia_satisf_oficina, :ia_satisf_minicurso, :ia_satisf_seminario, :ia_satisf_vis_tec, :ia_satisf_estagio, :ia_satisf_prat_prof, :ia_satisf_bolsas, :ia_est_dur_curso, :ia_empresa_pq_sim, :ia_empresa_pq_nao, :ia_avalia_curso, :ia_nessec_atlzr, :ia_fazer_atlzr, :saip_esta_inst, :saip_back_inst, :saip_curso_atual, :saip_pq_back, :saip_pqnao_back, :saip_trab_atual, :saip_trab_area, :saip_tempo, :saip_vinculo, :saip_local, :saip_renda, :saip_ja_trab, :saip_prim_oport, :saip_pq_nao_esta, :saip_texto1, :saip_pq_nunca, :saip_texto2)\n end",
"def set_questionario_egresso\n @questionario_egresso = QuestionarioEgresso.find(params[:id])\n end",
"def create\r\n @egresso = Egresso.new(egresso_params)\r\n\r\n respond_to do |format|\r\n if @egresso.save\r\n format.html { redirect_to @egresso, notice: 'Egresso criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @egresso }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @egresso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def destroy\n @questionario_egresso.destroy\n respond_to do |format|\n format.html { redirect_to questionario_egressos_path(@questionario_egresso, egresso_id: @questionario_egresso.egresso_id), notice: 'Questionario excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def egresso_params\r\n params.require(:egresso).permit(:cpf, :nome_completo, :nome_social, :data_nasc, :genero, :link, :est_conjugal, :end_completo, :email_princ, :email_alt, :link_face, :lattes, :lkdn, :tel_res, :tel_com, :tel_cel, :num_zap, :foto, :foto_cache, :relatorio, :remove_foto, :primacesso, :skip_fields_validation)\r\n end",
"def create\n params.permit(:id_groupe, :id_question)\n ajout = GroupeService.instance.ajouterQuestion(params[:id_groupe], params[:id_question])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def create\n @tipo_agressor = TipoAgressor.new(tipo_agressor_params)\n\n respond_to do |format|\n if @tipo_agressor.save\n format.html { redirect_to @tipo_agressor, notice: @@msgs }\n format.json { render :show, status: :created, location: @tipo_agressor }\n else\n format.html { render :new }\n format.json { render json: @tipo_agressor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionario_egresso.update(questionario_egresso_params)\n format.html { redirect_to home_path, notice: 'Questionario preenchido com sucesso.' }\n format.json { render :show, status: :ok, location: questionario_egressos_path }\n else\n format.html { render :edit }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def questionario_params\n params.require(:questionario).permit(:descricao, :vaga_id, questoes_attributes: [:id, :questionario_id, :descricao, :nota, :_destroy, opcoes_attributes: [:id, :questao_id, :gabarito, :descricao, :_destroy]])\n end",
"def questionario_resposta_params\n params.require(:questionario_resposta).permit(:questionario_id, :participante_id, :pergunta_id, :alternativa_id)\n end",
"def create\n @regra_negocio = RegraNegocio.new(regra_negocio_params)\n\n respond_to do |format|\n if @regra_negocio.save\n format.html { redirect_to @regra_negocio, notice: 'Regra negocio was successfully created.' }\n format.json { render :show, status: :created, location: @regra_negocio }\n else\n format.html { render :new }\n format.json { render json: @regra_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @questionario_resposta = QuestionarioResposta.new(questionario_resposta_params)\n\n respond_to do |format|\n if @questionario_resposta.save\n format.html { redirect_to @questionario_resposta, notice: 'Questionario resposta was successfully created.' }\n format.json { render :show, status: :created, location: @questionario_resposta }\n else\n format.html { render :new }\n format.json { render json: @questionario_resposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def create\n @comentario_egresado = ComentarioEgresado.new(comentario_egresado_params)\n\n respond_to do |format|\n if @comentario_egresado.save\n format.html { redirect_to @comentario_egresado, notice: 'Comentario egresado was successfully created.' }\n format.json { render :show, status: :created, location: @comentario_egresado }\n else\n format.html { render :new }\n format.json { render json: @comentario_egresado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @arriendo = Arriendo.new(arriendo_params)\n\n respond_to do |format|\n if @arriendo.save\n format.html { redirect_to @arriendo, notice: 'Arriendo was successfully created.' }\n format.json { render :show, status: :created, location: @arriendo }\n else\n format.html { render :new }\n format.json { render json: @arriendo.errors, status: :unprocessable_entity }\n end\n end\n\n (1..(@arriendo.cantidad-1)).each do |arriendo2|\n arriendo2 = Arriendo.new\n arriendo2.talla = @arriendo.talla\n arriendo2.talla_parka = @arriendo.talla_parka\n arriendo2.talla_pantalon = @arriendo.talla_pantalon\n arriendo2.altura = @arriendo.altura\n arriendo2.fecha = @arriendo.fecha\n arriendo2.peso = @arriendo.peso\n arriendo2.nombre = @arriendo.nombre\n arriendo2.apellidop = @arriendo.apellidop\n arriendo2.apellidom = @arriendo.apellidom\n arriendo2.nropedido = @arriendo.nropedido\n arriendo2.cantidad = @arriendo.cantidad\n arriendo2.user_id = @arriendo.user_id\n arriendo2.equipo_id = @arriendo.equipo_id\n arriendo2.email = @arriendo.email\n arriendo2.dias = @arriendo.dias\n arriendo2.experience = @arriendo.experience\n arriendo2.document = @arriendo.document\n arriendo2.save\n end\n\n end",
"def create\n @tipo_negocio = TipoNegocio.new(params[:tipo_negocio])\n\n respond_to do |format|\n if @tipo_negocio.save\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully created.' }\n format.json { render json: @tipo_negocio, status: :created, location: @tipo_negocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def socio_economico_submit\n\n # responding for the first time\n if not session[:current_response_id]\n current_response = nil\n # preparing the object to store the surveys and requests data\n json_response = { 'surveys' => [], 'requests' => [] }\n else\n current_response = FormResponse.find(session[:current_response_id])\n json_response = JSON.parse current_response.json_response\n end\n\n # appending the new response to the array of surveys\n surveys_number = json_response['surveys'].size\n json_response['surveys'] = [] if surveys_number == 0\n json_response['surveys'].push(\n params.merge({\n :attempt => (surveys_number + 1),\n :sent_at => Time.zone.now\n })\n )\n\n if current_response\n current_response.update({\n json_response: json_response.to_json\n })\n else\n # the response must be created only in this form\n # and not in the request form!\n current_response = FormResponse.create({\n form_id: Form.where(reference_model: 'FormVagasRemanescentes').first.id,\n user: current_user.email,\n json_response: json_response.to_json\n })\n\n # storing the response id in session to access it\n # from the other form, the request form\n session[:current_response_id] = current_response.id\n end\n\n redirect_to action: 'pedido'\n end",
"def create\n @grua = Grua.new(grua_params)\n @grua.dicc_mantenciones = @grua.set_dicc_mantenciones(@grua.tipo, @grua.horometro)\n\n if @grua.tipo == \"Eléctrica\"\n @grua.mantenciones = [6000, 2000, 1000, 250]\n elsif @grua.tipo == \"Gas\"\n @grua.mantenciones = [2800, 1400, 700, 350]\n elsif @grua.tipo == \"Apilador\"\n @grua.mantenciones = [2000, 1000, 500]\n else @grua.mantenciones = []\n end\n\n respond_to do |format|\n if @grua.save\n format.html { redirect_to @grua, notice: 'Grua creada exitosamente.' }\n format.json { render :show, status: :created, location: @grua }\n else\n format.html { render :new }\n format.json { render json: @grua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugestao = Sugestao.new(sugestao_params)\n\n respond_to do |format|\n if @sugestao.save\n format.html { redirect_to @sugestao, notice: 'Sugestão salva com sucesso.' }\n format.json { render :show, status: :created, location: @sugestao }\n else\n format.html { render :new }\n format.json { render json: @sugestao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_egresso\r\n @egresso = Egresso.find(params[:id])\r\n end",
"def create\n @movimentode_estoque = MovimentodeEstoque.new(movimentode_estoque_params)\n\n respond_to do |format|\n if @movimentode_estoque.save\n format.html { redirect_to @movimentode_estoque, notice: 'Movimentode estoque was successfully created.' }\n format.json { render :show, status: :created, location: @movimentode_estoque }\n else\n format.html { render :new }\n format.json { render json: @movimentode_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @atividades_extra = AtividadesExtra.new(atividades_extra_params)\n\n respond_to do |format|\n if @atividades_extra.save\n format.html { redirect_to @atividades_extra, notice: 'Atividades extra was successfully created.' }\n format.json { render :show, status: :created, location: @atividades_extra }\n else\n format.html { render :new }\n format.json { render json: @atividades_extra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def regra_negocio_params\n params.require(:regra_negocio).permit(:siglaRegra, :nomeRegra, :descricaoRegra)\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(tipo_pregunta_params)\n\n respond_to do |format|\n if @tipo_pregunta.save\n format.html { redirect_to @tipo_pregunta, notice: 'Tipo pregunta was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_tipo_pregunta_url(@tipo_pregunta) }\n else\n format.html { render :new }\n format.json { render json: @tipo_pregunta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao = Solicitacao.new(solicitacao_params)\n\n respond_to do |format|\n if @solicitacao.save\n @solicitacao.produto_solicitados.each do |item|\n i = Produto.find(item.produto_id)\n i.quantidade = i.quantidade - item.quantidade\n i.save\n end\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.new(params[:competency_pertenece_asignatura])\n\n respond_to do |format|\n if @competency_pertenece_asignatura.save\n format.html { redirect_to @competency_pertenece_asignatura, notice: 'Competency pertenece asignatura was successfully created.' }\n format.json { render json: @competency_pertenece_asignatura, status: :created, location: @competency_pertenece_asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency_pertenece_asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def egreso_params\n params.require(:egreso).permit(:estado, :monto, :fecha, :concepto)\n end",
"def create\n @pregunta_alternativa = PreguntaAlternativa.new(pregunta_alternativa_params)\n\n respond_to do |format|\n if @pregunta_alternativa.save\n format.html { redirect_to @pregunta_alternativa, notice: 'Pregunta la pregunta fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @pregunta_alternativa }\n else\n format.html { render :new }\n format.json { render json: @pregunta_alternativa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:propietario]\n @negocio_propio = Negocio.find(params[:negocio_id])\n @propietario = Usuario.find(params[:usuario_id])\n authorize! :update, @propietario\n if @propietario.negocios_propios << @negocio_propio\n render json: @propietario.negocios_propios, status: :created\n else\n render json: @propietario.negocios_propios.errors, status: :unprocessable_entity\n end\n else\n @negocio = Negocio.new(parametros_negocio)\n authorize! :create, Negocio\n if @negocio.save\n render json: @negocio, status: :created\n else\n render json: @negocio.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @aws_security_group_egress = AwsSecurityGroupEgress.new(aws_security_group_egress_params)\n\n respond_to do |format|\n if @aws_security_group_egress.save\n format.html { redirect_to @aws_security_group_egress, notice: 'Aws security group egress was successfully created.' }\n format.json { render :show, status: :created, location: @aws_security_group_egress }\n else\n format.html { render :new }\n format.json { render json: @aws_security_group_egress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gato = Gato.new(gato_params)\n\n respond_to do |format|\n if @gato.save\n format.html { redirect_to gatos_url, notice: 'Gato Creado.' }\n format.json { render :show, status: :created, location: @gato }\n else\n format.html { render :new }\n format.json { render json: @gato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prueba = Prueba.new(prueba_params)\n\n cantidadAlmacenada = @prueba.cantidad_almacenada\n cantidadDesechada = @prueba.cantidad_desechada\n\n @prueba.cantidad = cantidadAlmacenada + cantidadDesechada \n\n respond_to do |format|\n if @prueba.save\n\n @etiqueta = Etiqueta.new\n\n etiquetaAnalisis = @prueba.etiqueta.etiqueta\n idAnalisis = @prueba.id\n idAnalisisString = idAnalisis.to_s\n\n @etiqueta.etiqueta = etiquetaAnalisis + idAnalisisString + \"-\"\n @etiqueta.formato_id = 2\n @etiqueta.save\n\n format.html { redirect_to etiqueta_mostrar_path(@etiqueta.id), notice: 'Prueba was successfully created.' }\n format.json { render :show, status: :created, location: @prueba }\n else\n format.html { render :new }\n format.json { render json: @prueba.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @especie_id = params[:especie_id]\n\n if @especie_id.present? && @especie_id != '0'\n begin\n @especie = Especie.find(@especie_id)\n end\n else\n @especie = 0\n end\n\n @comentario = Comentario.new(comentario_params.merge(especie_id: @especie_id))\n tipo_proveedor = params[:tipo_proveedor]\n proveedor_id = params[:proveedor_id]\n params = comentario_params\n\n respond_to do |format|\n if params[:con_verificacion].present? && params[:con_verificacion] == '1'\n if (verify_recaptcha(:model => @comentario, :message => t('recaptcha.errors.missing_confirm')) && @comentario.save) || (!Rails.env.production? && @comentario.save)\n\n if params[:es_respuesta].present? && params[:es_respuesta] == '1'\n comentario_root = @comentario.root\n @comentario.completa_info(comentario_root.usuario_id)\n\n # Enviar a los responsables de contenido si es que el usuario siguio la charla\n EnviaCorreo.avisar_responsable_contenido(@comentario, dame_usuarios_envio).deliver\n\n format.json {render json: {estatus: 1, created_at: @comentario.created_at.strftime('%d/%m/%y-%H:%M'),\n nombre: @comentario.nombre}.to_json}\n else\n # Para guardar en la tabla comentarios proveedores\n if proveedor_id.present? && CategoriasContenido::REGISTROS_GEODATA.include?(tipo_proveedor)\n comentario_proveedor = ComentarioProveedor.new\n comentario_proveedor.comentario_id = @comentario.id\n comentario_proveedor.proveedor_id = proveedor_id\n comentario_proveedor.save\n end\n\n EnviaCorreo.confirmacion_comentario(@comentario).deliver\n\n # No SÓLO aquí es donde hay q poner el envio a los responsables de contenido (también allá arriba cuando un usuario responde)\n EnviaCorreo.avisar_responsable_contenido(@comentario, dame_usuarios_envio).deliver if dame_usuarios_envio.present?\n \n format.html { redirect_to especie_path(@especie_id), notice: '¡Gracias! Tu comentario fue enviado satisfactoriamente y lo podrás ver en la ficha una vez que pase la moderación pertinente.' }\n end\n\n else\n # Hubo un error al enviar el formulario\n if params[:es_respuesta].present? && params[:es_respuesta] == '1'\n format.json {render json: {estatus: 0}.to_json}\n else\n format.html { render action: 'new' }\n end\n\n end\n\n # Para evitar el google captcha a los usuarios administradores, la respuesta siempre es en json\n else\n if params[:es_admin].present? && params[:es_admin] == '1' && @comentario.save\n if @comentario.root.general # Si es comentario general\n envia_correo(@comentario)\n else # Si fue un comentario en la plataforma de administración de comentarios (IMPORTANTE!!)\n EnviaCorreo.respuesta_comentario(@comentario).deliver\n end\n if [email protected]\n nombre = usuario.nombre + usuario.apellido\n end\n created_at = @comentario.created_at.strftime('%d/%m/%y-%H:%M')\n format.json {render json: {estatus: 1, ancestry: \"#{@comentario.ancestry}/#{@comentario.id}\", nombre: nombre, created_at: created_at ||= '' }.to_json}\n else\n format.json {render json: {estatus: 0}.to_json}\n end\n\n end # end con_verificacion\n end # end tipo response\n end",
"def pregunta_alternativa_params\n params.require(:pregunta_alternativa).permit(:nombre, :pregunta, :respuesta1, :respuesta2, :respuesta3, :respuesta4, :verdadera, :explicacion)\n end",
"def estrada_params\n params.require(:estrada).permit(:descricao, :geom)\n end",
"def create\n @exercicio_serie = ExercicioSerie.new(exercicio_serie_params)\n\n respond_to do |format|\n if @exercicio_serie.save\n format.html { redirect_to @exercicio_serie, notice: 'O Exercício da Série foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @exercicio_serie }\n else\n format.html { render :new }\n format.json { render json: @exercicio_serie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def relatorio_params\r\n params.require(:relatorio).permit(:tipo, :quantidade_total, :quantidade_erros)\r\n end",
"def gato_params\n params.require(:gato).permit(:nombre, :edad, :formato_edad, :sexo, :raza, :tipo, :peso, :porte, :chip, :numero_chip, :agresividad, :color, :senas, :fecha_operacion, :comentario, :ficha_id, :propietario_es, :veterinario_id, :apto_cirujia, :apto_cirujia_text, :medico_tratante, :hora_ingreso, :tipo_cirujia, :hallazgos, :hora_alta, :complicaciones,vacunas_attributes:[:id,:nombre,:_destroy], enfermedades_attributes:[:id,:nombre,:_destroy],veterinario_atributes:[:id,:nombre,:_destroy],medicamentos_attributes:[:id,:nombre,:cantidad,:unidad,:cada,:durante,:durante_unidad,:_destroy])\n end",
"def create\n @groep = Groep.new(params[:groep])\n @lesgevers = Lesgever.order('name').all\n @dags = Dag.all\n @niveaus = Niveau.order('position').all\n respond_to do |format|\n if @groep.save\n format.html { redirect_to @groep, notice: 'Groep werd succesvol aangemaakt.' }\n format.json { render json: @groep, status: :created, location: @groep }\n else\n format.html { render action: \"new\" }\n format.json { render json: @groep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n @exam.patient = @patient\n\n if @exam.save\n render json: @exam, include: [:point_po, :point_or, :point_n, :point_a], methods: :maxillary_depth_angle, status: :created\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tipomaquinat = Tipomaquinat.new(tipomaquinat_params)\n #@tipomaquinat = Tipomaquinat.new\n #@tipomaquinat.id=401\n #@tipomaquinat.tipomaquina = \"KLK\" #params.require(:tipomaquinat).permit(:tipomaquina)\n #@tipomaquinat.descripcion = \"YOOOO\" #params.require(:tipomaquinat).permit(:descripcion)\n #descripcion\n\n # params.require(:tipomaquinat).permit(:tipomaquina, :descripcion,\n\n respond_to do |format|\n if @tipomaquinat.save\n format.html { redirect_to @tipomaquinat, notice: 'Tipomaquinat was successfully created.' }\n format.json { render :show, status: :created, location: @tipomaquinat }\n else\n format.html { render :new }\n format.json { render json: @tipomaquinat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pergunta = @topico.perguntas.new(pergunta_params)\n\n respond_to do |format|\n if @pergunta.save\n format.html { redirect_to set_path, notice: 'Pergunta criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @pergunta }\n else\n format.html { render action: 'new' }\n format.json { render json: @pergunta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @analisisregistro = Analisisregistro.new(analisisregistro_params)\n cantidadAlmacenada = @analisisregistro.cantidad_almacenada\n cantidadDesechada = @analisisregistro.cantidad_desechada\n\n @analisisregistro.cantidad = cantidadAlmacenada + cantidadDesechada \n\n @almacenado = Almacenado.new\n @almacenado.cantidad = cantidadAlmacenada\n @almacenado.save\n @desechado = Desechado.new\n @desechado.cantidad = cantidadDesechada \n @desechado.save \n\n respond_to do |format|\n\n if @analisisregistro.save\n \n\n @etiqueta = Etiqueta.new\n\n etiquetaAnalisis = @analisisregistro.etiqueta.etiqueta\n idAnalisis = @analisisregistro.id\n idAnalisisString = idAnalisis.to_s\n\n @etiqueta.etiqueta = etiquetaAnalisis + idAnalisisString + \"-\"\n @etiqueta.formato_id = 2\n @etiqueta.save\n\n format.html { redirect_to etiqueta_mostrar_path(@etiqueta.id), notice: 'Análisis registrado exitosamente.' }\n format.json { render :show, status: :created, location: @analisisregistro }\n else\n format.html { render :new }\n format.json { render json: @analisisregistro.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def movimentode_estoque_params\n params.require(:movimentode_estoque).permit(:data, :quantidade, :pessoa, :operacao, :produto)\n end",
"def create\n @movimentacao_de_estoque = MovimentacaoDeEstoque.new(params[:movimentacao_de_estoque])\n\n respond_to do |format|\n if @movimentacao_de_estoque.save\n format.html { redirect_to @movimentacao_de_estoque, notice: 'Movimentacao de estoque was successfully created.' }\n format.json { render json: @movimentacao_de_estoque, status: :created, location: @movimentacao_de_estoque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movimentacao_de_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @colegio = Colegio.new(params[:colegio])\n\n respond_to do |format|\n if @colegio.save\n format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' }\n format.json { render json: @colegio, status: :created, location: @colegio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def respuesta_params\n params.require(:respuesta).permit(:consulta_id, :pregunta_id, :valor)\n end",
"def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end",
"def add_question\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:quiz_id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:quiz_id])\n\t\t\t\tno = quiz.no_of_MCQ + quiz.no_of_rearrangeQ\t\n\t\t\t\tno.times do |n|\n\t\t\t\t\tquestion = Question.create((params[\"_json\"][n]).permit([:text, :mark, :right_answer, :choices => []]))\n\t\t\t\t\tquiz.questions << question\n\t\t\t\tend\n\t\t\t\trender json: { info: \"created\"}, status: 201\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def create\n @nota_progreso = NotaProgreso.new(nota_progreso_params)\n \n @nota_progreso.historia_clinica_id = @historia_clinica.id\n\n\n\n\n respond_to do |format|\n if @nota_progreso.save\n format.html { redirect_to paciente_historia_clinica_nota_progreso_path(@paciente, @historia_clinica, @nota_progreso), notice: 'Nota de Evolución creada Satisfactoriamente.' }\n\n format.json { render :show, status: :created, location: @nota_progreso }\n else\n format.html { render :new }\n format.json { render json: @nota_progreso.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n\t flash[:scale_alert] = nil;\n @ind = 0\n for i in 0..($array_escalas.size-1)\n @escala = Escala.new($array_escalas[@ind])\n @escala.numero_sequencia = 1\n #@escala.profissional_responsavel_id = $responsavel\n @escala.tipo_acao_id = TipoAcao.where(\"descricao = ?\",\"Inclusão\").first.id\n if @escala.save\n \t#Cria entradas da tabela agendamento para cada escala\n \tminutos = @escala.horario_fim_execucao - @escala.horario_inicio_execucao #em segundos\n \tminutos = minutos / 60\n \tintervalo = minutos / @escala.numero_atendimentos\n \tfor j in 0..(@escala.numero_atendimentos-1)\n \t\t@agendamento = Agendamento.new\n \t\[email protected]_id = @escala.orgao_id\n \t\[email protected]_id = @escala.id\n @agendamento.tipo_situacao_id = TipoSituacao.where(\"descricao = ?\", \"Vago\").first.id\n\n \t\[email protected]_inicio_consulta = @escala.horario_inicio_execucao + (j*intervalo*60)\n \t\tfim_consulta = j + 1\n \t\[email protected]_fim_consulta = @escala.horario_inicio_execucao + (fim_consulta*intervalo*60)\n \t\[email protected]\n \tend\n $array_escalas.delete_at(@ind)\n\t\telse\n\t\t\t@ind = @ind + 1\n\t\tend\n\tend\n\t\tif $array_escalas.size == 0\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html { redirect_to escalas_url, notice: \"Escala(s) criada(s) com sucesso\" }\n\t\t\t\t\tformat.json { render json: @escala, status: :created, location: @escala}\n\t\t\t\t\tend\n \telse\n flash[:scale_alert] = \"Uma ou mais escala(s) possuem conflito de horário com uma escala já criada.\"\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to new_escala_path}\n\t\t\t\tformat.json { render json: @escala.errors, status: unprocessable_entity }\n\t\t\tend\n \tend\n end",
"def add_specific\n\t\t@empresa = getMyEnterpriseAPP\n\t\tpadre = GovernanceDecision.find(params[:id_padre].to_i)\n\t\t# ES: Parametros para construir la decision:\n\t\t# EN: Parameters to build a new decisions:\n\t\tdesc = params[:description]\n\t\tdim = padre.dimension\n\t\t# ES: Crea la decision:\n\t\t# EN: Creates the decision:\n\t\tdecSpe = GovernanceDecision.new\n\t\tdecSpe.description = desc\n\t\tdecSpe.dimension = padre.dimension\n\t\tdecSpe.decision_type = SPECIFIC_TYPE\n\t\tdecSpe.parent_id = padre.id\n\t\tdecSpe.enterprise_id = @empresa.id\n\n\t\trespond_to do |format|\n\t\t\tif decSpe.save\n\t\t\t\t# OK\n\t\t\t\tformat.json {render json: decSpe}\n\t\t\telse\n\t\t\t\t# ES: No se pudo guardar\n\t\t\t\t# EN: Couldn't save\n\t\t\t\tformat.json {render json: 'ERROR'}\n\t\t\tend\n\t\t\t\n end\n\tend",
"def create\n @relatorio_pedagogicos = RelatorioPedagogico.all\n authorize @relatorio_pedagogicos\n\n @relatorio_pedagogico = RelatorioPedagogico.new(relatorio_pedagogico_params)\n\n respond_to do |format|\n if @relatorio_pedagogico.save\n format.html { redirect_to @relatorio_pedagogico, notice: 'Relatório pedagógico criado com sucesso!' }\n format.json { render :show, status: :created, location: @relatorio_pedagogico }\n else\n format.html { render :new }\n format.json { render json: @relatorio_pedagogico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @questao = Questao.new(questao_params)\n\n respond_to do |format|\n if @questao.save\n format.html { redirect_to @questao, notice: 'Questao was successfully created.' }\n format.json { render :show, status: :created, location: @questao }\n else\n format.html { render :new }\n format.json { render json: @questao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @soatseguro = Soatseguro.new(soatseguro_params)\n\n respond_to do |format|\n if @soatseguro.save\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully created.' }\n format.json { render :show, status: :created, location: @soatseguro }\n else\n format.html { render :new }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @atividade_extra = AtividadeExtra.new(atividade_extra_params)\n respond_to do |format|\n if @atividade_extra.save\n format.html { redirect_to @atividade_extra, notice: 'Atividade criada com sucesso.' }\n format.json { render :show, status: :created, location: @atividade_extra }\n else\n format.html { render :new }\n format.json { render json: @atividade_extra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ponte_params\n params.require(:ponte).permit(:descricao, :geom)\n end",
"def create\n @gastos_balanceado = GastosBalanceado.new(gastos_balanceado_params)\n\n respond_to do |format|\n if @gastos_balanceado.save\n format.html { redirect_to @gastos_balanceado, notice: 'Gastos balanceado was successfully created.' }\n format.json { render :show, status: :created, location: @gastos_balanceado }\n else\n format.html { render :new }\n format.json { render json: @gastos_balanceado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estoque = Estoque.new(params[:estoque])\n\n respond_to do |format|\n if @estoque.save\n format.html { redirect_to @estoque, notice: 'Estoque was successfully created.' }\n format.json { render json: @estoque, status: :created, location: @estoque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def progreso_params\n params.require(:progreso).permit(:repeticion_completada, :estudiante_id, :leccion_id)\n end",
"def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @basico = Basico.new(basico_params)\n @basico.nombre_producto = @basico.nombre_producto.strip.downcase\n\n respond_to do |format|\n # ANADIR INGREDIENTES\n ingredientes = Array.new\n if !params[:basico][:ingredientes].nil?\n params[:basico][:ingredientes].each do | ingrediente |\n ingredientes.push(:id => ingrediente['id'], :cantidad => ingrediente['cantidad'])\n end\n end\n\n i = 0\n @basico.ingredientes = Array.new\n @basico.detalles_basicos = Array.new\n #@compuesto.composicion = Array.new\n\n ingredientes.each do | ingrediente |\n ingrediente_nuevo = Ingrediente.find(ingrediente[:id])\n @basico.ingredientes.push ingrediente_nuevo\n @basico.detalles_basicos[i].cantidad = ingrediente[:cantidad]\n i = i + 1\n end \n\n # / ANADIR INGREDIENTES\n\n if @basico.ingredientes.any?\n tiene_ingredientes = true\n else\n tiene_ingredientes = false\n @basico.errors.add :general, \"Debe agregar a lo menos un ingrediente.\"\n end\n\n if tiene_ingredientes and @basico.save\n format.html { redirect_to @basico, notice: 'Producto creado correctamente.' }\n format.json { render :show, status: :created, location: @basico }\n else\n format.html { render :new }\n format.json { render json: @basico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tipos = Tipo.all\n @ingrediente = Ingrediente.new(ingrediente_params)\n if @ingrediente.save\n flash[:success] = \"Ingrediente agregado exitosamente \"\n redirect_to ingrediente_path(@ingrediente)\n else\n render 'new'\n end\n end",
"def create\n @tecnica_de_impresion = TecnicaDeImpresion.new(tecnica_de_impresion_params)\n\n respond_to do |format|\n if @tecnica_de_impresion.save\n format.html { redirect_to @tecnica_de_impresion, notice: 'Tecnica de impresion was successfully created.' }\n format.json { render :show, status: :created, location: @tecnica_de_impresion }\n else\n format.html { render :new }\n format.json { render json: @tecnica_de_impresion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def questao_params\n params.require(:questao).permit(:descricao)\n end",
"def create\n @anteproyecto_estudiante = AnteproyectoEstudiante.new(anteproyecto_estudiante_params)\n\n respond_to do |format|\n if @anteproyecto_estudiante.save\n format.html { redirect_to @anteproyecto_estudiante, notice: 'Anteproyecto estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @anteproyecto_estudiante }\n else\n format.html { render :new }\n format.json { render json: @anteproyecto_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @regraponto = Regraponto.new(regraponto_params)\n\n respond_to do |format|\n if @regraponto.save\n format.html { redirect_to @regraponto, notice: 'Regraponto was successfully created.' }\n format.json { render :show, status: :created, location: @regraponto }\n else\n format.html { render :new }\n format.json { render json: @regraponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def problema_params\n params.require(:problema).permit(:descricao, :resposta, :status, :relator)\n end",
"def create\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @galeria_prep_mate = @producto.galeria_prep_mates.new(galeria_prep_mate_params)\n\n respond_to do |format|\n if @galeria_prep_mate.save\n format.html { redirect_to empresa_producto_galeria_prep_mates_path, notice: 'Galeria prep mate was successfully created.' }\n format.json { render :show, status: :created, location: @galeria_prep_mate }\n else\n format.html { render :new }\n format.json { render json: @galeria_prep_mate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def relatorio_params\n params.require(:relatorio).permit(:relatorio_data, :aluno_id, :funcionario_id)\n end",
"def create\n @grupoassunto = Grupoassunto.new(grupoassunto_params)\n\n if @grupoassunto.save\n render json: @grupoassunto, status: :created, location: @grupoassunto\n else\n render json: @grupoassunto.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @solicitacao.produto_solicitados.each do |item|\n i = Produto.find(item.produto_id)\n i.quantidade = i.quantidade + item.quantidade\n i.save\n end\n @solicitacao.destroy\n respond_to do |format|\n format.html { redirect_to solicitacoes_url }\n format.json { head :no_content }\n end\n end",
"def create\n @add_question = AddQuestion.new(add_question_params)\n\n respond_to do |format|\n if @add_question.save\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def detalle_gasto_params\n params.require(:detalle_gasto).permit(:titulo, :descripcion, :monto, :concepto_gasto_id, :informe_gastos_id, :voluntario_id, :comprobante_id)\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to @quiz, notice: \"Quiz was successfully created.\" }\n format.json { render :show, status: :created, location: @quiz }\n\t\tmy_array = []\n\t\tmy_array << @quiz.option1\n\t\tmy_array << @quiz.option2\n\t\tmy_array << @quiz.option3\n\t\tmy_array << @quiz.option4\n\t\t\n\t\tcorrect_respo = my_array[@quiz.correct_response.to_i - 1]\n\t\[email protected]_response_text = correct_respo\n\t\[email protected]\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gatineo = Gatineo.new(gatineo_params)\n\n respond_to do |format|\n if @gatineo.save\n format.html { redirect_to @gatineo, notice: 'Gatineo criado com sucesso!' }\n format.json { render :show, status: :created, location: @gatineo }\n else\n format.html { render :new }\n format.json { render json: @gatineo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iprannet_qosegressinterface = IprannetQosegressinterface.new(iprannet_qosegressinterface_params)\n\n respond_to do |format|\n if @iprannet_qosegressinterface.save\n format.html { redirect_to @iprannet_qosegressinterface, notice: 'Iprannet qosegressinterface was successfully created.' }\n format.json { render :show, status: :created, location: @iprannet_qosegressinterface }\n else\n format.html { render :new }\n format.json { render json: @iprannet_qosegressinterface.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.find(params[:quiz_id])\n @question = Question.new(question_params) \n #respond_to do |format|\n if @question.save\n link_quiz_question(@quiz, @question)\n #format.json { render :show, status: :created, location: @question }\n else\n redirect_to quizzes_path\n flash[:notice] = 'Falha em criar pergunta'\n #format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n #end\n end",
"def create\n @pasteurizacion = Pasteurizacion.new(pasteurizacion_params)\n\n cantidadAlmacenada = @pasteurizacion.cantidad_almacenada\n cantidadDesechada = @pasteurizacion.cantidad_desechada\n\n @pasteurizacion.cantidad = cantidadAlmacenada + cantidadDesechada\n\n @almacenado = Almacenado.new\n @almacenado.cantidad = cantidadAlmacenada\n @almacenado.save\n @desechado = Desechado.new\n @desechado.cantidad = cantidadDesechada \n @desechado.save \n\n respond_to do |format|\n if @pasteurizacion.save\n\n @etiqueta = Etiqueta.new\n\n etiquetaPasteurizacion = @pasteurizacion.etiqueta.etiqueta\n idPasteurizacion = @pasteurizacion.id\n idPasteurizacionString = idPasteurizacion.to_s\n\n @etiqueta.etiqueta = etiquetaPasteurizacion + idPasteurizacionString + \"-\"\n @etiqueta.formato_id = 3\n @etiqueta.save\n\n format.html { redirect_to etiqueta_mostrar_path(@etiqueta.id), notice: 'Pasteurización registrada exitosamente.' }\n end\n end\n end",
"def evaluacion_params\n params.require(:evaluacion).permit(:pregunta_1, :pregunta_2, :pregunta_3, :pregunta_4, :pregunta_5, :pregunta_6, :pregunta_7, :pregunta_8, :observacion, :fecha_evaluacion, :nota, :nota_informe_practica)\n end",
"def create\n @tipos_encuestum = TiposEncuestum.new(tipos_encuestum_params)\n\n respond_to do |format|\n if @tipos_encuestum.save\n format.html { redirect_to @tipos_encuestum, notice: 'Tipos encuestum was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_encuestum }\n else\n format.html { render :new }\n format.json { render json: @tipos_encuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gpsquest = Gpsquest.new(gpsquest_params)\n\n respond_to do |format|\n if @gpsquest.save\n format.html { redirect_to @gpsquest, notice: 'Gpsquest was successfully created.' }\n format.json { render :show, status: :created, location: @gpsquest }\n else\n format.html { render :new }\n format.json { render json: @gpsquest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\n end",
"def create\n cliente_id = params[:venda][:cliente_id]\n desconto = params[:venda][:desconto].to_f\n opcao_pgt = params[:opcaoPgt]\n @venda = Venda.new\n\n cont = 0\n erros = false\n if !params[:venda][:produto_id].nil?\n for produto in params[:venda][:produto_id]\n produto_existente = Produto.find(produto)\n preco_unitario = produto_existente.precoUnitario\n qtd = params[:venda][:quantidade][cont].to_i\n valor_venda = qtd * preco_unitario\n valor_venda *= (1 - (desconto/100))\n valor_venda = valor_venda.round(2)\n\n if opcao_pgt != \"Dinheiro\"\n num_cartao = params[:venda][:num_cartao]\n validade_cartao = params[:venda][:valid_cartao]\n codigo_cartao = params[:venda][:cvv_cartao]\n venda = Venda.new(cliente_id: cliente_id, produto_id: produto, quantidade: qtd, valorVenda: valor_venda, tipo_pgt: opcao_pgt,\n desconto: desconto, num_cartao: num_cartao, validade_cartao: validade_cartao, codigo_cartao: codigo_cartao)\n else\n venda = Venda.new(cliente_id: cliente_id, produto_id: produto, quantidade: qtd, valorVenda: valor_venda,\n tipo_pgt: opcao_pgt, desconto: desconto)\n end\n\n if !venda.save\n erros = true\n for msg in venda.errors.full_messages\n @venda.errors.add(:base, msg)\n end\n else\n produto_existente.qtd_estoque -= qtd\n produto_existente.save\n end\n cont+= 1\n end\n\n respond_to do |format|\n if erros\n format.html { render :new }\n else\n format.html { redirect_to lojas_url, notice: 'Venda realizada com sucesso!' }\n end\n end\n else\n respond_to do |format|\n format.html { render :new }\n end\n end\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def create\n @tipo_exame = TipoExame.new(tipo_exame_params)\n\n respond_to do |format|\n if @tipo_exame.save\n format.html { redirect_to @tipo_exame, notice: 'Tipo exame was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_exame }\n else\n format.html { render :new }\n format.json { render json: @tipo_exame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_answer = TipoAnswer.new(tipo_answer_params)\n\n respond_to do |format|\n if @tipo_answer.save\n format.html { redirect_to @tipo_answer, notice: 'Tipo answer was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_answer }\n else\n format.html { render :new }\n format.json { render json: @tipo_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fonte_de_recurso = FonteDeRecurso.new(fonte_de_recurso_params)\n\n respond_to do |format|\n if @fonte_de_recurso.save\n addlog(\"Fonte e recurso criada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso criado com sucesso.' }\n format.json { render :show, status: :created, location: @fonte_de_recurso }\n else\n format.html { render :new }\n format.json { render json: @fonte_de_recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n puts evaluation_params\n @evaluation = Evaluation.new(evaluation_params)\n #De aca en adelante es para lograr insertar datos en la tabla intermedia \n #La Tabla intermedia se la evaluation_question\n respond_to do |format|\n puts \"Entre al respond\"\n if @evaluation.save\n puts \"Pude guardarlo\"\n evaluation = Evaluation.last\n evaluation.update(course_id: params[:course_id])\n evaluation_id = evaluation.id\n question_ids = params[:questions]\n question_ids.each do |question_id|\n EvaluationQuestion.create(question_id: question_id, evaluation_id: evaluation_id)\n end\n format.html { redirect_to @evaluation, notice: 'La evaluación fue creada con éxito' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n @question = Question.all\n @courses = Course.all\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gestacao = Gestacao.new(gestacao_params)\n\n respond_to do |format|\n if @gestacao.save\n format.html { redirect_to @gestacao, notice: 'Gestacao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gestacao }\n else\n format.html { render action: 'new' }\n format.json { render json: @gestacao.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6672659",
"0.6631674",
"0.6585595",
"0.62861395",
"0.6275319",
"0.5895884",
"0.58818436",
"0.58555984",
"0.5719281",
"0.5683607",
"0.56761897",
"0.56534475",
"0.56318355",
"0.5619606",
"0.5601388",
"0.5597034",
"0.55484337",
"0.5533738",
"0.5531236",
"0.5488991",
"0.54248834",
"0.5389283",
"0.5381633",
"0.53811514",
"0.5360021",
"0.5329087",
"0.53163946",
"0.53064007",
"0.53052944",
"0.5294388",
"0.5286332",
"0.52583283",
"0.5257149",
"0.52442783",
"0.5242175",
"0.5237391",
"0.5235341",
"0.5223884",
"0.52217144",
"0.52141505",
"0.52136576",
"0.5204647",
"0.51957077",
"0.5191923",
"0.518517",
"0.51840085",
"0.5180178",
"0.5176733",
"0.51763177",
"0.51757145",
"0.51741314",
"0.5173923",
"0.51715446",
"0.5164693",
"0.51628596",
"0.5157552",
"0.5156002",
"0.5153459",
"0.5148256",
"0.51335996",
"0.5124062",
"0.5122969",
"0.512058",
"0.51106143",
"0.5106588",
"0.51052165",
"0.51048744",
"0.51048386",
"0.5101036",
"0.5100515",
"0.50950617",
"0.50903296",
"0.5087254",
"0.5085306",
"0.50850964",
"0.50828874",
"0.50738215",
"0.5071103",
"0.5070986",
"0.5070856",
"0.50699306",
"0.50677055",
"0.50616556",
"0.5060489",
"0.5060308",
"0.505739",
"0.5056175",
"0.50555307",
"0.5051888",
"0.5051198",
"0.504624",
"0.5043541",
"0.50415397",
"0.5040586",
"0.50394213",
"0.503712",
"0.50361145",
"0.50352705",
"0.503458",
"0.503438"
] |
0.77029645
|
0
|
PATCH/PUT /questionario_egressos/1 PATCH/PUT /questionario_egressos/1.json
|
def update
respond_to do |format|
if @questionario_egresso.update(questionario_egresso_params)
format.html { redirect_to home_path, notice: 'Questionario preenchido com sucesso.' }
format.json { render :show, status: :ok, location: questionario_egressos_path }
else
format.html { render :edit }
format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'La pregunta fue modificada correctamente.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionario_resposta.update(questionario_resposta_params)\n format.html { redirect_to @questionario_resposta, notice: 'Questionario resposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionario_resposta }\n else\n format.html { render :edit }\n format.json { render json: @questionario_resposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n respond_to do |format|\n if @questao.update(questao_params)\n format.html { redirect_to @questao, notice: 'Questao was successfully updated.' }\n format.json { render :show, status: :ok, location: @questao }\n else\n format.html { render :edit }\n format.json { render json: @questao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def set_questionario_egresso\n @questionario_egresso = QuestionarioEgresso.find(params[:id])\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n @egresso.skip_fields_validation = false\r\n if @egresso.update(egresso_params)\r\n if current_admin.try(:adm?)\r\n format.html { redirect_to egressos_path, notice: 'Egresso atualizado com sucesso.' }\r\n format.json { render :show, status: :ok, location: egressos_path }\r\n else\r\n format.html { redirect_to :back, notice: 'Dados atualizados com sucesso.' }\r\n format.json { render :show, status: :ok, location: :back }\r\n end\r\n\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @egresso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vas_question.update(vas_question_params)\n format.html { redirect_to @vas_question, notice: 'Vas question was successfully updated.' }\n format.json { render :show, status: :ok, location: @vas_question }\n else\n format.html { render :edit }\n format.json { render json: @vas_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @regra_negocio.update(regra_negocio_params)\n format.html { redirect_to @regra_negocio, notice: 'Regra negocio was successfully updated.' }\n format.json { render :show, status: :ok, location: @regra_negocio }\n else\n format.html { render :edit }\n format.json { render json: @regra_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 @negocio.update(negocio_params)\n format.html { redirect_to @negocio, notice: 'Negocio was successfully updated.' }\n format.json { render :show, status: :ok, location:@negocio}\n else\n format.html { render :edit }\n format.json { render json: @negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @poll.type_poll_id = params[:type_poll_id]\n respond_to do |format|\n\n if @poll.update(descripcion: poll_params[:descripcion], type_poll_id: params[:type_poll_id])\n @questions= params[:questions]\n if (@questions)\n @question_polls = QuestionPoll.where(poll_id: @poll.id)\n @question_polls.each do |question_poll|\n question_poll.destroy\n end\n @questions.each do |question_id|\n QuestionPoll.create(poll_id: @poll.id, question_id: question_id)\n end\n else\n @collections = Collection.all\n format.html { render '/postulates/chequeo', notice: 'Debe seleccionar por lo menos un recaudo' }\n end\n format.html { redirect_to '/polls' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n\n end\n\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to edit_question_path(@question), notice: 'Question was successfully updated.' }\n format.json\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, :notice =>'Question was successfully updated.' }\n format.json { render :show, :status => :ok, :location => @question }\n else\n format.html { render :edit }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quimicos_serigrafia_producto.update(quimicos_serigrafia_producto_params)\n format.html { redirect_to @quimicos_serigrafia_producto, notice: 'Quimicos serigrafia producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @quimicos_serigrafia_producto }\n else\n format.html { render :edit }\n format.json { render json: @quimicos_serigrafia_producto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n format.js { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n format.js { head :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"Question was successfully updated.\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_question.update(add_question_params)\n format.html { redirect_to @add_question, notice: 'Add question was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_question }\n else\n format.html { render :edit }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n respond_to do |format|\n if @argumentative_question.update(argumentative_question_params)\n format.html { redirect_to argumentative_questions_path, notice: 'Pregunta actualizada.' }\n format.json { render :show, status: :ok, location: @argumentative_question }\n else\n format.html { render :edit }\n format.json { render json: @argumentative_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n if @comentario.update_attributes(params[:comentario])\n format.html do \n redirect_to pregunta_url(@pid, :anchor => \"comentario-#{@comentario.id}\")\n end\n format.json { head :no_content }\n else\n format.html do\n @editing_comentario = true\n @pregunta = Pregunta.find(@pid)\n render template: \"preguntas/show\" \n end\n format.json { render json: @comentario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question_option.update(question_option_params)\n format.html { redirect_to @question_option, notice: 'Question option was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_option }\n else\n format.html { render :edit }\n format.json { render json: @question_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @b_question.update(b_question_params)\n format.html { redirect_to @b_question }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @b_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingresso.update(ingresso_params)\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingresso }\n else\n format.html { render :edit }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @giro_comercial.update(giro_comercial_params)\n format.html { redirect_to @giro_comercial, notice: 'Giro comercial fue exitosamente editado.' }\n format.json { render :show, status: :ok, location: @giro_comercial }\n else\n format.html { render :edit }\n format.json { render json: @giro_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_answer.update(tipo_answer_params)\n format.html { redirect_to @tipo_answer, notice: 'Tipo answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_answer }\n else\n format.html { render :edit }\n format.json { render json: @tipo_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to [@category, @question], notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_pregunta.update(tipo_pregunta_params)\n format.html { redirect_to @tipo_pregunta, notice: 'Tipo pregunta was successfully updated.' }\n format.json { render :show, status: :ok, location: api_v1_tipo_pregunta_url(@tipo_pregunta) }\n else\n format.html { render :edit }\n format.json { render json: @tipo_pregunta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to \"/\"\n\n # respond_to do |format|\n # if @question.update(question_params)\n # format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n # format.json { render :show, status: :ok, location: @question }\n # else\n # format.html { render :edit }\n # format.json { render json: @question.errors, status: :bad_request }\n # end\n # end\n end",
"def update\n # before_action :set_question\n #before_action :set_tag\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"更新しました\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @nota_progreso.update(nota_progreso_params)\n format.html { redirect_to paciente_historia_clinica_nota_progreso_path(@paciente, @historia_clinica, @nota_progreso), notice: 'Nota de Evolución actualizada Satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @nota_progreso }\n else\n format.html { render :edit }\n format.json { render json: @nota_progreso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def update\n respond_to do |format|\n if @proyecto_minero_exam.update(proyecto_minero_exam_params)\n format.html { redirect_to @proyecto_minero_exam, notice: 'Proyecto minero exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto_minero_exam }\n else\n format.html { render :edit }\n format.json { render json: @proyecto_minero_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @congresso.update(congresso_params)\n format.html { redirect_to @congresso, notice: 'Congresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @congresso }\n else\n format.html { render :edit }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n check_delete_flg\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @nota_tecnica.update(nota_tecnica_params)\n format.html { redirect_to @nota_tecnica, notice: 'Nota tecnica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nota_tecnica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if @questions_option.update_attributes(params[:questions_option])\n format.html { redirect_to @questions_option, notice: 'Questions option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questions_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipomaquinat.update(tipomaquinat_params)\n format.html { redirect_to @tipomaquinat, notice: 'Tipomaquinat was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipomaquinat }\n else\n format.html { render :edit }\n format.json { render json: @tipomaquinat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoveiculo.update(tipoveiculo_params)\n format.html { redirect_to @tipoveiculo, notice: 'Tipoveiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @problema.update(problema_params)\n format.html { redirect_to consulta_problema_path(@consulta), notice: 'Problema Actualizado' }\n format.json { render :show, status: :ok, location: @problema }\n else\n format.html { render :edit }\n format.json { render json: @problema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.64545584",
"0.64470184",
"0.6330834",
"0.6323789",
"0.6323135",
"0.62889564",
"0.62721944",
"0.62679297",
"0.6263592",
"0.6261784",
"0.6251707",
"0.6236323",
"0.62331885",
"0.62237036",
"0.62147707",
"0.6133462",
"0.6123554",
"0.6123554",
"0.6123554",
"0.6114019",
"0.60708654",
"0.60530025",
"0.60309213",
"0.603072",
"0.60253966",
"0.60236317",
"0.6011591",
"0.6011591",
"0.5997107",
"0.5993857",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.5983728",
"0.59799594",
"0.59798265",
"0.59784496",
"0.5973779",
"0.5972314",
"0.5972119",
"0.5969337",
"0.59680414",
"0.59645784",
"0.5963565",
"0.5963565",
"0.5963565",
"0.5963565",
"0.5963565",
"0.5962275",
"0.5955946",
"0.59503317",
"0.5949632",
"0.59492046",
"0.59434265",
"0.5933246",
"0.5932128",
"0.5930626",
"0.59261376",
"0.59239465",
"0.5919063",
"0.5916362",
"0.5915861",
"0.59108216",
"0.59104073",
"0.59092885",
"0.5908433",
"0.59004915",
"0.5897218",
"0.589667",
"0.5896344",
"0.58941674",
"0.5894079",
"0.5893914",
"0.58935565",
"0.58922637",
"0.588458",
"0.5881049",
"0.58809066",
"0.58798474",
"0.58771044",
"0.5870287",
"0.58691174",
"0.58663136",
"0.5864836",
"0.58590436",
"0.5857764"
] |
0.7440442
|
0
|
DELETE /questionario_egressos/1 DELETE /questionario_egressos/1.json
|
def destroy
@questionario_egresso.destroy
respond_to do |format|
format.html { redirect_to questionario_egressos_path(@questionario_egresso, egresso_id: @questionario_egresso.egresso_id), notice: 'Questionario excluído com sucesso.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La pregunta ha sido eliminada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionario_resposta.destroy\n respond_to do |format|\n format.html { redirect_to questionarios_respostas_url, notice: 'Questionario resposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questao.destroy\n respond_to do |format|\n format.html { redirect_to questaos_url, notice: 'Questao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_negocio = TipoNegocio.find(params[:id])\n @tipo_negocio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_negocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @argumentative_question.destroy\n respond_to do |format|\n format.html { redirect_to argumentative_questions_url, notice: 'Pregunta eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_quest_items_url, notice: 'Всё норм' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estoque = Estoque.find(params[:id])\n @estoque.destroy\n\n respond_to do |format|\n format.html { redirect_to estoques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def destroy\n @api_v1_question.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @giro_comercial.destroy\n respond_to do |format|\n format.html { redirect_to giro_comercials_url, notice: 'Giro comercial fue exitosamente destruido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movimentacao_de_estoque = MovimentacaoDeEstoque.find(params[:id])\n @movimentacao_de_estoque.destroy\n\n respond_to do |format|\n format.html { redirect_to movimentacao_de_estoques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }\n format.json { head :no_content }\n \nend\n end",
"def destroy\n @tipo_pregunta = TipoPregunta.find(params[:id])\n @tipo_pregunta.destroy\n\n head :no_content\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quimicos_serigrafia_producto.destroy\n respond_to do |format|\n format.html { redirect_to quimicos_serigrafia_productos_url, notice: 'Quimicos serigrafia producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pregunta_alternativa.destroy\n respond_to do |format|\n format.html { redirect_to pregunta_alternativas_url, notice: 'Pregunta la pregunta fue destruida exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to(questoes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comentariox = Comentariox.find(params[:id])\n @comentariox.destroy\n\n respond_to do |format|\n format.html { redirect_to comentarioxes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comentario_egresado.destroy\n respond_to do |format|\n format.html { redirect_to comentario_egresados_url, notice: 'Comentario egresado was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n @competency_pertenece_asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to competency_pertenece_asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apoio_educacioanl.destroy\n respond_to do |format|\n format.html { redirect_to apoio_educacioanls_url, notice: 'Apoio educacioanal foi excluído com Sucesso !' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyecto_minero_exam.destroy\n respond_to do |format|\n format.html { redirect_to proyecto_minero_exams_url, notice: 'Proyecto minero exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario_cosa.destroy\n respond_to do |format|\n format.html { redirect_to inventario_cosas_url, notice: 'Inventario cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_answer.destroy\n respond_to do |format|\n format.html { redirect_to tipo_answers_url, notice: 'Tipo answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etiquetum.destroy\n respond_to do |format|\n format.html { redirect_to etiqueta_url, notice: 'Etiqueta borrada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @problema.destroy\n respond_to do |format|\n format.html { redirect_to consulta_problemas_path(@consulta), notice: 'Problema eliminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingresso.destroy\n respond_to do |format|\n format.html { redirect_to ingressos_url, notice: 'Ingresso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @preguntum = Preguntum.find(params[:id])\n @preguntum.destroy\n\n respond_to do |format|\n format.html { redirect_to pregunta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end",
"def destroy\n @requerimiento = Requerimiento.find(params[:id])\n @requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to requerimientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n #na real, cada question pertence a um quiz, basta achar a question de mesma id\n @qq = QuizQuestion.where(question: @question)\n @qq.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно удалена' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ejercicio = Ejercicio.find(params[:id])\n @ejercicio.destroy\n\n respond_to do |format|\n format.html { redirect_to ejercicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ejercicio.destroy\n respond_to do |format|\n format.html { redirect_to ejercicios_url, notice: 'Ejercicio eliminado con exito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_agressor.destroy\n respond_to do |format|\n format.html { redirect_to tipo_agressores_url, notice: @@msgs }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requiero.destroy\n respond_to do |format|\n format.html { redirect_to requieros_url, notice: 'Requiero was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gato.destroy\n respond_to do |format|\n format.html { redirect_to gatos_url, notice: 'Gato eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_imposto.destroy\n respond_to do |format|\n format.html { redirect_to @empresa, notice: 'Tipo de imposto removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignarmultiplebeneficio.destroy\n respond_to do |format|\n format.html { redirect_to asignarmultiplebeneficios_url, notice: 'Asignarmultiplebeneficio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignarmultiplebeneficio.destroy\n respond_to do |format|\n format.html { redirect_to asignarmultiplebeneficios_url, notice: 'Asignarmultiplebeneficio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gatineo.destroy\n respond_to do |format|\n format.html { redirect_to gatineos_url, notice: 'Gatineo apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end",
"def destroy\n @example.destroy\n respond_to do |format|\n format.html { redirect_to examples_url, notice: 'Operação realizada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionpri.destroy\n respond_to do |format|\n format.html { redirect_to questionpris_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to_path = topico_perguntas_path(@pergunta.topico)\n @pergunta.destroy\n respond_to do |format|\n format.html { redirect_to set_path, notice: \"Pergunta deletada com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercicio_serie.destroy\n respond_to do |format|\n format.html { redirect_to exercicio_series_url, notice: 'O Exercício da Série foi destruído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ejemplo.destroy\n respond_to do |format|\n format.html { redirect_to ejemplos_url, notice: 'Ejemplo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anteproyecto_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_estudiantes_url, notice: 'Anteproyecto estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey.destroy\n respond_to do |format|\n format.html { redirect_to surveys_url, notice: \"Le questionnaire vient d'être détruit.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atividades_extra.destroy\n respond_to do |format|\n format.html { redirect_to atividades_extras_url, notice: 'Atividades extra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end",
"def 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"
] |
[
"0.7280255",
"0.7244226",
"0.7179036",
"0.71341497",
"0.71156216",
"0.7115618",
"0.7104042",
"0.7083343",
"0.7072378",
"0.7054231",
"0.7048593",
"0.7025022",
"0.7012467",
"0.7005945",
"0.69730175",
"0.6954191",
"0.69532424",
"0.694578",
"0.693468",
"0.69107544",
"0.69080573",
"0.6906128",
"0.6905771",
"0.6902832",
"0.68981785",
"0.68826956",
"0.68821424",
"0.6880597",
"0.6875999",
"0.687185",
"0.6870869",
"0.68693686",
"0.68693686",
"0.6866685",
"0.6856823",
"0.6856158",
"0.6853205",
"0.68503696",
"0.68503696",
"0.68484306",
"0.6848147",
"0.68473816",
"0.68471",
"0.6846997",
"0.6846997",
"0.6846997",
"0.6846997",
"0.6846997",
"0.6846997",
"0.68447113",
"0.6844513",
"0.68439645",
"0.68426174",
"0.6841284",
"0.6840539",
"0.6838467",
"0.6838354",
"0.6837331",
"0.6832991",
"0.6829786",
"0.6829585",
"0.68293816",
"0.6828908",
"0.68276167",
"0.68253213",
"0.6824807",
"0.68244773",
"0.68214023",
"0.68200874",
"0.68199694",
"0.6815756",
"0.68129987",
"0.68119234",
"0.68113154",
"0.68094486",
"0.6809236",
"0.68076235",
"0.6807275",
"0.68055755",
"0.6804856",
"0.68043435",
"0.68043435",
"0.6801673",
"0.6801008",
"0.6800912",
"0.6797808",
"0.67968416",
"0.67951745",
"0.6792925",
"0.67897904",
"0.6789391",
"0.67892003",
"0.6789115",
"0.6783996",
"0.6783756",
"0.6781084",
"0.6773426",
"0.6771029",
"0.67706895",
"0.67706895"
] |
0.78672314
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_questionario_egresso
@questionario_egresso = QuestionarioEgresso.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 questionario_egresso_params
params.require(:questionario_egresso).permit(:auxiliar, :nome_curso,:curso_id, :realizado, :form_acad_id, :egresso_id, :ig_idade, :ig_genero, :ig_cor, :ig_est_conjug, :ia_qual_curso, :ia_nome_curso, :ia_ano_iniciou, :ia_ano_concluiu, :ia_satisf_palestras, :ia_satisf_oficina, :ia_satisf_minicurso, :ia_satisf_seminario, :ia_satisf_vis_tec, :ia_satisf_estagio, :ia_satisf_prat_prof, :ia_satisf_bolsas, :ia_est_dur_curso, :ia_empresa_pq_sim, :ia_empresa_pq_nao, :ia_avalia_curso, :ia_nessec_atlzr, :ia_fazer_atlzr, :saip_esta_inst, :saip_back_inst, :saip_curso_atual, :saip_pq_back, :saip_pqnao_back, :saip_trab_atual, :saip_trab_area, :saip_tempo, :saip_vinculo, :saip_local, :saip_renda, :saip_ja_trab, :saip_prim_oport, :saip_pq_nao_esta, :saip_texto1, :saip_pq_nunca, :saip_texto2)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Resolves conflict add file to staged area
|
def resolve
@base.add(@path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def try_resolve_conflict\n # retry the merge\n working_changeset = self[nil]\n merge_changeset = working_changeset.parents.last\n \n # backup the current file to a .resolve file (but retain the extension\n # so editors that rely on extensions won't bug out)\n path = working_join file\n File.copy(path, path + \".resolve\" + File.extname(path))\n \n # try to merge the files!\n merge_state.resolve(file, working_changeset, merge_changeset)\n \n # restore the backup to .orig (overwriting the old one)\n File.move(path + \".resolve\" + File.extname(path), path + \".orig\" + File.extname(path))\n end",
"def merge_conflict?; end",
"def mark_conflicted(filename)\n merge_state.mark_conflicted filename\n end",
"def hook_add_files\n @flavor.class.before_add_files do |files, resource_action|\n if :create == resource_action && fail_on_clobber\n files.each do |file|\n if File.exist?(destination_path(file))\n fail \"tried to overwrite file #{file}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end",
"def add_conflict(entity, id, attr, o, c, p)\n logger.warn { \"Detected conflict on #{entity} #{attr}: [o, c, p] = #{[o, c, p].inspect}\" }\n\n conflicts.add(entity, id, attr, o, c, p)\n end",
"def mark_resolved(filename)\n merge_state.mark_resolved filename\n end",
"def resolve_conflict(files)\n filename = files\n .map {|f| f['path']}\n .sort\n .first\n puts %[rm \"#{filename}\"]\nend",
"def replaced_files; end",
"def add_file(file)\n index = @repo.index\n index.add path: file, oid: (Rugged::Blob.from_workdir @repo, file), mode: 0100644\n index.write\n\n @affected_files << file\n end",
"def merge(srcfs)\n @fs.merge!( srcfs.fs )\n @fs = Cleanfs.killdupl(@@loader.source,@fs,srcfs.fs)\n end",
"def add_file(file, dsid, file_name) \n return add_external_file(file, file_name) if dsid == 'content'\n super\n end",
"def hook_add_templates\n @flavor.class.before_add_templates do |templates, resource_action|\n if :create == resource_action && fail_on_clobber\n templates.each do |template|\n if File.exist?(destination_path(template))\n fail \"tried to overwrite file #{template}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end",
"def add_file(file, dsid, file_name) \n return add_external_file(file, dsid, file_name) if dsid == 'content'\n super\n end",
"def add_conflict(name, specifics)\n @conflicts << Requirement.parse(name, specifics)\n end",
"def check_conflicts(list)\n #return if write?\n list.each do |action, fname|\n tpath = source + fname\n fpath = output + fname\n if File.exist?(fpath)\n if tpath.directory?\n if !fpath.directory?\n raise \"Directory to be created clashes with a pre-existent file -- #{fname}\"\n end\n else\n if fpath.directory?\n raise \"File to be created clashes with a pre-existent directory -- #{fname}\"\n end\n end\n end\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 revert(files=nil, opts={})\n # get the parents - used in checking if we haven an uncommitted merge\n parent, p2 = dirstate.parents\n \n # get the revision\n rev = opts[:revision] || opts[:rev] || opts[:to]\n \n # check to make sure it's logically possible\n unless rev || p2 == Amp::Mercurial::RevlogSupport::Node::NULL_ID\n raise abort(\"uncommitted merge - please provide a specific revision\")\n end\n \n # if we have anything here, then create a matcher\n matcher = if files\n Amp::Match.create :files => files ,\n :includer => opts[:include],\n :excluder => opts[:exclude]\n else\n # else just return nil\n # we can return nil because when it gets used in :match => matcher,\n # it will be as though it's not even there\n nil\n end\n \n # the changeset we use as a guide\n changeset = self[rev]\n \n # get the files that need to be changed\n stats = status :node_1 => rev, :match => matcher\n \n ###\n # now make the changes\n ###\n \n ##########\n # MODIFIED and DELETED\n ##########\n # Just write the old data to the files\n (stats[:modified] + stats[:deleted]).each do |path|\n File.open path, 'w' do |file|\n file.write changeset.get_file(path).data\n end\n UI::status \"restored\\t#{path}\"\n end\n \n ##########\n # REMOVED\n ##########\n # these files are set to be removed, and have thus far been dropped from the filesystem\n # we restore them and we alert the repo\n stats[:removed].each do |path|\n File.open path, 'w' do |file|\n file.write changeset.get_file(path).data\n end\n \n staging_area.normal path # pretend nothing happened\n UI::status \"saved\\t#{path}\"\n end\n \n ##########\n # ADDED\n ##########\n # these files have been added SINCE +rev+\n stats[:added].each do |path|\n remove path\n UI::status \"destroyed\\t#{path}\"\n end # pretend these files were never even there\n \n staging_area.save\n true # success marker\n end",
"def add_files(*files)\n Rails.logger.info \"Adding #{files.map(&:upload_file_name).join(', ')} to bundle #{self.bundle_type}:#{self.id} in #{self.study.name}\"\n files.each do |file|\n file.update!(study_file_bundle_id: self.id)\n end\n additional_files = StudyFileBundle.generate_file_list(*files)\n self.original_file_list += additional_files\n self.save!\n Rails.logger.info \"File addition to bundle #{self.bundle_type}:#{self.id} successful\"\n end",
"def create_conflict\n controller.create_conflict(resource: resource)\n end",
"def merge(source); end",
"def check_conflicts(list)\n #return if force?\n list.each do |action, loc, tname, fname, opts|\n tpath = loc + tname\n fpath = output + fname\n if File.exist?(fpath)\n if tpath.directory?\n if !fpath.directory?\n raise \"Directory to be created clashes with a pre-existent file -- #{fname}\"\n end\n else\n if fpath.directory?\n raise \"File to be created clashes with a pre-existent directory -- #{fname}\"\n end\n end\n end\n end\n end",
"def add(entry, src_path, &continue_on_exists_proc); end",
"def add(file)\n @file = file\n FileUtils.cp_r(file.path,folder_path)\n unless system(\"cd #{repo_path};git add .\")\n raise GitCloud::GitException.new(\"Add\")\n end\n end",
"def fix\n path = Rails.root.join(\"public/system/files/#{self.id}/original/#{self.file_file_name}\")\n Formatador.display_line(\"Uploading file at: [green]#{path}[/]\")\n if File.exists?(path)\n self.attached_file.store!(File.open(path))\n self.update_attribute(:attached_file, self.file_file_name)\n Formatador.display_line(\"[yellow]Done![/]\")\n else\n Formatador.display_line(\"[red]ERROR: [/]File does not exist!\")\n end\n end",
"def fix_adjust_merged_record_mark_positions(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\\z/i,\n \"Adjusting merged :record_mark positions\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::AdjustMergedRecordMarkPositions.fix(contents, filename)\n [outcome]\n end\n end",
"def merge(file, remote_file, file_dest, flags, move)\n @actions << Action::MergeAction.new(file, remote_file, file_dest, flags, move)\n end",
"def merge_cart_file(old_cart, new_cart)\n need_added_data = {}\n\n new_cart.each do |new_name, new_data|\n if old_cart.key?(new_name)\n old_data = old_cart[new_name]\n\n new_data = CartFileChecker.check_library_by(new_data, old_data)\n\n case new_data.conflict_type\n when ConflictType::ACCEPT\n need_added_data[new_name] = new_data\n when ConflictType::ERROR\n raise \"Halt !!! #{new_data.error_msg}\"\n else\n # ignore state, do nothing.\n end\n\n else # not has key 'new_name'\n new_data.conflict_type = ConflictType::ACCEPT\n need_added_data[new_name] = new_data\n end\n end\n\n old_cart.merge!(need_added_data)\n old_cart\nend",
"def updated_source_file?; end",
"def offer_to_overwrite_conflicts\n @host.overwrite = \"true\" if @host.errors.any? and @host.errors.are_all_conflicts?\n end",
"def add!()\n git \"add #{@path}\"\n end",
"def wonkofile_merge(old, new)\n res = old.merge new\n # changing versions is not allowed by adding another version index (we might end up with a version in the index that\n # we don't have an actual version file for)\n res['versions'] = old['versions']\n res\nend",
"def merge(*files)\n files.each do |f|\n f = check_for_file(f)\n @merged << f\n end\n end",
"def merge\n notify \"Importing...\"\n @importer.merge\n end",
"def file_add(file)\n\t\tputs \"Add entries to the local host repository from file: #{file}\"\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\thosts=file_2_list(file)\n\t\tchanges=bulk_add(hosts)\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def set_conflict\n @conflict = Conflict.find(params[:id])\n end",
"def updated_source_file; end",
"def each_conflict(&block) # :yields: file, your_version, their_version\n self.lib.conflicts(&block)\n end",
"def reference_source_files\n set_reference_source_file(@encoding_job, true)\n redirect_to play_encoding_job_path(@encoding_job)\n end",
"def add_idl_file(idl_file, name = nil)\n # IDLFiles listed by component recipes are not managed\n # so we do not register the recipe with the IDLFile,\n # unless it is the component idl file self.\n # this is done later in recipe #verify\n @idl_files[name || idl_file.full_path] = idl_file\n end",
"def stage_and_commit_file(repo_base_path, relpath_to_file, commit_message = nil)\n commit_message = \"Updated #{relpath_to_file} via website\" unless !commit_message.blank?\n gitRepo = Repo.new(repo_base_path)\n olddir = Dir.pwd\n Dir.chdir(repo_base_path)\n gitRepo.add(relpath_to_file)\n gitRepo.commit_index(commit_message)\n Dir.chdir(olddir)\n end",
"def addFile(filename, essence)\n \n \n \n begin\n \n\n filesize = essence.length\n filename.gsub!(/ /, '_')\n \n # if filesize is larger than about 5mb, increase git timeout\n if filesize > 5000000\n Grit::Git.git_timeout = 30\n # if filesize is larger than about 100mb, throw an exception\n if filesize > 100000000\n raise Exception.new(\"File is too large to handle with git\")\n end\n else\n Grit::Git.git_timeout = 10\n end\n \n # create dir if it does not exist\n if not (File.exists?(@dev_path) && File.directory?(@dev_path))\n FileUtils.mkdir_p(@dev_path) \n end\n \n \n if filename.size > 1\n path = filename[0..filename.rindex('/')]\n FileUtils.mkdir_p(@dev_path+path) \n end\n \n #puts \"name: #{filename}\"\n #puts \"path: #{path}\"\n \n \n path = File.join(@dev_path, filename)\n # write the file\n File.open(path, \"wb\") { |f| \n #puts f.to_s\n f.write(essence)\n \n }\n sleep(0.2)\n @repo.add(\"#{@dev_path}#{filename}\")\n puts \"File \" + filename + \" added to repo.\"\n rescue Exception => e\n puts \"Error: #{e.to_s}\"\n puts \" -- line: #{e.backtrace[0].to_s}\"\n raise Exception.new(\"Could not add a new file to virtual container!\")\n end\n return true\n end",
"def merge!; end",
"def transfer_applicable_st_ops_to_foreign_file!(foreign_content_at_file, applicable_st_ops_for_file)\n if applicable_st_ops_for_file.any?\n # An st_ops_for_file exists. That means the file is being synced.\n # NOTE: Not sure why we're passing applicable_st_ops_for_file\n # as an array as there should really be only one.\n\n # Iterate over st_ops and incrementally update both content and data\n found_st_ops = false\n applicable_st_ops_for_file.each do |st_ops_for_file|\n # Detect if there are st_ops for file, or if it's time slice\n # changes only.\n found_st_ops ||= st_ops_for_file.operations.any?\n transfer_st_ops_to_foreign_file!(\n foreign_content_at_file,\n st_ops_for_file\n )\n # We have to reload the file contents as they were changed on\n # disk by #transfer_st_ops_to_foreign_file!\n foreign_content_at_file.reload_contents!\n end\n # We need to manually write the @to_git_commit to st_sync_commit.\n # We can't rely on transfer_st_ops_to_foreign_file! alone since\n # it will only write sync commits that actually contained st_ops\n # for the current file. However we want to record on the file\n # that it has been synced to the current primary st_sync_commit.\n update_foreign_file_level_data(\n foreign_content_at_file,\n @to_git_commit,\n {} # Don't touch sts that require review\n )\n if found_st_ops\n # Actual st ops\n print \" - Synced\".color(:green)\n else\n # Time slice changes only\n print \" - Synced (Time slice changes only)\".color(:green)\n end\n else\n # No applicable st ops, just update file level st_sync data\n update_foreign_file_level_data(\n foreign_content_at_file,\n @to_git_commit,\n {} # Don't touch sts that require review\n )\n print \" - No applicable st_ops\"\n end\n true\n end",
"def scan_for_merges\n moves = []\n # prescan for merges in the list of actions.\n @actions.select {|act| act.is_a? Action::MergeAction}.each do |a|\n # destructure the list\n file, remote_file, filename_dest, flags, move = a.file, a.remote_file, a.file_dest, a.flags, a.move\n UI.debug(\"preserving #{file} for resolve of #{filename_dest}\")\n # look up our changeset for the merge state entry\n vf_local = working_changeset[file]\n vf_other = target_changeset[remote_file]\n vf_base = vf_local.ancestor(vf_other) || @repo.versioned_file(file, :file_id => Updating::NULL_REV)\n # track this merge!\n @repo.merge_state.add(vf_local, vf_other, vf_base, filename_dest, flags)\n\n moves << file if file != filename_dest && move\n end\n moves\n end",
"def merge_file(fp:, from_dir:, to_dir:, prepend_path: '', keep_rela_path: false, rename: nil)\n\n @@logger.debug \"merge_file #{fp}\"\n @try_counter += 1\n\n do_merge = false\n\n begin\n s_f = most_similar_file(fp, to_dir)\n if !(FileCompare.new(fp, s_f).similar?)\n # not exist, do merge, return target\n @@logger.info \"merge_file new! #{fp}\".green\n do_merge = true\n else\n # exist\n @@logger.info \"merge_file exist. #{s_f}\".yellow\n do_merge = false\n end\n rescue UncertainSimilarityError => e # not sure, user decided\n if !e.user_judge # files are not the same\n @@logger.info \"merge_file new! #{fp} \".green\n do_merge = true\n else # files are the same\n if user_confirm(\"Force merge and overwrite ???\".red)\n File.delete(e.b)\n do_merge = true\n else\n do_merge = false\n @@logger.info \"user skip merge_file #{fp}\"\n end\n end\n end\n\n if do_merge\n if nil != rename && '' != rename\n new_bn = rename\n else\n new_bn = File.basename(fp)\n end\n\n rel_path = Pathname.new(File.dirname(fp)).relative_path_from(Pathname.new(from_dir))\n if keep_rela_path\n @@logger.debug \"prepend_path #{prepend_path} rel_path #{rel_path}\"\n new_path = File.join(prepend_path, rel_path)\n else\n new_path = prepend_path\n end\n\n new_fp = File.join(to_dir, new_path, new_bn)\n\n if !Dir.exist?(File.join(to_dir, new_path))\n FileUtils.mkdir_p(File.join(to_dir, new_path))\n end\n\n FileUtils.cp(fp, new_fp, verbose: true)\n @file_trans.add(from:fp, to:new_fp)\n new_fp\n else\n nil\n end\n end",
"def add_stored(entry, src_path, &continue_on_exists_proc); end",
"def patch_file(file, &block)\n filename = \"#{Dir.pwd}/#{file}\"\n if File.exist?(filename)\n contents = IO.read(filename)\n new_contents = block.call(contents.dup)\n if contents != new_contents\n File.open(filename, 'wb') {|f| f.write new_contents}\n mysystem(\"git add #{file}\")\n return true\n end\n end\n false\n end",
"def merge_if_exists!\n t = merge_if_exists || self\n t.save!\n end",
"def insert_ignore\n insert_conflict\n end",
"def divergent_rename(file, other_files)\n @actions << Divergent_renameAction.new(file, other_files)\n end",
"def verify_no_uncommitted_merge\n if !overwrite? && @working_changeset.parents.size > 1\n raise abort(\"outstanding uncommitted merges\")\n end\n end",
"def existing_files; end",
"def hook_add_files\n @flavor.class.after_add_files do |files, resource_action, type|\n files.each do |file|\n actions_taken << \"#{resource_action} #{type} #{file}\"\n end\n end\n end",
"def add_files(*files)\n files = files.flatten\n unless files.empty?\n @perforce.run(\"edit\", \"-c\", @number, *files)\n @perforce.run(\"add\", \"-c\", @number, *files)\n end\n end",
"def overwrite?; end",
"def manifest_merge\n UI::status(\"resolving manifests\")\n UI::debug(\" overwrite #{overwrite?} partial #{filter}\")\n UI::debug(\" ancestor #{ancestor} local #{local} remote #{remote}\")\n \n copy = calculate_copies\n copied_files = Hash.with_keys(copy.values)\n \n # Compare manifests\n working_changeset.each do |file, node|\n update_local_file file, node, copy, copied_files\n end\n \n remote.each do |file, node|\n update_remote_file file, node, copy, copied_files\n end\n end",
"def test_add_the_same_file_in_both_repos\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\", \n \"b added two\",\n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end",
"def file_content_looker(repo, txn, path)\n @logger.debug(\"UnresolvedMergeChecker checking \"+path)\n `svnlook cat -t #{txn} #{repo} #{path}`\n end",
"def extend_image_with_file(base_image, new_image, file_path, file_contents)\n container_id = run_stdin [], base_image, file_contents, \"/bin/sh\", \"-c\", \"cat > #{file_path}; cat #{file_path}\"\n wait container_id\n commit container_id, new_image, \"Added #{file_path}\"\n end",
"def merge\n @mergeit.merge_data(@input_files)\n end",
"def create_study_file_copy\n begin\n ApplicationController.firecloud_client.execute_gcloud_method(:copy_workspace_file, 0,\n study.bucket_id,\n study_file.bucket_location,\n study_file.parse_fail_bucket_location)\n if study_file.is_bundled? && study_file.is_bundle_parent?\n study_file.bundled_files.each do |file|\n # put in same directory as parent file for ease of debugging\n bundled_file_location = \"parse_logs/#{study_file.id}/#{file.upload_file_name}\"\n ApplicationController.firecloud_client.execute_gcloud_method(:copy_workspace_file, 0,\n study.bucket_id,\n file.bucket_location,\n bundled_file_location)\n end\n end\n true\n rescue => e\n ErrorTracker.report_exception(e, user, study_file, { action: :create_study_file_copy})\n false\n end\n end",
"def add_files(frameworks_build_phase, files, lib_group, relative_source_directory)\n\tfiles.each { |file|\n\t\tif file != \".\" && file != \"..\"\n\t\t\ta_ref = lib_group.new_file(relative_source_directory + file)\n\t\t\tframeworks_build_phase.add_file_reference(a_ref, true)\n\t\tend\n\t}\nend",
"def ingest_new_content( depositor, work, file_str, asset_dir, current, total )\n file_names = file_str.split('|')\n\n puts \"Ingesting row #{current} of #{total}: #{work.title.join} (#{file_names.length} assets)...\"\n\n # handle dry running\n return true if ENV[ 'DRY_RUN' ]\n\n # and upload each file\n file_names.each do |file_name|\n\n # Clamav can't handle file names with space, (, or )\n # Assume they have been removed, but keep them in the label\n adjusted_file_name = file_name.gsub(/[() ]/, '_')\n file_path = File.join( asset_dir, adjusted_file_name )\n\n # remove spaces in filename\n #file_no_spaces = file_path.gsub(' ', '_')\n #File.rename(file_path, file_no_spaces)\n #file_path = file_no_spaces\n\n # Check for existing asset\n if work.file_sets.any? {|fs| fs.title.first == file_name }\n puts \"Skipping existing file: #{file_name}\"\n next\n end\n\n if File.exist?(file_path)\n fileset = TaskHelpers.upload_file( depositor, work, file_path, file_name, work.visibility )\n else\n puts \"File does not exist: #{file_path}\"\n end\n # Upload very slowly...\n sleep(30)\n\n end\n\n return true\n end",
"def add(filename)\n not_implemented('add')\n end",
"def try_merge!(pin); end",
"def combine_files!(infiles)\n make_files_by_datetime\n infiles.merge!(@files_by_datetime) do |key, oldval, newval|\n log_error(\"Key collision: #{key}, #{oldval}, #{newval}\")\n raise\n end\n end",
"def add_files_to_project\n # add/overwrite some files\n mkdir('config/init')\n mkdir_p('lib/tasks')\n cp_r(Dir.glob('../files/*'), '.')\n # gem changed the api in version 1.3.2, I think, at least it is changed\n # in version 1.3.4, so the following merb hack is necessary for merb\n # 1.0.11\n # TODO: this should be generically performed outside of the spec2merb script\n if Versionomy.parse(`gem --version`) < Versionomy.parse('1.3.4')\n raise Exception.new 'Please upgrade rubygems to at least 1.3.4 (sudo gem update --system)'\n end\n if File.exist?('tasks/merb.thor/gem_ext_4.rb')\n rm('tasks/merb.thor/gem_ext.rb') if File.exist?('tasks/merb.thor/gem_ext.rb')\n mv('tasks/merb.thor/gem_ext_4.rb', 'tasks/merb.thor/gem_ext.rb')\n end\n end",
"def create_and_update_assembly_branch?(opts = {})\n module_branch = get_or_create_module_for_service_instance\n\n unless opts[:trap_error]\n update_assembly_branch(module_branch)\n else\n # trap all errors except case where task action does not\n begin\n update_assembly_branch(module_branch)\n rescue Task::Template::TaskActionNotFoundError => e\n raise e\n rescue => e\n Log.info_pp(['trapped error in create_and_update_assembly_branch', e])\n end\n end\n\n @service_module.get_workspace_branch_info(assembly_module_version).merge(edit_file: meta_file_path)\n end",
"def fixLoadPath(oldpath,libpath,target)\n debug \"#{$install_name_tool} -change #{oldpath} #{$executableId}#{libpath} #{target}\"\n `#{$install_name_tool} -change #{oldpath} #{$executableId}#{libpath} #{target}`\nend",
"def obsolete_files; end",
"def add_gemfile\n copy_file 'static/dry/Gemfile.default', \"#{name}/Gemfile\"\n say 'Add Gemfile', :green\n end",
"def import_diff_file(file_path)\n raise NotImplementedError\n end",
"def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end",
"def add_from_upload\n\t\tbegin\n\t\t\tproject = Project.editable(current_user).find_by_name(params[:project_id])\n\t\t\traise \"The project does not exist, or you are not authorized to make a change to the project.\\n\" unless project.present?\n\t\t\traise ArgumentError, \"sourcedb is not specified.\" unless params[\"sourcedb\"].present?\n\n\t\t\tsourcedb = params[\"sourcedb\"]\n\t\t\tfilename = params[:upfile].original_filename\n\t\t\text = File.extname(filename)\n\t\t\traise ArgumentError, \"Unknown file type: '#{ext}'.\" unless ['.txt'].include?(ext)\n\n\t\t\traise \"Up to 10 jobs can be registered per a project. Please clean your jobs page.\" unless project.jobs.count < 10\n\n\t\t\tfilepath = File.join('tmp', \"add-docs-to-#{params[:project_id]}-#{Time.now.to_s[0..18].gsub(/[ :]/, '-')}#{ext}\")\n\t\t\tFileUtils.mv params[:upfile].path, filepath\n\n\t\t\t# AddDocsToProjectFromUploadJob.perform_now(project, sourcedb, filepath)\n\n\t\t\tactive_job = AddDocsToProjectFromUploadJob.perform_later(project, sourcedb, filepath)\n\t\t\tjob = Job.find_by(active_job_id: active_job.job_id)\n\t\t\tmessage = \"The task, '#{active_job.job_name}', is created.\"\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html {redirect_back fallback_location: root_path, notice: message }\n\t\t\t\tformat.json {render json: {message: message, task_location: project_job_url(project.name, job.id, format: :json)}, status: :ok}\n\t\t\tend\n\t\trescue => e\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html {redirect_back fallback_location: root_path, notice: e.message }\n\t\t\t\tformat.json {render json: {message: e.message}, status: :unprocessable_entity}\n\t\t\tend\n\t\tend\n\tend",
"def conflict(val)\n conflicts << val\n conflicts.dup\n end",
"def conflict(val)\n conflicts << val\n conflicts.dup\n end",
"def test_add_back_a_remotely_removed_file\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n a.rm(\"two\").commit(\"a removed two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal nil, a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal nil, a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\",\n \"a removed two\",\n \"b added two\", \n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end",
"def run_addMolid2File()\n ifn = @work_dir + '_1.sdf'\n ofn = @work_dir + '_2.sdf'\n addMolid2File(ifn, ofn)\n puts \"\\nwrite to #{ofn}\\n\"\n end",
"def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc:\n# sql = \"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\"\n# devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql)\n#\n devfiles_of_prev_commit = Devfile.find_by_sql(\"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\")\n if devfiles_of_prev_commit.size > 0\n ActiveRecord::Base.connection.execute(\"begin\")\n now = DateTime.now\n devfiles_of_prev_commit.each do |df|\n if not changed_files.has_key?(df.path + df.name)\n begin\n sql = \"insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');\"\n ActiveRecord::Base.connection.execute(sql)\n rescue\n # do nothing\n end\n end\n end\n ActiveRecord::Base.connection.execute(\"commit\")\n end\n end",
"def add_file(file_params)\n # append a new file to our the current identity's list of bruse_files\n\n file = BruseFile.new(file_params)\n\n if bruse_files << file\n # return file\n file\n else\n # could not append file!\n file.destroy\n nil\n end\n end",
"def schedule_add(package, dest_path, force = false)\n @queues_mutex.synchronize do\n conflict = @add_queue.detect { |x| x[1] == dest_path }\n @add_queue.delete(conflict) if conflict && force\n conflict &&= conflict[0]\n \n conflict ||= Package.with(:file, dest_path)\n \n if conflict\n raise NameConflictError, File.basename(dest_path) if not force\n conflict.lock do\n name_version = Library.name_version(conflict.type, conflict.file)\n library = Library.with(:name_version, name_version)\n library.packages.delete(conflict)\n _file = conflict.file\n conflict.delete!\n FileUtils.rm_f(_file)\n end\n end\n \n @add_queue.push([package, dest_path])\n end\n end",
"def single_ucf_file_lists\n File.open(single_bad_ucf_file, 'a') do |mergedfile|\n Dir.glob(\"#{output_directory_path}*name.txt\").each do |file|\n File.foreach(file) do |line|\n mergedfile.write(line)\n end\n end\n end\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 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 resolve_merge_conflicts_and_delete_old_description\n if (params[:delete_after] == \"true\") &&\n (old_desc = @description.class.safe_find(params[:old_desc_id]))\n if !in_admin_mode? && !old_desc.is_admin?(@user)\n flash_warning(:runtime_description_merge_delete_denied.t)\n else\n flash_notice(:runtime_description_merge_deleted.\n t(old: old_desc.partial_format_name))\n log_description_merged(old_desc)\n old_desc.destroy\n end\n end\n end",
"def add_source_files_references\n UI.message '- Adding source files' do\n add_file_accessors_paths_to_pods_group(:source_files, nil, true)\n end\n end",
"def do_execute(repo, txn)\n msg=nil\n changes = change_list_finder(repo, txn)\n @logger.debug(\"UnresolvedMergeChecker paths=>\" + changes.to_s)\n changes.each do |change|\n path=change_to_path(change) # extract path after change code and spaces\n content = file_content_looker(repo, txn, path)\n @logger.debug(\"UnresolvedMergeChecker content=>\" + content + \"<<END\")\n if unresolved_mark?(content)\n msg = \"Unresolved merge in \" +path + \". Please resolve and recommit.\"\n break\n end\n end\n msg\n end",
"def updateAndCheckConflicts\n rError = nil\n\n lConflicts = []\n # Execute svn update\n change_dir(@LocalRepository) do\n `svn update --accept=postpone #{@StrFiles}`.split(\"\\n\").each do |iLine|\n # Check that this line does not tell about a conflict\n if (iLine.strip[0..0] == 'C')\n # There is a conflict\n lConflicts << iLine.strip[1..-1].strip\n end\n end\n end\n # Sum up conflicts\n if (!lConflicts.empty?)\n rError = UpdateConflictError.new(\"The following files are in conflict: #{lConflicts.join(', ')}. Please resolve the conflict by updating before committing.\")\n end\n\n return rError\n end",
"def add_fileset\n\n # grab the parameters\n work_id = params[:work]\n file_id = params[:file]\n label = params[:label]\n\n # validate them\n if work_id.blank? == false && file_id.blank? == false && label.blank? == false\n work = get_the_work( work_id )\n if work.nil? == false\n filename = APIV1FilesetsController.cache_contents( file_id )\n if filename.blank? == false\n fileset = ::FileSet.new\n fileset.title << label\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.create_metadata( work )\n file_actor.create_content( File.open( filename ) )\n fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n fileset.save!\n\n # audit the information\n #audit_log( \"File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}\" )\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{File.basename( filename )}/#{label} added\" )\n\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'File not found' )\n end\n else\n render_standard_response( :not_found, 'Work not found' )\n end\n else\n render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' )\n end\n\n end",
"def merge(space, path = nil)\n\n # Follow the path.\n path = Path.new(path) unless path.kind_of?(Path)\n m = meta_walk(path)\n\n # First, verify that we can add. Then add.\n merge_in(m, space, path, true)\n merge_in(m, space, path)\n\n end",
"def add_fake_errors(input_file, prefix)\n output_file = input_file.sub('.root', '_statshapes.root')\n output_sys_list = input_file.sub('.root', '_statshapes.txt')\n file output_file => [input_file] do |t|\n sh \"add_stat_shapes.py #{input_file} #{output_file} --filter '#{prefix}/fakes' --prefix CMS_vhtt_#{$period}_#{prefix}_fakeshape > #{output_sys_list}\"\n end\n return output_file\nend",
"def add(path); end",
"def file_add(file)\n\t\tputs \"Add entries to the local site store from file: #{file}\"\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\tchanges=Hash.new\n\t\tsites=file_2_list(file)\n\t\tchanges=bulk_add(sites) unless sites.nil? or sites.empty?\n\t\tputs \"Done loading file #{file}. \"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def add\n working_repo.add tree\n end",
"def merge_local_with_api(filename)\n project = YAML.safe_load_file(filename)\n api_data = JSON.parse(open(\"_data/projects/all.json\").read)\n unless project.nil?\n new_data = update_from_api(project, api_data[project['name']])\n end\nend",
"def replace(entry, src_path); end",
"def add(path, target, &resolve_collision)\n link_path = path_of(path)\n if File.directory?(link_path) && File.directory?(target)\n merge_directories(path, target, link_path, &resolve_collision)\n elsif !File.exist?(link_path)\n FileUtils.mkdir_p File.dirname(link_path)\n File.symlink target, link_path\n true\n else\n yield path, target\n end\n end",
"def main(json)\n files = JSON.parse(json).fetch('files')\n dupes = get_name_conflicts(files)\n dupes.each do |list|\n # resolve_conflict(list)\n list.each {|file| puts file['path']}\n puts\n end\nend",
"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 add_to_base(file)\n occurence = file.scan(/(\\s+mount\\s.*?\\n)/).last.first\n replacement = occurence + mount_point\n file.sub!(occurence, replacement)\n end"
] |
[
"0.6969783",
"0.6516617",
"0.6491172",
"0.6335912",
"0.57899153",
"0.5722829",
"0.56688976",
"0.56387454",
"0.55698955",
"0.5550421",
"0.55307037",
"0.55158746",
"0.5512391",
"0.5466221",
"0.53982687",
"0.5393984",
"0.5375969",
"0.53402245",
"0.53193307",
"0.53150785",
"0.53044075",
"0.5248967",
"0.52446866",
"0.52398133",
"0.5230062",
"0.52114767",
"0.5208527",
"0.5208357",
"0.520499",
"0.5199087",
"0.51624584",
"0.5159836",
"0.5157766",
"0.51545024",
"0.514406",
"0.51438713",
"0.511107",
"0.5071708",
"0.5062661",
"0.5060079",
"0.5056523",
"0.5046351",
"0.50410026",
"0.50340205",
"0.5030233",
"0.5029815",
"0.50189066",
"0.50077385",
"0.4996082",
"0.4980889",
"0.4978493",
"0.4971924",
"0.49561486",
"0.49556944",
"0.4952932",
"0.49453282",
"0.49441054",
"0.49425146",
"0.4931397",
"0.49291533",
"0.49161103",
"0.49032763",
"0.49019277",
"0.48963666",
"0.4893366",
"0.48924932",
"0.48922017",
"0.48905882",
"0.48851505",
"0.48812655",
"0.487219",
"0.48645222",
"0.48623183",
"0.48622215",
"0.48614037",
"0.48614037",
"0.4853894",
"0.48517403",
"0.48436144",
"0.48353872",
"0.48274463",
"0.48271236",
"0.48256594",
"0.4823508",
"0.48215863",
"0.48157793",
"0.48120806",
"0.48108688",
"0.48018414",
"0.48011744",
"0.4799137",
"0.47947675",
"0.47941533",
"0.4792323",
"0.47906765",
"0.47893283",
"0.47861782",
"0.47817174",
"0.47770488",
"0.47754174"
] |
0.5218371
|
25
|
returns winning marker or nil
|
def winning_marker
WINNING_LINES.each do |line|
squares = @squares.values_at(*line)
if three_identical_markers?(squares)
return squares.first.marker
end
end
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker # return the corresponding detected marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n markers = squares.map(&:marker)\n return markers[0] if markers.uniq.size == 1 && squares[0].marked?\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n return squares.first.marker if three_identical_markers?(squares)\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if identical_markers?(3, squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n line_squares = squares.values_at(*line)\n next if line_squares.any?(&:unmarked?)\n markers = line_squares.map(&:marker)\n return markers.first if winner?(markers)\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end",
"def winning_marker\n WINNING_COMBOS.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\r\n WINNING_LINES.each do |line|\r\n winning_marker = check_for_winning_marker(@squares.values_at(*line))\r\n return winning_marker if winning_marker\r\n end\r\n nil\r\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n line_markers = squares.values_at(*line).map(&:marker)\n next if line_markers.include?(Square::INITIAL_MARKER)\n return line_markers.first if line_markers.uniq.size == 1\n end\n\n nil\n end",
"def winnning_marker\n WINNING_POSITIONS.each do |line|\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTPlay::HUMAN_MARKER\n end\n if count_computer_marker(@squares.values_at(*line)) == 3\n return TTTPlay::COMPUTER_MARKER\n end\n end\n\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n unless incomplete_line?(line)\n return find_winning_marker(line) if player_won?(line)\n end\n end\n nil\n end",
"def winning_marker # iterate through winning lines, and see if square\n # in each 3 elements in 'line' array match the human marker\n # or computer marker, if so return that marker, if no match return nil\n WINNING_LINES.each do |line|\n # line is 3 element arr representing winning line\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil # if we dno't put this, then .each will return array\n end",
"def detect_winner\n winning_marker = nil\n\n WINNING_LINES.each do |line|\n line_markers = squares.values_at(*line).map(&:marker)\n next if line_markers.include?(Square::INITIAL_MARKER)\n line_markers.uniq!\n winning_marker = line_markers[0] if line_markers.size == 1\n break if !!winning_marker\n end\n\n winning_marker\n end",
"def winning_marker\n return nil if populated_win_lines.empty?\n there_is_a_win_line_with_uniform_markers? ? win_maker : nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n full_line_mark = full_line_check(@squares.values_at(*line))\n next if full_line_mark.nil?\n return full_line_mark\n end\n nil\n end",
"def look_for_win\n Game::LINES.each do |winning_line|\n markers = group_positions_by_marker(winning_line)\n if markers[marker].length == 2 and markers.keys.include?(nil)\n puts markers.keys\n choice = markers[nil].first\n return choice\n end\n end\n false\n end",
"def detect_marker\n WINNING_LINES.each do |line|\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTGame::HUMAN_MARKER\n elsif count_computer_marker(@squares.values_at(*line)) == 3\n return TTTGame::COMPUTER_MARKER\n end\n end\n nil\n end",
"def detect_winner # iterate through winning lines, and see if square in each 3 elements\n # in this line array matches the human marker or computer marker, if so return that marker\n # if no match return nil\n WINNNING_LINES.each do |line| # line is 3 element arr representing winning line\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTGame::HUMAN_MARKER # vid 8 refactor\n elsif count_computer_marker(@squares.values_at(*line)) == 3\n return TTTGame::COMPUTER_MARKER\n end\n end\n nil # if we dno't put this, then .each will return array\n end",
"def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end",
"def detect_winner(brd)\n Board::WINNING_LINES.each do |line|\n if brd.position_values[line[0]] == Board::PLAYER_MARKER &&\n brd.position_values[line[1]] == Board::PLAYER_MARKER &&\n brd.position_values[line[2]] == Board::PLAYER_MARKER\n return 'Player'\n elsif brd.position_values[line[0]] == Board::CPU_MARKER &&\n brd.position_values[line[1]] == Board::CPU_MARKER &&\n brd.position_values[line[2]] == Board::CPU_MARKER\n return 'CPU'\n end\n end\n nil\n end",
"def winning_cell_for_marker(marker)\n win_lines = lines_with_winning_move(marker)\n return outstanding_winning_cell(win_lines.first) unless win_lines.empty?\n end",
"def detect_winner(brd)\n WINNING_LINES.each do |line|\n if brd.values_at(*line).count(PLAYER_MARKER) == 3\n return 'Player'\n elsif brd.values_at(*line).count(COMPUTER_MARKER) == 3\n return 'Computer'\n end\n end\n nil\nend",
"def winner\n if won? == nil\n return nil\n else\n winning_position = won?\n winning_index = winning_position[0]\n @board[winning_index]\n end\n end",
"def winner\n WIN_COMBINATIONS.each do |win_combination|\n #puts win_combination.inspect\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n \n position_1 = @board[win_index_1] \n position_2 = @board[win_index_2] \n position_3 = @board[win_index_3] \n \n if position_1 == position_2 && position_2 == position_3 && position_taken?(win_index_1)\n return position_1\n end\n end\n nil\n end",
"def look_for_lose\n Game::LINES.each do |winning_line|\n markers = group_positions_by_marker(winning_line)\n if markers[@game.other_player.marker].length == 2 and markers.keys.include?(nil)\n return markers[nil].first\n end\n end\n false\n end",
"def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end",
"def check_for_winner\n \tcollect_winning_positions.each do |position| \t\t\n \t\tif position == \"OOO\"\n \t\t return 2 \t\t\n \t\telsif position == \"XXX\" \n \t return 1 \t\t \n \t\tend \t\n \tend\n \tcat_game? == true ? 0 : -1\n end",
"def winner\n if won?\n win_array = won?\n position = win_array[0]\n @board[position]\n else \n nil\n end\nend",
"def winner\n if won?\n winner = won?\n return @board[winner[0]]\n else\n return nil\n end\n end",
"def winner\n return @board[won?[0]] if won?\n end",
"def winner()\n if won?()\n return @board[won?()[0]]\n end\n return nil\n end",
"def find_winner\n\t\t@counter = 0\n\t\[email protected] do |player|\n\t\t\tif player.points > @winning\n\t\t\t\t@winner = @counter + 1\n\t\t\tend\n\t\t\t@counter += 1\n\t\tend\n\t\treturn @winner\n\tend",
"def check_for_winner(marker, player)\n Game::WINNING_LINES.each do |the_line|\n if board.squares[the_line[0]] == marker && board.squares[the_line[1]] == marker && board.squares[the_line[2]] == marker\n puts \"#{player} wins\"\n sleep 0.5\n exit\n end\n end\n Game::WINNING_LINES.each do |the_line|\n if @board.available_squares.any? == false\n puts \"It's a tie!\"\n sleep 0.5\n exit\n end \n end\n end",
"def determine_winner\n \tif self.won?(@player_symbol) then\n \t\t@over = true\n \treturn \"Player\" \n \tend\n \tif self.won?(@computer_symbol) then\n \t\t@over = true\n \t return \"Computer\" \n \tend\n \tif self.open_spots.count == 0 then\n \t\t@over = true\n \t\treturn \"Draw\"\n \tend\n return \"\" \n end",
"def winner(board)\n won?(board) ? board[won?(board)[0]] : nil\nend",
"def winner\n if won?\n return @board[ won?[0] ]\n else\n return nil\n end\n end",
"def winner\n if winning_array = won?\n @board[winning_array[0]]\n end\n end",
"def winning_team_with_spread\n\t\tif self.final?\n\t\t\treturn home_team_id if home_team_score > away_team_score + point_spread\n\t\t\treturn away_team_id if away_team_score + point_spread > home_team_score\n\t\t\treturn \"tie\" if home_team_score == away_team_score + point_spread\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"def winner\n self.won?? self.board.cells[self.won?[0]] : nil\n end",
"def someone_won?\n !!winnning_marker\n end",
"def winner\n if won? != false && won? != nil\n win = won?\n return @board[win[0]]\n else\n return nil\n end\n end",
"def winning_move(board)\n winning_spot = nil\n \n board.empty_position.each do |spot|\n board.place_mark(*spot, marker)\n winning_spot = spot if board.won?\n board[*spot] = nil\n end\n \n winning_spot\n end",
"def winning_player_id\n return nil if draw?\n player_score.value > opponent_score.value ? player_id : opponent_id\n end",
"def winner(board)\n # Return the square entry from the winning configuration\n won?(board) ? board[won?(board)[0]] : nil\nend",
"def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end",
"def winner(board)\n if winner_array = won?(board)\n return board[winner_array[0]]\n else\n return nil\n end\nend",
"def winner?(board, marker)\n\tif board[0] == marker && board[1] == marker && board[2] == marker ||\n\t board[3] == marker && board[4] == marker && board[5] == marker ||\n\t board[6] == marker && board[7] == marker && board[8] == marker ||\n\t board[2] == marker && board[4] == marker && board[6] == marker ||\n\t board[0] == marker && board[4] == marker && board[8] == marker ||\n\t board[0] == marker && board[3] == marker && board[6] == marker ||\n\t board[1] == marker && board[4] == marker && board[7] == marker ||\n\t board[2] == marker && board[5] == marker && board[8] == marker\n\t\ttrue\n\telse\n\t\tfalse\t\n\tend\nend",
"def winner(board)\n if won?(board)\n winner = won?(board)\n return board[winner[0]]\n else\n return nil\n end\nend",
"def win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend",
"def winner(board)\n if won?(board)\n winning_index = won?(board)[0]\n winning_token = board[winning_index]\n else\n nil\n end\nend",
"def winner\n won = \"\"\n if winner = won?\n won = @board[winner.first]\n end\n end",
"def winner\n if won?\n @board[won?[0]]\n end\n end",
"def detect_winner(board)\n WINNING_LINES.each do |line|\n if board.values_at(*line).count('X') == 2\n return 'X'\n elsif board.values_at(*line).count('O') == 2\n return 'O'\n end\n end\n nil\nend",
"def winner\n match = horizontal_match || vertical_match || diagonal_match\n match ? @last_drop[:piece] : nil\n end",
"def winner\n if winning_combo = won?\n @board[winning_combo.first]\n end\n end",
"def win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend",
"def find_team_marker(piece_team)\n if piece_team == :none\n \"0\"\n else\n piece_team.to_s[0].upcase\n end\n end",
"def winner\n if object.team_winner.nil?\n nil\n else\n if object.match.doubles\n object.team_winner.id\n else\n object.team_winner.first_player.id\n end\n end\n end",
"def check_winner\r\n\t\tif board.winner?(p1.marker)\r\n\t\t\ttrue\r\n\t\telsif board.winner?(p2.marker)\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\t\t\r\n\t\tend\r\n\tend",
"def winner(board)\n if won?(board) then return board[won?(board)[0]]\n end\nend",
"def winner(board)\n triplet = won?(board)\n if !!triplet\n return board[triplet[0]]\n end\n return nil\nend",
"def winner(board)\n triplet = won?(board)\n if !!triplet\n return board[triplet[0]]\n end\n return nil\nend",
"def winner \n @board[won?[0]] if won?\n end",
"def winner\n won? ? board.cells[won?[0]] : nil\n end",
"def winner(board)\n the_winner = won?(board)\n if the_winner\n board[the_winner[0]]\n else\n return nil\n end\nend",
"def determine_match_winner\n @games_to_win = ((total_number_of_games / 2.0).floor) + 1\n if player1.score == games_to_win\n return player1\n elsif player2.score == games_to_win\n return player2\n else\n return nil\n end\n end",
"def winner(board)\n if won?(board)\n return board[won?(board)[0]]\n end\nend",
"def winner(board)\n return board[won?(board)[0]] if won?(board)\nend",
"def winner\n if won = won?\n board.cells[won.first]\n end\n #won? == false ? nil : @board.cells[winner[0]];\n end",
"def winner(board)\n if won?(board) != nil\n board[won?(board)[0]]\n else\n end\nend",
"def winner(board)\n if won?(board) != nil\n board[won?(board)[0]]\n else\n end\nend",
"def winner(board)\n if won?(board)\n indexes = won?(board)\n return board[indexes[0]]\n else \n return nil \n end\nend",
"def wins_point(winner)\n \n if winner == @player1\n @player1.record_won_ball!\n @score_counter += 1\n return @player1.points\n else\n @player2.record_won_ball!\n @score_counter += 1\n return @player2.points\n end\n # TODO: Think it's gross to pass an integer instead of a player object?\n # Then reimplement this method!\n end",
"def find_at_risk_square(line, board, marker)\n if board.position_values.values_at(*line).count(marker) == 2\n mark = board.position_values.select { |k, v| line.include?(k) && v == Board::INITIAL_MARKER }\n mark.keys.first\n end\n end",
"def winner(board)\n if won?(board) != false\n return board[won?(board)[0]]\n else\n return nil\n end\nend",
"def winner(board)\n who_wins = won?(board)\n if who_wins\n board[who_wins[0]] \n else\n nil\n end\nend",
"def winner\n #return token x or o that won the game\n won = \" \"\n if winner = won?\n won = @board[winner.first]\n end\nend",
"def winner(board)\n if won?(board)\n board[won?(board)[0]]\n end\nend",
"def winner\n if !won?\n nil\n else winner = @board[won?[0]]\n\n end\n\n end",
"def winner\n @player_positions.max_by{|player, position| position}[0]\n end",
"def winner\n index = won?\n if index && @board.cells[index[0]] == \"X\"\n return \"X\"\n elsif index && @board.cells[index[0]] == \"O\"\n return \"O\"\n else\n return nil\n end\n end",
"def findPlayer\n playerFound = false\n finishFound = false\n @maze.each_with_index do |row, rowIndex|\n row.each_with_index do |col, colIndex|\n case col\n when PLAYER_CHAR then\n raise 'More than one player' if playerFound\n playerFound = true\n @playerRow = rowIndex\n @playerCol = colIndex\n when FINISH_CHAR then finishFound = true\n when TRACK_MARKER then raise 'Track marker playerFound in maze'\n end\n end\n end\n raise 'No player' unless playerFound\n end",
"def winner\n won = won?()\n if won != false\n if @board[won[0]] == \"X\"\n return \"X\"\n elsif @board[won[0]] == \"O\"\n return \"O\"\n end\n else\n return nil\n end\n end",
"def winner\n if won?\n win_combination = won?\n token = @board[win_combination[0]]\n return token\n end\n end",
"def winner(board)\n if win_combo = won?(board)\n board[win_combo.first]\n else\n nil\n end\nend",
"def determine_match_winner\n # CURRENTLY ASSUMES ONLY TWO COMPETITOR IDS\n # debugger\n winner_ids = games.collect { |game| game.winner_id }.compact # [1,2,2,2,1]\n grouped_winner_ids = winner_ids.group_by { |e| e }.values # [[1,1], [2,2,2]]\n\n # One winner for all matches\n if grouped_winner_ids.length == 1\n ret = grouped_winner_ids[0][0]\n # multiple winners in multiple matches\n elsif grouped_winner_ids.length > 1\n if grouped_winner_ids[0].length != grouped_winner_ids[1].length\n ret = grouped_winner_ids.max_by(&:size).try(:first)\n else # No matches recorded or tie\n ret = nil\n end\n else\n ret = nil\n end\n ret\n end",
"def winner(board)\n winner = won?(board)\n return won?(board) == false ? nil : board[winner[0]]\nend",
"def winner(board)\n if !won?(board)\n return nil\n else board[won?(board)[0]]\n end\nend",
"def winner\n if self.won?\n self.board.cells[self.won?[0]]\n elsif self.draw?\n nil\n end\n end",
"def winner\n if won?\n @board[won?[0]]\n end\n end",
"def winner(board)\n if won?(board) != false\n return board[won?(board)[0]]\n end\nend"
] |
[
"0.85002774",
"0.8436989",
"0.84034675",
"0.84034675",
"0.84034675",
"0.84034675",
"0.84034675",
"0.84034675",
"0.84034675",
"0.84034675",
"0.840281",
"0.8393305",
"0.83877844",
"0.8382617",
"0.83823586",
"0.83460945",
"0.83377886",
"0.81496006",
"0.81261563",
"0.8119364",
"0.8085256",
"0.80013674",
"0.7966379",
"0.79417145",
"0.7818039",
"0.7719088",
"0.76818943",
"0.74417126",
"0.7081154",
"0.69877446",
"0.69376564",
"0.69261587",
"0.68813896",
"0.684879",
"0.68200535",
"0.68021816",
"0.67442083",
"0.67368156",
"0.6681159",
"0.6671357",
"0.66711193",
"0.6640897",
"0.6631592",
"0.6617541",
"0.6615853",
"0.66067886",
"0.6602298",
"0.6575442",
"0.657175",
"0.65705365",
"0.65699625",
"0.65672135",
"0.6560493",
"0.6546261",
"0.65284157",
"0.65209466",
"0.6519538",
"0.65120727",
"0.65110785",
"0.65075964",
"0.6502803",
"0.64914566",
"0.6486668",
"0.64820766",
"0.6477873",
"0.64764476",
"0.64740837",
"0.64732265",
"0.6473085",
"0.64711493",
"0.64711493",
"0.6471139",
"0.64691585",
"0.6458886",
"0.64494205",
"0.6444432",
"0.6439604",
"0.6437553",
"0.64249265",
"0.64249265",
"0.6410426",
"0.640806",
"0.6392916",
"0.6391544",
"0.63895273",
"0.6386816",
"0.6380267",
"0.63709813",
"0.6363882",
"0.63610625",
"0.6360921",
"0.6360246",
"0.6359773",
"0.63561016",
"0.63553107",
"0.63519233",
"0.6351462",
"0.6349749",
"0.6347086",
"0.6346219"
] |
0.83985656
|
11
|
You may assume no duplicates in the array. Naive Approach O(N) Iterate through every element, if current element >= target return the index
|
def search_insert(arr, target)
arr.each_with_index do |element, index|
return index if element >= target
end
arr.length
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_index(array, target)\n index = 0\n found_index = nil\n\n array.each do |element|\n if element == target\n found_index = index\n end\n index += 1\n end\n\n found_index\nend",
"def search_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n mid = (start_ind + last_ind) / 2\n\n #having condition as start_ind + 1 < last_ind will be helpful in find first/last position in function\n #also avoid infinite loop when the array only has two elements\n while start_ind + 1 < last_ind do \n mid = start_ind + (last_ind - start_ind) / 2\n if (nums[mid] == target)\n last_ind = mid\n elsif nums[mid] > target\n last_ind = mid\n else\n start_ind = mid\n end\n end\n\n #find first position\n #if we wanna find the last position, check last_ind first\n if nums[start_ind] == target\n return start_ind\n end\n\n if nums[last_ind] == target\n return last_ind\n end\n\n return -1\nend",
"def slow_dance(target, tiles_array)\n tiles_array.each_with_index do |tile, idx|\n return idx if tile == target\n end\nend",
"def search_insert(nums, target)\r\n\r\n # iterate over array until target's position is found\r\n (0..nums.length-1).each do |i|\r\n if nums[i] >= target\r\n return i\r\n end\r\n end\r\n\r\n # if target is bigger than all elements in array, target belongs at the end\r\n return nums.length\r\n\r\nend",
"def sortAndSearch(arr, target)\n arr = arr.sort_by(&:to_i)\n\n startIndex = 0;\n endIndex = arr.size-1\n\n if (target < arr[startIndex] || target > arr[endIndex])\n return 'target is not in array'\n elsif (target === arr[startIndex])\n return startIndex\n elsif (target === arr[endIndex])\n return endIndex\n end\n\n while (startIndex < endIndex - 1)\n midIndex = (startIndex + endIndex) / 2\n\n if (arr[midIndex] === target)\n return midIndex\n elsif (target < arr[midIndex])\n endIndex = midIndex\n elsif (target > arr[midIndex])\n startIndex = midIndex\n end\n end\n\n return 'target is not in array'\nend",
"def find_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n\n while (start_ind + 1 < last_ind) do\n mid = start_ind + (last_ind - start_ind) / 2\n\n if nums[mid] == target\n return mid\n end\n\n if nums[start_ind] < nums[mid]\n if nums[start_ind] <= target && target <= nums[mid]\n last_ind = mid\n else\n start_ind = mid\n end\n else\n if nums[mid] <= target && target <= nums[last_ind]\n start_ind = mid\n else\n last_ind = mid\n end\n end\n end\n\n return start_ind if nums[start_ind] == target\n return last_ind if nums[last_ind] == target\n return -1\nend",
"def slow_dance(target_tile, tiles_array)\n tiles_array.each_with_index do |tile, index|\n return index if target_tile == tile\n end\n\n nil\nend",
"def linear_search(array, target)\n for i in 0..(array.length - 1)\n if array[i] == target\n return i\n end\n end\n return -1\nend",
"def find(array, target)\n array.each_with_index do |element,index|\n return index if (element == target)\n end\n nil\nend",
"def first_pos(nums, target)\n start_ind = 0\n last_ind = nums.size #will return the size if not found such element\n\n while start_ind + 1 < last_ind do\n mid = start_ind + (last_ind - start_ind) / 2\n if nums[mid] < target\n start_ind = mid\n else\n last_ind = mid\n end\n end\n\n if nums[start_ind] >= target\n return start_ind\n end\n\n return last_ind\nend",
"def awesome(arr, target)\n hash = Hash.new(0)\n i = 0\n j = i + 1\n while i < arr.size\n hash[arr[i] + arr[j]] += 1 \n if j < arr.size\n j += 1\n else\n i += 1\n if j = i + 1 > arr.length\n j = i \n else\n j = i + 1\n \n end\n\n end\n \n end\n return true if hash[target] >= 1\n false\nend",
"def slow_dance(target, array)\n\n array.each.with_index do |phrase, i|\n return i if array[i] == target \n end \n end",
"def binary_index(array, target)\n upper = array.size - 1\n lower = 0\n\n while upper >= lower\n center = lower + (upper - lower) / 2\n\n case @comparator.call(target, array[center])\n when 0\n return center\n when 1\n lower = center + 1\n when -1\n upper = center - 1\n end\n end\n lower\n end",
"def search(nums, target)\n nums.each_with_index do |num, index|\n return index if num == target\n end\n -1\nend",
"def linear_search(array, target)\n for i in 0...array.length\n if array[i] == target\n return i\n end\n end\n\n return -1\nend",
"def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end",
"def search_insert(nums, target)\n nums.each_with_index do |num, index|\n return index if num >= target\n end\n \n return nums.size\nend",
"def search_array(integers, target)\n idx = 0\n\n while idx < integers.length\n if integers[idx] == target\n return idx\n elsif idx == integers.length\n nil\n else\n idx += 1\n end\n end\nend",
"def iteration_counter(array, target)\n counter = 0\n for el in array\n counter += 1\n if el == target\n return counter\n end\n end\n counter\n end",
"def slow_dance(tile, array)\n array.each_with_index do |el, i|\n return i if el == tile\n end\nend",
"def search(target)\n i = @array.bsearch_index { |ele| ele >= target }\n !!i && @array[i] == target\n end",
"def search_insert (nums, target)\n\ti, j, m = 0, nums.length - 1, 0\n\twhile i <= j\n\t\tm = (i + j) / 2\n\t\tif nums[m] == target then return m\n\t\telsif nums[m] < target then i = m + 1\n\t\telse j = m - 1 end\n\tend\n\treturn i\nend",
"def search_insert(nums, target)\n if nums.length == 1\n if target > nums[0]\n return 1\n else\n return 0\n end\n end\n\n i = 0\n while i < nums.length\n if nums[i] == target\n return i\n elsif target < nums[i]\n return i\n end\n i += 1\n end\n\n return nums.length\nend",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend",
"def find_item(array, target)\n array.select do |elem| elem== target\n return array.index(target)+1\n end\n\n\n\n\nend",
"def binary_search(target, array)\r\n\t#Your code here\r\n\tindex = array.length / 2\r\n\tlo = 0\r\n\thi = array.length - 1\r\n\twhile array[index] != target && array.include?(target)\r\n\t\tif array[index] > target\r\n\t\t\thi = index - 1\r\n\t\t index = (lo + hi) / 2\r\n\t\telsif array[index] < target\r\n\t\t\tlo = index + 1\r\n\t\t\tindex = (lo + hi) / 2\r\n\t\tend\r\n\tend\r\n\tif array[index] == target\r\n\t\treturn index\r\n\telse\r\n\t\treturn -1\r\n\tend \r\nend",
"def search_insert(nums, target)\n idx = nums.index(target)\n return idx unless idx.nil?\n first = nums.first\n last = nums.last\n return nums.size if target > last\n return 0 if target < first\n target.downto(first).to_a.each do |e|\n idx = nums.index(e)\n return idx + 1 unless idx.nil?\n end\n return 'Not found'\nend",
"def index_of(target)\n current = @head\n index = 0\n until current.nil?\n return index if current.value == target\n\n current = current.next\n index += 1\n end\n -1\n end",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend",
"def bsearch(arr, target)\n i = 0\n j = arr.length - 1\n while i <= j\n m = (i + j) / 2\n if target < arr[m]\n j = m - 1\n elsif target > arr[m]\n i = m + 1\n elsif target == arr[m]\n return m\n end\n end\n -1\nend",
"def bs(array, target)\n start = 0\n endp = array.length \n \n while start <= endp\n mid = start + (endp - start)/2\n \n if array[mid] == target\n return mid\n end\n\n if array[mid] < target \n start = mid + 1 \n else\n endp = mid - 1\n end\n end\n return 'Not found' \nend",
"def search(array, index_target)\r\n\tindex = 0 \r\n\t\r\nwhile index < array.length \r\n\tif array[index] == index_target\r\n\t\treturn index \r\n\telse \r\n\t\tnil \r\n\tend\r\n\tindex += 1 \r\nend \r\nend",
"def bsearch(array, target)\n return nil if array.length == 1 && target != array[0]\n idx = array.length / 2\n mid_ele = array[idx]\n\n if target == mid_ele\n return idx\n elsif target < mid_ele\n return bsearch(array[0...idx], target)\n else\n if bsearch(array[idx+1..-1], target).nil?\n return nil\n else\n return idx + 1 + bsearch(array[idx+1..-1], target)\n end\n end\nend",
"def num_occur(array, target)\n return 0 if array.empty?\n next_step = num_occur(array.drop(1), target)\n \n if array.first == target\n 1 + next_step\n else\n next_step\n end\nend",
"def linear_search(sorted_array, desired_item)\n index = 0\n sorted_array.length.times do \n if desired_item == sorted_array[index]\n break \n else \n index += 1\n end\n if index > sorted_array.length - 1\n index = nil \n end\n end\n return index \nend",
"def find_index(array, target, root = build_tree(array))\n return root.index if target == root.val\n if target < root.val\n if root.left\n find_index(array, target, root.left)\n else\n -1\n end\n else target > root.val\n if root.right\n find_index(array, target, root.right)\n else\n -1\n end\n end\nend",
"def is_majority_element(nums, target)\n last_index = get_target_index(nums, target, true)\n return false if last_index == -1\n first_index = get_target_index(nums, target, false)\n (last_index - first_index + 1) > (nums.length / 2) \nend",
"def search_range(nums, target)\n emp = []\n if nums.include?(target)\n nums.each_with_index do |n,i|\n if n == target\n emp.push(i)\n end\n end\n\n emp.map {|n| [emp[0], emp[emp.length - 1]] }[0]\n\n else\n [-1,-1]\n end\nend",
"def find_a_number_in_sorted_array(target_num, array, start_index, end_index)\n \n if end_index < start_index or start_index > end_index\n return nil\n end\n \n middle_index = ((start_index + end_index)/2).floor\n found_target_index = nil \n \n if target_num < array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, start_index, middle_index - 1)\n elsif target_num > array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, middle_index + 1, end_index)\n else\n found_target_index = middle_index\n end\n \n return found_target_index\nend",
"def big_eles(arr, target)\n # new array variable\n # loop through array \n # compare each ele in arr to target\n # if greater than or equal target, add to new array\n # return new array\n\n big_arr = []\n arr.each do |num|\n if num >= target\n big_arr << num\n end\n end\n return big_arr\n\n # return arr.select {|num| num >= target}\nend",
"def binary_search(arr, target)\n return nil if !arr.include?(target)\n middle_ele = arr[arr.length / 2]\n middle_idx = arr.length / 2\n if target == middle_ele\n return middle_idx\n elsif target > middle_ele\n binary_search(arr[middle_idx+1..-1], target) + arr[0..middle_idx].length\n else\n binary_search(arr[0...middle_idx], target)\n end\nend",
"def find_element(array, target, low, high)\n return -1 if high < low\n mid = (low + high)/2\n return mid if target == array[mid]\n if array[low] <= array[mid]\n if target >= array[low] && target <= array[mid]\n return find_element(array, target, low, mid-1)\n end\n return find_element(array, target, mid+1, high)\n end\n if target >= array[mid] && target <= array[high]\n return find_element(array, target, mid+1, high)\n end\n return find_element(array, target, low, mid-1)\nend",
"def search_insert(nums, target)\n start_ind = 0\n last_ind = nums.size \n\n while start_ind + 1 < last_ind do\n mid = start_ind + (last_ind - start_ind) / 2\n if nums[mid] == target\n return mid\n end\n\n if nums[mid] < target\n start_ind = mid\n else\n last_ind = mid\n end\n end\n\n if nums[start_ind] >= target\n return start_ind\n end\n\n return last_ind\nend",
"def binary_search(target, array)\n length = array.length\n center = length / 2\n first = 0\n last = length - 1\n\n while first <= last\n if array[center] == target\n return array.index(target)\n elsif array[center] < target\n first = center + 1\n center = (first + last) / 2\n else\n last = center - 1\n center = (first + last) / 2\n end\n end\n\n return -1\nend",
"def binary_search(target, collection, min_index = 0, max_index = collection.size - 1)\n return nil if collection.empty?\n loop do\n return nil if max_index < min_index\n index_to_check = mid_point(min_index, max_index)\n return index_to_check if collection[index_to_check] == target\n min_index = index_to_check + 1 if collection[index_to_check] < target\n max_index = index_to_check - 1 if collection[index_to_check] > target\n end\nend",
"def num_occur(array, target)\n @base ||= 0\n @base += 1 if array[0] == target\n num_occur(array.drop(1),target) unless array.empty?\n @base\nend",
"def find_index_of_element(arr=[120, 34, 12, 127, 12, 123, 140])\n results_arr = Array.new\n arr.each_with_index do |el, i|\n results_arr.push(i) if (arr[i] > arr[0]) && (arr[i] < arr[-1])\n end\n print results_arr.last\nend",
"def get_index_of_position(target_position, ary)\n ary.each_index do |i|\n current_position = ary[i][1]\n if current_position == target_position\n return i\n end\n end\n end",
"def slow_dance(tile, tiles_array)\n tiles_array.each_with_index do |direction, idx|\n return idx if direction == tile\n end\nend",
"def binary_search(arr, target)\n return nil if arr.empty?\n probe_index = arr.size / 2\n probe_ele = arr[probe_index]\n\n case probe_ele <=> target\n when 1\n left_arr = arr.take(probe_index) \n return binary_search(left_arr,target)\n when 0 \n return probe_index\n when -1\n compensated_index = (probe_index + 1)\n right_arr = arr.drop(compensated_index)\n return nil if binary_search(right_arr,target).nil?\n return binary_search(right_arr,target) + compensated_index\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length < 1\n # return nil if target > arr.max || target < arr.min\n compare_index = arr.length / 2\n match = target <=> arr[compare_index]\n case match\n when -1\n bsearch(arr.take(compare_index), target)\n when 0\n compare_index\n else\n result = bsearch(arr.drop(compare_index+1), target)\n return nil if result.nil?\n result + compare_index + 1\n end\nend",
"def search_insert(nums, target)\n @start_index = 0\n @end_index = nums.length - 1\n if target > nums.last\n return nums.length\n elsif target < nums.first\n return 0\n else\n while @start_index <= @end_index\n @mid_index = (@end_index + @start_index) / 2\n if nums[@mid_index] == target\n return @mid_index\n elsif nums[@mid_index] < target\n @start_index += 1\n else\n @end_index -= 1\n end\n \n end\n return nums.bsearch_index{|e| e > target}\n end\nend",
"def search_array2(ary, target)\n i = 0\n match = nil\n ary.each do |x|\n case\n when x == target then match = i\n else i += 1\n end\n end\n p match\nend",
"def binary_search(arr, target)\n binary_search_helper(arr, target, 0, arr.length - 1)\nend",
"def bsearch(sorted_array, target)\n return nil if sorted_array.empty?\n \n i_mid = (sorted_array.length-1) / 2\n mid = sorted_array[i_mid]\n \n if target == mid\n i = i_mid\n elsif target < mid\n i = bsearch(sorted_array[0...i_mid], target)\n else\n i = bsearch(sorted_array[i_mid + 1..-1], target)\n i += mid + 1 if i\n end\n \n i\nend",
"def num_occur(array, target)\n array[0] == target ? val = 1 : val = 0\n return val if array.length == 1\n\n val + num_occur(array.drop(1), target)\nend",
"def slow_dance(direction, arr)\n arr.each_with_index do |el, i|\n return i if el == direction\n end\nend",
"def search_insert(nums, target)\n return 0 if nums.length == 0 \n if nums.include?(target)\n nums.each_with_index do |val ,index| \n if val == target\n return index\n end\n end\n else\n if target > nums[-1] \n return (nums.length - 1) + 1\n elsif target < nums[0]\n return 0\n elsif target.between?(nums[0],nums[-1])\n i = 0 \n j = 1\n while i < nums.length - 1 do \n if target.between?(nums[i],nums[j])\n return i + 1\n end\n i += 1\n j += 1\n end\n end\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length < 1\n\n middle_idx = arr.length / 2\n return_idx = 0\n\n return middle_idx if arr[middle_idx] == target\n\n if target < arr[middle_idx]\n index = bsearch(arr[0...middle_idx], target)\n index.nil? ? (return nil) : return_idx += index\n else\n index = bsearch(arr[middle_idx + 1..-1], target)\n index.nil? ? (return nil) : (return_idx = (middle_idx + index + 1))\n end\n\n return_idx\nend",
"def index_for_insert(element, arr)\n arr.each_with_index { |num,i| if element <= num then return i end}\n -1\nend",
"def slow_dance(target, tiles)\n tiles.each_with_index do |dir, idx|\n return idx if dir == target\n end\nend",
"def do_search(target_value, array)\n min = 0\n max = array.length - 1\n\n binary_search(target_value, array, min, max)\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n mid_idx = array.length / 2\n mid_ele = array[mid_idx]\n\n return mid_idx if target == mid_ele\n\n if target < mid_ele\n sub_arr = array[0...mid_idx]\n return bsearch(sub_arr, target)\n else\n sub_arr = array[mid_idx + 1..-1]\n next_search = bsearch(sub_arr, target)\n return nil if next_search == nil\n return mid_idx + 1 + next_search\n end\nend",
"def nearest_larger(arr,i)\n target = arr[i]\n \n up_idx = i\n down_idx = i\n\n until up_idx == arr.length-1 && down_idx == 0\n \n if down_idx !=0\n down_idx -= 1\n end\n\n if up_idx != arr.length-1\n up_idx += 1\n end\n\n if arr[down_idx] > target\n return down_idx\n elsif arr[up_idx] > target\n return up_idx\n end\n\n end\nnil\nend",
"def nums(target, *array)\n\tarray.each_with_index do |a, x|\n\t\tarray.each_with_index do |b, y|\n\t\t\tif x > y\n\t\t\t\tif a + b == target\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn false\nend",
"def binary_search(arr, target, idx_puls = 0)\n mid = arr.length / 2\n return mid + idx_puls if arr[mid] == target\n return nil if arr.length == 1\n\n if arr[mid] < target\n binary_search(arr[(mid + 1)..-1], target, mid + 1)\n else\n binary_search(arr[0...mid], target, idx_puls)\n end\n\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 get_index_of_id(target_id, ary)\n ary.each_index do |i|\n current_id = ary[i][0]\n if current_id == target_id\n return i\n end\n end\n end",
"def slow_dance(direction, array)\n array.each_with_index do |el, idx|\n return idx if el == direction\n end\nend",
"def bsearch(arr, target)\n return nil if arr.empty?\n mid_idx = arr.length / 2\n pivot = arr[mid_idx]\n return mid_idx if pivot == target\n if pivot > target\n bsearch(arr[0...mid_idx], target)\n else\n result = bsearch(arr[mid_idx + 1..-1], target)\n if result == nil\n nil\n else\n mid_idx + 1 + result\n end\n end\nend",
"def search_range(nums, target)\n low = search(nums, target)\n nums[low] == target ? [low, search(nums, target + 1) - 1] : [-1, -1] \nend",
"def bsearch(array, target)\n return nil if array.length <= 1 && array[0] != target\n\n mid_idx = (array.length - 1) / 2\n if array[mid_idx] == target\n mid_idx\n elsif array[mid_idx] < target\n response = bsearch(array[(mid_idx + 1)..-1], target)\n response.nil? ? nil : response + mid_idx + 1\n else\n bsearch(array[0...mid_idx], target)\n end\nend",
"def okay_two_sum?(arr, target)\n sorted = quick_sort(arr)\n\n arr.each_with_index do |el, idx|\n p current = target - el\n bruh = bsearch(arr, current)\n next if bruh == idx\n return true unless bruh.nil?\n end\n\n return false\nend",
"def bsearch(arr, target)\n return nil if arr.length == 1 && arr[0] != target\n mid_i = arr.length / 2\n return mid_i if arr[mid_i] == target\n\n low_arr = arr[0...mid_i]\n high_arr = arr[mid_i+1..-1]\n\n if arr[mid_i] > target\n bsearch(low_arr, target) \n elsif bsearch(high_arr, target) != nil\n low_arr.length + 1 + bsearch(high_arr, target)\n end\n\nend",
"def find_dup(arr)\n sorted = arr.sort\n num_arr = sorted.select.with_index do |el, idx|\n current_el = sorted[idx]\n if current_el == sorted[idx + 1]\n current_el\n end\n end\n num_arr[0]\nend",
"def pick_index()\n target = rand(@array[-1][0])\n @array.bsearch { |x, _| x > target }.last\n end",
"def solve(nums, target)\n nums.each_with_index do |e, i|\n nums.each_with_index do |e_, i_|\n return [i, i_] if ((e + e_ == target) && (i != i_))\n end\n end\nend",
"def num_occur(array, target)\n if array.empty?\n return 0\n end\n \n if array[-1] == target\n return num_occur(array[0...-1], target) + 1\n else\n return num_occur(array[0...-1], target)\n end\n \nend",
"def num_occur(array, target)\n dup = array.dup\n if dup.length == 1 \n return (dup.pop == target) ? 1 : 0\n end\n increment_count_by = (dup.pop == target) ? 1 : 0\n count = increment_count_by + num_occur(dup, target)\nend",
"def binary_search(array, target)\n lower_bound = 0\n upper_bound = array.length - 1\n while lower_bound <= upper_bound\n midpoint = (lower_bound + upper_bound) / 2\n value_at_midpoint = array[midpoint]\n if target = value_at_midpoint\n return midpoint\n elsif target > value_at_midpoint\n lower_bound = midpoint + 1\n elsif target < value_at_midpoint\n upper_bound = midpoint - 1\n end\n end\n return nil\nend",
"def slow_dance(direction, array)\n array.each_with_index do |tile, idx|\n return idx if tile == direction\n end\nend",
"def two_sum_sort(array, target)\n array = array.sort\n array.each_with_index do |val, idx|\n a = array.bsearch_index do |el|\n el == target - val\n end\n if a != idx && a\n return true\n end\n end\n false\nend",
"def binary_search(array, target)\n temp = array.sort\n middle = temp.length / 2\n first = 0\n last = temp.length - 1\n while first < last\n if temp[middle] == target\n return middle\n elsif temp[middle] < target\n first = middle + 1\n middle = (first + last) / 2\n else\n last = middle - 1\n middle = (first + last) / 2\n end\n end\n return -1\nend",
"def slow_dance(dir, array)\n array.each.with_index do |el, idx|\n return idx if dir == el\n end\nend",
"def slow_dance(direction, array)\n array.each_with_index do |tile, idx|\n return idx if tile == direction\n end\n\n nil\nend",
"def shifted_binary_search(arr, target)\n shifted_binary_search_helper(arr, target, 0, arr.length - 1)\nend",
"def shifted_binary_search(arr, target)\n shifted_binary_search_helper(arr, target, 0, arr.length - 1)\nend",
"def binary_search(array, target)\n return nil if array.empty?\n\n middle_idx = array.length/2\n\n case target <=> array[middle_idx]\n\n when -1\n binary_search(array.take(middle_idx), target)\n when 0\n return middle_idx\n when 1\n binary_search(array[middle_idx..-1], target)\n end\n\nend",
"def slow_dance(dir, arr)\n arr.each_with_index do |el, idx|\n return idx if dir == el\n end\nend",
"def shifted_binary_search(array, target)\n return shifted_binarysearch_helper(array, target, 0, array.length - 1)\nend",
"def is_majority_element(nums, target)\n return false if !nums.include?(target)\n @last_element = target == nums.last ? nums.length : nums.bsearch_index { |element| element > target}\n @first_element = nums.bsearch_index { |element| element == target}\n (@last_element - @first_element) > (nums.length / 2)\nend",
"def search(nums, target)\n left = 0\n right = nums.length - 1\n\n while left <= right\n pivot = left + (right - left) / 2\n\n return pivot if nums[pivot] == target\n\n if target < nums[pivot]\n right = pivot - 1\n else\n left = pivot + 1\n end\n end\n\n -1\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n middle_idx = array.length / 2\n if array[middle_idx] == target\n return middle_idx\n elsif array[middle_idx] > target\n bsearch(array[0...middle_idx], target)\n else\n result = bsearch(array[(middle_idx+1)..-1], target)\n if result.is_a?(Fixnum)\n result + middle_idx + 1\n else\n nil\n end\n end\nend",
"def okay_two_sum?(arr, target)\n sorted_arr = arr.sort\n sorted_arr.each.with_index do |el, idx|\n target_pair = target - el\n if sorted_arr[idx+1..-1].bsearch{|n| n >= target_pair } == target_pair\n p target_pair\n return true\n end\n end\n false\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 search_range(nums, target)\n return [-1, -1] if nums.empty?\n\n start_pos = first_pos(nums, target)\n last_pos = first_pos(nums, target + 1) - 1\n\n if (start_pos == nums.size || nums[start_pos] != target)\n return [-1, -1]\n else\n return [start_pos, [start_pos, last_pos].max]\n end\nend",
"def mystery_method_iterative(arr, val)\n\n # Returns nothing if no array or an empty array is passed\n return nil if arr.nil? || arr.length == 0\n\n # Determine middle, \"low\" index, and \"high\" index points\n mid = arr.length / 2\n l = 0\n h = arr.length - 1\n\n # Iterate through the extent of indices in the array starting at the beginning\n while l <= h\n\n # First check, does value at middle index equal our target `val`, if so return for a\n # quick win. Index found.\n if arr[mid] == val\n return mid\n\n # Second, is our middle index's value less than target `val`, check the first half\n # of the array.\n elsif arr[mid] < val\n l = mid + 1\n mid = (l + h) / 2\n\n # Otherwise, check the second half of the array\n else\n h = mid - 1\n mid = (l + h) / 2\n end\n\n end\n\n return mid\nend",
"def okay_two_sum?(arr, target)\n\n arr.each do |ele1| # O(n)\n # debugger\n found = arr.bsearch do |ele2|\n # debugger\n (target - ele1) == ele2\n end\n return true unless found.nil? || arr.index(found) == arr.index(ele1)\n end\n false\nend",
"def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend",
"def binary_search(array, target)\n return nil if array.length == 1 && array[0] != target\n mid = array.length / 2\n\n if target == array[mid]\n return mid\n elsif target < array[mid]\n return binary_search(array[0...mid], target)\n else\n found = binary_search(array[mid+1..-1], target)\n return found.nil? ? nil : mid + 1 + found\n end\nend"
] |
[
"0.7710215",
"0.74841803",
"0.73470235",
"0.7325671",
"0.73082954",
"0.72499514",
"0.7139708",
"0.70808256",
"0.7079577",
"0.7078256",
"0.70670986",
"0.7055596",
"0.70440763",
"0.70414275",
"0.7037703",
"0.7031434",
"0.7027173",
"0.69715285",
"0.6952183",
"0.69246745",
"0.6905745",
"0.6898798",
"0.6898469",
"0.6891525",
"0.6882917",
"0.68576527",
"0.6854432",
"0.6821108",
"0.6820752",
"0.68202925",
"0.6815391",
"0.6803807",
"0.67990446",
"0.6797333",
"0.6791903",
"0.67635155",
"0.67493653",
"0.67457354",
"0.67447156",
"0.67133707",
"0.6702848",
"0.6699258",
"0.66795725",
"0.66785693",
"0.6642798",
"0.6629942",
"0.6623742",
"0.6616358",
"0.6612235",
"0.6604268",
"0.65926564",
"0.6590009",
"0.6587849",
"0.6586147",
"0.65671116",
"0.65599054",
"0.6553679",
"0.6543351",
"0.6538464",
"0.6527296",
"0.6521541",
"0.6517789",
"0.6514529",
"0.6512419",
"0.6512248",
"0.6505842",
"0.6501574",
"0.64912766",
"0.64904296",
"0.6483692",
"0.64825475",
"0.64771616",
"0.647308",
"0.6461119",
"0.64605606",
"0.64497644",
"0.6445265",
"0.6441539",
"0.6441188",
"0.64407426",
"0.6437945",
"0.6437918",
"0.64335746",
"0.64274263",
"0.64261246",
"0.6422574",
"0.6422574",
"0.6419815",
"0.64175475",
"0.64170444",
"0.64092976",
"0.6404843",
"0.6402222",
"0.6391142",
"0.6384497",
"0.63786215",
"0.6376551",
"0.6376389",
"0.637259",
"0.63639605"
] |
0.73555815
|
2
|
Returns true or false if the player is logged in.
|
def logged_in?
!session[:player_id].nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def logged_in?\n !current_player.nil?\n end",
"def logged_in?\n !current_player.nil?\n end",
"def logged_in?\n @current_player.is_a?(Player)\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 loggedin?\n @session.nil? ? false : (return true)\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 !session[:user_id].nil?\n return true\n else\n return false\n end\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 @logged_in\n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n !!session[:logged_in]\n end",
"def logged_in?\n return false unless @auth_header\n true\n end",
"def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n @logged_in ? true : false\n end",
"def logged_in?\n !!current_ma_user\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].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 !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"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?\r\n current_user != :false\r\n end",
"def logged_in?\n\t\t !!current_user\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def logged_in?\n !@session_id.nil?\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 logged_in?\n current_user != :false \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 !!logged_in_user \n end",
"def logged_in?\n !!session[:user_id]\n # !!@current_user\n end",
"def logged_in?\n current_user.present?\n end",
"def logged_in?\n return(logged_in_from_session? || logged_in_from_cookie?)\n end",
"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 session[:authorized] == true\n end",
"def _is_login\n p session[:user]\n session[:user] ? true : false\n end",
"def logged_in?\n\t !session[:user_id].nil?\n\tend",
"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\t\t!current_member.nil?\n\tend",
"def logged_in?\n current_user ? true : false;\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 return session[:user_id].present?\n end",
"def loggedIn?\n return @logged_in\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n if current_user\n true\n else \n false\n end\n end",
"def logged_in?\n !session[:user_id].nil? #&& User.find(session[:user_id]).owns(@current_site)\n end",
"def logged_in?\r\n\t\t!current_user.nil?\r\n\tend",
"def logged_in?\n \t!current_user.nil? && session[:user_id]\n\tend",
"def logged_in?\n current_account != :false && current_account.active?\n end",
"def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end",
"def logged_in?\n current_user_id.to_i > 0\n end",
"def logged_in?\n current_user.present? # True neu user login\n end",
"def logged_in?\n\t session[:login] != nil\n\tend",
"def logged_in?\n !current_user_session.nil?\n end",
"def logged_in?\n !current_user_session.nil?\n end",
"def is_logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n\t\t!current_golfer.nil?\n\tend",
"def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend",
"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 return session['current_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\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"
] |
[
"0.86407477",
"0.86407477",
"0.84310234",
"0.81205475",
"0.8090825",
"0.8061363",
"0.8061363",
"0.80012524",
"0.79322904",
"0.79322904",
"0.79322904",
"0.79322904",
"0.79173934",
"0.7892113",
"0.7875051",
"0.7867881",
"0.7853163",
"0.78527623",
"0.78527623",
"0.7838977",
"0.78366286",
"0.7833668",
"0.78327894",
"0.78299737",
"0.78299737",
"0.78299737",
"0.78299737",
"0.7815195",
"0.7815195",
"0.781261",
"0.7811941",
"0.77915037",
"0.7790855",
"0.77840036",
"0.778025",
"0.77632755",
"0.77569693",
"0.77569693",
"0.77569693",
"0.77569693",
"0.77569693",
"0.77569693",
"0.77569693",
"0.77569693",
"0.77569693",
"0.77457255",
"0.7734071",
"0.7720695",
"0.770562",
"0.7696776",
"0.7695809",
"0.76935196",
"0.7690088",
"0.7689561",
"0.76894283",
"0.7688533",
"0.7687728",
"0.76862735",
"0.76823276",
"0.76806223",
"0.7680086",
"0.7678985",
"0.7678745",
"0.76754504",
"0.76690716",
"0.766712",
"0.766461",
"0.7664203",
"0.7663632",
"0.7663161",
"0.76591533",
"0.76591533",
"0.7658996",
"0.76554585",
"0.76537335",
"0.76514226",
"0.76514226",
"0.76514226",
"0.76514226",
"0.7648068",
"0.76465285",
"0.7645925",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358",
"0.7645358"
] |
0.8433673
|
2
|
Formats the ActivationRecord for the logger.
|
def record ar, mode
ad = ar.advised
msg = nil
case mode
when :before, :after
msg = ad.log_prefix(logger, ar).to_s
msg = msg.dup if msg.frozen?
ar[:args] ||= format(ar.args, :args) if ad[:log_args] != false
ar[:meth] ||= "#{ad.meth_to_s} #{ar.rcvr.class}"
msg << "#{format(ar[:"time_#{mode}"], :time)} #{ar[:meth]}"
msg << " #{format(ar.rcvr, :rcvr)}" if ad[:log_rcvr]
msg << " ( #{ar[:args]} )" if ar[:args]
end
case mode
when :before
msg << " {"
when :after
msg << " }"
if ar.error
msg << " #{format(ar[:error], :error )}" if ad[:log_error] != false
else
msg << " #{format(ar[:result], :result)}" if ad[:log_result] != false
end
end
msg
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def log_formatter; end",
"def log_formatter; end",
"def to_log_format\n @log_format ||= begin\n attributes = []\n attributes << \"#{LOG_ATTR_ENV}=#{env}\" unless env.nil?\n attributes << \"#{LOG_ATTR_SERVICE}=#{service}\"\n attributes << \"#{LOG_ATTR_VERSION}=#{version}\" unless version.nil?\n attributes << \"#{LOG_ATTR_TRACE_ID}=#{trace_id}\"\n attributes << \"#{LOG_ATTR_SPAN_ID}=#{span_id}\"\n attributes << \"#{LOG_ATTR_SOURCE}=#{Core::Logging::Ext::DD_SOURCE}\"\n attributes.join(' ')\n end\n end",
"def record_format\n @record_format ||= make_record_description if record_describer\n end",
"def format_agent_activity\n @agent_activity_log.group_by(:agent_uuid).map do |agent_uuid, records|\n XES::Trace.new.tap do |trace|\n trace.attributes << XES.string(\"pione:traceType\", \"agent_activity\")\n trace.identity_id = agent_uuid\n trace.events = records.sort{|a, b| a.timestamp <=> b.timestamp}.map do |record|\n XES::Event.new.tap do |event|\n event.concept_name = record.state\n event.org_resource = record.agent_type\n event.time_timestamp = record.timestamp\n event.lifecycle_transition = record.transition\n end\n end\n end\n end.flatten\n end",
"def format_conversion\n { account_id: self.account_id.to_s, app_id: self.app_id.to_s, actor_id: self.actor_id.to_s, properties: self.properties, time: self.updated_at}\n rescue => e\n Rails.logger.error(\"**** ERROR **** #{e.message}\")\n {}\n end",
"def log_formatter=(_arg0); end",
"def log_formatter=(_arg0); end",
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def format(log_record)\n msg_txt = self.formatMessage(log_record)\n msg_txt = msg_proc.call(log_record, msg_txt) if msg_proc\n return unless msg_txt\n\n lvl = @level_labels[log_record.level]\n indent = @indent || 0\n spacer = ''\n wrap_width = @width - indent\n if log_record.level.intValue < JavaUtilLogger::Level::INFO.intValue\n spacer = ' '\n wrap_width -= 2\n end\n msg = wrap_width > 0 ? Console.wrap_text(msg_txt, wrap_width) : [msg_txt]\n sb = java.lang.StringBuilder.new()\n msg.each_with_index do |line, i|\n if i == 0\n fmt = java.lang.String.format(@format_string,\n log_record.millis,\n log_record.logger_name,\n log_record.logger_name,\n lvl,\n msg[i],\n log_record.thrown,\n spacer)\n else\n fmt = java.lang.String.format(@format_string,\n log_record.millis, '', '', '', msg[i], nil, spacer)\n end\n sb.append(fmt)\n sb.append(LINE_END) if @width < 0 || fmt.length < @width\n end\n sb.toString()\n end",
"def format(tag, time, record)\n newrecord = {}\n\n begin\n if record['severity']\n newrecord['severity'] = Integer(record['severity'])\n else\n newrecord['severity'] = @severity\n end\n rescue\n newrecord['severity'] = @severity\n end\n\n newrecord['type'] = tag.to_s\n newrecord['agent_time'] = time.to_s\n newrecord['manager'] = @manager\n newrecord['class'] = @source\n newrecord['source'] = @hostname\n newrecord['description'] = record['message']\n newrecord['custom_info'] = record\n\n newrecord.to_msgpack\n end",
"def to_format\n @format ||= lookup.last \n end",
"def create_for(record:)\n Rails.logger.info \"[zizia] event: record_import_started, batch_id: #{batch_id}, collection_id: #{collection_id}, record_title: #{record.respond_to?(:title) ? record.title : record}\"\n\n created = import_type.new\n attrs = process_attrs(record: record)\n actor_env = Hyrax::Actors::Environment.new(created,\n ::Ability.new(depositor),\n attrs)\n\n if Hyrax::CurationConcern.actor.create(actor_env)\n Rails.logger.info \"[zizia] event: record_created, batch_id: #{batch_id}, record_id: #{created.id}, collection_id: #{collection_id}, record_title: #{attrs[:title]&.first}\"\n csv_import_detail.success_count += 1\n # CU Boulder export of new generated URL and use Replaces to generate a map from Bepress to Samvera redirects\n new_url = work_url(created.id,attrs[:admin_set_id])\n open(Rails.root.join('tmp',\"load_batch#{batch_id}_processed.out\"), 'a') do |f|\n f << \"#{batch_id} , #{created.id} , #{new_url} , #{attrs[:replaces]} , #{attrs[:title]&.first} \\n\"\n end\n replace= \"#{attrs[:replaces]}\"\n if Rails.env.production?\n save_cybercom(replace.split('|')[0],replace.split('|')[1],new_url)\n end\n else\n # Log Errors for batch import\n open(Rails.root.join('tmp',\"load_batch#{batch_id}_errors.out\"), 'a') do |f|\n f << \"=========================================\\n\"\n created.errors.each do |attr, msg|\n Rails.logger.error \"[zizia] event: validation_failed, batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: record_title: #{attrs[:title] ? attrs[:title] : attrs}\"\n f << \"ValidationError: batch_id: #{batch_id}, collection_id: #{collection_id}, attribute: #{attr.capitalize}, message: #{msg}, record_title: record_title: #{attrs[:title] ? attrs[:title] : attrs}\\n\"\n end\n f << \"=========================================\\n\"\n end\n csv_import_detail.failure_count += 1\n end\n csv_import_detail.save\n end",
"def format\n @_format\n end",
"def formatter \n original_formatter = Logger::Formatter.new\n Proc.new do |severity, datetime, progname, msg|\n original_formatter.call(severity, datetime, \n \"#{progname}##{caller_method}\",\n msg.dump)\n end\n end",
"def format\n @format\n end",
"def to_line(record)\n str = \"\"\n str = \"# Puppet Name: #{record[:name]}\\n\" if record[:name]\n if record[:environment] and record[:environment] != :absent and record[:environment] != [:absent]\n record[:environment].each do |env|\n str += env + \"\\n\"\n end\n end\n\n if record[:special]\n str += \"@#{record[:special]} #{record[:command]}\"\n else\n str += join(record)\n end\n str\n end",
"def format\n collect { |a| a.format }\n end",
"def to_audit_event\n {\n user_name: to_s,\n user_email: email\n }\n end",
"def formatter()\n @formatter\n end",
"def format_rule_process\n XES::Trace.new.tap do |trace|\n trace.concept_name = \"rule_process %s\" % Util::UUID.generate\n trace.attributes << XES.string(\"pione:traceType\", \"rule_process\")\n trace.events = @rule_process_log.records.map do |record|\n XES::Event.new.tap do |event|\n # standard attributes\n event.concept_name = record.name\n event.org_resource = record.caller\n event.time_timestamp = record.timestamp\n event.lifecycle_transition = record.transition\n\n # pione extension attributes\n event.attributes << XES.string(\"pione:ruleType\", record.rule_type)\n end\n end\n end\n end",
"def set_audit_informations\n self.event_id = routing_key.split('.')[-3, 2].join(':')\n self.log_type = routing_key.split('.').slice(1, 2).join('.')\n self.routing_type = routing_key.split('.')[3]\n end",
"def default_format(f)\n @default_formatter = Log4r::PatternFormatter.new(:pattern => f)\n\n #\n # Set all current outputters\n #\n result.outputters.each do |o|\n o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter)\n end\n\n @default_formatter\n end",
"def process_log(record)\n record = record.merge(transition: \"complete\") unless record.transition\n write(TupleSpace::ProcessLogTuple.new(record))\n end",
"def emailable_record(record, email_format)\n RecordDecorator.email(record, self, email_format)\n end",
"def formatters=(formatters); end",
"def format_attributes\n self.email = self.email.downcase\n self.first_name = self.first_name.titleize\n self.last_name = self.last_name.titleize\n self.full_name = \"#{self.first_name} #{self.last_name}\"\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def formatters; end",
"def format\n @format ||= properties.format.new self\n end",
"def formatter\n @formatter.formatter\n end",
"def format(tag, time, record)\n # [tag, time, record].to_json + \"\\n\"\n ## Alternatively, use msgpack to serialize the object.\n [tag, time, record].to_msgpack\n end",
"def get_formatter_class\n Formatter::V0::Customer\n end",
"def join\n super(self.class.format)\n end",
"def record\n return @decorated_record if @decorated_record\n decoration_fn = self.class.instance_variable_get(:@decoration_fn)\n decoration_fn ||= -> (rec) { rec } # Default is no-op decoration\n @decorated_record = decoration_fn.call(@record)\n end",
"def create_formatter(config)\n log_format = get_format_config(config)\n formatter = Log4r::PatternFormatter.new(:pattern => log_format)\n return formatter\n end",
"def formatter=(_arg0); end",
"def formatter=(_arg0); end",
"def formatter=(_arg0); end",
"def header_format; self.underline end",
"def format\n @format ||= {}\n end",
"def __format(params)\n # Define singleton method.\n instance_eval(_format_method, __FILE__, __LINE__)\n # Delegate to singleton method.\n __format(params)\n end",
"def formatted format\n {:status => status, :error => exception.message}.send to_format(format)\n end",
"def record_attributes_hash\n { activated_at: nil }\n end",
"def format!; end",
"def format_records(records)\n records.each do |record|\n report record\n end\n end",
"def format\n return @format\n end",
"def format\n return @format\n end",
"def format\n return @format\n end",
"def format_for_alexa(custom_types)\n wrap_in_name_values_hash(wrap_in_name_hash(custom_types))\n end",
"def datetime_format\n @logger.first.datetime_format\n end",
"def for_config\n #.iso8601 #=> 2015-11-13T18:00:00+01:00\n fmt = \"%F %T %z\" #=> 2015-11-25 18:00:00 +0100\n #fmt = \"%d.%m.%Y %T %z\" #=> 13.11.2015 18:00:00 +0100\n #puts deactivated_at.strftime(fmt)\n\n {\n account_name => {\n \"email\" => account_email,\n \"activated\" => activated?,\n \"activation_time\" => activated_at.strftime(fmt),\n \"deactivation_time\" => deactivated_at.strftime(fmt),\n \"message\" => message\n }\n }\n end",
"def format\n @item_attributes.first.format.collect {|f| f.to_s}\n end",
"def format_message(severity, timestamp, progname, msg)\n \"#{AUTHORIZATION_SYSTEM_LOG_MSG_PREFIX} #{timestamp.to_formatted_s(:db)} #{severity} #{msg}\\n\" \n end",
"def formats; end",
"def formats; end",
"def to_line\n [@location.join(', '), @details.join(': ')].join(' - ')\n end",
"def formatter\n raise NotImplementedError\n end",
"def format\n f = @item_attributes.first.format\n f.to_s unless f.nil?\n end",
"def format(tag, time, record)\n [tag, time, record].to_json + \"\\n\"\n ## Alternatively, use msgpack to serialize the object.\n # [tag, time, record].to_msgpack\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 append_info_to_payload(payload)\n super\n request_logging_context_data.each do |key, value|\n payload[key] = BlackSquareLoggingRails.format_value(value)\n end\n\n # Add request parameters to lograge output when the logger is in DEBUG mode\n if BlackSquareLoggingRails.enable_request_parameter_logging\n parameters = request.filtered_parameters.except(*ActionController::LogSubscriber::INTERNAL_PARAMS)\n payload[:request_params] = BlackSquareLoggingRails.format_value(parameters) if parameters.any?\n end\n end",
"def format_info\n attributes.with_indifferent_access\n end",
"def format(tag, time, record)\n [tag, time, record].to_msgpack\n end",
"def formatter\n raw_data['formatter']\n end",
"def format\n @ole.Format\n end",
"def format\n @ole.Format\n end",
"def append_info_to_payload(payload)\n super\n\n # Use the request ID generated by the aamzon ALB, if available\n payload[:request_id] = request.headers.fetch(\"X-Amzn-Trace-Id\", request.request_id)\n payload[:remote_ip] = request.remote_ip\n payload[:user_agent] = request.user_agent\n end",
"def to_format(formatter_klass, options={})\n formatter_klass.new(self, options).output\n end",
"def as_line\n [id, legal_name, name, email, form].join(':')\n end",
"def b_format_form\n \"#{id} - #{cert_ope}\"\n end",
"def format(tag, time, record)\n @packer.pack([tag, time, record]).to_s\n end",
"def emit record\n puts record.to_flat.join(\"\\t\")\n end",
"def call(log, logger)\n super(log, logger).to_json\n end",
"def format(tag, time, record)\n return [tag, record].to_msgpack\n end",
"def format(tag, time, record)\n return [tag, record].to_msgpack\n end",
"def formatter fmt\n @formatter = fmt\n end",
"def create\n @tap_log_record = current_account.tap_log_records.new(params[:tap_log_record])\n authorize! :create, @tap_log_record\n\n respond_to do |format|\n if @tap_log_record.save\n format.html { redirect_to(@tap_log_record, :notice => 'Tap log record was successfully created.') }\n format.xml { render :xml => @tap_log_record, :status => :created, :location => @tap_log_record }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tap_log_record.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def internal_format\n selfclass.send(:internal_format)\n end",
"def new_record_with_decoration(params = {})\n decorate(new_record_without_decoration(params))\n end",
"def format_statement\n transaction_log.map do |transaction|\n date = transaction.time.strftime(\"%d/%m/%Y\")\n puts \"#{date} || #{transaction.credit} || #{transaction.debit} || #{transaction.balance}\"\n end\n end",
"def to_s\n klass.fields.map { |field_def|\n field_name = field_def.name.to_s\n v = @fields[ field_name.to_sym ].to_s\n\n field_def.pass_through_formatters(\n field_def.is_padding? ? \"\" : v\n )\n }.pack(klass.pack_format)\n end",
"def history_log_attributes\n {}\n end",
"def debug_exception_response_format=(_arg0); end",
"def debug_exception_response_format=(_arg0); end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n if new_record?\n return\n else\n update_columns(activation_digest: User.digest(activation_token))\n end \n end",
"def serializer\n PaperTrail.config.serializer\n end",
"def format_hash(event)\n event.attributes.symbolize_keys\n end",
"def canonical_log logevent\n write(format(logevent))\n end",
"def format_task_process\n XES::Trace.new.tap do |trace|\n trace.concept_name = \"task process %s\" % Util::UUID.generate\n trace.attributes << XES.string(\"pione:traceType\", \"task_process\")\n trace.events = @task_process_log.records.map do |record|\n XES::Event.new.tap do |event|\n # standard attributes\n event.concept_name = record.name\n # event.org_resource = record.caller\n event.time_timestamp = record.timestamp\n event.lifecycle_transition = record.transition\n\n # pione extension attributes\n event.attributes << XES.string(\"pione:ruleType\", record.rule_type)\n event.attributes << XES.string(\"pione:inputs\", record.inputs)\n event.attributes << XES.string(\"pione:parameters\", record.parameters)\n end\n end\n end\n end",
"def format(tag, time, record)\n [tag, time, record].to_msgpack\n end"
] |
[
"0.5497052",
"0.5497052",
"0.54417574",
"0.5405089",
"0.50963205",
"0.50928205",
"0.498088",
"0.498088",
"0.49433672",
"0.49433672",
"0.49433672",
"0.49260613",
"0.49142674",
"0.4898576",
"0.4897965",
"0.4830425",
"0.4753048",
"0.47373948",
"0.47322837",
"0.47320268",
"0.47091085",
"0.47064537",
"0.46928844",
"0.46822974",
"0.46783993",
"0.4677728",
"0.46560875",
"0.46152037",
"0.46105817",
"0.46092257",
"0.46092257",
"0.46092257",
"0.46092257",
"0.46092257",
"0.46092257",
"0.46092257",
"0.46092257",
"0.4591218",
"0.45899782",
"0.45828298",
"0.4520972",
"0.45125562",
"0.45050558",
"0.4500701",
"0.4498659",
"0.4493333",
"0.4493333",
"0.4493333",
"0.44803846",
"0.44751835",
"0.44577986",
"0.4457289",
"0.44552526",
"0.44454032",
"0.44398892",
"0.4428901",
"0.4428901",
"0.4428901",
"0.44251585",
"0.44231442",
"0.44197604",
"0.4413998",
"0.4412882",
"0.43906194",
"0.43906194",
"0.438967",
"0.43788856",
"0.4375813",
"0.43480176",
"0.4341652",
"0.43411288",
"0.43406704",
"0.4339186",
"0.43326923",
"0.43270674",
"0.43270674",
"0.43246266",
"0.43138433",
"0.43133152",
"0.4312767",
"0.4311908",
"0.430441",
"0.4302424",
"0.43000153",
"0.43000153",
"0.4299634",
"0.42988262",
"0.42966223",
"0.4296393",
"0.42956135",
"0.42940322",
"0.42858645",
"0.42830282",
"0.42830282",
"0.42811003",
"0.42805228",
"0.42741725",
"0.42691338",
"0.42626134",
"0.42617977"
] |
0.4784783
|
16
|
=begin idea: given argument n produce a string consisting of n lines each line has length n, and an ascending number of stars rightjustified in line, from 1 to n. implementation details: can produce the overall string with inject method call inject on range (1..n), pass empty string as initial value, block param num on each iteration, add another line to memostring with num stars rightjustified in string of length n, add newline at the end. how to get a rightjustified string? string.rjust(n) where string is a sequence of stars. =end
|
def triangle(n)
triangle = (1..n).inject('') do |memo, current_num|
stars = '*' * current_num
line = stars.rjust(n) + "\n"
memo + line
end
puts "\n" + triangle + "\n"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def staircase(n)\n for i in 1..n do\n puts (\"#\" * i).rjust(n)\n end\n\nend",
"def tower_builder(n)\n (1..n)\n .map { |i| ' ' * (n - i) + '*' * (i + i - 1) + ' ' * (n - i) }\nend",
"def letra_i(n)\n result = \"\"\n n.times do |i|\n if i == 0 || i == n-1\n n.times {result += \"*\"} \n else\n n.times do |b|\n if (n-1)/2 == b\n result += \"*\"\n else\n result += \" \"\n end\n end\n end \n result += \"\\n\" \n end \n result\nend",
"def rjust(p0, padstr=\"\") end",
"def letra_z(n)\n result = \"\"\n t = n-1\n n.times do |i| \n if i == 0 || i == n-1\n n.times {result += \"*\"} \n else \n n.times do |b| \n if t == b\n result += \"*\"\n else\n result += \" \"\n end\n end\n end \n t -= 1 \n result += \"\\n\" \n end \n result\nend",
"def pattern(n)\n (1..n).map{|x| \"#{x.to_s*x}\"}.join(\"\\n\")\nend",
"def repeat(str, n = 2)\n ((str + ' ') * n).strip\nend",
"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 repeat (n, s)\n\t\tres = \"\"\n\t\tfor i in 0...n\n\t\t\tres << s\n\t\tend\n\t\treturn res\n\tend",
"def pattern(n)\n str = \"\"\n for i in 1..n do\n \n i.times do\n str += i.to_s\n # str += \"#{i}\"\n end\n str += \"\\n\"\n end\n \n puts str\nend",
"def triangle(num)\n 1.upto(num) { |n| puts \"#{\"*\" * n}\".rjust(num) }\nend",
"def repeat_str n, s\n s * n\nend",
"def print_stairs n, str\n\ts = str;\n\tn.times {|n| puts s; s += str}\nend",
"def triangle(int)\n for i in (0..int)\n puts (\"*\"*i).rjust(int) \n end\nend",
"def triangle(int)\n star_chars = '*'\n int.times do\n puts star_chars.rjust(int, ' ')\n star_chars << '*'\n end\nend",
"def repeat(input, n=2)\n ([input] * n).join ' '\nend",
"def repeat_str (n, s)\r\n return s * n\r\nend",
"def indent(str,n)\n return '' unless str\n if n >= 0\n str.gsub(/^/, ' ' * n)\n else\n str.gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def repeat (string, n=2)\n\tresult = \"\"\n\tn.times{result += string + \" \"}\n\treturn result.chomp(\" \")\nend",
"def repeat_str (n, s)\n s * n\nend",
"def repeat_str (n, s)\n s * n\nend",
"def getstr (n)\n\tstr=n.to_s\n\tlen=str.length\n\ts=''\n\tfor i in 1...(7-len)\n\t\ts+=' ' \n\tend #end of the for loop\n\t\n\ts+str #return the spaces and the number combined as a string\nend",
"def staircase(n)\n str = ' ' * n \n 1.upto(n) do |i|\n str[-i] = '#'\n puts str\n end \n\nend",
"def repeat(input, n)\n ([input] * n).join ' '\nend",
"def repeat(string, n)\n return if n <= 0\n\n i = 0\n result = ''\n until i == n\n if i == n - 1\n result << string\n else\n result << string << \"\\n\"\n end\n i += 1\n end\n result\nend",
"def ljust_term(num)\n padding = (num - length_term)\n return self if padding <= 0\n self + ' ' * padding\n end",
"def pattern(n)\n if n.odd?\n \t(2...n).step(2).map { |i| i.to_s * i }.join(\"\\n\")\n else\n \t(2..n).step(2).map { |i| i.to_s * i }.join(\"\\n\")\n end\nend",
"def repeat_str (n, s)\n s*n\nend",
"def tarjan_string_limit(n)\n tarjan.take(n).inject(\"\") {|s,i| s + \" \" + i.to_s }\n end",
"def repeat(str, n = 2)\n arr = []\n n.times {arr << str}\n arr.join(\" \")\nend",
"def triangle(num)\n star_count = 0\n while star_count < num\n star_count += 1\n stars = \"*\" * star_count\n puts stars.rjust(num)\n end\nend",
"def repeat_str(n, s)\n return s * n\nend",
"def decoration(number, line_length)\n (\"=\" * number * (line_length+1)) << \"\\n\"\nend",
"def ljust(p0, padstr=\"\") end",
"def stairs(n)\n\ttext_to_print = \"\"\n\tn.times do |line|\n\t\ttext_to_print += (\" \" * (n-1)) + (\"*\" * (n-(n-1))) \n\t\ttext_to_print << \"\\n\"\n\t\tn -= 1\n\tend\n\ttext_to_print.split(\"\\n\").each{|line| puts line}\nend",
"def towerBuilder(n)\n (0...n).map do |i|\n space = ' ' * (n - i)\n stars = '*' * (i * 2 + 1)\n space + stars + space\n end\nend",
"def repeat_str (n, s)\n string = ''\n n.times do\n string << s\n end\n return string\nend",
"def repeat(text, n=2)\n\treturn Array.new(n, text).join(\" \")\nend",
"def create_string(value, n)\n value.length < 3 ? value * n : value[0..2] * n\nend",
"def triangle(num)\n count = 1\n while count <= num do\n stars = \"*\" * count\n puts \"#{(stars.rjust(num))}\"\n count += 1\n end\nend",
"def pyramid(n)\n count = 1\n n.times do\n puts (\" \" * (n - count)) + (\"#\" * count)\n count += 1\n end\nend",
"def star(n)\n num_spaces = (n - 2) / 2\n arr = []\n until num_spaces < 0\n arr.push \"*#{' ' * num_spaces}*#{' ' * num_spaces}*\"\n num_spaces -= 1\n end \n arr += arr.reverse\n arr.insert(n / 2, \"*\" * n)\n arr.each { |x| puts x.center(n) }\nend",
"def indent(string, n)\n tabs = \"\\t\" * n\n wrap = screen_width - (n * 8) - 1\n\n tabs + string.gsub(/(.{1,#{wrap}})(\\s+|\\Z)/, \"\\\\1\\n#{tabs}\").rstrip\n end",
"def repeat (a, n = 2)\n [a] * n * ' '\nend",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def repeatNum( v, n )\n\treturn (1..n).inject( \"\" ){ |s| s.to_s + v.to_s }\nend",
"def pad n, pad_with = nil\n fill pad_with, length, n - length\n end",
"def zerofill2(n)\n n.to_s.rjust(2, '0')\n end",
"def indent(txt, n = 2)\n \"#{' ' * n}#{txt}\"\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def rjust(label)\n label = label.to_s\n if label.size > 20\n \"#{label}\\n#{' ' * 20}\"\n else\n label.rjust(20)\n end\n end",
"def padded(n)\n output = ''\n if (n < 10)\n output = '0' + n.to_s\n else\n output = n.to_s\n end\n output\n end",
"def triangle(rows)\n 1.upto(rows) { |num| puts \"#{\"*\" * num}\".rjust(rows)}\nend",
"def decorate(n)\n size=Readline::HISTORY.size\n n_avail=[ n, size ].min\n ((size - n_avail)..size-1).zip(entries(n_avail)).map {|e| e.join(\" \")}\n end",
"def wrap(s)\n r = \"\"\n i = 0\n n = s.length\n sofar = 0\n while i < n\n r << String(s[i])\n \n if /\\s/ =~ s[i]\n sofar = 0\n else\n sofar += 1\n end\n \n if sofar >= 100\n r << \"\\n\"\n sofar = 0\n end\n i+=1\n end\n return r\nend",
"def indent(n)\n indent = \" \" * n\n gsub '\\n', \"\\n#{indent}\"\n end",
"def repeat(word, x=2)\n return ((+ word + ' ') *x).rstrip\n \nend",
"def sameLineDivider(n)\n n.times {|x| print \"*\"}\nend",
"def repeat(word, n = 2)\n\treturn ((word + \" \")* n)[0...-1]\nend",
"def triangle(integer)\n counter = 0\n until counter > integer\n puts ('*' * counter).rjust(integer)\n counter += 1\n end\nend",
"def expand(n)\r\n @string * n\r\n end",
"def repeat(string, num = 2)\n\treturn ((string + \" \") * num).strip\nend",
"def pad_string(str)\n str.scan(/..../).reverse.join.dup.insert(0,'*****').insert(9,'*').insert(18,'*').insert(27,'*').insert(36,'*').insert(41,'*****')\n end",
"def repeater(string)\n doubled_str = ''\n string.size.times do |i|\n doubled_str << string[i] * 2\n end\n doubled_str\nend",
"def horizontalSpacer(n , text)\n n.times {print \" \"}\n puts text\nend",
"def pad_number(n)\n n.to_s.rjust(self.field_width, ' ')\n end",
"def mirror(text)\n arr = text.split\n width = arr.map(&:size).max\n stars = '*' * (width + 4)\n [stars, arr.map{ |w| \"* #{w.reverse.ljust(width)} *\" }, stars].join(\"\\n\")\nend",
"def padding(n, c = \"\\0\")\n m = n % 4\n c * (m == 0 ? 0 : 4 - m)\n end",
"def ljust(width, padstr = \" \") # from Rubinius\n justified = dup\n justified.justify(width, :left, padstr)\n end",
"def repeat string, number=2\n\trepeated = \"\"\n\tcur_index = 0\n\n\tnumber.times do\n\t\trepeated += string\n\n\t\tif cur_index != number - 1\n\t\t\trepeated += \" \"\n\t\tend\n\n\t\tcur_index += 1\n\tend\n\n\trepeated\nend",
"def repeat(x, y = 2)\nretstring = \"\"\n y.times do\n retstring += x + ' ' \n end\nreturn retstring[0...-1]\nend",
"def pattern(n)\n # take an array from 1 to n and print each element\n # the amount of times of the value of that element\n # join the output elements with newline characters\n (1..n).map { |num| num.to_s * num }.join(\"\\n\")\nend",
"def justify(array, max_length=16)\n words_per_line = 0\n character_count = 0\n per_line = []\n\n array.each_with_index do |word, index|\n if (character_count + word.length) > max_length\n per_line << words_per_line\n character_count = 0\n words_per_line = 0\n end\n character_count += word.length + 1\n words_per_line += 1\n end\n\n per_line << array.size - per_line.inject(:+) if (array.size - per_line.inject(:+)) != 1\n\n result = []\n number_of_lines = per_line.size\n\n 0.upto(number_of_lines - 1) do |i|\n line = array.first(per_line[i])\n array = array.drop(per_line[i])\n\n num_of_chars = line.join(\" \").size\n num_of_chars_to_fill = max_length - num_of_chars\n num_of_words = per_line[i]\n num_of_words == 1 ? num_of_spaces = 1 : num_of_spaces = (num_of_words - 1)\n\n if num_of_chars_to_fill % num_of_spaces == 0\n 0.upto(num_of_spaces-1) do |space|\n line[space] << \" \" * (num_of_chars_to_fill/num_of_spaces)\n ##will only occur when number of chars to fill is less than the num of spaces.\n if num_of_chars_to_fill > 0 && num_of_chars_to_fill/num_of_spaces == 0\n ## Add the num_of_chars_to_fill to the most lefterly spaces.\n count = 0\n until count == num_of_chars_to_fill\n line[count] << \" \"\n count += 1\n end\n end\n end\n elsif num_of_chars_to_fill % num_of_spaces != 0\n if num_of_chars_to_fill == 1\n line[0] << \" \"\n elsif num_of_chars_to_fill > 1\n 0.upto(num_of_spaces-1) do |space|\n line[space] << \" \" * (num_of_chars_to_fill/num_of_spaces)\n line[0] << \" \"\n if num_of_chars_to_fill > 0 && num_of_chars_to_fill/num_of_spaces == 0\n ## Add the num_of_chars_to_fill to the most lefterly spaces.\n ## Count == as we have already placed one.\n count = 1\n until count == num_of_chars_to_fill\n line[count] << \" \"\n count += 1\n end\n end\n end\n end\n end\n line = line.join(\" \")\n result << line\n end\n\n unless array.empty?\n last_line = array[0] + (\" \" * (max_length - array[0].size))\n result << last_line\n end\n\n puts result\nend",
"def repeat(text , num=2)\n #text = text.chars\n val = \"\"\n i = 0\n for i in (1..num)\n val = text + \" \"+ val\n end\n return val.rstrip\n \nend",
"def stringy(len)\n str = ''\n len.times do |n|\n n.even? ? str << '1' : str << '0'\n end\n str\nend",
"def numero_cero(n)\n result = \"\" \n n.times do |i| \n if i == 0 || i == n-1\n n.times do |b| \n result += \"*\"\n end \n else\n n.times do |b| \n if b == 0 || b == n-1\n result += \"*\"\n elsif i == b\n result += \"*\"\n else\n result += \" \"\n end\n end \n end \n result += \"\\n\" \n end \n result\nend",
"def repeat(str, nb=0)\n\tstrBase = str\n\tif nb < 1\n\t\treturn str+ \" \" +strBase\n\telse\n\t\t(nb-1).times do |i|\n\t\t\tstr += \" \" +strBase\n\t\tend\n\tend\n\n\treturn str\nend",
"def justify(str, size)\n if str.include?('-')\n # ' - ' => ' --- '\n str = ('-' * size).center(size + 2, ' ')\n elsif str.include?('|')\n # put _size_ spaces in between bars\n # Use indexes to grab leftmost/rightmost chars. Each may be a bar, may be a\n # space.\n str = str[0,1] + ' ' * (size) + str[-1,1]\n else\n # Blank strings are always lines that would have dashes (line 0, 2, or 4)\n str = ' ' * (size + 2)\n end\n return str\nend",
"def staircase(n)\n n.times do |i|\n (n-1-i).times { |i| print ' '}\n (i+1).times { |i| print '#'}\n puts\n end\nend",
"def pad(s)\n s.to_s.rjust(3,\"0\")\nend",
"def display_upper_semi_diamond(n)\n left_outline = n / 2\n right_outline = left_outline\n\n (n / 2).times do\n row = ' ' * n\n row[left_outline] = '*'\n row[right_outline] = '*'\n\n puts row\n left_outline -= 1\n right_outline += 1\n end\nend",
"def repeat(str, num)\n\t a = (str + \" \")* num\n\t return a.chop\nend",
"def repeater(string, n)\n string * n\nend",
"def stringy(length)\n string = ''\n length.times do |index|\n number_str = index.even? ? '1' : '0'\n string << number_str\n end\n string\nend",
"def repeater(string)\n string.chars.map! { |char| char * 2 }.join('')\nend",
"def spell(n)\n result = \"\"\n remaining = n\n \n while (remaining > 0) \n result.insert(0, lookup(remaining % 10).concat(\" \"))\n remaining = remaining / 10\n end\n \n return result\nend",
"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 star(num)\n return puts \"number should be odd and greater than 5\" if num.even? || num < 7\n lines = (num/2).times.with_object([]) do |idx, arr|\n arr << (['*'] * 3).join(' ' * idx).center(num)\n end\n puts lines.reverse, ('*' * num), lines\nend",
"def circle(n)\r\n lines = []\r\n half_grid = n / 2\r\n top_stars = half_grid.even? ? half_grid - 1 : half_grid\r\n\r\n spaces_between_stars = top_stars\r\n loop do\r\n lines << ('*' +\r\n ' ' * spaces_between_stars +\r\n '*').center(n)\r\n\r\n spaces_between_stars += 2\r\n break if spaces_between_stars == n - 2\r\n end\r\n\r\n top_bottom = ('*' * top_stars).center(n)\r\n\r\n puts top_bottom\r\n puts lines\r\n (top_stars).times do\r\n puts ('*' + ' ' * (n - 2) + '*').center(n)\r\n end\r\n puts lines.reverse\r\n puts top_bottom\r\nend",
"def lorem(n=nil)\n words = %w{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.} \n if n \n while (n > words.size) do words = words + words; end \n words = words[0..n] \n end\n return words.join(' ') \n end",
"def staircase(n)\n i = 1\n spaces = \" \"\n destination = Array.new\n n.times do\n destination << (\" \" * (n-i)) + (\"#\" * (i))\n puts destination\n i = i + 1\n destination = []\n end\nend",
"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 repeater(string)\n new_str = ''\n\n string.chars.each { |x| new_str << x * 2 }\n new_str\nend",
"def newParagraphSpacer(n) \n n.times {puts \" \" }\nend",
"def staircase(n)\n spaces=0\n arr = Array.new(n) { |i| Array.new(n) { |j| (i >= j) ? '#' : ' ' } }\n print_matrix(arr.map(&:reverse), spaces)\nend",
"def repeat(hello, n = 2)\n\n\t([hello] * n).join(\" \")\nend",
"def repeat(word, times=2)\n\t((word+\" \")*times).rstrip\nend",
"def pad(n_str, amount)\n l = n_str.length\n pad_length = amount - l\n if pad_length >= 0\n zeros = \"0\" * pad_length\n \"#{zeros}#{n_str}\"\n else\n \"#{n_str}\"\n end\n end",
"def gen_numstr(seeds, length)\n ((length/2) + 1).times.map{\n seeds.sample.to_s.rjust(2, \"0\")\n }.join[0..length-1]\nend"
] |
[
"0.69316155",
"0.6731054",
"0.671986",
"0.6602063",
"0.6600533",
"0.6553574",
"0.64965814",
"0.64634234",
"0.64489734",
"0.64206165",
"0.6400786",
"0.6348424",
"0.6344818",
"0.6341171",
"0.63302374",
"0.6283368",
"0.62775785",
"0.62698853",
"0.6267738",
"0.62653893",
"0.62653893",
"0.6263784",
"0.62636495",
"0.6261263",
"0.62574667",
"0.6253481",
"0.62490976",
"0.6239891",
"0.62377745",
"0.62208855",
"0.622066",
"0.62056756",
"0.6191504",
"0.6188643",
"0.61741245",
"0.61733633",
"0.6165652",
"0.61614096",
"0.61560094",
"0.61070144",
"0.6079454",
"0.6066414",
"0.6062943",
"0.6059779",
"0.60576046",
"0.6057102",
"0.6051032",
"0.60065615",
"0.59979737",
"0.5994176",
"0.5988371",
"0.5986139",
"0.5971704",
"0.5969613",
"0.59552085",
"0.59357136",
"0.59314215",
"0.5919851",
"0.59153724",
"0.5915207",
"0.5914804",
"0.59097123",
"0.5907413",
"0.5902221",
"0.5898978",
"0.588997",
"0.5888",
"0.5887935",
"0.5887301",
"0.5885813",
"0.5882613",
"0.5880031",
"0.5869895",
"0.58658934",
"0.5833503",
"0.5828543",
"0.5827973",
"0.5824441",
"0.5823704",
"0.5816967",
"0.5796347",
"0.57807255",
"0.57797575",
"0.5779056",
"0.5778322",
"0.5749014",
"0.5744626",
"0.5735879",
"0.57191753",
"0.5717432",
"0.5717186",
"0.57148707",
"0.5713406",
"0.570686",
"0.5694878",
"0.5685205",
"0.56794727",
"0.5677905",
"0.56765133",
"0.56716835"
] |
0.70692235
|
0
|
TODO: Colorized output for all feedback types, or running counters, or TODO: something...
|
def success!(info = nil)
@logger.error { info } if info
@successes += 1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def output(message, type)\n puts \"\\e[31m[ ✘ ]\\e[0m #{message}\" if type == 'error'\n puts \"\\e[32m[ ✔︎ ]\\e[0m #{message}\" if type == 'success'\n puts \"\\e[33m[ ✻ ]\\e[0m #{message}\" if type == 'info'\nend",
"def feedback\n end",
"def tally\n return \"\"\n\n text = \"%s concerns: %s passed, %s failed, %s errored (%s/%s assertions)\"\n total = @passed.size + @failed.size + @raised.size\n text = text % [total, @passed.size, @failed.size, @raised.size, $assertions - $failures, $assertions]\n if @failed.size > 0\n text.ansi(:red)\n elsif @raised.size > 0\n text.ansi(:yellow)\n else\n text.ansi(:green)\n end\n end",
"def print_feedback\n\t\ttemp_array = []\n\t\[email protected] do |x|\n\t\t\tif x[1]\n\t\t\t\ttemp_array << x[0]\n\t\t\telse\n\t\t\t\ttemp_array << '_'\n\t\t\tend\n\t\tend\n\t\ttemp_array.join(' ')\n\tend",
"def print_colorized_array(ary)\n l = ary.length - 1\n (0..l).each do |i|\n if ary == @feedback\n print format_feedback(ary[i])\n else print colorize_input(ary[i])\n end\n end\n end",
"def print_passing_test\n Kernel.print \".\".green\n end",
"def record(r)\n\t\t\tpres = if r.skipped?\n\t\t\t\t\"\\e[34;1mSKIP\\e[0m\"\n\t\t\telsif r.passed?\n\t\t\t\t\"\\e[32;1mPASS\\e[0m\"\n\t\t\telse\n\t\t\t\t\"\\e[31;1mFAIL\\e[0m\"\n\t\t\tend\n\t\t\t\n\t\t\[email protected] \"[#{pres}] #{r.class}##{r.name}\"\n\t\tend",
"def colorized?; end",
"def outputs(type, msg, style = :plain)\n line = \"#{type}> #{msg}\"\n line = line.color(:red) if (style == :err) || (style == :error)\n line = line.color(:green) if style == :ok\n line = line.color(:cyan) if style == :ok2\n\n $stdout.puts line\n end",
"def stage2Conclusion\n sleep(2)\n puts \"Awesome that was a lot better, but I think a little more will make her perfect\"\n sleep(1)\n puts \"Let's increase her intelligence\"\n sleep(2)\n puts \"ai.intelligence = 60\"\n bar = TTY::ProgressBar.new(\"Initializing [:bar]\", total: 50)\n # make the bar load slowly\n 30.times do\n sleep(0.04)\n bar.advance # by default increases by 1\n end\n 10.times do\n sleep(0.5)\n bar.advance # by default increases by 1\n end\n 3.times do\n sleep(1)\n bar.advance # by default increases by 1\n end\n puts \"\"\n\n msg = 'Error!'.colorize(:red)\n 10.times do\n puts \"\\r#{ msg }\"\n sleep 0.1\n puts \"\\r#{ ' ' * msg.size }\" # Send return and however many spaces are needed.\n sleep 0.1\n end\n\n i = 60\n while i < 900\n puts \"ai.intelligence = #{i}\".colorize(:red)\n sleep(0.1)\n i += 50\n end\n smart = TTY::ProgressBar.new(\"Initializing [:bar]\", total: 100)\n 100.times do\n sleep(0.01)\n smart.advance # by default increases by 1\n end\n sleep(0.5)\n 30.times do\n puts \"1010101010000101010100101010101111110101010010001101000101010101010101010101010101001010101010101010101010101010101010101010101010101010101001010101010101010010101\".colorize(:red)\n sleep(0.05)\n puts \"1011110101001010101010101010110000100101010101011101010010100101010110100011010101010101010101010010110101100110101010101010101001010110101010101011010001110111100\".colorize(:red)\n sleep(0.05)\n puts \"1011110101001010101111100111110000100101010101011101010010100101010110100011010100010101010111100101101010001010100011111101100101010000101010110110101101011110101\".colorize(:red)\n sleep(0.05)\n end\n\n 30.times do\n puts \"\"\n end\n\n end",
"def basic_status_and_output(messages); end",
"def display_helper(round, score = [\"-\", \"-\", \"-\", \"-\"], feedback = [\"-\", \"-\", \"-\", \"-\"])\n\t\tputs \"\\nRound #{round}\\n#{score[0]} #{score[1]} #{score[2]} #{score[3]}\" \\\n\t\t \"\\n#{feedback[0]} #{feedback[1]} #{feedback[2]} #{feedback[3]}\"\n\tend",
"def describe_progress\n if @options[:num]\n \"#{@messages.size} of #{@options[:num]} message#{'s' if @messages.size!=1} collected\"\n else\n \"#{@messages.size} message#{'s' if @messages.size!=1} collected\"\n end \n end",
"def pass(description, message)\n print green(\".\")\n end",
"def print_action_sum\n string = 'Liked: ' + @total_likes.to_s.colorize(:red) +\n ' Followed: ' + @total_follows.to_s.colorize(:red) +\n ' Unfollowed: ' + @total_unfollows.to_s.colorize(:red)\n print_time_stamp\n puts string\n end",
"def display_stats\n draw \"Total hits: %d\" % @queue.total_hits\n draw \"Hits (past %isc): %d\" % [@queue.threshold, @queue.current_hits]\n draw \"High traffic alerts: %d\" % @queue.high_traffic_alerts\n draw_eol\n\n draw \"Total bytes: %s (Avg: ~%s)\" % [@queue.total_bytes.as_readable_bytes, @queue.avg_bytes.as_readable_bytes]\n draw \"Bytes (past %isc): %s \" % [@queue.threshold, @queue.current_bytes.as_readable_bytes]\n draw \"High traffic ended alerts: %s\" % @queue.end_of_high_traffic_alerts\n draw_eol\n end",
"def wave_display\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n case $current_lvl\n when $lvl_1\n puts font_col.red(font_big.write(\"WAVE 1\"))\n when $lvl_2\n puts font_col.red(font_big.write(\"WAVE 2\"))\n when $lvl_3\n puts font_col.red(font_big.write(\"WAVE 3\"))\n end\nend",
"def print_class\n\n puts \"* #{name.capitalize} *\".colorize(:light_green).bold.indent(10)\n puts\n puts short_description.to_s.colorize(:green).indent(10)\n puts\n stats.each_pair do |name, value|\n print \"| \".colorize(:green).indent(10)\n print \" #{name.capitalize} :\".colorize(:light_green)\n print \" #{value}\"\n print \" |\".colorize(:green)\n end\n puts\n puts\n\n end",
"def html_out(msg, color_name=\"black\")\n\t\t\trgb = Color::RGB::by_name color_name\n\t\t\tputs \"<span style='color:#{rgb.css_rgb};'>#{msg}</span>\"\n\t\tend",
"def results_color results\n if results.failing?\n :red\n elsif results.respond_to?(:errored?) && results.errored?\n :red\n elsif results.pending? || results.empty?\n :yellow\n else\n :green\n end # if-elsif-else\n end",
"def info(*args); say $terminal.color(format(*args), :yellow); end",
"def perform_tick_debug_labels\n color = {r: 255, g: 255, b: 255, a: 255}\n active_color = {r: 255, g: 0, b: 0, a: 255}\n $gtk.args.outputs.labels << { x: 8, y: 720 - 48, text: \"Render mode (press X to change, Z for off): #{@rendering ? (@full_render ? 'Full re-render' : 'Double buffer re-render') : 'Off'}\" }.merge(color)\n $gtk.args.outputs.labels << { x: 50, y: 720 - 100, text: 'Full re-render' }.merge(@rendering && @full_render ? active_color : color)\n $gtk.args.outputs.labels << { x: 690, y: 720 - 100, text: 'Double buffered re-render' }.merge(@rendering && !@full_render ? active_color : color)\n end",
"def print_status(msg)\n puts \"\" if verbose_mode?\n puts \"#{color('----->', 32)} #{msg}\"\n end",
"def helpmessage()\n\t\"\\nThis script will take a collection of input files to sass implementations and change the\\n\"+\n\t\"hierarchy in such a way that testrunner.rb can be used to run batches of tests. The\\n\"+\n\t\"expected_output.css files are generated by running sass (whichever version you have) on the\\n\"+\n\t\"input files. Sass is assumed to be on you path. View the initial comment of this script for\\n\"+\n\t\"more detailed info.\\n\\n\"\nend",
"def display\n if @count.to_f/@tries.to_f < .33\n print @progress.join.green\n puts\n elsif @count.to_f/@tries.to_f > .33 && @count.to_f/@tries.to_f < .66\n print @progress.join.orange\n puts\n elsif @count.to_f/@tries.to_f > .66\n print @progress.join.red\n end\n\nend",
"def print_results(results)\n important \"\"\n print_stats(results)\n\n important \"* #{format_float(results.failure_rate)}% failure rate\"\n suffix = \" (#{format_float(results.elapsed / ITERATIONS.to_f)}/iteration)\" if ITERATIONS > 0\n important \"* #{format_float(results.elapsed)} seconds elapsed#{suffix}\"\nend",
"def show_stat\n \t\tputs \"=============Statistics============\"\n \t\tputs \"Score: #{get_score}\"\n \t\tputs \"Total time: \" + \"%0.2f\" %(@end_time - @start_time + @save_time) + \" seconds\"\n \t\tputs \"Number of sets found: #{@number_of_correct}\"\n \t\tputs \"#{@number_of_hint}/#{@total_hint} hints used\"\n \tend",
"def print_status(msg, color)\n cprint RESET + BOLD\n cprint WHITE + \"[ \"\n cprint \"#{ msg } \", color\n cprint WHITE + \"] \" + RESET\n end",
"def print_status(msg, color)\n cprint RESET + BOLD\n cprint WHITE + \"[ \"\n cprint \"#{ msg } \", color\n cprint WHITE + \"] \" + RESET\n end",
"def shout(message)\n output.puts Paint[message, :bold, :red ]\n end",
"def printColorHelp()\n\tputs \"Red looks like this\".red()\n\tputs \"Green looks like this\".green()\n\tputs \"Yellow looks like this\".yellow()\n\tputs \"Blue looks like this\".blue()\n\tputs \"Magenta looks like this\".magenta()\n\tputs \"Cyan looks like this\".cyan()\n\tputs \"Complements are:\"\n\tputs \"Red and Cyan\"\n\tputs \"Green and Magenta\"\n\tputs \"Blue and Yellow\"\n\tputs \"When prompted for 'color', enter the color in which the word appears\"\n\tputs \"When prompted for 'word', enter the word that is written\"\n\tputs \"Please enter all data in lowercase and in a single line when \"\\\n\t\"prompted for two words\"\n\tputs \"Once you have attained the required points for a given level, \"\\\n\t \"you will be asked if you want to skip to the next level\"\n\tputs \"I apologize to all the colorblind folks out there!\"\nend",
"def get_color\n completed? ? 'info' : 'warning'\n end",
"def success_message\n puts \"Correct!\".green\nend",
"def step_status(msg = '')\n\t\toutput.print_status(\"#{pos}: #{msg}\") if (msg and msg.length > 0)\n\tend",
"def output_message message, color\n case color\n when :black\n puts message.black\n when :red\n puts message.red\n when :green\n puts message.green\n when :yellow\n puts message.yellow\n when :blue\n puts message.blue\n when :magenta\n puts message.magenta\n when :cyan\n puts message.cyan\n else\n puts message\n end\n end",
"def display_info_about_app\n info_msg = \"Look Dude or Dudette ! All You Need To Know Is That This Is A Great App And You Should Be Very Happy It Fell Into Your Lap. It Will Help You Navigate The World Of Pharmacies, Especially If You Are An Orc Or A Kobolt Or One Of Those UnderWorld Creatures! And If You Happen To Be A DarkElf, Know That Drizzt D'Urden Is A Good Friend Of This ... WhatEver This Is!\"\n puts \"\" \n puts \" -- #{ info_msg } -- \".colorize(:color => :light_blue, :background => :white)\n puts \"\" \nend",
"def feedbackchart\n \n end",
"def status(text)\n STDERR.puts blue_term_text(text)\n end",
"def message(input)\r\n start_line\r\n puts input.colorize(:light_blue)\r\n sleep(1.5)\r\n end",
"def statuses(status)\n puts \"\\n#{status}\\n\".colorize(:green)\nend",
"def stdouts; end",
"def wrestler_output\n\n\t\tputs \"Name: #{self.values[:name]}\"\n\t\tputs \"Set: #{self.values[:set]}\"\n\t\tputs \"Singles Priority: #{self.values[:prioritys]}\"\n\t\tputs \"Tag Team Priority: #{self.values[:priorityt]}\"\n\t\tputs \"TT Probability: #{self.statistics[:tt_probability]}\"\n\t\tputs \"Card Rating: #{self.statistics[:total_card_rating]}\"\n\t\tputs \"OC Probability: #{self.statistics[:oc_probability]}\"\n\t\tputs \"Total Points-Per-Round: #{self.statistics[:total_card_points_per_round]}\"\n\t\tputs \"DQ Probability-Per-Round: #{self.statistics[:dq_probability_per_round]}\"\n\t\tputs \"P/A Probability-Per-Round: #{self.statistics[:pa_probability_per_round]}\"\n\t\tputs \"Submission Roll Probability-Per-Round: #{self.statistics[:sub_probability_per_round]}\"\n\t\tputs \"XX Roll Probability-Per-Round: #{self.statistics[:xx_probability_per_round]}\"\n\t\tputs \"Submission Loss Probability: #{self.points[:sub_prob]}\"\n\t\tputs \"Tag Team Save Probability: #{self.points[:tag_prob]}\"\n\t\tputs \"\\n\"\n\n\t\ttt_probability = \"%.1f\" % (self.statistics[:tt_probability] * 100) + \"%\"\n\t\tcard_rating = \"%.1f\" % self.statistics[:total_card_rating]\n\t\toc_probability = \"%.1f\" % (self.statistics[:oc_probability] * 100) + \"%\"\n\t\ttotal_card_points_per_round = \"%.3f\" % self.statistics[:total_card_points_per_round]\n\t\tdq_probability_per_round = \"%.1f\" % (self.statistics[:dq_probability_per_round] * 100) + \"%\"\n\t\tpa_probability_per_round = \"%.1f\" % (self.statistics[:pa_probability_per_round] * 100) + \"%\"\n\t\tsub_probability_per_round = \"%.1f\" % (self.statistics[:sub_probability_per_round] * 100) + \"%\"\n\t\txx_probability_per_round = \"%.1f\" % (self.statistics[:xx_probability_per_round] * 100) + \"%\"\n\t\t\n\t\tsub_prob = \"%.1f\" % (self.points[:sub_prob] * 100) + \"%\"\n\t\ttag_prob = \"%.1f\" % (self.points[:tag_prob] * 100) + \"%\"\n\n\t\tf = File.new('files/results.csv', 'a')\n\t\tf.write(\"#{self.values[:name]},#{self.values[:set]}, #{self.values[:prioritys]}, #{self.values[:priorityt]}, #{tt_probability}, #{card_rating}, #{oc_probability}, #{total_card_points_per_round}, #{dq_probability_per_round}, #{pa_probability_per_round}, #{sub_probability_per_round}, #{xx_probability_per_round}, #{sub_prob}, #{tag_prob}, \\n\")\n\t\tf.close\n\tend",
"def process\n if execute\n if diff\n CIAT::TrafficLight::GREEN\n else\n CIAT::TrafficLight::RED\n end\n else\n CIAT::TrafficLight::YELLOW\n end\n end",
"def give_feedback\n print 'Matches: '\n puts 'Black ' * @secret.exact_matches(last_guess) + \\\n 'White ' * @secret.near_matches(last_guess)\n end",
"def all_pass_result_summary_msg\n if result_count < 1\n \"uhh...\"\n elsif result_count == 1\n \"pass\"\n else\n \"all pass\"\n end\n end",
"def render_progress passed, total\n\t\n\t\ts = '<div class=\"progress bar\">';\n\t\t(passed).times do\n\t\t\ts << '<span class=\"p\"></span>'\n\t\tend\n\t\ts<< '<span class=\"c\"></span>'\n\t\t(total-passed-1).times do\n\t\t\ts << '<span class=\"r\"></span>'\n\t\tend\n\t\ts << '</div>'\n\t\t\n\t\treturn s.html_safe\n\tend",
"def process_messages(type)\n message_hash = {\n '_correct' => [\n 'Correct!',\n 'That\\'s right',\n 'Nice, good choice!',\n 'A fine letter you picked',\n 'Thumbs up from me'\n ],\n '_incorrect' => [\n 'Not quite the right guess...',\n 'Getting closer... I hope anyway',\n 'Nope, not what I\\'m looking for',\n 'A compeltely different letter would have done the trick.'\n ],\n '_invalid' => [\n 'That guess is simply unacceptable! Humph.',\n 'Ensure you\\'re typing unused letters only or save',\n 'Input invalid. Beep boop.',\n 'Executioner: invalid input huh... this player isn\\'t takin\\' us seriously. Best sort \\'im out.'\n ],\n '_serialise' => ['Serialising...', 'Saving...', 'Committing your performance to memory!']\n }\n to_print = message_hash[type].sample\n message_colour(type, to_print)\n end",
"def instruction_message\n puts \"\\nMASTERMIND is a color guessing game where the computer generates a \\\nrandom string of four characters representing the base colors #{\"(r)ed\".red}, \\\n#{\"(g)reen\".green}, #{\"(b)lue\".blue}, and/or #{\"(y)ellow\".yellow}. \\\nThe intermediate difficulty level is six characters and adds \\\n#{\"(m)agenta\".magenta} and the advanced difficulty level is eight characters \\\nand adds #{\"(c)yan\".cyan}. \\\nThe string is only guaranteed to contain one color. The player must submit \\\nguesses to try to find the generated combination. Guesses are not case sensitive.\"\n\n puts \"\\nEnter #{\"(p)lay\".green}, #{\"(i)nstructions\".yellow} or #{\"(q)uit\".red}\"\n end",
"def print_formatted_action(msg, opts={})\n m = [self.timestamp] + msg\n\n unless opts[:no_truncate]\n if m.map(&:first).join(' ').length > self.term_width\n fixed_length = m[0,2].map(&:first).join(' ').length\n m[2][0] = m[2][0][0,(term_width - fixed_length - 4)] + ' … '\n end\n end\n\n o = []\n m.each_with_index do |e,i|\n val, colors = e\n colors.each do |c|\n val = val.send c\n end\n o << val\n end\n\n puts o.join ' '\n end",
"def color\n if not @title\n 'blank'\n elsif @warnings\n 'missing'\n elsif @missing\n 'missing'\n elsif @approved\n if @approved.length < 5\n 'ready'\n elsif @comments\n 'commented'\n else\n 'reviewed'\n end\n elsif @text or @report\n 'available'\n elsif @text === undefined\n 'missing'\n else\n 'reviewed'\n end\n end",
"def print_status(string)\n\tputs \"[*] \".light_blue + \"#{string}\".white\nend",
"def outcome()\n puts \"Here is what you made, looks delicous . . .\"\n puts blend\n end",
"def to_text\n \n output_res=[]\n \n if @seq_rejected\n output_res<< \"[#{@tuple_id},#{@order_in_tuple}] Sequence #{seq_name} had the next actions: \".bold.underline + \" REJECTED: #{@seq_rejected_by_message}\".red \n # puts @seq_name.bold + bold + ' REJECTED BECAUSE ' +@seq_rejected_by_message.bold if @seq_rejected \n else\n output_res<< \"[#{@tuple_id},#{@order_in_tuple}] Sequence #{seq_name} had the next actions: \".bold.underline \n \n end\n \n n=1\n withMessage = [\"ActionIsContaminated\",\"ActionVectors\",\"ActionBadAdapter\",\"ActionLeftAdapter\",\"ActionRightAdapter\"] \n color = red\n \n @actions.sort!{|e,f| e.start_pos<=>f.start_pos}.each do |a| \n a_type=a.action_type\n color = a.apply_decoration(\" EXAMPLE \") \n color2 =a.apply_decoration(\" #{a_type.center(8)} \") \n \n reversed_str = '' \n \n if a.reversed\n reversed_str = \" REVERSED \".bold \n end\n \n output_res<< \" [#{n}] \".bold + color2+ \" #{a.title} \".ljust(24).reset + \" [ \" + \" #{a.start_pos+1}\".center(6) + \" , \" + \"#{a.end_pos+1}\".center(6) + \" ]\" + clear.to_s + \"#{a.message}\".rjust(a.message.size+8) + reversed_str\n \n n +=1 \n end\n \n pos = 0\n res = '' \n \n @seq_fasta_orig.each_char do |c|\n \n @actions.each do |a|\n c= a.decorate(c,pos) \n \n end \n \n res += c\n \n pos += 1\n end \n \n output_res<< res\n \n if SHOW_QUAL and @seq_qual_orig\n res = '' \n pos=0 \n output_res<< ''\n @seq_fasta_orig.each_char do |c2|\n c=@seq_qual_orig[pos].to_s+' '\n @actions.each do |a|\n c= a.decorate(c,pos) \n\n end \n res += c\n pos += 1\n end\n \n output_res<< res\n end\n \n if SHOW_FINAL_INSERTS \t\t \n output_res<< \"INSERT ==>\"+get_inserts.join(\"\\nINSERT ==>\")\n output_res<< \"=\"*80\n end\n # puts @seq_name.bold + bold + ' rejected because ' +@seq_rejected_by_message.bold if @seq_rejected \n\n return output_res\n end",
"def bold_red(output)\n color('1;31', output)\n end",
"def print_game_state\n puts \"Players hand is #{@player_hand} Value: #{get_hand_value(@player_hand)}\".colorize(:light_blue)\n puts \"Dealer hand is #{@dealer_hand} Value: #{get_hand_value(@dealer_hand)}\".colorize(:light_blue)\nend",
"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 print_status\n next_run = ((@@next_task-Time.now)/60.0).round(2)\n\n print \"\\r\"\n print \"#{Time.now} #{[@chains.count,@steps_done].min}/#{@chain_count} chains active - #{@chains.sum(&:remaining_task_count)}/#{@task_count} Tasks remaining - Next task will run in #{next_run} minutes\"\n\n EM.add_timer 1, proc {\n print_status\n }\n end",
"def print_out_line\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd\n #beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def status(msg = '')\n\t\toutput.print_status(msg)\n\tend",
"def print_out_line\n\t\t\t#p ['id', id, 'ctd', ctd]\n\t\t\t#p rcp.results.zip(rcp.results.map{|r| send(r)})\n\t\t\tname = @run_name\n\t\t\tname += \" (res: #@restart_id)\" if @restart_id\n\t\t\tname += \" real_id: #@real_id\" if @real_id\n\t\t\tbeginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s)\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s)\n\t\t\tif @status == :Incomplete and @completed_timesteps\n\t\t\t\tbeginning += sprintf(\" %d steps \", @completed_timesteps)\n\t\t\telsif @percent_complete\n \t\t\t\tbeginning+=sprintf(\" %3s%1s \", percent_complete, \"%\")\n\t\t\tend\n\t\t\tif ctd\n\t\t\t\t#beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n\t\t\tend\n\t\t\tbeginning += \" ---#{@comment}\" if @comment\n\t\t\tbeginning\n\t\tend",
"def print(color)\n puts \"Fetched at #{Time.now}\".colorize(:light_black)\n puts status.colorize(color)\n puts agency.colorize(color)\n puts location.colorize(color)\n end",
"def to_color_log\n @lines.map.with_index do |val, i|\n case val[0][:status] \n when \" \"\n \"\\033[90m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"+\"\n \"\\033[32m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"-\"\n \"\\033[31m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n when \"*\"\n \"\\033[36m#{i} #{val[0][:status]} #{val[0][:string]}\\033[0m\"\n end\n end.join(\"\\n\") + \"\\n\"\n end",
"def success(string)\n puts\n puts \"[#{colorize(\"OK\", \"green\")}] #{ string }\"\nend",
"def text_urgent(text); text_green(text);end",
"def status(max_size=nil)\n \" Result for #{title}: \" \\\n + \"Success? #{succeeded? ? 'Yes'.green : 'No'.red}, \" \\\n + \"Skipped: #{skips.to_s.yellow}, \" \\\n + \"Total user time: #{Logger.time(time).blue}, \" \\\n + \"Output files: #{output_files.length.to_s.bold}\"\n end",
"def print_results\n UI.puts results_message\n end",
"def plain_output(message, color)\n if @options['without-color']\n puts message\n else\n puts Colorize.send(color, message)\n end\n end",
"def print_colors\n 1.upto(6) { |i| print \"#{i} = \" + \"\\u2b24\".color(COLORS[i]) + \" \" }\n print \": \"\nend",
"def print_out_line\n #p ['id', id, 'ctd', ctd]\n #p rcp.results.zip(rcp.results.map{|r| send(r)})\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd and fusionQ\n beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"def progress_info\n\n color=\"#AAAAAA\"\n progress=0\n message=\"Log not available.\"\n\n if self.cluster_stdout\n\n color=\"blue\"\n progress=0\n message=\"Execution not started.\"\n\n self.cluster_stdout.each_line do |line| \n if /\\([0-9]* run \\/ [0-9]* fail \\/ [0-9]* done \\/ [0-9]* left\\)/.match(line)\n run = /[0-9]* run/.match(line)[0].to_s.split[0].to_f \n done = /\\/ [0-9]* done/.match(line)[0].to_s.split[1].to_f\n failed = /\\/ [0-9]* fail/.match(line)[0].to_s.split[1].to_f\n left = /\\/ [0-9]* left/.match(line)[0].to_s.split[1].to_f\n progress=100*(run+done+failed)/(run+done+failed+left)\n # set toolbar color \n red=255*(failed)/(failed+done+run)\n blue=255*(run).to_f/(failed+done+run).to_f\n green=128*(done).to_f/(failed+done+run).to_f\n color=\"rgb(#{red.to_i},#{green.to_i},#{blue.to_i})\"\n if progress!= 100 && (\n\t CbrainTask::COMPLETED_STATUS.include?(self.status) ||\n\t CbrainTask::FAILED_STATUS.include?(self.status) ||\n\t self.status == \"Post Processing\" ||\n\t self.status == \"Data Ready\")\n color=\"red\"\n end\n if progress==100\n\t color=\"green\"\n end\n message=\"PSOM tasks: #{run.to_i} run / #{failed.to_i} fail / #{done.to_i} done / #{left.to_i} left\"\n end\n end\n end \n return {:color => color,:percentage => progress, :message => message, :show_percentage => true}\n end",
"def red(output)\n color(31, output)\n end",
"def graphic\n flower = []\n @counter.times do\n flower << \"(@) \".colorize(:red)\n end\n puts \"#{flower.join}\"\n puts\n puts \"#{@puzzle_array.join}\"\n puts\n end",
"def status_color(accepted)\n if accepted == 0\n return \"style=\\\"color:red;\\\"\"\n elsif accepted == 1\n return \"style=\\\"color:gray;\\\"\"\n elsif accepted == 2\n return \"style=\\\"color:black;\\\"\"\n else\n return \"style=\\\"color:red;\\\"\"\n end\n end",
"def one_round_human_codebreaker\n show_round(@round)\n obtain_human_input\n codebreaker_guess\n print_colorized_array(@guess)\n update_feedback\n codemaker_feedback\n print_colorized_array(@feedback)\n end",
"def status_color\n if skipped?\n :yellow\n elsif error?\n :red\n else\n :green\n end\n end",
"def intro\n clr\n puts\"\n████████╗██╗ ██████╗████████╗ █████╗ ██████╗████████╗ ██████╗ ███████╗\n╚══██╔══╝██║██╔════╝╚══██╔══╝██╔══██╗██╔════╝╚══██╔══╝██╔═══██╗██╔════╝\n ██║ ██║██║ ██║ ███████║██║ ██║ ██║ ██║█████╗ \n ██║ ██║██║ ██║ ██╔══██║██║ ██║ ██║ ██║██╔══╝ \n ██║ ██║╚██████╗ ██║ ██║ ██║╚██████╗ ██║ ╚██████╔╝███████╗\n ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝\n \"\n sleep 2\n end",
"def debug_print(output, debug)\n\tif debug\n\t\tputs \"[*] #{output}\".red\n\tend\nend",
"def print_current_status\n print_guess_word_status = \"\"\n @guess_word_status.each do |letter|\n print_guess_word_status += \"#{letter} \"\n end\n puts \"\\nYou guessed #{@failed_attempts} times wrong so far. Remember, when reaching 10 you lose!\"\n puts \"Guess word status = #{print_guess_word_status}\"\n end",
"def colorize(text, status = :normal)\n case status\n when :success\n text.green\n when :error\n text.red\n when :warning\n text.yellow\n when :neutral\n text.blue\n else\n text.white\n end\n end",
"def colorize_logging; end",
"def message(string)\n puts\n puts \"[#{colorize(\"--\", \"blue\")}] #{ string }\"\nend",
"def show_basic\n puts \"#{@total_packet_count} total packets captured\"\n puts \"#{@rinda_packet_count} Rinda packets captured\"\n puts \"#{@drb_packet_count} DRb packets captured\"\n puts \"#{@drb_messages_sent} messages sent\"\n puts \"#{@drb_results_received} results received\"\n puts \"#{@drb_exceptions_raised} exceptions raised\"\n end",
"def print_result_summary(result, time_taken=0)\n if result.failure_count == 0 && result.error_count == 0\n final_color = success_color\n elsif result.error_count > 0\n final_color = error_color\n else\n final_color = fail_color\n end\n\n out \"\\nTests: #{result.run_count}, Assertions: #{result.assertion_count}, Fails: #{result.failure_count}, Errors: #{result.error_count}, Time taken #{sprintf('%.2f', time_taken)}s\", final_color\n end",
"def result_case\n if @succeeded\n color_print(\"Success\", :green)\n else\n color_print(\"Error\", :red)\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n\n end",
"def success(count)\n color(\n \"#{count} #{t('checked')}, %{no_issues} #{t('detected')}\\n\",\n :default,\n no_issues: [t('no_issues'), :green]\n )\n end",
"def success(count)\n color(\n \"#{count} #{t('checked')}, %{no_issues} #{t('detected')}\\n\",\n :default,\n no_issues: [t('no_issues'), :green]\n )\n end",
"def congrats_msg()\r\n start = 0\r\n\r\n starstop1 = \"* * * * * * * * * * * * * * * * *\\n\\n\".cyan\r\n starsbottom1 = \"\\n* * * * * * * * * * * * * * * * \".cyan\r\n starstop2 = \" * * * * * * * * * * * * * * * * \\n\\n\".red\r\n starsbottom2 = \"\\n * * * * * * * * * * * * * * * * \".red\r\n starstop3 = \" * * * * * * * * * * * * * * * * \\n\\n\"\r\n starsbottom3 = \"\\n* * * * * * * * * * * * * * * * *\"\r\n message = \"Congratulations!\\n\\n\".center(starstop3.length).yellow\r\n\r\n while(start <= 20)\r\n messagePrint(starstop1, message, starsbottom1)\r\n messagePrint(starstop2, message, starsbottom2)\r\n messagePrint(starstop3, message, starsbottom3)\r\n start +=1\r\n end\r\nend",
"def msg(type, text)\n case type\n when \"exit\"\n print(\"[\\033[31mEXIT\\033[0m] #{text}\\n\")\n when \"ok\"\n print(\"[\\033[32m OK \\033[0m] #{text}\\n\")\n when \"warn\"\n print(\"[\\033[33mWARN\\033[0m] #{text}\\n\")\n else\n print(\" #{text}\\n\")\n end\nend",
"def print_success(s)\n puts Time.now.localtime.strftime(\"[%k:%M:%S]\")+'[+]'.green+' '+s\nend",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n end",
"def build_final_output\n perf_output = \" | #{@perfdata.join(' ')}\"\n if @critical.any?\n crit_msg(@critical.join(', ') + perf_output)\n elsif @warning.any?\n warn_msg(@warning.join(', ') + perf_output)\n else\n ok_msg(@okays.join(', ') + perf_output)\n end\n end",
"def full_story\n puts \" This is your user story\".colorize(:color => :yellow)\n\n puts \"\n I walk through the color jungle. I take out my\n #{@adjective} canteen. There's a #{@adjective2} parrot with \n a #{@adjective3} #{@noun} in his mouth right\n there in front of me in the #{@adjective4}\n trees! I gaze at his #{@adjective5} #{@noun2}. A sudden \n sound awakes me from my daydream! A panther’s #{@verb} \n in front of my head! I #{@verb2} his #{@adjective6} \n breath. I remember I have a packet of #{@noun3} that \n makes go into a deep slumber! I #{@verb3} it away from me \n in front of the #{@noun3}. Yes he's eating it! I #{@verb4}\n away through the #{@adjective7} jungle. I meet my parents \n at the tent. Phew! It’s been an exciting day \n in the jungle.\"\n\n\n end",
"def visualize\n health_level = @health * 100 / @initial_health\n stars = \"*\" * health_level\n spaces = \" \" * (100 - stars.length)\n @is_tired == true ? tired_or_not = \"tired\" : tired_or_not = \"not_tired\"\n @is_dead == true ? dead_or_alive = \"dead\" : dead_or_alive = \"alive\"\n puts \"#{@name} #{stars}#{spaces} #{tired_or_not} #{dead_or_alive}\"\n end",
"def green(output)\n color(32, output)\n end",
"def colors(warm, cool)\n puts \"#{warm} is a contrast color to #{cool}\"\nend"
] |
[
"0.65192735",
"0.62432534",
"0.62414855",
"0.62272316",
"0.6187011",
"0.60789466",
"0.60214823",
"0.6016784",
"0.59771425",
"0.5971962",
"0.59434277",
"0.59279495",
"0.58759886",
"0.5863351",
"0.5837028",
"0.5831333",
"0.5825332",
"0.58015454",
"0.5786821",
"0.5781382",
"0.57748413",
"0.5771445",
"0.57710993",
"0.5770028",
"0.57635707",
"0.57513887",
"0.575125",
"0.5733523",
"0.5733523",
"0.57170343",
"0.5715232",
"0.57114375",
"0.5710686",
"0.57068694",
"0.5705894",
"0.57046056",
"0.5702266",
"0.5693457",
"0.56933117",
"0.56834674",
"0.565909",
"0.5653994",
"0.5651428",
"0.56465375",
"0.5642555",
"0.56131405",
"0.5598976",
"0.5587652",
"0.5576732",
"0.55658346",
"0.55526924",
"0.55475545",
"0.55296975",
"0.5527908",
"0.5524939",
"0.55185926",
"0.5514878",
"0.5513315",
"0.550435",
"0.5496101",
"0.54948425",
"0.54901856",
"0.54868364",
"0.54854184",
"0.5484487",
"0.5479573",
"0.547806",
"0.54762363",
"0.54734004",
"0.54717916",
"0.54703414",
"0.5470012",
"0.5469659",
"0.54672056",
"0.54623055",
"0.54614335",
"0.5459517",
"0.5459281",
"0.54588175",
"0.5456468",
"0.545348",
"0.5440894",
"0.5440477",
"0.5432912",
"0.5431162",
"0.54304147",
"0.54304147",
"0.5428948",
"0.5425446",
"0.5422581",
"0.5422031",
"0.5422031",
"0.5422031",
"0.5422031",
"0.5422031",
"0.5422031",
"0.5419607",
"0.541744",
"0.54170835",
"0.5415573",
"0.54122245"
] |
0.0
|
-1
|
Opens an active debugger for the process with the given PID.
|
def open_active_debugger(pid)
ITwibDebugger.new(@connection, @device_id, send(Command::OPEN_ACTIVE_DEBUGGER, [pid].pack("Q<")).wait_ok.object_ids[0])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start_debugger\n # First try the more modern 'byebug'\n begin\n require \"byebug\"\n byebug\n rescue LoadError\n # If that fails, try the older debugger\n begin\n require 'debugger'\n debugger\n rescue LoadError\n self.log.info \"No debugger found, can't break on failures.\"\n end\n end\n end",
"def set_debugger\n @debugger = Debugger.find(params[:id])\n end",
"def _dbg\r\n require 'rubygems'\r\n require 'pp' # who would want debug without pp? not I\r\n begin\r\n require 'ruby-debug'\r\n debugger\r\n rescue LoadError => e\r\n throw \"unable to load ruby-debug gem for _dbg... #{e}\"\r\n end\r\n end",
"def load_debugger\n pid = Process.fork do\n STDOUT.close\n STDERR.close\n\n debug_loop = ENV[\"TM_BUNDLE_SUPPORT\"] + \"/lib/debug_loop.rb\"\n `ruby #{e_sh debug_loop} #{@output_swf} #{e_sh @flex_sdk_bin} &> /dev/null &`\n end\n Process.detach pid\n\n sleep 0.6 # Give the debugger a moment to load\nend",
"def activate_debugger(thread, ctxt, bp)\n puts \"[Debugger activated]\" unless bp.kind_of? StepBreakpoint\n @debug_thread = thread\n @eval_context = @debug_context = ctxt\n\n # Load debugger commands if we haven't already\n load_commands unless @commands\n\n file = @debug_context.file.to_s\n line = @debug_context.line\n\n puts \"\"\n puts \"#{file}:#{line} (#{@debug_context.method.name}) [IP:#{@debug_context.ip}]\"\n output = Output.new\n output.set_line_marker\n output.set_color :cyan\n if bp.kind_of? StepBreakpoint and bp.step_by == :ip\n bc = @debug_context.method.decode\n inst = bc[bc.ip_to_index(@debug_context.ip)]\n output.set_columns([\"%04d:\", \"%-s \", \"%-s\"])\n output << [inst.ip, inst.opcode, inst.args.map{|a| a.inspect}.join(', ')]\n else\n lines = source_for(file)\n unless lines.nil?\n output.set_columns(['%d:', '%-s'])\n output << [line, lines[line-1].chomp]\n end\n end\n output.set_color :clear\n puts output\n\n @prompt = \"\\nrbx:debug> \"\n until @done do\n inp = Readline.readline(@prompt)\n inp.strip!\n if inp.length > 0\n process_command(inp)\n @last_inp = inp\n elsif @last_inp\n process_command(@last_inp)\n end\n end\n\n # Clear any references to the debuggee thread and context\n @debug_thread = nil\n @debug_context = nil\n @eval_context = nil\n end",
"def dbg\nbegin\n require 'rubygems'\n require 'ruby-debug'\n debugger\nrescue LoadError\nend\nend",
"def activate_process_window( pid )\n pid , hwnd = find_parent_process_with_hwnd(pid)\n wsh.AppActivate(pid) if pid\n end",
"def activate_debugger(thread, ctxt, bp_list)\n @debug_thread = thread\n @interface.at_breakpoint(self, thread, ctxt, bp_list)\n end",
"def pid\n @pid = python_p('gdb.selected_inferior().pid').to_i\n end",
"def attach_process(process)\n case process\n when String\n @pid = GHRL.functions[:GetProcessID].call(process).to_i\n when Integer\n @pid = process\n else\n Logger.error('Please pass either a String or Integer')\n exit!\n end\n\n @handle = GHRL.functions[:OpenProcess].call(GHRL::PROCESS_ALL_ACCESS, GHRL::NULL, @pid)\n\n # OpenProcess RETURNS 0 ON ERROR\n if @handle.zero?\n return unless @handle.zero?\n\n Logger.error(\"Couldn't find PID\")\n exit!\n end\n end",
"def debug_program(dbgr, ruby_path, program_to_debug)\n\n # Make sure Ruby script syntax checks okay.\n # Otherwise we get a load message that looks like trepanning has \n # a problem. \n output = `#{ruby_path} -c #{program_to_debug.inspect} 2>&1`\n if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/\n puts output\n exit $?.exitstatus \n end\n # print \"\\032\\032starting\\n\" if Trepan.annotate and Trepan.annotate > 2\n\n dbgr.trace_filter << self.method(:debug_program)\n dbgr.trace_filter << Kernel.method(:load)\n\n old_dollar_0 = $0\n\n # Without the dance below to set $0, setting it to a signifcantly\n # longer value will truncate it in some OS's. See\n # http://www.ruby-forum.com/topic/187083\n $progname = program_to_debug\n alias $0 $progname\n dollar_0_tracker = lambda {|val| $program_name = val} \n trace_var(:$0, dollar_0_tracker)\n\n dbgr.debugger(:hide_stack=>true) do\n dbgr.core.processor.hidelevels[Thread.current] = \n RubyVM::ThreadFrame.current.stack_size + 1\n Kernel::load program_to_debug\n end\n\n # The dance we have to undo to restore $0 and undo the mess created\n # above.\n $0 = old_dollar_0\n untrace_var(:$0, dollar_0_tracker)\n end",
"def initialize(pid) \r\n @pid = pid\r\n @h = Ragweed::Wrap32::open_process(pid)\r\n @a = arena()\r\n end",
"def load_debugger(new_argv)\n path_to_rdebug = \"/home/user/Ruby/ruby-debug-ide/bin/rdebug-ide\"\n\n old_argv = ARGV.clone\n ARGV.reject {|x| true}\n new_argv.each do |x|\n ARGV << x\n end\n \n old_0 = $0.clone\n $0 = path_to_rdebug\n\n load path_to_rdebug\n\n $0 = old_0\n ARGV.reject {|x| true}\n old_argv.each do |x|\n ARGV << x\n end\nend",
"def get_debugger_port\n throw \"Could not get devices from adb\" if @adb.getDevices.size == 0\n dev = @adb.getDevices[0]\n sleep(1)\n throw \"Could not get clients for device (#{dev})\" if dev.getClients.size == 0\n dev.getClients.each do |cli|\n $DEBUG and puts(\"Found process: #{cli}\")\n if(cli.getClientData.getDebuggerConnectionStatus.to_s == \"WAITING\")\n $DEBUG and puts(\"Found process waiting for debugger: #{cli} : #{cli.getDebuggerListenPort}\")\n return(cli.getDebuggerListenPort)\n end\n end\n throw(\"Could not find a process waiting for debugger.\")\n return(nil)\n end",
"def rungdb\n gdbcmd = \"gdb --batch --quiet -x \\\"#{@cmdfilepath}\\\" \\\"#{@dsymfile}\\\"\"\n gdbout = `#{gdbcmd}`\n gdbout\n end",
"def debug_program\n error = Byebug.debug_load(program, stop)\n puts \"#{error}\\n#{error.backtrace}\" if error\n end",
"def initialize\n # HACK readline causes `rake spec` to hang in ioctl()\n require 'readline-native'\n\n @breakpoint_tracker = BreakpointTracker.new do |thread, ctxt, bp|\n activate_debugger thread, ctxt, bp\n end\n\n # Register this debugger as the default debug channel listener\n Rubinius::VM.debug_channel = @breakpoint_tracker.debug_channel\n\n @quit = false\n @breakpoint_listener = Thread.new do\n thrd = nil\n until @quit do\n @done = false\n begin\n thrd = @breakpoint_tracker.wait_for_breakpoint\n @breakpoint_tracker.wake_target(thrd) unless @quit # defer wake until we cleanup\n rescue Error => e\n puts \"An exception occured while processing a breakpoint:\"\n puts e\n end\n end\n # Release singleton, since our loop thread is exiting\n Debugger.__clear_instance\n\n # Remove all remaining breakpoints\n @breakpoint_tracker.clear_breakpoints\n\n # De-register debugger on the global debug channel\n Rubinius::VM.debug_channel = nil\n\n if thrd\n # thrd will be nil if debugger was quit from other than a debug thread\n puts \"[Debugger exiting]\"\n @breakpoint_tracker.wake_target(thrd)\n end\n @breakpoint_tracker.release_waiting_threads\n end\n Thread.pass until waiting_for_breakpoint?\n end",
"def initialize\n @breakpoint_tracker = BreakpointTracker.new do |thread, ctxt, bp|\n activate_debugger thread, ctxt, bp\n end\n\n # Register this debugger as the default debug channel listener\n Rubinius::VM.debug_channel = @breakpoint_tracker.debug_channel\n\n @quit = false\n @breakpoint_listener = Thread.new { handle_breakpoints }\n Thread.pass until waiting_for_breakpoint?\n end",
"def set_debug\n @debug = Debug.find(params[:id])\n end",
"def set_debug_run\n @debug_run = DebugRun.find(params[:id])\n end",
"def open_process_by_title(title)\r\n window_handle = find_window_by_title(title)\r\n pid = window_pid(window_handle)\r\n\r\n # permissions = Kernel32::PROCESS_QUERY_INFORMATION | Kernel32::PROCESS_VM_READ\r\n # permissions = Kernel32::PROCESS_QUERY_LIMITED_INFORMATION\r\n # permissions = Kernel32::PROCESS_QUERY_INFORMATION | Kernel32::PROCESS_VM_READ\r\n permissions = Kernel32::PROCESS_QUERY_INFORMATION | Kernel32::PROCESS_VM_READ\r\n process_handle = Kernel32.open_process(permissions, false, pid)\r\n\r\n if process_handle == 0\r\n error_message = format_error_code(Kernel32.get_last_error)\r\n\r\n raise Error::System::Windows::OpenProcessFailure, message: error_message\r\n end\r\n\r\n process_handle\r\n end",
"def debug it\n PryByebug::BreakCommand.new.send :add_breakpoint, \"Testo::Test#run\", nil\n # How to \"next next step\" automatically when the breakpoint is hit?\n\n begin\n run it\n raise \"Cannot reproduce. It might be a heisebug.\"\n rescue\n $!\n end\nend",
"def enable_breakpoint(bp)\n bp.enable\n end",
"def debug\n ::RSpec.configure do |config|\n config.add_setting :debugger_proc\n config.debugger_proc = ->(ex) do\n exception = ex.exception\n defined?(Pry) ? binding.pry : debugger # rubocop:disable Debugger\n end\n config.after(debug: true) do |ex|\n instance_exec(ex, &config.debugger_proc) if ex.exception\n end\n end\n end",
"def debugger_address; end",
"def attach(pid)\n MemoryIO::Process.new(pid)\n end",
"def open\n # Opening the simulator with a specific UDID will boot the device\n if booted\n shutdown\n end\n sim = %x[/usr/bin/xcode-select -p].gsub(\"\\n\", \"/Applications/iOS Simulator.app\")\n %x[open -g -a '#{sim}' --args -CurrentDeviceUDID #{self.id}]\n sleep 0.5\n end",
"def testCommandLineDebug\n # Make sure we don't break debug\n lDebugMode = debug_activated?\n begin\n executeSlave( [ '--debug' ] )\n rescue Exception\n activate_log_debug(lDebugMode)\n raise\n end\n activate_log_debug(lDebugMode)\n end",
"def connect\n begin\n port = get_debugger_port\n rescue\n # Sometimes this will fail if we don't wait long enough, try one more time\n sleep(2)\n port = get_debugger_port\n end\n connect_host_port(\"localhost\", port)\n end",
"def debugger_address=(_arg0); end",
"def launchProc(session,target)\n\tprint_status(\"Launching hidden #{target}...\")\n\n\t# Set the vars; these can of course be modified if need be\n\tcmd_exec = target\n\tcmd_args = nil\n\thidden = true\n\tchannelized = nil\n\tuse_thread_token = false\n\n\t# Launch new process\n\tnewproc = session.sys.process.execute(cmd_exec, cmd_args,\n\t\t'Channelized' => channelized,\n\t\t'Hidden' => hidden,\n\t\t'InMemory' => nil,\n\t\t'UseThreadToken' => use_thread_token)\n\n\tprint_status(\"Process #{newproc.pid} created.\")\n\n\treturn newproc\nend",
"def debug(progname = nil, &block)\n add(DEBUG, nil, progname, &block)\n end",
"def set_breakpoint(cm, ip)\n @breakpoint_tracker.on(cm, :ip => ip)\n end",
"def console\n puts 'Entering debug console.'\n if RUBY_VERSION == '2.0.0'\n require 'byebug'\n byebug\n else\n require 'ruby-debug'\n Debugger.start\n debugger\n end\n puts 'Leaving debug console.'\n end",
"def breakpoint binding; IRB.start_with_binding binding end",
"def openDPM(attributes)\r\n dpmAlias = attributes[\"Name\"]\r\n confName = @context.createValidName(dpmAlias)\r\n varType = attributes[\"Type\"]\r\n dataType = attributes[\"DataType\"] if attributes.has_key?(\"DataType\")\r\n prodType = attributes[\"ProductType\"]\r\n\r\n dataType = prodType if nil == dataType\r\n\r\n dpm = Dpm.new(confName, dpmAlias, varType, dataType, prodType)\r\n\r\n @context.dpms[dpmAlias] = dpm\r\n end",
"def open_project(path)\n UI.puts \"Opening '#{path}'\"\n `open \"#{path}\"`\n end",
"def start_pry(binding, file = nil, header = nil)\n PryDebug.synchronize do\n puts header if header\n\n ret = catch(:resume_debugging!) do\n Pry.start(binding, :commands => ShortCommands)\n end\n\n if ret == :next\n PryDebug.stepped_file = file\n end\n\n # In case trace_func was changed\n set_trace_func trace_proc\n end\n end",
"def manual_debug_code(program)\n print(\"[Starting a Debug Session with @#{caller.first}]\\n\")\n write_temp_file(strip_line_num(program))\n remote_info = setup_unix_doman_socket_remote_debuggee\n\n while !File.exist?(remote_info.sock_path)\n sleep 0.1\n end\n\n DEBUGGER__::Client.new([socket_path]).connect\n ensure\n kill_remote_debuggee remote_info\n end",
"def test_debugger_base\n assert_equal(false, Debugger.started?, \n 'Debugger should not initially be started.')\n Debugger.start_\n # we need to add the breakpoint to force enabling trace points\n Debugger.add_breakpoint(__FILE__, 1)\n assert(Debugger.started?, \n 'Debugger should now be started.')\n assert_equal(false, Debugger.debug,\n 'Debug variable should not be set.')\n assert_equal(false, Debugger.post_mortem?,\n 'Post mortem debugging should not be set.')\n a = Debugger.contexts\n assert_equal(1, a.size, \n 'There should only be one context.')\n assert_equal(Array, a.class, \n 'Context should be an array.')\n ensure\n Debugger.stop\n assert_equal(false, Debugger.started?, \n 'debugger should no longer be started.')\n end",
"def start!(&block)\n if running?\n fail InsidiousError.new(\"Process is already running with PID #{pid}\")\n exit 2\n else\n if @pid_file.nil? && daemon?\n fail InsidiousError.new('No PID file is set but daemonize is set to true')\n exit 1\n end\n\n run_daemon!(&block)\n end\n end",
"def change(id, expression = nil)\n validate_expression expression\n\n breakpoint = find_by_id(id)\n breakpoint.expr = expression\n breakpoint\n end",
"def launched_from(pid, depth = 0)\n raise 'UnknownAncestor' if depth > 8\n cmd, ppid = ps_cmd(pid)\n return cmd if INIT_PID.include?(ppid.to_i)\n launched_from(ppid, depth + 1)\nend",
"def start_proc(proc_name)\n print_good(\"Starting Notepad.exe to house Meterpreter Session.\")\n proc = client.sys.process.execute(proc_name, nil, {'Hidden' => true })\n print_good(\"Process created with pid #{proc.pid}\")\n return proc.pid\n end",
"def connect_to_process!\n Bullring.logger.debug{\"#{caller_name}: Connecting to process...\"}\n\n if !process_port_active?\n Bullring.logger.debug {\"#{caller_name}: Spawning process...\"}\n\n # Spawn the process in its own process group so it stays alive even if this process dies\n pid = Process.spawn([@options[:process][:command], @options[:process][:args]].flatten.join(\" \"), {:pgroup => true})\n Process.detach(pid)\n\n time_sleeping = 0\n while (!process_port_active?)\n sleep(0.2)\n if (time_sleeping += 0.2) > @options[:process][:max_bringup_time]\n Bullring.logger.error {\"#{caller_name}: Timed out waiting to bring up the process\"}\n raise StandardError, \"#{caller_name}: Timed out waiting to bring up the process\", caller\n end\n end\n end\n\n if !@local_service.nil?\n @local_service.stop_service\n Bullring.logger.debug {\"#{caller_name}: Stopped local service on #{@local_service.uri}\"}\n end\n \n @local_service = DRb.start_service \"druby://127.0.0.1:0\"\n Bullring.logger.debug {\"#{caller_name}: Started local service on #{@local_service.uri}\"}\n\n @process = DRbObject.new nil, \"druby://#{host}:#{port}\"\n \n @after_connect_block.call(@process) if !@after_connect_block.nil?\n end",
"def show\n # debugger\n end",
"def start_proc()\n\tprint_good(\"Starting Notepad.exe to house Meterpreter Session.\")\n\tproc = client.sys.process.execute('notepad.exe', nil, {'Hidden' => true })\n\tprint_good(\"Process created with pid #{proc.pid}\")\n\treturn proc.pid\nend",
"def set_debug_info\n @debug_info = DebugInfo.find(params[:id])\n end",
"def debug_shell\n puts '------ Opening debug shell -----'\n @orig_dir = Dir.pwd\n begin\n if respond_to?(:prepare_debug_shell)\n prepare_debug_shell\n end\n system('bash')\n ensure\n Dir.chdir(@orig_dir)\n end\n puts '------ Exiting debug shell -----'\n end",
"def show\n #debugger\n end",
"def xdg_open(file_name)\n pid = spawn(\"xdg-open '#{file_name}'\")\n\n Process.wait pid\n\n if $CHILD_STATUS.exitstatus > 0\n warn \"Error when running xdg-open #{file_name}. Exiting...\"\n nil\n end\nend",
"def debugger_uri\n return @debugger_uri if @debugger_uri\n\n debugger_address =\n @bridge.http.\n call(:get, \"/session/#{@bridge.session_id}\", nil).\n payload.\n dig('value', 'goog:chromeOptions', 'debuggerAddress')\n\n debugger_address.prepend('http://') unless debugger_address.match?(%r{^\\w+://})\n @debugger_uri = URI.parse(debugger_address)\n end",
"def delete(id)\n deleted = Byebug.started? && \n Byebug.remove_breakpoint(id) &&\n breakpoints.delete(find_by_id(id))\n raise ArgumentError, \"No breakpoint ##{id}\" if not deleted\n Pry.processor.debugging = false if to_a.empty?\n end",
"def open_tab(options = nil)\n current_terminal.launch_ :session => 'New session'\n end",
"def start!\n process.start\n end",
"def debug_on(debug=true)\n ap \"Debugging is ON\"\n @debug = debug\n end",
"def restart_debug\n restart do\n debug\n end\n end",
"def SwitchY2Debug(_PID)\n if _PID == nil\n Builtins.y2error(\"PID cannot be: %1\", _PID)\n return\n end\n\n cmd = Builtins.sformat(\"kill -s USR1 %1\", _PID)\n\n Builtins.y2milestone(\n \"Adjusting Y2DEBUG >%1<: %2\",\n cmd,\n WFM.Execute(path(\".local.bash_output\"), cmd)\n )\n\n nil\n end",
"def open\n @is_running = true\n run_interpreter\n end",
"def open(id)\n API::Device.open(id) do |pointer|\n API.snd_rawmidi_open(nil, pointer, id, 0)\n end\n end",
"def set_debugger_thread(thr)\n raise TypeError, \"Must be another Thread\" unless thr.kind_of?(Thread)\n\n @debugger_thread = thr\n end",
"def enable_debug(file = nil)\n set_debug_file(file.to_s)\n self\n end",
"def start(settings = {:immediate => false})\n @settings = @settings.merge(settings)\n skip_loader if @settings[:skip_loader]\n spinup_thread\n @debugee_thread = @thread\n if @settings[:hide_level]\n @processor.hidelevels[@thread] = @settings[:hide_level]\n end\n\n # Feed info to the debugger thread!\n locs = Rubinius::VM.backtrace(@settings[:offset] + 1, true)\n\n method = Rubinius::CompiledMethod.of_sender\n\n event = settings[:immediate] ? 'debugger-call' : 'start'\n bp = Trepanning::Breakpoint.new('<start>', method, 0, 0, 0, \n {:event => event}\n )\n channel = Rubinius::Channel.new\n\n @local_channel.send Rubinius::Tuple[bp, Thread.current, channel, locs]\n\n # wait for the debugger to release us\n channel.receive\n\n Thread.current.set_debugger_thread @thread\n self\n end",
"def debug=(d)\n @pdnsdbs.each do |pdnsdb|\n pdnsdb.debug = d\n end\n end",
"def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end",
"def start_monit(pidfile = nil)\n context.execute \"monit start #{adapter}_#{app['shortname']}\" do\n retries 3\n creates pidfile unless pidfile.to_s.empty?\n end\n end",
"def testCommandLineDebugShort\n # Make sure we don't break debug\n lDebugMode = debug_activated?\n begin\n executeSlave( [ '-d' ] )\n rescue Exception\n activate_log_debug(lDebugMode)\n raise\n end\n activate_log_debug(lDebugMode)\n end",
"def attach\n Console.open self\n end",
"def open_pdi_page(*args, &block)\n @p.open_pdi_page(self, *args, &block)\n end",
"def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end",
"def remote_debug args\n require 'pry-remote'\n remote(args) do |ssh|\n ssh.forward.local 9876, '127.0.0.1', 9876\n ssh.forward.remote 9877, '127.0.0.1', 9877\n debugging = true\n Thread.new { ssh.loop { debugging } }\n PryRemote::CLI.new(['-P', '9877']).run\n debugging = false\n end\n end",
"def create\n @pdb = Pdb.new(params[:pdb])\n\n respond_to do |format|\n if @pdb.save\n format.html { redirect_to @pdb, notice: 'Pdb was successfully created.' }\n format.json { render json: @pdb, status: :created, location: @pdb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pdb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def debug\n usb_set_indicator_as_debug_light wValue: 1\n self\n end",
"def start\n @process = ChildProcess.build(*parameters)\n process.start\n end",
"def open_port(index)\n Interface::midiin_open_port(@midiin, index)\n end",
"def enable_debug(file = nil)\n set_debug_file(file.to_s)\n end",
"def _start_monitor(analyzer_id, port)\n $logger.debug \"_START MONITOR\"\n opts={\n :ARGV => ['restart', analyzer_id.to_s, port.to_s],\n :multiple => true,\n :monitor => true,\n :backtrace => true,\n :mode => :exec,\n :log_output => File.join(File.dirname(__FILE__), '../../log/monitor.out'+($is_debug ? \".dug\" :\"\"))\n }\n script = File.join(File.dirname(__FILE__), \"monitor.rb\")\n #Child process execs\n #ObjectSpace.each_object(IO) {|io| io.close rescue nil }\n app = Daemons.run(script, opts)\n $logger.debug \"------------------------------------------->\"\n $logger.debug app.inspect()\n $logger.debug \"<-------------------------------------------\"\n #parent process continues\n end",
"def [](pid)\n pid = pid.to_i\n @running_processes[pid] ||= find_by_pid(pid)\n end",
"def re_open opts={}\n @logdev.re_open opts\n self\n end",
"def breakpoint()\n #This is a stub, used for indexing\n end",
"def set_dpm\n @dpm = Dpm.find(params[:id])\n end",
"def call_pry\n return unless Rails.env.development? && @debug\n Ncurses.def_prog_mode\n Ncurses.reset_shell_mode\n binding.pry # rubocop:disable Lint/Debugger\n Ncurses.reset_prog_mode\n end",
"def checkdebug\n begin\n if ENV['FACTER_DEBUG'] == 'true'\n Facter.debugging(true)\n end\n rescue\n end\nend",
"def checkdebug\n begin\n if ENV['FACTER_DEBUG'] == 'true'\n Facter.debugging(true)\n end\n rescue\n end\nend",
"def process_alive(pid)\n\t\t::Process.kill(0, pid)\n\t\ttrue\n\trescue Errno::ESRCH\n\t\tfalse\n\tend",
"def process_alive(pid)\n\t\t::Process.kill(0, pid)\n\t\ttrue\n\trescue Errno::ESRCH\n\t\tfalse\n\tend",
"def started?\n raise NotImplementedException.new \"Debugger.started? not implemented\"\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 set_process_detail\n @process_detail = ProcessDetail.find(params[:id])\n end",
"def set_process_detail\n @process_detail = ProcessDetail.find(params[:id])\n end",
"def debug state=true\n @debug = state\n end",
"def debug?\n @debug || to_bool( ENV['LAUNCHY_DEBUG'] )\n end",
"def _start_monitor(analyzer_id, port)\n $logger.debug \"_START MONITOR\"\n opts={\n :ARGV => ['restart',analyzer_id.to_s,port.to_s],\n :multiple => true,\n :monitor => true,\n :backtrace => true,\n :mode => :exec,\n :log_output => File.join(File.dirname(__FILE__) ,'../../log/monitor.out')\n }\n script = File.join(File.dirname(__FILE__),\"monitor.rb\")\n #Child process execs\n #ObjectSpace.each_object(IO) {|io| io.close rescue nil }\n app = Daemons.run(script ,opts)\n $logger.debug \"------------------------------------------->\"\n $logger.debug app.inspect()\n $logger.debug \"<-------------------------------------------\"\n #parent process continues\n end",
"def is_process_still_running?(pid)\n 10.times do\n sleep 0.1\n begin\n Process.kill(0, pid)\n rescue Errno::ESRCH\n return false\n end\n end\n true\n end",
"def open_in_viewer\n fork { exec \"#{Seee::Config.application_paths[:pdf_viewer]} \\\"#{current_path}\\\"\" }\n end",
"def enable_advanced_debugging_tools; end",
"def add_process(pid)\n phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)\n\n raise Error, get_last_error if phandle == 0\n\n pbool = 0.chr * 4\n IsProcessInJob(phandle, nil, pbool)\n\n if pbool.unpack('L').first == 0\n unless AssignProcessToJobObject(@job_handle, phandle)\n raise Error, get_last_error\n end\n @process_list << pid\n else\n raise Error, \"pid #{pid} is already part of a job\"\n end\n\n pid\n end",
"def open_command\n if RbConfig::CONFIG[\"host_os\"] =~ /mswin|mingw/\n \"start\"\n elsif RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n \"open\"\n else\n \"xdg-open\"\n end\nend",
"def started_db\n start unless db.running?\n db\n end",
"def started_db\n start unless db.running?\n db\n end"
] |
[
"0.66999483",
"0.59827304",
"0.5888002",
"0.57304233",
"0.557473",
"0.55458605",
"0.5523532",
"0.5379685",
"0.53770626",
"0.5325998",
"0.52798176",
"0.5254402",
"0.5216819",
"0.5215103",
"0.51993775",
"0.5180837",
"0.5140287",
"0.5097943",
"0.5067256",
"0.50338763",
"0.497886",
"0.4973533",
"0.49547744",
"0.49448276",
"0.49385428",
"0.4930457",
"0.487243",
"0.48675215",
"0.48139298",
"0.47851035",
"0.47850323",
"0.4777767",
"0.47591037",
"0.47294548",
"0.4707233",
"0.46870494",
"0.46740606",
"0.4673361",
"0.46689153",
"0.4668539",
"0.4668441",
"0.46608528",
"0.46441036",
"0.46434483",
"0.46426308",
"0.46332484",
"0.4628637",
"0.4600237",
"0.45996717",
"0.45824227",
"0.45699942",
"0.45650432",
"0.455893",
"0.45516813",
"0.45487854",
"0.45395985",
"0.45205867",
"0.4519921",
"0.45172364",
"0.45145282",
"0.4498695",
"0.44837436",
"0.44782773",
"0.4470416",
"0.44696912",
"0.44614103",
"0.4455668",
"0.4448857",
"0.44473436",
"0.44412088",
"0.4437713",
"0.44373658",
"0.44335157",
"0.44267908",
"0.4407782",
"0.43826422",
"0.43765086",
"0.43701553",
"0.43696362",
"0.43682256",
"0.43594053",
"0.43432558",
"0.43292913",
"0.43292913",
"0.43176246",
"0.43176246",
"0.4315868",
"0.43093935",
"0.42967406",
"0.42967406",
"0.42820376",
"0.42734337",
"0.4273085",
"0.42729968",
"0.4264425",
"0.42571935",
"0.4252622",
"0.42481402",
"0.42437902",
"0.42437902"
] |
0.8355894
|
0
|
Delivers the alert via SMS to the owning user if the following 2 conditions are met: 1. The given `current_temperature` is greater than or equal to the `temperature_threshold` for the alert. 2. The alert hasn't already been delivered today.
|
def conditionally_deliver(current_temperature)
return if Time.current < Time.current.change(hour: 6)
return if current_temperature < temperature_threshold
return if delivered_today?
deliver
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def alarm\n @history_thermostats = HistoryThermostat.all\n @thermostat = Thermostat.find(params[:id])\n @history_thermostats = @thermostat.history_thermostats\n @last_history = @history_thermostats.last\n if @last_history != nil\n @alarm = @last_history.thermostat.location.alarm\n if @alarm != nil\n if @last_history.temperature > @alarm.temp_max || @last_history.temperature < @alarm.temp_min\n flash[:notice] = \"Alarma!!\"\n end\n end\n end\n end",
"def notify_tech\n if self.status_id_changed?\n account_sid = ENV[\"TWILIO_ACCOUNT_SID\"]\n auth_token = ENV[\"TWILIO_AUTH_TOKEN\"]\n @client = Twilio::REST::Client.new(account_sid, auth_token)\n rocketElevAlert = ENV[\"TWILIO_FROM\"]\n tech_phone_number = ENV[\"TWILIO_TO\"]\n sms_body = \"The Elevator #{self.id} with Serial Number #{self.serialNumber} needs an intervention\"\n if self.status_id == Status.find_by(name: \"intervention\").id\n @client.messages.create(\n from: ENV[\"TWILIO_FROM\"],\n to: tech_phone_number, #self.column.battery.building.techPhone,\n body: sms_body)\n end\n end\n end",
"def check_temp\n\t\tif cpu_temp >= \"temp=50.0'C\"\n\t\t\tRPi::GPIO.set_high 12\n\t\t\tend\n\t\tif cpu_temp <= \"temp=49.9'C\"\n\t\t\tRPi::GPIO.set_low 12\n\t\t\tend\n\tend",
"def alert\n # @twilio_number = ENV['TWILIO_NUMBER']\n # @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n # binding.pry\n number_to_send_to = self.phone_number\n\n\t twilio_sid = \"ACca4bce79e5cdb95990cdf5a84b89c45b\"\n\t twilio_token = \"5f5703217d9812afe53c1fceea9d0b3f\"\n\t twilio_phone_number = \"5404694050\"\n\n\t @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n # time_str = ((self.time).localtime).strftime(\"%I:%M%p on %b. %d, %Y\")\n reminder = \"Hi 😍 This is a reminder from the Shiviti App. Happy Meditating 🙏\"\n \n # @twilio_client.account.sms.messages.create\n message = @twilio_client.account.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => reminder,\n )\n puts message.to\n end",
"def create\n weather_datum = WeatherDatum.new(weather_datum_params)\n weather_datum.set_sensor_id(request.headers['Authorization'].match(/(Token token=)(.*)/)[2])\n sent = false\n\n if weather_datum.save\n\n if weather_datum.temp > weather_datum.sensor.trigger_temp_max\n\n if Notification.last_notification_status(weather_datum.sensor)\n recipients = []\n notification = Notification.new message: \"Temperature Alert: #{weather_datum.temp}F @ #{weather_datum.location}!\",\n weather_datum_id: weather_datum.id,\n sensor_id: weather_datum.sensor.id,\n contacts: []\n\n Email.all.each do |e|\n e.sensors.each do |id|\n if ( Sensor.find(id).location == weather_datum.location )\n notification.contacts << e.email\n # SensorMailer.temp_email(e.email, l, data.temp, data.humidity).deliver_now\n recipients << e.email\n end\n end\n end\n sent = true\n notification.save!\n\n end\n end\n\n render json: {status: \"Record was created!\", notification: sent}\n else\n render json: {status: \"Record wasn't created!\", errors: weather_datum.errors}\n end\n end",
"def current_bmi_alert\n weight = self.current_weight\n height = self.current_height\n alert = nil\n unless weight == 0 || height == 0\n current_bmi = (weight/(height*height)*10000).round(1);\n if current_bmi <= 18.5 && current_bmi > 17.0\n alert = 'Low BMI: Eligible for counseling'\n elsif current_bmi <= 17.0\n alert = 'Low BMI: Eligible for therapeutic feeding'\n end\n end\n\n alert\n end",
"def get_temperature_callback_threshold\n send_request(FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 5, 'k s s')\n end",
"def create\n @user_order = UserOrder.new(user_order_params)\n respond_to do |format|\n if @user_order.save\n format.html { redirect_to @user_order, notice: 'User order was successfully created.' }\n format.json { render :show, status: :created, location: @user_order }\n else\n format.html { render :new }\n format.json { render json: @user_order.errors, status: :unprocessable_entity }\n end\n end\n\n # check new order total and notify host via SMS if order minimum has been met\n current_order_total = 0.0\n UserOrder.where(OrderID: @user_order.OrderID).each do |uo|\n current_order_total = current_order_total + uo.Total\n end\n\n host_order = Order.find(@user_order.OrderID)\n if current_order_total >= host_order.reqd_total.to_f\n account_sid = 'ACd8e80d698128ba7ac744054f5ccdc705' #trial credentials\n auth_token = '4b34a2a4f74ced7d1214bcf53efae432' #trial credentials\n client = Twilio::REST::Client.new account_sid, auth_token\n\n host_cell_number = User.where(Email: host_order.primaryUser).first.phone\n sms = client.account.messages.create({\n :body => \"Hello from Order2gether! Your order total has been fulfilled. Go to My Orders to review and place your order.\",\n :to => \"#{host_cell_number}\",\n :from => \"+17605762473\" #trial credentials\n })\n end\n end",
"def unacknowledged(seconds)\n @test_time = @time if @test_time.nil?\n @alert &&\n @alert.raised? &&\n [email protected]? &&\n (@test_time - @alert.raised_at) >= seconds\n end",
"def temperature\n send_message!(Protocol::Light::GetTemperature.new,\n wait_for: Protocol::Light::StateTemperature) do |payload|\n payload.temperature / 100.0\n end\n end",
"def check_weight(current_weight_kg)\n \n # currentWeightKG calculated thanks to weight sensors\n if (current_weight_kg > @max_weight_kg)\n\n # Display 10 warnings\n for _ in 1..10 do\n puts \"\\nALERT Maximum weight capacity reached on Elevator #{@id}\"\n end\n\n # Freeze elevator until weight goes back to normal\n if (@movement != \"idle\")\n @movement = \"idle\"\n end\n \n @door.open_door()\n end\n end",
"def ac_monitor current_temp, ac_working, desired_temp\n # if ((ac_working == true) && (current_temp > desired_temp))\n # \"Turn on the AC.\"\n # elsif (ac_working == true) && (current_temp <= desire_temp))\n # \"Just Right!\"\n # elsif ((ac_working == false) && (current_temp <= desire_temp))\n # \"Fix the AC whenever you have the chance. It's cool\"\n # else\n # \"Fix the AC now! It's hot!\"\n # end\nend",
"def report\n sensors = get_readings(:temperature, :oi_mode, :charging_source, :battery_charge, :battery_capacity, :current)\n sensors[:temperature][:text] = sensors[:temperature][:formatted].to_s + \" Celsius\"\n sensors[:battery_charge][:text] = sensors[:battery_charge][:formatted]\n sensors[:battery_capacity][:text] = sensors[:battery_capacity][:formatted]\n sensors[:current][:text] = sensors[:current][:formatted].to_s + \" mA\"\n\n sensors[:oi_mode][:text] = case sensors[:oi_mode][:formatted]\n when 0\n \"off\"\n when 1\n \"passive mode\"\n when 2\n \"safe mode\"\n when 3\n \"full mode\"\n end\n\n sensors[:charging_source][:text] = case sensors[:charging_source][:raw]\n when 1\n \"charging\"\n when 2\n \"docked\"\n when 3\n \"docked+\"\n else\n \"undocked\"\n end\n\n if sensors[:battery_charge][:text] == 0\n\n else\n @messages.push sensors\n end\n sensors\n end",
"def alert(today = Date.today)\n # Pull the previous 18 days' reports\n # These should all be loaded after running update_from_darksky\n\n # Recent reports are the previous three days\n recent_precip = 0.0\n logger.info(\"Computing Recent Precip for Station #{self} on #{today}\")\n recent_weather_reports(today).each do |report|\n recent_precip += report.precip_inches\n end\n logger.debug(\"Got #{recent_precip} inches of precipitation in the three prior days.\")\n # Old reports are the 15 days prior to the 3 days' \"recent reports\". So, days d - 4 through d - 18\n old_precip = 0.0\n old_weather_reports(today).each do |report|\n old_precip += report.precip_inches\n end\n logger.debug(\"Got #{old_precip} inches of precipitation in the 15 days before that.\")\n \n threshold_level = 3.5 - 0.67 * old_precip\n alert_level = recent_precip - threshold_level\n \n WeatherStationAlert.new(\n :latitude => self.latitude, :longitude => self.longitude, \n :alert_for => today,\n :level => alert_level,\n :old_sum => old_precip,\n :recent_sum => recent_precip,\n ) \n end",
"def set_temperature(desired)\n desired *= 2 if last_status && last_status.temperature_scale == :celsius || desired < 50\n send_message(\"\\x0a\\xbf\\x20#{desired.round.chr}\")\n end",
"def deliver_message\n\t\ttext = interpolate_text @template.text\n\t\tbegin \n\t\t\tsent_sms = send_sms(\"+#{@user.phone}\", text)\n\t\trescue Exception => e\n\t\t\tlogger.info \"Exception thrown interacting with Twillio: #{e}\"\n\t\t\treturn false\n\t\tend\n\n\t\tif(sent_sms.status != \"failed\")\n\t\t\tmessage = Message.create!(user: @user, template: @template, text: text)\n\t\t\ttrue\t\n\t\telse\n\t\t\tlogger.info \"Message failed to send: #{sent_sms}\"\n\t\t\tfalse\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @reading.update(reading_params)\n format.html { redirect_to user_readings_path, notice: 'Reading was successfully updated.' }\n format.json { render :show, status: :ok, location: @reading }\n if @reading.systolic > current_user.systolic_range.high || @reading.diastolic < current_user.systolic_range.low\n # Get your Account Sid and Auth Token from twilio.com/user/account\n account_sid = 'AC63de569ccbfd715bed71f1bd6d884215'\n auth_token = '447c2138b017c4bf199553496fab3554'\n @client = Twilio::REST::Client.new account_sid, auth_token\n \n message = @client.account.messages.create(:body => \"#{current_user.firstname} #{current_user.lastname}'s blood pressure is outside of normal range\",\n :to => current_user.guardian_phone_number, \n :from => current_user.phone_number)\n puts message.to\n end\n else\n format.html { render :edit }\n format.json { render json: @reading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_sensor(notification)\n\t\tvalue = notification.userInfo\n mp \"sensor value is #{value}__serial is #{value['serial']}_____________\"\n if value[\"value\"] >=5\n mp \"motion sensed - triggering lights\"\n if @Player.isPlaying\n mp 'cant start audio still playing'\n else\n avalancheTrigger\n end\n end \n\tend",
"def temperature_bot(temp)\n\tif temp >=60 && temp <=80\n\t\tputs \"comfortable\"\n\telsif temp < 60\n\t\tputs \"cold\"\n\telse\n\t\tputs \"hot\"\n\tend\nend",
"def create\n @user = current_user\n @reading = Reading.new(reading_params)\n\n respond_to do |format|\n if @reading.save\n format.html { redirect_to user_readings_path, notice: 'Reading was successfully created.' }\n format.json { render :show, status: :created, location: @reading }\n if @reading.systolic > current_user.systolic_range.high || @reading.diastolic < current_user.systolic_range.low\n # Get your Account Sid and Auth Token from twilio.com/user/account\n account_sid = 'AC63de569ccbfd715bed71f1bd6d884215'\n auth_token = '447c2138b017c4bf199553496fab3554'\n @client = Twilio::REST::Client.new account_sid, auth_token\n \n message = @client.account.messages.create(:body => \"#{current_user.firstname} #{current_user.lastname}'s blood pressure is outside of normal range\",\n :to => current_user.guardian_phone_number, \n :from => current_user.phone_number)\n puts message.to\n end\n else\n format.html { render :new }\n format.json { render json: @reading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_temperature(desired)\n desired *= 2 if last_status && last_status.temperature_scale == :celsius || desired < 50\n send_message(\"\\x0a\\xbf\\x20#{desired.chr}\")\n end",
"def temperature_check\r\n Proc.new do |observations|\r\n (observations.any? { |obs| Helper.float_above_value(obs, TEMPERATURE_THRESHOLD) })\r\n end\r\n end",
"def current_bmi_alert(patient_weight, patient_height)\n weight = patient_weight\n height = patient_height\n alert = nil\n unless weight == 0 || height == 0\n current_bmi = (weight/(height*height)*10000).round(1);\n if current_bmi <= 18.5 && current_bmi > 17.0\n alert = 'Low BMI: Eligible for counseling'\n elsif current_bmi <= 17.0\n alert = 'Low BMI: Eligible for therapeutic feeding'\n end\n end\n\n alert\n end",
"def air_conditioning(ac_status, current_temp, desired_temp)\n\tif ac_status == \"yes\" && current_temp > desired_temp\n\t\tputs \"Turn on the A/C Please\"\n\telsif ac_status == \"no\" && current_temp > desired_temp\n\t\tputs \"Fix the A/C now! It's hot!\"\n\telsif ac_status == \"no\" && current_temp < desired_temp\n\t\tputs \"Fix the A/C whenever you have the chance... It's cool...Brrrrrrr.\"\n\telse\n\t\tputs \"The temperature of #{current_temp} is okay with me!\"\n\tend\nend",
"def ac_monitor current_temp, ac_working, desired_temp\n if current_temp > desired_temp && ac_working == true\n return \"Turn on the AC.\"\n end\n if current_temp <= desired_temp && ac_working == true\n return \"Just right!\"\n end\n if current_temp > desired_temp && ac_working == false\n return \"Fix the AC now! It's hot!\"\n end\n if current_temp <= desired_temp && ac_working == false\n return \"Fix the AC whenever you have the chance. It's cool.\"\n end\nend",
"def alive(alert, event, status)\n starts_at = DateTime.now - eval(event.amounts)\n ends_at = DateTime.now\n\n raw = @platform.raw_data.captured_between(starts_at, ends_at)\n if raw.count == 0 \n @status.update_attributes(status: \"ALERT!\", message: \"Platform #{@platform.name} is down, no new data for alert period of #{event.amounts}!\", end_time: DateTime.now)\n AlertMailer::alert_email(alert, \"Platform #{@platform.name} is down, no new data for alert period of #{event.amounts}!\", @platform.name).deliver\n else\n @status.update_attributes(status: \"Finished\", end_time: DateTime.now)\n end\n\tend",
"def select_brew_temperature(temp)\n\n #Alert if water tank is empty\n def water_empty?\n end\n\nend",
"def alert\n Confirmer.delay.emergency(@order.id, @this_user.id)\n redirect_to @this_user\n flash[:notice] = \"Email on route!\"\n end",
"def temperature_bot(temp)\n feeling = \"\"\n if temp < 60\n feeling = \"cold\"\n elsif temp.between?(60, 80)\n feeling = \"comfortable\"\n elsif temp > 80\n feeling = \"hot\"\n end\n return feeling\nend",
"def notify_sms (c, order)\r\n\r\n # notify only if not already done! \r\n unless already_notified order\r\n #dump_order = MultiJson.dump order, :pretty => true\r\n \r\n # log order data\r\n @logger.info \"NEW ORDER: #{order[\"order_id\"]} (num products: #{order[\"num_products\"]}, \\\r\nprice: #{order[\"price\"]} #{order[\"currency_code\"]}, current state: #{order[\"current_state\"]})\" \r\n\r\n # format SMS text with order details \r\n message = compose_sms_with_order_details c, order\r\n\r\n # send SMS through Skuby API (interfacing Skebby Gateway)\r\n sms_sent = send_sms(message, @seller_cell_number, @logger) if @send_sms\r\n\r\n @logger.info \"SMS SENT:\\n#{message}\" # if sms_sent #logger.debug\r\n \r\n # if SMS TX is disable, mark as notified anyway (debug)\r\n set_notified! order if (sms_sent || !@send_sms)\r\n\r\n # return status (success/error)\r\n sms_sent\r\n else\r\n true\r\n end\r\nend",
"def checkAvailable(results, location)\n \n time = Time.now\n \n #checks if location has appointments\n if results.include? \"No Appointments Available Currently\"\n puts time.inspect + \" : \" + location.downcase + \"- NO appointment found\"\n else\n puts time.inspect + \" : \" + location.downcase + \"- YES appointment found\"\n \n #Starts Twilio to send text message\n account_sid = '000000000000000000000000000000'\n auth_token = '000000000000000000000000000000'\n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n from = '+0000000000' # Your Twilio number\n toPerson = '+0000000000' # Your mobile phone number\n \n #Sends message as text notification and includes quick link\n client.messages.create(\n from: from,\n to: toPerson,\n body: \"Appointment has been found at \" + location + \". https://am-i-eligible.covid19vaccine.health.ny.gov\"\n )\n puts 'text notification sent'\n \n #Waits 1-hour before checking again to avoid spamming\n puts \"waiting 60 minutes before checking again\"\n sleep 900\n puts \"waiting 45 minutes before checking again\"\n sleep 900\n puts \"waiting 30 minutes before checking again\"\n sleep 900\n puts \"waiting 15 minutes before checking again\"\n sleep 900\n \n puts \"resuming...\"\n end\nend",
"def temperature_bot(temp)\n # temperature bot is American but takes Celsius temperatures\n case temp\n when 18..21\n \"I like this temperature\"\n else\n \"This is uncomfortable for me\"\n end\n end",
"def send_sms\n status = self.status\n if status.upcase == 'INTERVENTION'\n self.message\n end\n end",
"def notify_user\n current_user.notify!(twilio_client)\n redirect_to current_user\n end",
"def charging_temperature; end",
"def hotel_notification(hotel, action, current_user)\n @user = current_user\n @action = action\n @hotel = hotel\n mail(to: \"[email protected]\", subject: \"Hotel created/updated/destroyed\")\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def sms_notify(username, source_system, message)\r\n sender = SmsGlobal::Sender.new :user => CONFIG[:sms_global_settings][:user_name].to_s, :password => CONFIG[:sms_global_settings][:password].to_s\r\n\r\n sender.send_text message, username, source_system\r\n Rails.logger.info \"#{Time.now.utc} - sms_notify - #{username} - #{source_system} - #{message}\"\r\n end",
"def notify from, to, message, data = nil\n string = \"Alert: #{@@alert_name}\n\n[ #{from} ] => [ #{to} ]\n \n#{message}\n \n \"\n string += \"\n \n Data: \n #{data}\n \" if data\n print string\n self.send_slack(string)\n self.send_telegram(string)\n end",
"def temperature\n if @temp.to_i > 90\n \"super hot\"\n elsif @temp.to_i > 80 \n \"hot\"\n elsif @temp.to_i > 70\n 'warm'\n elsif @temp.to_i > 60\n 'cool'\n elsif @temp.to_i > 40\n 'cold'\n else\n 'freezing'\n end\n end",
"def notify_usage( user )\n most_recent = Usage.first :conditions => { :site => user.site }, :order => 'period_from DESC'\n # 24hr can be nil during free download periods\n if most_recent && most_recent.download_24hr && most_recent.download_24hr >= user.warning_threshold\n logger.info(\" notifying: #{most_recent.download_24hr}/#{user.warning_threshold}\")\n Notifier.deliver_usage_message( user, most_recent ) \n end\nend",
"def deliver\n if session[:user_id] then\n EVENT_LOG.tagged(DateTime.now, 'ADMIN') { EVENT_LOG.info('Test-firing message push to devices') }\n User.all.each do |user|\n if rand > 0.5\n user.send_notification('test broadcast', :message)\n else\n user.send_notification(\"Please create a weekly entry\", :reminder)\n end\n end\n Rpush.push\n render nothing: true, status: :ok\n else\n redirect_to admin_login_url\n end\n end",
"def set_temperature_callback_threshold(option, min, max)\n send_request(FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, '')\n end",
"def update_monitor topic, name_value_pair, received_time\n name = name_value_pair[0]\n value = name_value_pair[1]\n device = Device.find_by(name: name)\n msg_type = \"\"\n\n if topic==\"/monitor/status\"\n msg_type = \"status\"\n if device\n device.update(status: value, status_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{value}=>#{received_time.to_s(:rfc822)}\"\n else\n new_device = Device.create(name: name, status: value, status_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{value}=>#{received_time.to_s(:rfc822)}\"\n end\n elsif topic==\"/board/temp\"\n msg_type = \"temperature\"\n if device\n device.temp_readings.create(value: value, unit: 'Celsius', received_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{BigDecimal(value)}=>#{received_time.to_s(:rfc822)}\"\n else\n new_device = Device.create(name: name)\n new_device.temp_readings.create(value: value, unit: 'Celsius', received_time: received_time)\n ActionCable.server.broadcast 'mqtt_stream_channel', content: \"#{msg_type}=>#{name}=>#{BigDecimal(value)}=>#{received_time.to_s(:rfc822)}\"\n end\n else\n Rails.logger.error \"Unable to match topic in MyMqtt\"\n end\n end",
"def alert_threshold\n return @alert_threshold\n end",
"def in_alert?\n return true if status == 'alert_new' || status == 'alert_still'\n false\n end",
"def get_temperature\n Rails.logger.debug(\"get_temperature\")\n result = Status::UNKNOWN\n begin\n result = temperature_sensor.get_value\n Rails.logger.debug(\"result = #{result}\")\n rescue => exception\n Rails.logger.info(\"get_temperature error: \\n = #{exception}\")\n end\n result\n end",
"def block_if_on_hold\n raise \"Account is currently on hold. Messaging is disabled.\" if current_account.on_hold?\n end",
"def alert_threshold=(value)\n @alert_threshold = value\n end",
"def alert(user, alert, tweet)\n @tweet = tweet\n @alert = alert\n mail to: user.email, subject: \"You have a new alert from Give Me Notice\"\n end",
"def meter_maid_check\n if minutes_remaining < 0\n fine = minutes_remaining * -3\n \"Bummer! You got a $#{fine} ticket.\"\n else\n 'The meter maid came and went.'\n end\n end",
"def going_hiking(temp)\n\n# Create if statement that checks for whether\n# temperature is >= 50\n\n\tif temp >= 50\n\n# Output string that interpolates \"temp\"\n\n\t\tputs \"#{temp} is pretty good for hiking!\"\n\n# Create second if statement that checks for \n# whether temperature is < 50\n\n\telsif temp == 23\n\n\t\tputs \"The temperature is 23!\"\n\n\telsif temp < 50\n\n# Output string that interpolates \"temp\"\n\t\t\n\t\tputs \"#{temp} is too cold for hiking!\"\n\n\n\tend\n\n# Close method\n\nend",
"def send_alert_this_day?(timing, config, _entity)\n self.class.timing_matches_today?(timing, config)\n end",
"def temperature_bot(temp)\n\treturn \"hot\" if (temp > 80)\n\treturn \"cold\" if (temp < 60)\n\treturn \"comfortable\"\nend",
"def do_ramp(last_check)\n if last_check.off?\n # If the status report says the Equipment is offline, try\n # resending the Task. If that doesn't work, fail and punt to the launcher.\n ramp_failure! unless send_to_rhizome\n elsif last_check.temperature >= target_temperature\n # If we reach the target temperature, transition into holding.\n ready!\n end\n end",
"def alerted?\n !alert_sent.nil?\n end",
"def hows_the_weather(temperature)\n if temperature < 40 \n \"It's brisk out there!\"\n elsif temperature >= 40 && temperature <= 65\n \"It's a little chilly out there!\"\n elsif temperature >= 85\n \"It's too dang hot out there!\"\n else\n \"It's perfect out there!\"\n end\nend",
"def votes_notification\n \ttype = 0\n\tcase self.total_votes\n\twhen 10\n\t\ttype = 310\n\twhen 25\n\t\ttype = 311\n\twhen 50\n\t\ttype = 312\n\twhen 100\n\t\ttype = 313\n\twhen 250\n\t\ttype = 314\n\twhen 500\n\t\ttype = 315\n\twhen 1000\n\t\ttype = 316\n\twhen 2500\n\t\ttype = 317\n\twhen 5000\n\t\ttype = 318\n\tend\n\tif type > 0\n\t\top_user_id = self.user_id\n\t\t# create activity \n\t\tcurrent_time = Time.now\n\t\tif Rails.env == 'production'\n\t\t\tRecentActivity.delay.add_activity(op_user_id, type.to_s, nil, nil, \"shout-votes-\"+self.total_votes.to_s+\"-\"+op_user_id.to_s+\"-\"+current_time.to_i.to_s, \"Shout\", self.id, 'You received ' + self.total_votes.to_s + ' votes on your shout \"'+self.body.truncate(23, separator: /\\s/)+'\"')\n\t\t\tWhisperNotification.delay.send_notification_330_level(op_user_id, type, self.total_votes, self.id)\n\t\tend\t\n\tend \n end",
"def create\n\n #Se mira si existe el gateway con ese ID\n gateway_id = Gateway.where(\"gateway_id = ?\", params[:gatewayId])\n if gateway.exists?\n gateway_id = gateway.take.id\n else\n gateway_id = nil\n end\n\n #Se guardan los datos recibidos\n hardware = Hardware.create(gateway_id: gateway_id, hardware_id: params[:gatewayId], cpu_percent: params[:cpu][:percent], memory_available: params[:memory][:available], memory_total: params[:memory][:total], memory_percent: params[:memory][:percent], disk_free: params[:disk][:free], disk_total: params[:disk][:total], disk_percent: params[:disk][:percent], temperature: params[:temperature][:value], updated_at: params[:updated_at])\n\n #Se mira si existen alertas para este hardware\n alerts = Alert.where(\"element = ? AND element_id = ?\", \"hardware\", hardware.hardware_id)\n if alerts.present?\n alerts.each do |alert|\n #Se obtiene el valor que esta monitorizando la alerta\n alert_type = alert.alert_type_id.column_name\n alert_type_name = alert.alert_type.name\n hardware_value = hardware[alert_type]\n persistence = alert.persistence\n alert_condition = (alert.sign) ? (hardware_value > alert.limit) : (hardware_value < alert.limit)\n\n #Se mira si se cumple la condicion de alerta\n if alert_condition\n #Si ya la alerta esta activada, no se hace nada\n if alert.triggered\n next\n end\n #Se mira si la alerta exige persistencia\n if persistence.nil? || persistence == 0\n message = create_trigger_message(alert.element_id, alert_type_name, alert.sign, alert.limit, alert.persistence, hardware.updated_at, alert.client.name)\n notification = Notification.create(triggered: true, alert_id: alert.id, message: message, alert_type_id: alert.alert_type_id, client_id: alert.client_id, gateway_id: alert.gateway_id, notify_app: alert.notify_app, notify_email: alert.notify_email, notify_slack: alert.notify_slack, start_time: params[:updated_at], end_time: nil)\n alert.update(triggered:true)\n else\n #Se mira si la condicion lleva cumpliendose mas que la persistencia exigida\n if alert.persistence_since.nil?\n alert.persistence_since = hardware.updated_at\n end\n persistence_since = DateTime.parse(alert.persistence_since.to_s)\n current_time = DateTime.parse(hardware.updated_at.to_s)\n difference = (current_time - persistence_since)*24*60\n if difference >= alert.persistence\n message = create_trigger_message(alert.element_id, alert_type_name, alert.sign, alert.limit, alert.persistence, hardware.updated_at, alert.client.name)\n notification = Notification.create(triggered: true, alert_id: alert.id, message: message, alert_type_id: alert.alert_type_id, client_id: alert.client_id, gateway_id: alert.gateway_id, notify_app: alert.notify_app, notify_email: alert.notify_email, notify_slack: alert.notify_slack, start_time: params[:updated_at], end_time: nil)\n alert.update(triggered:true)\n end\n end\n else\n #Si no se cumple la condicion de alerta y la alerta esta encendida, se apaga\n if alert.triggered\n alert.update(triggered: false, persistence_since: nil)\n notifications = alert.notifications.where(triggered: true)\n if notifications.present?\n notification = notifications.take\n notification.update(triggered: false, end_time: hardware.updated_at)\n end\n end\n end\n\n end\n\n end\n\n render json: hardware.to_json, status: :ok\n end",
"def send_sms_notifications(participant_id, notification_id, sms_template_id, first_name, docket_number, status = \"\")\n sms_response = send_va_notify_request(\n sms_request(participant_id, notification_id, sms_template_id, first_name, docket_number, status)\n )\n log_info(sms_response)\n sms_response\n end",
"def raised_for(seconds)\n @test_time = @time if @test_time.nil?\n @alert &&\n @alert.raised? &&\n (@test_time - @alert.raised_at) >= seconds\n end",
"def new_response_reminder_alert(info_request, incoming_message)\n # Make a link going to the form to describe state, and which logs the\n # user in.\n post_redirect = PostRedirect.new(\n :uri => main_url(request_url(info_request)) + \"#describe_state_form_1\",\n :user_id => info_request.user.id)\n post_redirect.save!\n url = confirm_url(:email_token => post_redirect.email_token)\n\n @from = contact_from_name_and_email\n headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken\n 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834\n @recipients = info_request.user.name_and_email\n @subject = \"Was the response you got to your FOI request any good?\"\n @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }\n end",
"def send_current_offers(user)\n @user = user\n @matches = User.offer_matches(@user)\n @offers = Offer.all\n .order(:date)\n .where('date >= ?', DateTime.now.to_date)\n .where('filled = ?', false)\n .joins(:center)\n .where(centers: {circonscription: @user.circonscription})\n .limit(5)\n\n if (@day_of_week == 1 || @day_of_week == 3)\n if (@matches.blank? && @offers.present?)\n mail( :to => @user.email,\n :subject => 'Certaines de nos offres pourraient vous intéresser' ) do |format|\n format.html(content_transfer_encoding: \"7bit\")\n end\n end\n end\n end",
"def teaser_scan\n return if shop.onboarded\n data = fullcontact_data\n return unless data\n\n set_social_data\n\n if self.teaser_celebrity?\n shop.teaser_celebrity = true\n shop.save\n NotificationMailer.teaser(self).deliver_now\n end\n end",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def resendable?\n (self.sent_at + 15.minutes) < Time.current\n end",
"def accept\n offer = Offer.find(params[:id])\n if offer \n if offer.product.user.id == @current_user.id\n if offer.offer_status == Offer.OFFER_OFFERED\n conversation = Conversation.new\n conversation.seller = @current_user\n conversation.buyer = offer.user\n conversation.offer = offer\n conversation.save()\n \n offer.offer_status = Offer.OFFER_ACCEPTED\n offer.conversation_id = conversation.id\n offer.save()\n \n offer.product.sold_status = Product.SOLD_IN_TRANSACTION\n offer.product.save()\n\n notify(\"NOTIF_NEW_CONVERSATION\", {\n conversation: {\n id: conversation.id,\n is_seller: false,\n prev_message: nil\n },\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name\n },\n offer: {\n id: offer.id,\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name,\n price: offer.product.price\n }\n }, offer.user_id)\n\n OfferMailer.offer_accepted_email(offer.user, offer, offer.product, offer.product.user, conversation).deliver_later!(wait: 15.seconds)\n \n render status: 200, json: {conversation_id: conversation.id}\n else\n render status: 471, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end",
"def alarm\n puts \"\\nYOUR DEVICE IS INFECTED WITH CLIPBOARD HIJACKER !\"\n system(\"notify-send -u critical 'YOUR DEVICE IS INFECTED WITH CLIPBOARD HIJACKER !'\")\n system(\"spd-say 'Your device is infected with clipboard hijacker!'\")\n end",
"def create\n if params[\"CustomerNickname\"] != \"TOMCTA\"\n render :xml => %Q{\n <TxTNotifyResponse> \n <Error> \n <ErrorCode>201</ErrorCode> \n <ErrorMessage>Customer Nickname is not valid</ErrorMessage> \n </Error> \n </TxTNotifyResponse>\n }, :status => 422\n return\n end\n\n if params[\"CustomerNickname\"] != \"TOMCTA\"\n render :xml => %Q{\n <TxTNotifyResponse> \n <Error> \n <ErrorCode>201</ErrorCode> \n <ErrorMessage>Customer Nickname is not valid</ErrorMessage> \n </Error> \n </TxTNotifyResponse>\n }, :status => 422\n return\n end\n\n if params[\"Message\"].blank? || params[\"PhoneDestination\"].blank? || params[\"XMLResponse\"].blank?\n render :xml => %Q{\n <TxTNotifyResponse> \n <Error> \n <ErrorCode>201</ErrorCode> \n <ErrorMessage>Expected Message, PhoneDestination, AdminEmail, and XMLResponse</ErrorMessage> \n </Error> \n </TxTNotifyResponse>\n }, :status => 422\n return\n end\n\n # Recording the outbound message could be a bottleneck, but this CellTrust's gateway has a 400ms lag, so it's realistic.\n # CellTrust can receive messages asynchronously, so an even more realistic test would have several Mongrels behind\n # an HTTP proxy.\n TxtGatewayMessage.create!(\n :message => params[\"Message\"],\n :mobile_number => params[\"PhoneDestination\"],\n :accepted_time => Time.now\n )\n \n render :xml => %Q{\n <TxTNotifyResponse> \n <MsgResponseList> \n <MsgResponse type=\"SMS\"> \n <Status>ACCEPTED</Status> \n <MessageId>#{random_message_id}</MessageId> \n </MsgResponse> \n </MsgResponseList> \n </TxTNotifyResponse> \n }\n end",
"def checkWeight(maxWeight)\n weight = rand(1..600) #This random simulates the weight from a weight sensor\n while weight > maxWeight\n @weightSensor = SensorStatus::ON\n puts \" ! Elevator capacity reached, waiting until the weight is lower before continue...\"\n weight -= 100 #I'm supposing the random number is 600, I'll subtract 100 so it will be less than 500 (the max weight I proposed) for the second time it runs\n end\n\n @weightSensor = SensorStatus::OFF\n puts \" Elevator capacity is OK\"\n end",
"def send_test_mail(current_value, user)\n @user = user\n @current_values = current_value\n\n mail to: '[email protected]', subject: 'Currency Exchange Rate'\n end",
"def unsubscribe_sms\n if current_user\n current_user.update_notification_preference(:push) \n render :text => \"ok\"\n else\n render :text => \"unknown user\"\n end\n end",
"def check_alerts\n hits = @queue.size\n\n if hits >= @hits_alert_threshold && (@alerts.empty? || @alerts.last.kind_of?(EndHighTrafficAlert))\n @alerts << HighTrafficAlert.new(hits: hits)\n elsif hits < @hits_alert_threshold && @alerts.last.kind_of?(HighTrafficAlert)\n @alerts << EndHighTrafficAlert.new\n end\n end",
"def report\n if data[:ping].nil?\n @fails += 1\n if @fails >= @alert_after\n alarm \"Miner #{@num} did not respond to status query\"\n end\n else\n @fails = 0\n if self[:mhs] < @min_speed*0.95 and upminutes > 5\n alarm \"Miner #{@num} performance is #{self[:mhs]}, should be #{@min_speed}\"\n elsif upminutes < 2\n alarm \"Miner #{@num} restarted\", \"Frog.aiff\"\n end\n end\n end",
"def check_if_alarm_breached(current_time)\n if @queue.length > @alarm_threshold\n @logger.debug(\"Queue length while alarming is #{@queue.length}\")\n @printer.print_alarm(@queue.length, current_time) unless @in_alarm\n @in_alarm = true\n else\n @logger.debug(\"Queue length is #{@queue.length}\")\n @printer.clear_alarm(current_time) if @in_alarm\n @in_alarm = false\n end\n end",
"def send_message_notification(user, message)\n puts \"FFFFFFFF\", user.device_token\n notification = Houston::Notification.new(:device => user.device_token)\n notification.badge = 0\n notification.sound = \"sosumi.aiff\"\n notification.content_available = true\n notification.custom_data = {:user_id => user.id}\n notification.alert = message\n certificate = File.read(\"config/production_driver.pem\")\n pass_phrase = \"push\"\n connection = Houston::Connection.new(\"apn://gateway.push.apple.com:2195\", certificate, pass_phrase)\n connection.open\n connection.write(notification.message)\n connection.close\n end",
"def notify\n return false unless @tiers # invalid tiers_id\n extract_destinations\n if @french || @other\n done = notify_all_destinations\n say_notified if done && @mode\n done\n else # no mail\n register_tiers\n false\n end\n end",
"def broadcast_check_for_hunts!\n @account.self_and_all_descendant_customers.find_each do |customer|\n ServiceRunnerJob.perform_later(\n \"DeviceBroadcasts::Customer\",\n customer,\n { type: \"hunts\", payload: {} }.to_json\n )\n end\n end",
"def raiseTemp(degrees)\n if degrees >= 0.0\n return Temperature.new(@myDegree + degrees, @myScale)\n \n else\n puts \"Please enter a degree greater than 0 to raise the temperature by!\"\n return self\n end\n end",
"def send_notifications(monster)\n nearby_users = User.near([monster.lat, monster.lng], NEARBY_MONSTER_DISTANCE)\n if nearby_users.count(:all) > 0\n notifications = Activity.notifications.where(user_id: nearby_users.map(&:id).join(\",\"))\n .where(monster_number: Monster::MONSTERS.index(monster.name))\n\n airship = Urbanairship::Client.new(key:Figaro.env.ua_application_key, secret:Figaro.env.ua_master_secret)\n push = airship.create_push\n push.notification = Urbanairship.notification(alert: \"A monster you are looking for is nearby!\")\n push.device_types = Urbanairship.device_types(['ios'])\n\n push.audience = Urbanairship.or(*notifications.map{ |n| Urbanairship.ios_channel(n.user.channel_id) } )\n push.send_push\n\n monster.save!\n end\n end",
"def confirm_daily_test_sms()\n Test.order(:created_at).last.update(:incoming_sms => 1)\nend",
"def send_app_notification\n if message.present?\n message.receipts.unread.each do |receipt|\n user = receipt.receiver\n if user.is_a?(User) #&& user.user_setting.\n user_setting = user.user_setting\n allow_push = false\n if message.message_type == 'user_messages' && user_setting.allow_user_messages?\n allow_push = true\n end\n if message.message_type == 'clan_messages' && !(user_setting.allow_clan_messages.include?(message.notified_object_id.to_s))\n allow_push = true\n end\n if allow_push && (user_setting.android? || user_setting.iphone? ) && user_setting.fcm_token.present?\n # sky start\n\n # fcm = FCM.new(\"AIzaSyCHC77aETrtuaAvNTQQqvnLhjFf6zHOSPc\")\n # options = {data: {message: \"#{sender.username}: #{subject}\", url: nil, id: receipt.id, type: :usermessages}, collapse_key: :updated_score}\n # registration_ids = [user_setting.fcm_token]\n # response = fcm.send(registration_ids, options)\n\n # sky end\n\n fcm = FCM.new(\"AAAAqD6vl5g:APA91bEE1FUBihFLdW6kO9XpN-srDxlama2BzzjimePRN-kBlfq0tKMsblhNPW7a2_CeM1J0Pz7SMAYx4c_notZMCx2schfCDYvizOW6EYWAhnUsYA10azWOenextxFiUaFotLT8Z8er\")\n if user_setting.android?\n options = { data: { title: sender.username, message: subject, url: nil, id: receipt.id, type: message.message_type}, collapse_key: :updated_score}\n else\n options = {notification: {title: sender.username, body: subject, icon: \"myicon\", sound: \"notificationRoster.wav\", url: nil, id: receipt.id, type: message.message_type}, priority: \"high\"}\n end\n\n registration_ids = [user_setting.fcm_token]\n response = fcm.send(registration_ids, options)\n\n end\n end\n end\n end\n end",
"def currentTemp(info)\n\treturn info[\"currently\"][\"temperature\"]\nend",
"def select_brew_temperature(temp)\n end",
"def sensor_temperature(key)\n sensors = $config.params\n display = sensors['AltDisplay']\n sensor = sensors[key]\n if sensor.nil?\n Command.help \"Unknown sensor: #{stat}\"\n else\n display_temp(key, sensor, display)\n end\n end",
"def incoming\n from = params[\"From\"]\n\n if Number.find_by(number: from).blank?\n Number.create(number:from)\n end\n\n number = Number.find_by(number: from)\n\n if number.user.blank? && number.skip_sign_up == false\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"If you would like to register your name so we can give you credit for your pictures, send a text with 'Register' followed by your name :)\"\n )\n\n number.update(skip_sign_up: true)\n end\n body = params[\"Body\"]\n split = body.split(\" \")\n\n if split[0]&.downcase == 'register'\n if number.user.blank?\n User.create(\n name: split.drop(1).join(\" \"),\n number: number\n )\n\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"Successfully registered #{from} to #{number.user.name}\"\n )\n elsif number.user.present?\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"#{from} is already registered to #{number.user.name}. Text William @ 4046801732 if this isn't right.\"\n )\n end\n elsif params[\"MediaUrl0\"].present?\n Pic.create(\n number: number,\n description: params[\"Body\"],\n path: params[\"MediaUrl0\"]\n )\n reply_body = \"Thanks for for sending the pics of the party!\"\n if number.user.present?\n reply_body = \"#{number.user.name}, Thanks for sending pics!\"\n end\n\n from_number = params[\"From\"]\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from_number,\n body: reply_body\n )\n end\n end",
"def weather(msg, location)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n weather = LittleHelper.init_weather\n conditions = weather.conditions(location)\n failed = false\n\n if conditions.is_a?(String)\n failed = true\n message = \"Error getting conditions: #{conditions}\"\n end\n\n alerts = weather.alerts(location)\n\n if alerts.is_a?(String)\n failed = true\n message = message.nil? ? \"Error getting alerts: #{alerts}\" : \" | Error getting alerts: #{alerts}\"\n end\n\n now = Time.now\n precip_chance = weather.chance_of_precipitation(now, now, location)\n\n unless failed\n name = conditions[:full_name]\n condition = conditions[:weather]\n temp = conditions[:formatted_temperature]\n feel = conditions[:formatted_feelslike]\n humidity = \"#{conditions[:humidity]}%\"\n date = conditions[:updated]\n message = \"#{name}: #{condition} | \"\n\n # Appending `message` based on temp_feel in any other way would make for terrible styling.\n # rubocop:disable Style/ConditionalAssignment\n if temp == feel\n message << \"#{temp}, and feels like it!\"\n else\n message << \"#{temp}, but feels like #{feel}\"\n end\n # rubocop:enable Style/ConditionalAssignment\n\n message << \" | Humidity: #{humidity} | #{precip_chance}% chance of precipitation | #{date}\"\n end\n\n unless alerts.nil?\n alerts.each do |a|\n desc = Cinch::Formatting.format(:red, a[:description])\n message << \" | #{desc} until #{a[:expires]}\"\n end\n end\n msg.reply(message)\n end",
"def send_all_texts\n\n #heroku scheduler runs rake task to check DB every 10 minutes, not every minute like whenever gem. Logic has to account for that range of time.\n if (Time.now - 10.minutes) <= self.time && self.time <= Time.now + 10.minutes && sent == false\n self.sent = true\n self.save\n self.twilio_text\n else\n end\n\n end",
"def ac_needed current_temp, ac_working, desired_temp\n if ac_working && current_temp > desired_temp then\n puts \"turn on the A/C please\"\n elsif !ac_working && current_temp > desired_temp then\n puts \"Fix the A/C now It's too DAMN HOT\"\n elsif !ac_working && current < desired_temp then\n puts \"EHHH fix it when you want to its cool\"\n end\nend",
"def diagnostics\n app_name = @hive_mind.device_details(refresh: true)['application']\n if app_name != Hive.config.network.tv.titantv_name\n @log.error(\"Repairing: TV is not on holding app\")\n raise DeviceNotReady.new(\"Current application: '#{app_name}'\") if repair != Hive.config.network.tv.titantv_name\n end\n super\n end",
"def sms_notification_params\n params.require(:sms_notification).permit(:day_temp, :content, :precip, :user_ID, :eve_temp)\n end",
"def send_to_phone\n if params[:level_source] && params[:phone] && (level_source = LevelSource.find(params[:level_source]))\n send_sms(level_source, params[:phone])\n render status: :ok, nothing: true\n else\n render status: :not_acceptable, nothing: true\n end\n end",
"def send_message\n twilio_service = TwilioService.new \n twilio = twilio_service.client\n if @user.first_name.downcase == 'brooks' && @user.last_name.downcase =='swinnerton'\n \n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: 'http://media-cache-ec0.pinimg.com/avatars/bswinnerton-57_140.jpg'\n )\n else\n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: @reddit.first_picture\n )\n end\n end",
"def get_temp(snmp = nil)\n snmp = snmp_manager unless snmp\n\n get_routing_engines(snmp) if @routing_engines.empty?\n res = gather_snmp_metrics_by_name(\"Temp\", @routing_engines, ROUTING_ENGINE_TEMP, snmp)\n NewRelic::PlatformLogger.debug(\"Device: Got #{res.size}/#{@routing_engines.size} Temperature metrics\")\n return res\n end",
"def weatherman (condition, temperature)\n if condition == \"rainy\" && temperature == \"cold\"\n puts \"Better stay inside!\"\n elsif condition == \"rainy\" && temperature == \"hot\"\n puts \"Sounds like a gross combination.\"\n elsif condition == \"sunny\" && temperature == \"hot\"\n puts \"Maybe best to go swimming.\"\n elsif condition == \"windy\" && temperature == \"cold\"\n puts \"Bundle up!\"\n elsif condition == \"windy\" && temperature == \"hot\"\n puts \"Tornado warning!\"\n end\nend",
"def check_battery( host, snmp )\n\t\tinfo = self.format_battery( snmp )\n\n\t\tconfig = self.identifiers[ host ].last['config'] || {}\n\t\tcap_warn = config[ 'capacity_warn_at' ] || self.class.capacity_warn_at\n\t\ttemp_warn = config[ 'temperature_warn_at' ] || self.class.temperature_warn_at\n\n\t\tin_use = info.dig( :battery, :in_use )\n\t\tstatus = info.dig( :battery, :status )\n\t\tcapacity = info.dig( :battery, :capacity )\n\t\ttemperature = info.dig( :battery, :temperature )\n\t\twarnings\t= []\n\n\t\tif in_use\n\t\t\tmins = info.dig( :battery, :minutes_remaining ) || \"(unknown)\"\n\t\t\twarnings << \"UPS on battery - %s minute(s) remaning.\" % [ mins ]\n\t\tend\n\n\t\twarnings << BATTERY_STATUS[ status ] if status != 2\n\n\t\twarnings << \"Battery remaining capacity %0.1f%% less than %0.1f percent\" %\n\t\t\t[ capacity, cap_warn ] if capacity && capacity <= cap_warn\n\n\t\twarnings << \"Battery temperature %dC greater than %dC\" %\n\t\t\t[ temperature, temp_warn ] if temperature && temperature >= temp_warn\n\n\t\tinfo[ :warning ] = warnings.join( \"\\n\" ) unless warnings.empty?\n\t\tself.results[ host ] = info\n\n\tend",
"def notify(activity)\n case activity.key\n when 'event.sms', 'workshop.sms', 'meeting.reminder'\n Notification.create(:user => self, :activity => activity, :email_me => self.email_short_messages, :sms_me => (self.sms_short_messages and not self.phone.blank?))\n else\n Notification.create(:user => self, :activity => activity, :email_me => self.email_notifications)\n end\n end",
"def send_notification\n\n # TODO this seems hacky\n if Rails.env.development?\n apn = Houston::Client.development\n else\n apn = Houston::Client.production\n end\n\n apn.certificate = AWS::S3.new.buckets[ENV['S3_BUCKET_NAME']].objects['private/cert.pem'].read\n\n token = self.user.apn_token\n\n notification = Houston::Notification.new(device: token)\n notification.alert = \"You won a free drink!\"\n\n apn.push(notification)\n end",
"def notify_customer\n\t\tStripeChargeMailer.notify_customer(self).deliver_now if customer_file.try(:has_customer_account?)\n\tend",
"def send_new_booking_request_notifications\n\n if pay_now\n notify_manager_pay_now\n notify_request_to_customer_pay_now\n else\n notify_manager\n notify_request_to_customer\n end\n\n end"
] |
[
"0.56281817",
"0.558501",
"0.5579354",
"0.53859705",
"0.5229786",
"0.5219185",
"0.5214493",
"0.5127954",
"0.5109558",
"0.510576",
"0.50797004",
"0.5065795",
"0.5053062",
"0.5023537",
"0.5011943",
"0.5006179",
"0.49930206",
"0.49607253",
"0.4942989",
"0.49251318",
"0.4899196",
"0.48917997",
"0.48828256",
"0.48714444",
"0.48537022",
"0.48500177",
"0.4811661",
"0.48060077",
"0.48042256",
"0.48040307",
"0.48004013",
"0.47990423",
"0.47933513",
"0.4782399",
"0.47479546",
"0.47435367",
"0.47341147",
"0.4733457",
"0.47320354",
"0.47314405",
"0.4718807",
"0.47017992",
"0.46942917",
"0.4673359",
"0.4653849",
"0.46454605",
"0.46323428",
"0.46220723",
"0.45906362",
"0.4589436",
"0.4584687",
"0.4559809",
"0.45597973",
"0.45589674",
"0.45463493",
"0.45461786",
"0.4540534",
"0.4538473",
"0.4534386",
"0.45266935",
"0.4525073",
"0.45169383",
"0.45128927",
"0.451282",
"0.44922245",
"0.44840616",
"0.4475961",
"0.44607276",
"0.44556916",
"0.444958",
"0.4445142",
"0.44398668",
"0.44300506",
"0.4429723",
"0.44277894",
"0.44272736",
"0.44216427",
"0.4414726",
"0.44108102",
"0.44089836",
"0.440723",
"0.44052222",
"0.43992034",
"0.43924966",
"0.4391815",
"0.43901116",
"0.43888596",
"0.43843848",
"0.4383949",
"0.43755907",
"0.4368251",
"0.4368024",
"0.43673885",
"0.43649113",
"0.43626887",
"0.43589967",
"0.43515968",
"0.43491936",
"0.43459705",
"0.43436378"
] |
0.71666527
|
0
|
This is called a instance method This means you can only call it on an instance so for example delhi_streets.print_out_name (array attached to class)
|
def print_out_name
@name
self # self is the object (restuarant) itself.
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def display_of_all_apartments_method(array)\n\t array.each do |instance|\n\t \t#binding.pry\n\t \tif instance.renters[0].class == Person && instance.renters != \"Unoccupied\"\n\t \t\tif instance.renters.length == 1\n\t \t\t\tinstance.renters.each do |tenant|\n\t\t \t\tputs \"#{tenant.name} lives in apartment #{instance.address}.\"\n\t\t \t\t\tend\n\t\t \telse \n\t\t \t\tinstance.renters.each do |person| \n\t\t \t\t\tputs \"#{person.name} lives in apartment #{instance.address}\"\n\t\t \t\tend\n\t\t \tend\n\t\telsif instance.renters[0] == \"Unoccupied\"\n\t\t \t\tputs \"#{instance.address} is #{instance.sqft} square feet, with #{instance.num_beds} bedrooms & #{instance.num_baths} bathrooms. Rent is $#{instance.monthly_rent} a month\"\t\t\n\t end\n\t #end\n\tend\n\nend",
"def apartment_details(array)\n puts \"What apartment would you like to see more about?\"\n\tarray.each{|instance|\n \t\t puts \"#{instance.address} -- \"}\n \t which_apt = gets.chomp.to_s\n \tarray.each{|instance|\n \t\tif instance.address == which_apt && instance.renters == \"Unoccupied\"\n \t\t\tputs \"\\nApartment #{instance.address}: Monthly Rent: #{instance.monthly_rent} Square Feet: #{instance.sqft}\\nBedrooms: #{instance.num_beds} Bathrooms: #{instance.num_baths} Tenants: Unoccupied\\n\"\t\n \t\telsif \n \t\t instance.address == which_apt && instance.renters[0].class == Person && instance.renters != \"Unoccupied\"\n \t\t \tinstance.renters.each do |tenant|\n \t\t \t\tputs \"\\nApartment #{instance.address}: Monthly Rent: #{instance.monthly_rent} Square Feet: #{instance.sqft}\\nBedrooms: #{instance.num_beds} Bathrooms: #{instance.num_baths} Tenants: #{tenant.name}\\n\"\n\t\t \tend\n \t\t \t\n \t\tend}\nend",
"def street_name\n\n end",
"def street_name; end",
"def array_print_10\nend",
"def output_name\n puts @name\n end",
"def toString\n\t\tputs Persona.get_info\n\tend",
"def print_elements(input_array)\n # TODO\nend",
"def writethis; end",
"def print_array my_array\n\t\tp my_array\n\tend",
"def output_array_to_string(method_output)\n array = []\n string = \"\"\n if method_output.class == Array \n method_output.each do |word|\n array << word.strip.capitalize \n end\n string = array.join(\"\\n\")\n else \n string = method_output\n end\n string\n end",
"def print_array(array)\n puts \"NOT IMPLEMENTED\"\nend",
"def print_details\n\n# @stud = [@student_name, @student_about]\n# @coa = [@coach_name, @coach_bio]\n puts \"\\nWorkshop - #{self.date} - Venue: #{self.venue}\"\n puts \"\\nStudents\"\n # puts \"#{self.add_participant(@student_name)}\"\n @student_name.each do |mems|\n puts \"#{mems} - #{@student_about[0]}\"\n end\n #end\n # puts \"Coaches\"\n # @coach_name.each do |memc|\n # puts \"#{memc[0]} - #{memc[1]}\"\n # end\n end",
"def look_and_say(array)\n\nend",
"def printName\r\n\t\traise NoMethodError\r\n\tend",
"def array_method(input)\n\treturn \"thanks for the sweet array!\"\nend",
"def print_array(array)\n raise NotImplementedError\nend",
"def print_name\n\t\t@dog_name\n\tend",
"def print_contacts(contacts)\n\nend",
"def print_name\r\nputs \"Person called #{@name}\"\r\nend",
"def print\n puts \"#{@name}\" #same as :name accessor above.\nend",
"def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend",
"def print_name\n puts \"Person called #{@name}\" \n end",
"def print_homes(home_array)\n\thome_array.each do |the_home|\n\t\tputs \"#{the_home.name}: #{{the_home.city}}, $ #{the_home.price}, Capacity: #{the_home.capacity}\"\n\tend\nend",
"def print_name\n puts \"Severus Snape\"\nend",
"def print_locations(array)\n puts \"id\".ljust(5)+\"name\".ljust(15)\n puts \"-\" * 80\n array.each do |object|\n puts object.id.to_s.ljust(5) + object.name.ljust(15) \n end\n end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def __array__; self; end",
"def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend",
"def name\n street_address\n end",
"def printer (array)\nrooms = assign_rooms(array)\nnames = batch_badge_creator(array)\nrooms.each do |room1|\n puts room1\nend\nnames.each do |name1|\n puts name1\nend\nend",
"def method_missing(method_name, *args, &block)\n @array.send(method_name, *args, &block)\n end",
"def print_name(name)\n puts \"Albus Dumbledore\"\nend",
"def initialize(name, breed, age) #initialize with 3 arguments.\n @name = name\n @breed = breed\n @age = age\n DOGS << self #showell into empty DOGS array. \nend",
"def print_name\n puts \"Person called #{@name}\"\n end",
"def method_missing(method_name, *args, &block)\n @array.send(method_name, *args, &block)\n end",
"def inspect()\n #This is a stub, used for indexing\n end",
"def printContacts(contacts)\n\nend",
"def saved_for_special_occasion(array)\n puts array[2]\nend",
"def print_name\n puts \"Person called #{@name}\"\n end",
"def inspect\n raise_error # expect no instances\n end",
"def get_titles()\n puts @arr_of_titles\n end",
"def name() end",
"def printDazzle\n puts \"self\"\nend",
"def array_nl()\n #This is a stub, used for indexing\n end",
"def print\n\t\tputs name + ' ' + className + \" just \" + move + \" and said \" + call\n\tend",
"def name\n \n end",
"def dummy_msg\n puts \"JUST HERE FOR FUN W #{object.first_name}\"\n end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def printCardsArray\n cards_as_string = []\n @cards.each do |card|\n cards_as_string.push(card.getName)\n end\n cards_as_string\n end",
"def printCardArray()\n\t\tprint @cards\n\tend",
"def out; end",
"def print_text\n\t\tputs self # First object\n\t\tputs \"this is instance method to print some text\"\n\tend",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end"
] |
[
"0.62716895",
"0.5925188",
"0.5860941",
"0.5766998",
"0.5711034",
"0.56430924",
"0.55890703",
"0.55845124",
"0.55394137",
"0.5519076",
"0.5514294",
"0.54761565",
"0.5464114",
"0.5454345",
"0.5408197",
"0.53999025",
"0.5392211",
"0.5368017",
"0.536073",
"0.53587806",
"0.53453296",
"0.5343873",
"0.53419966",
"0.53303397",
"0.5329137",
"0.5327599",
"0.5318502",
"0.5318502",
"0.5318502",
"0.5318502",
"0.5318502",
"0.5318502",
"0.5318502",
"0.5314516",
"0.5312233",
"0.5290405",
"0.52777153",
"0.527436",
"0.5263919",
"0.5263852",
"0.5255792",
"0.5255512",
"0.52523685",
"0.52452064",
"0.5243604",
"0.5242614",
"0.5232801",
"0.52123845",
"0.5206322",
"0.520194",
"0.5200343",
"0.5197788",
"0.51891065",
"0.5186903",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.51817167",
"0.5176619",
"0.5176439",
"0.51718783",
"0.5171586",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166",
"0.51707166"
] |
0.5562284
|
8
|
dynamically creates attributes set to space objects for all 42 spaces
|
def initialize
x = 0
y = 0
space_array = []
42.times do
space = instance_variable_set("@space#{x}#{y}", Space.new)
space_array.push(space)
self.class.send(:attr_accessor, "space#{x}#{y}")
y += 1
if y == 6
y = 0
x += 1
end
end
@space_array = space_array
@display = "------------------------------------\n| #{space05.occupied} | #{space15.occupied} | #{space25.occupied} |"\
" #{space35.occupied} | #{space45.occupied} | #{space55.occupied} | #{space65.occupied} |\n"\
"------------------------------------\n| #{space04.occupied} | #{space14.occupied} | #{space24.occupied} |"\
" #{space34.occupied} | #{space44.occupied} | #{space54.occupied} | #{space64.occupied} |\n" \
"------------------------------------\n| #{space03.occupied} | #{space13.occupied} | #{space23.occupied} |"\
" #{space33.occupied} | #{space43.occupied} | #{space53.occupied} | #{space63.occupied} |\n"\
"------------------------------------\n| #{space02.occupied} | #{space12.occupied} | #{space22.occupied} |"\
" #{space32.occupied} | #{space42.occupied} | #{space52.occupied} | #{space62.occupied} |\n"\
"------------------------------------\n| #{space01.occupied} | #{space11.occupied} | #{space21.occupied} |"\
" #{space31.occupied} | #{space41.occupied} | #{space51.occupied} | #{space61.occupied} |\n"\
"------------------------------------\n| #{space00.occupied} | #{space10.occupied} | #{space20.occupied} |"\
" #{space30.occupied} | #{space40.occupied} | #{space50.occupied} | #{space60.occupied} |\n"\
"------------------------------------\n 1 2 3 4 5 6 7"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make\n @spaces.each { |position| position.occupied = true }\n # pp \"made ship: #{@spaces}\"\n end",
"def attributes=(_arg0); end",
"def populate\n spots = @spaces.length**2\n asteroids = (spots * 0.3).round\n gravity_wells = (spots * 0.1).round\n empty_space = (spots * 0.6 ).round\n\n asteroids.times {fill_spot('A')}\n gravity_wells.times {fill_spot('G')}\n #Because we fill two empty space with start, end marks\n empty_space.times {fill_spot('.')}\n end",
"def boot_space\n @space = object_with_type Parfait::Space\n @space.classes = make_dictionary\n @space.types = make_dictionary\n Parfait::Space.set_object_space @space\n end",
"def create_spaces\n ((@tiles, @tile_map),\n (@up_vtexs, @up_vtex_map),\n (@down_vtexs, @down_vtex_map),\n (@asc_edges, @asc_edge_map),\n (@desc_edges, @desc_edge_map),\n (@vert_edges, @vert_edge_map)) =\n [[Tile, nil, 1..5, [3,4,5,4,3], [1..3, 1..4, 1..5, 2..5, 3..5]],\n [Vtex, :up, 1..6, [3,4,5,6,5,4], [1..3, 1..4, 1..5, 1..6, 2..6, 3..6]],\n [Vtex, :down, 0..5, [4,5,6,5,4,3], [0..3, 0..4, 0..5, 1..5, 2..5, 3..5]],\n [Edge, :asc, 1..6, [3,4,5,5,4,3], [1..3, 1..4, 1..5, 2..6, 3..6, 4..6]],\n [Edge, :desc, 1..6, [3,4,5,5,4,3], [1..3, 1..4, 1..5, 1..5, 2..5, 3..5]],\n [Edge, :vert, 1..5, [4,5,6,5,4], [1..4, 1..5, 1..6, 2..6, 3..6]]\n ].map {|cls, align, row_interval, row_counts, col_intervals|\n rows = row_counts.zip(row_interval.to_a).map {|c, r| [r]*c}.flatten\n cols = col_intervals.map {|ival| ival.to_a}.flatten\n count = rows.length\n list = (0...count).to_a.map {|i| cls.new}\n list.each {|obj| obj.alignment = align} unless align.nil?\n list.zip(rows, cols).each {|obj, row, col| obj.row, obj.col = row, col}\n map = Hash[list.map {|obj| [[obj.row, obj.col], obj]}]\n [list, map]\n }\n\n @vtexs = @up_vtexs + @down_vtexs\n @edges = @asc_edges + @desc_edges + @vert_edges\n @all_spaces = @tiles + @vtexs + @edges\n\n @vtex_map = Hash[@vtexs.map {|v| [v.coords, v]}]\n @edge_map = Hash[@edges.map {|e| [e.coords, e]}]\n\n @all_spaces.zip((0...(@all_spaces.length)).to_a).each do |obj, id|\n obj.id = id\n end\n end",
"def get_rackspace_values\n @cloud_attr_obj.add_ipv4_addr(rackspace[\"public_ipv4\"], :public)\n @cloud_attr_obj.add_ipv4_addr(rackspace[\"local_ipv4\"], :private)\n @cloud_attr_obj.add_ipv6_addr(rackspace[\"public_ipv6\"], :public)\n @cloud_attr_obj.add_ipv6_addr(rackspace[\"local_ipv6\"], :private)\n @cloud_attr_obj.public_hostname = rackspace[\"public_hostname\"]\n @cloud_attr_obj.local_hostname = rackspace[\"local_hostname\"]\n @cloud_attr_obj.provider = \"rackspace\"\n end",
"def nasa_space_craft; end",
"def buildObject()\n case @x\n when 0\n attrX = $doorAttr[rand(6)]\n attrSX = $doorAttrS[rand(6)]\n @obj_pickable = false\n @combat_usability = false\n when 1\n attrX = $chestAttr[rand(3)]\n attrSX = $chestAttrS[rand(3)]\n @obj_pickable = false\n @combat_usability = false\n when 2\n attrX = $knifeAttr[rand(2)] \n attrSX = $knifeAttrS[rand(2)]\n @obj_pickable = true\n @combat_usability = true\n when 3\n attrX = $bodyAttr[rand(3)]\n attrSX = $bodyAttrS[rand(3)]\n @obj_pickable = true\n @combat_usability = true\n when 4\n attrX = $vialAttr[rand(3)]\n attrSX = $vialAttrS[rand(3)] \n @obj_pickable = true\n @combat_usability = true\n when 5\n attrX = $keyAttr[rand(2)] \n attrSX = $keyAttrS[rand(2)] \n @obj_pickable = true\n @combat_usability = false\n when 6\n attrX = $windowAttr[rand(5)] \n attrSX = $windowAttrS[rand(5)] \n @obj_pickable = false\n @combat_usability = false\n when 7\n attrX = $herbAttr[rand(3)]\n attrSX = $herbAttrS[rand(3)]\n @obj_pickable = true\n @combat_usability = true\n end\n \n @obj_name = @objX\n @obj_attr = attrX\n @obj_secondattr = attrSX\n end",
"def space=(space)\n #This is a stub, used for indexing\n end",
"def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end",
"def generate_individual_ships\n # for each ship type, create it and then assign it to its accessor\n %w|carrier battleship submarine warship destroyer|.each do |type|\n ship = Ship.new(type)\n case type\n when \"carrier\"\n then @carrier = ship\n when \"battleship\"\n then @battleship = ship\n when \"submarine\"\n then @submarine = ship\n when \"warship\"\n then @warship = ship\n when \"destroyer\"\n then @destroyer = ship\n end\n @fleet << ship # for fleet-building\n end\n end",
"def initialize(data, start, constant_pool)\r\n creator = AttributesCreator.new(data, start, constant_pool)\r\n creator.create!\r\n @attributes = creator.attributes\r\n @size = creator.size\r\n end",
"def make_dimensionless\n self.physical_quantity = 'dimensionless'\n @base_quantity_hash = { }\n end",
"def make_hash\n variables = self.instance_variables\n attr_hash = {}\n \n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n \n attr_hash\n end",
"def set_objects_to_acessor\n if [email protected]?\n @sequence.each { |ele|\n self.class.__send__(:attr_accessor, ele.downcase)\n }\n end\n\nend",
"def initialize(name) #constructor\n self.name = name\n self.hp = 50 #default values line7-14 every object has these by default\n self.mp = 10\n self.atk = 10\n self.speed = 5\n self.ct = 0\n self.maxhp = 50\n self.maxmp = 10\n self.status = 'alive'\n ALL_UNITS << self\n end",
"def produce_spaceship6(type = :freighter, size: 10, **custom_components)\r\n components = {\r\n engine: :standard,\r\n seats: :standard,\r\n subwoofer: :none\r\n }\r\n components.merge!(custom_components)\r\nend",
"def create_attributes(klass, members); end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a choice argument for model objects\n space_type_handles = OpenStudio::StringVector.new\n space_type_display_names = OpenStudio::StringVector.new\n\n # putting model object and names into hash\n space_type_args = model.getSpaceTypes\n space_type_args_hash = {}\n space_type_args.each do |space_type_arg|\n space_type_args_hash[space_type_arg.name.to_s] = space_type_arg\n end\n\n # looping through sorted hash of model objects\n space_type_args_hash.sort.map do |key, value|\n # only include if space type is used in the model\n if !value.spaces.empty?\n space_type_handles << value.handle.to_s\n space_type_display_names << key\n end\n end\n\n # add building to string vector with space type\n building = model.getBuilding\n space_type_handles << building.handle.to_s\n space_type_display_names << '*Entire Building*'\n\n # make a choice argument for space type or entire building\n space_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('space_type', space_type_handles, space_type_display_names, true)\n space_type.setDisplayName('Apply the Measure to a Specific Space Type or to the Entire Model')\n space_type.setDefaultValue('*Entire Building*') # if no space type is chosen this will run on the entire building\n args << space_type\n\n # make an argument LPD\n lpd = OpenStudio::Measure::OSArgument.makeDoubleArgument('lpd', true)\n lpd.setDisplayName('Lighting Power Density (W/ft^2)')\n lpd.setDefaultValue(1.0)\n args << lpd\n\n # add in argument to add lights to all spaces that are included in building floor area even if original space didn't have lights\n add_instance_all_spaces = OpenStudio::Measure::OSArgument.makeBoolArgument('add_instance_all_spaces', true)\n add_instance_all_spaces.setDisplayName('Add lights to all spaces included in floor area, including spaces that did not originally include lights')\n add_instance_all_spaces.setDefaultValue(false)\n args << add_instance_all_spaces\n\n # make an argument for material and installation cost\n material_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('material_cost', true)\n material_cost.setDisplayName('Material and Installation Costs for Lights per Floor Area ($/ft^2).')\n material_cost.setDefaultValue(0.0)\n args << material_cost\n\n # make an argument for demolition cost\n demolition_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('demolition_cost', true)\n demolition_cost.setDisplayName('Demolition Costs for Lights per Floor Area ($/ft^2).')\n demolition_cost.setDefaultValue(0.0)\n args << demolition_cost\n\n # make an argument for duration in years until costs start\n years_until_costs_start = OpenStudio::Measure::OSArgument.makeIntegerArgument('years_until_costs_start', true)\n years_until_costs_start.setDisplayName('Years Until Costs Start (whole years).')\n years_until_costs_start.setDefaultValue(0)\n args << years_until_costs_start\n\n # make an argument to determine if demolition costs should be included in initial construction\n demo_cost_initial_const = OpenStudio::Measure::OSArgument.makeBoolArgument('demo_cost_initial_const', true)\n demo_cost_initial_const.setDisplayName('Demolition Costs Occur During Initial Construction?')\n demo_cost_initial_const.setDefaultValue(false)\n args << demo_cost_initial_const\n\n # make an argument for expected life\n expected_life = OpenStudio::Measure::OSArgument.makeIntegerArgument('expected_life', true)\n expected_life.setDisplayName('Expected Life (whole years).')\n expected_life.setDefaultValue(20)\n args << expected_life\n\n # make an argument for o&m cost\n om_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('om_cost', true)\n om_cost.setDisplayName('O & M Costs for Lights per Floor Area ($/ft^2).')\n om_cost.setDefaultValue(0.0)\n args << om_cost\n\n # make an argument for o&m frequency\n om_frequency = OpenStudio::Measure::OSArgument.makeIntegerArgument('om_frequency', true)\n om_frequency.setDisplayName('O & M Frequency (whole years).')\n om_frequency.setDefaultValue(1)\n args << om_frequency\n\n return args\n end",
"def create_objects\n cloud Mash.new\n cloud[:public_ips] = Array.new\n cloud[:private_ips] = Array.new\n end",
"def initialize attributes = {}\n @attributes = {}\n attributes.each { |attribute, value| set attribute, value }\n end",
"def setup_object_attributes; end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def attributes(attributes)\n @attributes = attributes.to_a.map do |k, v|\n { :name => k,\n :type => v,\n :length => Tem::Abi.send(:\"#{v}_length\") \n }\n end\n end",
"def make_monsters\n DATA[:monsters].each do |monster|\n new_monster = Monster.new\n monster.each_with_index do |attribute, i|\n new_monster.send(DATA[:monster_keys][i]+\"=\", attribute)\n end\n new_monster.save \n end\nend",
"def assign_spaces_to_rows\n space_names.each_slice(@length).to_a\n end",
"def create_attrib_item_values \n @base_attribs = []\n @attribs = params[:attrib]\n @attribs.keys.each do | key |\n @base_attribs << AttribItemValue.new(attrib_id: key, value: @attribs[key])\n #puts \"AttribItemValue: #{@base_attribs.last.attrib.id}, #{@base_attribs.last.value}\"\n end if @attribs\n #puts \"Attribs: #{@attribs}, @base_attribs: #{@base_attribs.size}\"\n modified_item_parms = item_params\n modified_item_parms[:attrib_values] = @base_attribs\n modified_item_parms\n end",
"def init_space\n\t\t\traise \"#{self.class} has not implemented a Space initializer\"\n\t\tend",
"def set_default_space\n account = Factory.create :account\n \n Account.current = account\n Space.current = account.spaces.first \nend",
"def xmlAttr()\r\n a = super()\r\n a << ['width', @width]\r\n a << ['height', @height]\r\n a << ['depth', @depth]\r\n @fillColor.xmlAttr.each { |ac|\r\n a << ac\r\n }\r\n a\r\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def fill_field\n SHIPS.each { |size| put_ship(size) }\n end",
"def create_grid\n spaces = create_spaces\n assign_spaces_to_rows.map do |row|\n row.each.with_index do |coordinates, index|\n row[index] = {coordinates => spaces[coordinates]}\n end\n end\n end",
"def setup_org_space\n $CF_ORG = random_suffix('org', 'CF_ORG')\n $CF_SPACE = random_suffix('space', 'CF_SPACE')\n at_exit do\n set errexit: false do\n run \"cf delete-space -f #{$CF_SPACE}\"\n run \"cf delete-org -f #{$CF_ORG}\"\n end\n end\n run \"cf create-org #{$CF_ORG}\"\n run \"cf target -o #{$CF_ORG}\"\n run \"cf create-space #{$CF_SPACE}\"\n run \"cf target -s #{$CF_SPACE}\"\nend",
"def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end",
"def spawn attributes={}\n child = self.dup\n self.work_groups.each do |wg|\n new_wg = WorkGroup.new(:institution=>wg.institution,:project=>child)\n child.work_groups << new_wg\n wg.group_memberships.each do |gm|\n new_gm = GroupMembership.new(:person=>gm.person, :work_group=>wg)\n new_wg.group_memberships << new_gm\n end\n end\n child.assign_attributes(attributes)\n child.avatar=nil\n child.lineage_ancestor=self\n child\n end",
"def attributes\n # ...\n # debugger\n # f = method_missing(name)\n @attributes ||= {}\n # attributes = Hash.new {|h,k| h[k] = []}\n # @attributes = @colm.map {|colm| attributes[colm]}\n # unless instance_variables(false).include?(f)\n # # print f\n # end\n\n # @attribute ={}\n end",
"def setAttributes _obj, _args\n \"_obj setAttributes _args;\" \n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def produce_spaceship5(type: :freighter, size: :m, fuel_tank_vol: 100, engine_count: 4)\r\n #..\r\nend",
"def space_params\n params.require(:space).permit(:title, :space_setting_id, :num_of_people_id, :content, :address, :token,\n :atmosphere_id, :city_id, :price_hour, :price_day, :price_month, :price_year,\n :detailed_ids => [], :user_group_ids => [], :rent_env_ids => [], photos_attributes: [:data] )\n end",
"def attribute=(_arg0); end",
"def attribute=(_arg0); end",
"def vattr_set(*syms) # :nodoc:\r\n syms.each do |sym|\r\n instance_eval <<EVAL, __FILE__, __LINE__ + 1\r\ndef #{sym}_attributes(version = nil)\r\n version = validate_version! version\r\n\r\n versions.sort.inject(Set.new) { |attributes, (current_version, hash)|\r\n if current_version <= version\r\n hash[#{sym.inspect}].try(:each) { |attribute, boolean|\r\n boolean ? attributes << attribute : attributes.delete(attribute)\r\n }\r\n end\r\n\r\n attributes\r\n }\r\nend\r\nEVAL\r\n end\r\n end",
"def produce_spaceship(type = :freighter, size: :m, **custom_components)\n components = {enging: :standard,\n seats: :standard,\n subwoofer: :none\n }\n components.merge!(custom_components)\nend",
"def add_space_type(template, clim, building_type, spc_type)\n #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"Adding space type: #{template}-#{clim}-#{building_type}-#{spc_type}\")\n\n # Get the space type data\n data = self.find_object(self.standards['space_types'], {'template'=>template, 'building_type'=>building_type, 'space_type'=>spc_type})\n if !data\n OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.Model', \"Cannot find data for space type: #{template}-#{clim}-#{building_type}-#{spc_type}, will not be created.\")\n return false #TODO change to return empty optional schedule:ruleset?\n end\n \n name = make_name(template, clim, building_type, spc_type)\n\n # Create a new space type and name it\n space_type = OpenStudio::Model::SpaceType.new(self)\n space_type.setName(name)\n\n # Set the standards building type and space type for this new space type\n space_type.setStandardsBuildingType(building_type)\n space_type.setStandardsSpaceType(spc_type)\n\n # Set the rendering color of the space type\n rgb = data['rgb']\n rgb = rgb.split('_')\n r = rgb[0].to_i\n g = rgb[1].to_i\n b = rgb[2].to_i\n rendering_color = OpenStudio::Model::RenderingColor.new(self)\n rendering_color.setRenderingRedValue(r)\n rendering_color.setRenderingGreenValue(g)\n rendering_color.setRenderingBlueValue(b)\n space_type.setRenderingColor(rendering_color)\n\n # Create the schedule set for the space type\n default_sch_set = OpenStudio::Model::DefaultScheduleSet.new(self)\n default_sch_set.setName(\"#{name} Schedule Set\")\n space_type.setDefaultScheduleSet(default_sch_set)\n\n # Lighting\n make_lighting = false\n lighting_per_area = data['lighting_per_area']\n lighting_per_person = data['lighting_per_person']\n unless lighting_per_area == 0 || lighting_per_area.nil? then make_lighting = true end\n unless lighting_per_person == 0 || lighting_per_person.nil? then make_lighting = true end\n\n if make_lighting == true\n\n # Create the lighting definition\n lights_def = OpenStudio::Model::LightsDefinition.new(self)\n lights_def.setName(\"#{name} Lights Definition\")\n lights_frac_to_return_air = data['lighting_fraction_to_return_air']\n lights_frac_radiant = data['lighting_fraction_radiant']\n lights_frac_visible = data['lighting_fraction_visible']\n unless lighting_per_area == 0 || lighting_per_area.nil?\n lights_def.setWattsperSpaceFloorArea(OpenStudio.convert(lighting_per_area, 'W/ft^2', 'W/m^2').get)\n lights_def.setReturnAirFraction(lights_frac_to_return_air)\n lights_def.setFractionRadiant(lights_frac_radiant)\n lights_def.setFractionVisible(lights_frac_visible)\n end\n unless lighting_per_person == 0 || lighting_per_person.nil?\n lights_def.setWattsperPerson(OpenStudio.convert(lighting_per_person, 'W/person', 'W/person').get)\n lights_def.setReturnAirFraction(lights_frac_to_return_air)\n lights_def.setFractionRadiant(lights_frac_radiant)\n lights_def.setFractionVisible(lights_frac_visible)\n end\n\n # Create the lighting instance and hook it up to the space type\n lights = OpenStudio::Model::Lights.new(lights_def)\n lights.setName(\"#{name} Lights\")\n lights.setSpaceType(space_type)\n\n # Additional Lighting\n additional_lighting_per_area = data['additional_lighting_per_area']\n if additional_lighting_per_area != nil\n # Create the lighting definition\n additional_lights_def = OpenStudio::Model::LightsDefinition.new(self)\n additional_lights_def.setName(\"#{name} Additional Lights Definition\")\n additional_lights_def.setWattsperSpaceFloorArea(OpenStudio.convert(additional_lighting_per_area, 'W/ft^2', 'W/m^2').get)\n additional_lights_def.setReturnAirFraction(lights_frac_to_return_air)\n additional_lights_def.setFractionRadiant(lights_frac_radiant)\n additional_lights_def.setFractionVisible(lights_frac_visible)\n\n # Create the lighting instance and hook it up to the space type\n additional_lights = OpenStudio::Model::Lights.new(additional_lights_def)\n additional_lights.setName(\"#{name} Additional Lights\")\n additional_lights.setSpaceType(space_type)\n end\n\n # Get the lighting schedule and set it as the default\n lighting_sch = data['lighting_schedule']\n unless lighting_sch.nil?\n default_sch_set.setLightingSchedule(add_schedule(lighting_sch))\n end\n end\n\n # Ventilation\n\n make_ventilation = false\n ventilation_per_area = data['ventilation_per_area']\n ventilation_per_person = data['ventilation_per_person']\n ventilation_ach = data['ventilation_air_changes']\n unless ventilation_per_area == 0 || ventilation_per_area.nil? then make_ventilation = true end\n unless ventilation_per_person == 0 || ventilation_per_person.nil? then make_ventilation = true end\n unless ventilation_ach == 0 || ventilation_ach.nil? then make_ventilation = true end\n\n\n if make_ventilation == true\n\n # Create the ventilation object and hook it up to the space type\n ventilation = OpenStudio::Model::DesignSpecificationOutdoorAir.new(self)\n ventilation.setName(\"#{name} Ventilation\")\n puts \"#{name}\"\n space_type.setDesignSpecificationOutdoorAir(ventilation)\n ventilation.setOutdoorAirMethod('Sum')\n unless ventilation_per_area.nil? || ventilation_per_area.to_f == 0\n ventilation.setOutdoorAirFlowperFloorArea(OpenStudio.convert(ventilation_per_area, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless ventilation_per_person.nil? || ventilation_per_person.to_f == 0\n ventilation.setOutdoorAirFlowperPerson(OpenStudio.convert(ventilation_per_person, 'ft^3/min*person', 'm^3/s*person').get)\n end\n unless ventilation_ach.nil? || ventilation_ach.to_f == 0\n ventilation.setOutdoorAirFlowAirChangesperHour(ventilation_ach)\n end\n end\n\n # Occupancy\n\n make_people = false\n occupancy_per_area = data['occupancy_per_area']\n unless occupancy_per_area == 0 || occupancy_per_area.nil? then make_people = true end\n\n if make_people == true\n # create the people definition\n people_def = OpenStudio::Model::PeopleDefinition.new(self)\n people_def.setName(\"#{name} People Definition\")\n unless occupancy_per_area == 0 || occupancy_per_area.nil?\n people_def.setPeopleperSpaceFloorArea(OpenStudio.convert(occupancy_per_area / 1000.0, 'people/ft^2', 'people/m^2').get)\n end\n\n # create the people instance and hook it up to the space type\n people = OpenStudio::Model::People.new(people_def)\n people.setName(\"#{name} People\")\n people.setSpaceType(space_type)\n\n # get the occupancy and occupant activity schedules from the library and set as the default\n occupancy_sch = data['occupancy_schedule']\n unless occupancy_sch.nil?\n default_sch_set.setNumberofPeopleSchedule(add_schedule(occupancy_sch))\n end\n occupancy_activity_sch = data['occupancy_activity_schedule']\n unless occupancy_activity_sch.nil?\n default_sch_set.setPeopleActivityLevelSchedule(add_schedule(occupancy_activity_sch))\n end\n\n end\n\n # Infiltration\n\n make_infiltration = false\n infiltration_per_area_ext = data['infiltration_per_exterior_area']\n infiltration_per_area_ext_wall = data['infiltration_per_exterior_wall_area']\n infiltration_ach = data['infiltration_air_changes']\n unless (infiltration_per_area_ext == 0 || infiltration_per_area_ext.nil?) && (infiltration_per_area_ext_wall == 0 || infiltration_per_area_ext_wall.nil?) && (infiltration_ach == 0 || infiltration_ach.nil?) \n then make_infiltration = true\n end\n\n if make_infiltration == true\n\n # Create the infiltration object and hook it up to the space type\n infiltration = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(self)\n infiltration.setName(\"#{name} Infiltration\")\n infiltration.setSpaceType(space_type)\n unless infiltration_per_area_ext == 0 || infiltration_per_area_ext.nil?\n infiltration.setFlowperExteriorSurfaceArea(OpenStudio.convert(infiltration_per_area_ext, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless infiltration_per_area_ext_wall == 0 || infiltration_per_area_ext_wall.nil?\n infiltration.setFlowperExteriorWallArea(OpenStudio.convert(infiltration_per_area_ext_wall, 'ft^3/min*ft^2', 'm^3/s*m^2').get)\n end\n unless infiltration_ach == 0 || infiltration_ach.nil?\n infiltration.setAirChangesperHour(infiltration_ach)\n end\n\n # Get the infiltration schedule from the library and set as the default\n infiltration_sch = data['infiltration_schedule']\n unless infiltration_sch.nil?\n default_sch_set.setInfiltrationSchedule(add_schedule(infiltration_sch))\n end\n\n end\n\n # Electric equipment\n\n make_electric_equipment = false\n elec_equip_per_area = data['electric_equipment_per_area']\n elec_equip_frac_latent = data['electric_equipment_fraction_latent']\n elec_equip_frac_radiant = data['electric_equipment_fraction_radiant']\n elec_equip_frac_lost = data['electric_equipment_fraction_lost']\n unless elec_equip_per_area == 0 || elec_equip_per_area.nil? then make_electric_equipment = true end\n\n if make_electric_equipment == true\n\n # Create the electric equipment definition\n elec_equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(self)\n elec_equip_def.setName(\"#{name} Electric Equipment Definition\")\n unless elec_equip_per_area == 0 || elec_equip_per_area.nil?\n elec_equip_def.setWattsperSpaceFloorArea(OpenStudio.convert(elec_equip_per_area, 'W/ft^2', 'W/m^2').get)\n elec_equip_def.setFractionLatent(elec_equip_frac_latent)\n elec_equip_def.setFractionRadiant(elec_equip_frac_radiant)\n elec_equip_def.setFractionLost(elec_equip_frac_lost)\n end\n\n # Create the electric equipment instance and hook it up to the space type\n elec_equip = OpenStudio::Model::ElectricEquipment.new(elec_equip_def)\n elec_equip.setName(\"#{name} Electric Equipment\")\n elec_equip.setSpaceType(space_type)\n\n # Get the electric equipment schedule from the library and set as the default\n elec_equip_sch = data['electric_equipment_schedule']\n unless elec_equip_sch.nil?\n default_sch_set.setElectricEquipmentSchedule(add_schedule(elec_equip_sch))\n end\n\n end\n\n # Gas equipment\n\n make_gas_equipment = false\n gas_equip_per_area = data['gas_equipment_per_area']\n gas_equip_frac_latent = data['gas_equipment_fraction_latent']\n gas_equip_frac_radiant = data['gas_equipment_fraction_radiant']\n gas_equip_frac_lost = data['gas_equipment_fraction_lost']\n\n unless gas_equip_per_area == 0 || gas_equip_per_area.nil? then make_gas_equipment = true end\n\n if make_gas_equipment == true\n\n # Create the gas equipment definition\n gas_equip_def = OpenStudio::Model::GasEquipmentDefinition.new(self)\n gas_equip_def.setName(\"#{name} Gas Equipment Definition\")\n gas_equip_def.setFractionLatent(gas_equip_frac_latent)\n gas_equip_def.setFractionRadiant(gas_equip_frac_radiant)\n gas_equip_def.setFractionLost(gas_equip_frac_lost)\n unless gas_equip_per_area == 0 || gas_equip_per_area.nil?\n gas_equip_def.setWattsperSpaceFloorArea(OpenStudio.convert(gas_equip_per_area, 'Btu/hr*ft^2', 'W/m^2').get)\n end\n\n # Create the gas equipment instance and hook it up to the space type\n gas_equip = OpenStudio::Model::GasEquipment.new(gas_equip_def)\n gas_equip.setName(\"#{name} Gas Equipment\")\n gas_equip.setSpaceType(space_type)\n\n # Get the gas equipment schedule from the library and set as the default\n gas_equip_sch = data['gas_equipment_schedule']\n unless gas_equip_sch.nil?\n default_sch_set.setGasEquipmentSchedule(add_schedule(gas_equip_sch))\n end\n\n end\n\n thermostat = OpenStudio::Model::ThermostatSetpointDualSetpoint.new(self)\n thermostat.setName(\"#{name} Thermostat\")\n\n heating_setpoint_sch = data['heating_setpoint_schedule']\n unless heating_setpoint_sch.nil?\n thermostat.setHeatingSetpointTemperatureSchedule(add_schedule(heating_setpoint_sch))\n end\n\n cooling_setpoint_sch = data['cooling_setpoint_schedule']\n unless cooling_setpoint_sch.nil?\n thermostat.setCoolingSetpointTemperatureSchedule(add_schedule(cooling_setpoint_sch))\n end\n\n # componentize the space type\n space_type_component = space_type.createComponent\n\n # #TODO make this return BCL component space types?\n #\n # #setup the file names and save paths that will be used\n # file_name = \"nrel_ref_bldg_space_type\"\n # component_dir = \"#{Dir.pwd}/#{component_name}\"\n # osm_file_path = OpenStudio::Path.new(\"#{component_dir}/files/#{file_name}.osm\")\n # osc_file_path = OpenStudio::Path.new(\"#{component_dir}/files/#{file_name}.osc\")\n #\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"component_dir = #{component_dir}\")\n #\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"creating directories\")\n # FileUtils.rm_rf(component_dir) if File.exists?(component_dir) and File.directory?(component_dir)\n # FileUtils.mkdir_p(component_dir)\n # FileUtils.mkdir_p(\"#{component_dir}/files/\")\n #\n # #save the space type as a .osm\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving osm to #{osm_file_path}\")\n # model.toIdfFile().save(osm_file_path,true)\n #\n # #save the componentized space type as a .osc\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving osc to #{osc_file_path}\")\n # space_type_component.toIdfFile().save(osc_file_path,true)\n #\n # #make the BCL component\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"creating BCL component\")\n # component = BCL::Component.new(component_dir)\n # OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"created uid = #{component.uuid}\")\n #\n # #add component information\n # component.name = component_name\n # component.description = \"This space type represent spaces in typical commercial buildings in the United States. The information to create these space types was taken from the DOE Commercial Reference Building Models, which can be found at http://www1.eere.energy.gov/buildings/commercial_initiative/reference_buildings.html. These space types include plug loads, gas equipment loads (cooking, etc), occupancy, infiltration, and ventilation rates, as well as schedules. These space types should be viewed as starting points, and should be reviewed before being used to make decisions.\"\n # component.source_manufacturer = \"DOE\"\n # component.source_url = \"http://www1.eere.energy.gov/buildings/commercial_initiative/reference_buildings.html\"\n # component.add_provenance(\"dgoldwas\", Time.now.gmtime.strftime('%Y-%m-%dT%H:%M:%SZ'), \"\")\n # component.add_tag(\"Space Types\") # todo: what is the taxonomy string for space type? is there one?\n #\n # #add arguments as attributes\n # component.add_attribute(\"NREL_reference_building_vintage\", template, \"\")\n # component.add_attribute(\"Climate_zone\", clim, \"\")\n # component.add_attribute(\"NREL_reference_building_primary_space_type\", building_type, \"\")\n # component.add_attribute(\"NREL_reference_building_secondary_space_type\", spc_type, \"\")\n #\n # #openstudio type attribute\n # component.add_attribute(\"OpenStudio Type\", space_type.iddObjectType.valueDescription, \"\")\n #\n # #add other attributes\n # component.add_attribute(\"Lighting Standard\", data[\"lighting_standard\"], \"\")\n # component.add_attribute(\"Lighting Primary Space Type\", data[\"lighting_pri_spc_type\"], \"\")\n # component.add_attribute(\"Lighting Secondary Space Type\", data[\"lighting_sec_spc_type\"], \"\")\n #\n # component.add_attribute(\"Ventilation Standard\", data[\"ventilation_standard\"], \"\")\n # component.add_attribute(\"Ventilation Primary Space Type\", data[\"ventilation_pri_spc_type\"], \"\")\n # component.add_attribute(\"Ventilation Secondary Space Type\", data[\"ventilation_sec_spc_type\"], \"\")\n #\n # component.add_attribute(\"Occupancy Standard\", \"NREL reference buildings\", \"\")\n # component.add_attribute(\"Occupancy Primary Space Type\", building_type, \"\")\n # component.add_attribute(\"Occupancy Secondary Space Type\", spc_type, \"\")\n #\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Standard\", \"NREL reference buildings\", \"\")\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Primary Space Type\", building_type, \"\")\n # component.add_attribute(\"Infiltration, Gas Equipment, Electric Equipment, and Schedules Secondary Space Type\", spc_type, \"\")\n #\n # #add the osm and osc files to the component\n # component.add_file(\"OpenStudio\", \"0.9.3\", osm_file_path.to_s, \"#{file_name}.osm\", \"osm\")\n # component.add_file(\"OpenStudio\", \"0.9.3\", osc_file_path.to_s, \"#{file_name}.osc\", \"osc\")\n #\n # #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"saving component to #{component_dir}\")\n # component.save_component_xml(component_dir)\n #\n # =e\n # return the space type and the componentized space type\n \n return space_type\n \n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def set_attrs\n @rrules ||= []\n @exrules ||= []\n @rdates ||= []\n @exdates ||= []\n end",
"def init_create\n init_dict()\n @grid = Array.new(self.size) { Array.new(self.size, nil) }\n init_first_word()\n self.finished = false\n end",
"def initialize\n @@boxes << @A1 = \"A1\"\n @@boxes << @A2 = \"A2\"\n @@boxes << @A3 = \"A3\"\n @@boxes << @B1 = \"B1\"\n @@boxes << @B2 = \"B2\"\n @@boxes << @B3 = \"B3\"\n @@boxes << @C1 = \"C1\"\n @@boxes << @C2 = \"C2\"\n @@boxes << @C3 = \"C3\"\n end",
"def create_bldg_space_types(model)\n @building_sections.each do |bldg_subsec|\n bldg_subsec.create_space_types(model, @total_floor_area, num_stories, @standard_template, @open_studio_standard)\n end\n end",
"def initialize(_attribtues_ = {})\n @attributes = {}\n \n # Ensure that start and end positions are in the correct order.\n if _attribtues_[:start] && (_attribtues_[:end] || _attribtues_[:stop])\n seq_start, seq_end = [_attribtues_.delete(:start).to_i, (_attribtues_.delete(:end) || _attribtues_.delete(:stop)).to_i].sort\n _attribtues_[:start] = seq_start\n _attribtues_[:end] = seq_end\n end\n \n _attribtues_.each do |name, value|\n send(\"#{name}=\", value)\n end\n end",
"def initialize(atts)\n atts.each do |key, val|\n accessor = \"#{key}=\"\n\n if respond_to?(accessor)\n send(accessor, val)\n end\n end\n end",
"def create(name, attributes)\n attributes = attributes.dup\n\n # Add the objectclasses\n attributes[\"objectClass\"] = objectclasses.collect { |o| o.to_s }\n attributes[\"objectClass\"] << \"top\" unless attributes[\"objectClass\"].include?(\"top\")\n\n attributes[rdn.to_s] = [name]\n\n # Generate any new values we might need.\n generate(attributes)\n\n # And create our resource.\n connect { |conn| conn.add dn(name), attributes }\n end",
"def build_space_type_hash\n space_type_hash = {}\n if @space_types\n space_type_list = []\n @space_types.each do |space_name, space_type|\n space_type_list << space_type[:space_type]\n end\n space_type_hash[xget_id] = space_type_list\n end\n @building_sections.each do |bldg_subsec|\n space_type_list = []\n bldg_subsec.space_types_floor_area.each do |space_type, hash|\n space_type_list << space_type\n end\n space_type_hash[bldg_subsec.xget_id] = space_type_list\n end\n return space_type_hash\n end",
"def generate_random_rule\n rule = Rule.new\n @size_of_attr.each do |size|\n rule << generate_random_attribute_rule(size)\n end\n rule\nend",
"def generate_random_rule\n rule = Rule.new\n @size_of_attr.each do |size|\n rule << generate_random_attribute_rule(size)\n end\n rule\nend",
"def initialize(bounds)\n self.lower_bound_x = bounds[:lower_x]\n self.lower_bound_y = bounds[:lower_y]\n self.upper_bound_x = bounds[:upper_x]\n self.upper_bound_y = bounds[:upper_y]\n @occupied_space = Array.new(upper_bound_x + 1) { Array.new(upper_bound_y + 1, piece: nil) }\n end",
"def new\n @space = Space.new\n end",
"def createSpaceStation\n supplies = createSuppliesPackage\n \n s1 = SpaceStation.new(\"DanielsP-Base\",supplies[0])\n s2 = SpaceStation.new(\"D2\",supplies[0])\n s3 = SpaceStation.new(\"D3\",supplies[1])\n s4 = SpaceStation.new(\"D4\",supplies[1])\n s5 = SpaceStation.new(\"D5\",supplies[2])\n s6 = SpaceStation.new(\"D6\",supplies[2])\n \n stations = [s1,s2,s3,s4,s5,s6]\n return stations\n end",
"def attributes\n super.merge({\n :screens => screens.size\n\t })\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def attributes(*args)\n attr_accessor(*args)\n end",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end",
"def createSpaceCity\n if !@haveSpaceCity\n others = []\n\n for station in @spaceStations\n if station != @currentStation\n others << station\n end\n end\n\n @currentStation = SpaceCity.new(@currentStation, others)\n @spaceStations[@currentStationIndex] = @currentStation\n @haveSpaceCity = true\n end\n end",
"def space_params\n params.require(:space).permit(:name, :spaceType, :multiplier, :area)\n end",
"def spacing=(spacing)\n @spacing = [spacing].flatten\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # populate choice argument for constructions that are applied to surfaces in the model\n construction_handles = OpenStudio::StringVector.new\n construction_display_names = OpenStudio::StringVector.new\n\n # putting space types and names into hash\n construction_args = model.getConstructions\n construction_args_hash = {}\n construction_args.each do |construction_arg|\n construction_args_hash[construction_arg.name.to_s] = construction_arg\n end\n\n # looping through sorted hash of constructions\n construction_args_hash.sort.map do |key, value|\n # only include if construction is used on surface\n if value.getNetArea > 0\n construction_handles << value.handle.to_s\n construction_display_names << key\n end\n end\n\n # make an argument for construction\n construction = OpenStudio::Measure::OSArgument.makeChoiceArgument('construction', construction_handles, construction_display_names, true)\n construction.setDisplayName('Choose a Construction to Alter.')\n args << construction\n\n # make an argument thickness\n thickness = OpenStudio::Measure::OSArgument.makeDoubleArgument('thickness', true)\n thickness.setDisplayName('Thickness of Layer 0')\n thickness.setDescription('Set Thickness of Layer 0. 0 value means do not change from default.')\n thickness.setDefaultValue(0)\n thickness.setUnits('m')\n args << thickness\n\n # make an argument density\n density = OpenStudio::Measure::OSArgument.makeDoubleArgument('density', true)\n density.setDisplayName('Density of Layer 0')\n density.setDescription('Set Density of Layer 0. 0 value means do not change from default.')\n density.setUnits('kg/m^3')\n density.setDefaultValue(0)\n args << density\n\n # make an argument thermal_absorptance\n thermal_absorptance = OpenStudio::Measure::OSArgument.makeDoubleArgument('thermal_absorptance', true)\n thermal_absorptance.setDisplayName('Thermal Absorptance of Layer 0')\n thermal_absorptance.setDescription('Set Thermal Absorptance of Layer 0. 0 value means do not change from default.')\n thermal_absorptance.setUnits('fraction')\n thermal_absorptance.setDefaultValue(0)\n args << thermal_absorptance\n\n # make an argument solar_absorptance\n solar_absorptance = OpenStudio::Measure::OSArgument.makeDoubleArgument('solar_absorptance', true)\n solar_absorptance.setDisplayName('Solar Absorptance of Layer 0')\n solar_absorptance.setDescription('Set Solar Absorptance of Layer 0. 0 value means do not change from default.')\n solar_absorptance.setUnits('fraction')\n solar_absorptance.setDefaultValue(0)\n args << solar_absorptance\n\n # make an argument visible_absorptance\n visible_absorptance = OpenStudio::Measure::OSArgument.makeDoubleArgument('visible_absorptance', true)\n visible_absorptance.setDisplayName('Visible Absorptance of Layer 0')\n visible_absorptance.setDescription('Set Visible Absorptance of Layer 0. 0 value means do not change from default.')\n visible_absorptance.setUnits('fraction')\n visible_absorptance.setDefaultValue(0)\n args << visible_absorptance\n\n # make an argument conductivity\n thermal_conductivity = OpenStudio::Measure::OSArgument.makeDoubleArgument('thermal_conductivity', true)\n thermal_conductivity.setDisplayName('Thermal Conductivity of Layer 0')\n thermal_conductivity.setDescription('Set Thermal Conductivity of Layer 0. 0 value means do not change from default.')\n thermal_conductivity.setDefaultValue(0)\n thermal_conductivity.setUnits('W/(m*K)')\n args << thermal_conductivity\n\n # make an argument specific_heat\n specific_heat = OpenStudio::Measure::OSArgument.makeDoubleArgument('specific_heat', true)\n specific_heat.setDisplayName('Specific Heat of Layer 0')\n specific_heat.setDescription('Set Specific Heat of Layer 0. 0 value means do not change from default.')\n specific_heat.setUnits('J/(kg*K)')\n specific_heat.setDefaultValue(0)\n args << specific_heat\n\n args\n end",
"def store_attributes name, meters, rate, cost, uom, usage, confidence, invoice_rate, days=nil\r\n hash = {}\r\n if !name.blank?\r\n hash[:name] = name\r\n end\r\n if !meters.blank?\r\n hash[:meters] = meters\r\n end\r\n if !rate.blank?\r\n if(rate.class.eql?(String) && rate[0].eql?('$'))\r\n rate = rate[1...rate.size]\r\n end\r\n hash[:rate] = rate.to_f\r\n end\r\n if !cost.blank?\r\n hash[:cost] = cost\r\n end\r\n if !uom.blank?\r\n hash[:uom] = uom\r\n end\r\n if !usage.blank?\r\n hash[:usage] = usage\r\n end \r\n if !confidence.blank?\r\n hash[:confidence] = confidence\r\n end \r\n if !invoice_rate.blank?\r\n hash[:invoice_rate] = invoice_rate\r\n end \r\n if !days.blank?\r\n hash[:days] = days\r\n end\r\n self.charge_attributes = hash\r\n end",
"def add_namespaces_and_attributes_to_current_node(attrs) \n # Namespaces\n attrs.select {|k| k.is_a? Array}.each do |pair|\n set_namespace(pair[0], pair[1])\n # set_normal_attribute(pair[0], pair[1])\n end\n # Attributes\n attrs.select {|k| k.is_a? String}.in_groups_of(2) do |pair|\n set_normal_attribute(pair[0], pair[1])\n end\n end",
"def build_ships\n 5.times do\n ship = self.ships.build\n ship.populate\n end\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a choice argument for model objects\n space_type_handles = OpenStudio::StringVector.new\n space_type_display_names = OpenStudio::StringVector.new\n\n # putting model object and names into hash\n space_type_args = model.getSpaceTypes\n space_type_args_hash = {}\n space_type_args.each do |space_type_arg|\n space_type_args_hash[space_type_arg.name.to_s] = space_type_arg\n end\n\n # looping through sorted hash of model objects\n space_type_args_hash.sort.map do |key, value|\n # only include if space type is used in the model\n if !value.spaces.empty?\n space_type_handles << value.handle.to_s\n space_type_display_names << key\n end\n end\n\n # add building to string vector with space type\n building = model.getBuilding\n space_type_handles << building.handle.to_s\n space_type_display_names << '*Entire Building*'\n\n # make a choice argument for space type\n space_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('space_type', space_type_handles, space_type_display_names)\n space_type.setDisplayName('Apply the Measure to a Specific Space Type or to the Entire Model.')\n space_type.setDefaultValue('*Entire Building*') \n args << space_type\n\n # make an argument for reduction percentage for occupied spaces (if user chose the Entire Building)\n occupied_space_type = OpenStudio::Measure::OSArgument.makeDoubleArgument('occupied_space_type', true)\n occupied_space_type.setDisplayName(\"Please fill in the Outdoor Air ventilation reduction in No.1-2, if you chose the 'Entire Building'. Otherwise, please fill in the value in No.3.\\n 1.OA Ventilation Reduction for Occupied Spaces (%).\")\n occupied_space_type.setDefaultValue(30.0)\n args << occupied_space_type\n \n # make an argument for reduction percentage for unoccupied spaces (if user chose the Entire Building)\n unoccupied_space_type = OpenStudio::Measure::OSArgument.makeDoubleArgument('unoccupied_space_type', true)\n unoccupied_space_type.setDisplayName('2.OA Ventilation Reduction for Unoccupied Spaces (%).')\n unoccupied_space_type.setDefaultValue(70.0)\n args << unoccupied_space_type\n\n # make an argument for reduction percentage for specific space type (if user chose only one space type to apply this measure)\n single_space_type = OpenStudio::Measure::OSArgument.makeDoubleArgument('single_space_type', true)\n single_space_type.setDisplayName('3.OA Ventilation Reduction for the Selected Space Type (%).')\n single_space_type.setDefaultValue(30.0)\n args << single_space_type\n\n # make an argument for the start time of the reduction\n starttime = OpenStudio::Measure::OSArgument.makeStringArgument('starttime', true)\n starttime.setDisplayName('Start Time for the Reduction')\n starttime.setDefaultValue('13:00:00')\n args << starttime\n\n # make an argument for the end time of the reduction\n endtime = OpenStudio::Measure::OSArgument.makeStringArgument('endtime', true)\n endtime.setDisplayName('End Time for the Reduction')\n endtime.setDefaultValue('16:00:00')\n args << endtime\n\n # no cost required to reduce required amount of outdoor air. Cost increase or decrease will relate to system sizing and ongoing energy use due to change in outdoor air provided.\n\n return args\n end",
"def create\n \n @ship = Ship.new(params[:ship])\n @ship.character_id = session[:character_id]\n @ship.port_id = 7\n @ship.save\n \n @ship_attribute = ShipAttribute.new()\n @ship_attribute.ship_id = @ship.id\n @ship_attribute.cargo = 100\n @ship_attribute.weapon_slot = 2\n @ship_attribute.mast_slot = 2\n @ship_attribute.crew_slot = 1\n @ship_attribute.custom_slot = 0\n @ship_attribute.rudder_slot = 1\n @ship_attribute.structure = 50\n @ship.update_attribute(:curr_hp, \"#{@ship_attribute.structure}\")\n \n @ship.create_std_items\n \n respond_to do |format|\n @ship_attribute.save\n session.delete(:registering)\n session[:character_id] = nil\n flash[:notice] = 'Ship was successfully created.'\n format.html { redirect_to(@ship) }\n format.xml { render :xml => @ship, :status => :created, :location => @ship }\n end\n end",
"def initialize_attributes(attributes); end",
"def attic *junk\n return metaclass if junk.empty?\n junk.each do |name|\n next if attic_variable? name\n self.attic_variables << name\n \n unless method_defined? name\n define_method(name) do\n attic_variable_get name\n end\n end\n unless method_defined? \"#{name}=\"\n define_method(\"#{name}=\") do |val|\n attic_variable_set name, val\n end\n end\n end\n attic_vars\n end",
"def attic *junk\n return metaclass if junk.empty?\n junk.each do |name|\n next if attic_variable? name\n self.attic_variables << name\n \n unless method_defined? name\n define_method(name) do\n attic_variable_get name\n end\n end\n unless method_defined? \"#{name}=\"\n define_method(\"#{name}=\") do |val|\n attic_variable_set name, val\n end\n end\n end\n attic_vars\n end",
"def assign_space_type_stubs(building_type, space_type_map)\n\n space_type_map.each do |space_type_name, space_names|\n # Create a new space type\n stub_space_type = OpenStudio::Model::SpaceType.new(self)\n stub_space_type.setStandardsBuildingType(building_type)\n stub_space_type.setStandardsSpaceType(space_type_name)\n \n space_names.each do |space_name|\n space = self.getSpaceByName(space_name)\n next if space.empty?\n space = space.get\n space.setSpaceType(stub_space_type)\n\n #OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', \"Setting #{space.name} to #{building_type}.#{space_type_name}\")\n end\n end\n\n return true\n end",
"def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end",
"def define_attributes\n @attributes = {}\n @attribute_map = {}\n yield # to the user defined block for further instruction\n @keys = @attributes.keys.freeze\n @attribute_map.freeze\n @attributes.freeze\n end",
"def attr(name); end",
"def initialize(**attributes)\n @attr = {}\n attributes\n end",
"def space()\n #This is a stub, used for indexing\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # populate choice argument for constructions that are applied to surfaces in the model\n air_loop_handles = OpenStudio::StringVector.new\n air_loop_display_names = OpenStudio::StringVector.new\n\n # putting space types and names into hash\n air_loop_args = model.getAirLoopHVACs\n air_loop_args_hash = {}\n air_loop_args.each do |air_loop_arg|\n air_loop_args_hash[air_loop_arg.name.to_s] = air_loop_arg\n end\n\n # looping through sorted hash of air loops\n air_loop_args_hash.sort.map do |key, value|\n show_loop = false\n components = value.supplyComponents\n components.each do |component|\n if !component.to_CoilCoolingDXSingleSpeed.is_initialized # instead of if not component.to_CoilCoolingDXSingleSpeed.empty?\n show_loop = true\n end\n end\n if show_loop == true\n air_loop_handles << value.handle.to_s\n air_loop_display_names << key\n end\n end\n\n # add building to string vector with air loops\n building = model.getBuilding\n air_loop_handles << building.handle.to_s\n air_loop_display_names << '*All Air Loops*'\n\n # make an argument for air loops\n object = OpenStudio::Measure::OSArgument.makeChoiceArgument('object', air_loop_handles, air_loop_display_names, true)\n object.setDisplayName('Choose an Air Loop with a single speed DX Cooling Unit to Alter.')\n object.setDefaultValue('*All Air Loops*') # if no air loop is chosen this will run on all air loops\n args << object\n\n # make an argument to add new space true/false\n cop = OpenStudio::Measure::OSArgument.makeDoubleArgument('cop', true)\n cop.setDisplayName('Rated COP')\n cop.setDefaultValue(4.0)\n args << cop\n\n # bool argument to remove existing costs\n remove_costs = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_costs', true)\n remove_costs.setDisplayName('Remove Baseline Costs From Effected Cooling Coil DX Single Speed Units?')\n remove_costs.setDefaultValue(true)\n args << remove_costs\n\n # make an argument for material and installation cost\n material_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('material_cost', true)\n material_cost.setDisplayName('Material and Installation Costs per Cooling Coil DX Single Speed Unit ($).')\n material_cost.setDefaultValue(0.0)\n args << material_cost\n\n # make an argument for demolition cost\n demolition_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('demolition_cost', true)\n demolition_cost.setDisplayName('Demolition Costs per Cooling Coil DX Single Speed Unit ($).')\n demolition_cost.setDefaultValue(0.0)\n args << demolition_cost\n\n # make an argument for duration in years until costs start\n years_until_costs_start = OpenStudio::Measure::OSArgument.makeIntegerArgument('years_until_costs_start', true)\n years_until_costs_start.setDisplayName('Years Until Costs Start (whole years).')\n years_until_costs_start.setDefaultValue(0)\n args << years_until_costs_start\n\n # make an argument to determine if demolition costs should be included in initial construction\n demo_cost_initial_const = OpenStudio::Measure::OSArgument.makeBoolArgument('demo_cost_initial_const', true)\n demo_cost_initial_const.setDisplayName('Demolition Costs Occur During Initial Construction?')\n demo_cost_initial_const.setDefaultValue(false)\n args << demo_cost_initial_const\n\n # make an argument for expected life\n expected_life = OpenStudio::Measure::OSArgument.makeIntegerArgument('expected_life', true)\n expected_life.setDisplayName('Expected Life (whole years).')\n expected_life.setDefaultValue(20)\n args << expected_life\n\n # make an argument for o&m cost\n om_cost = OpenStudio::Measure::OSArgument.makeDoubleArgument('om_cost', true)\n om_cost.setDisplayName('O & M Costs per Cooling Coil DX Single Speed Unit ($).')\n om_cost.setDefaultValue(0.0)\n args << om_cost\n\n # make an argument for o&m frequency\n om_frequency = OpenStudio::Measure::OSArgument.makeIntegerArgument('om_frequency', true)\n om_frequency.setDisplayName('O & M Frequency (whole years).')\n om_frequency.setDefaultValue(1)\n args << om_frequency\n\n return args\n end",
"def initialize(attributes) #\n attributes.each {|key, value| self.send((\"#{key}=\"), value)}\n # name: cityname name= cityname\n # population: num population= num\n \n save\n #or @@all << self\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make a choice argument for model objects\n space_type_handles = OpenStudio::StringVector.new\n space_type_display_names = OpenStudio::StringVector.new\n\n #putting model object and names into hash\n space_type_args = model.getSpaceTypes\n space_type_args_hash = {}\n space_type_args.each do |space_type_arg|\n space_type_args_hash[space_type_arg.name.to_s] = space_type_arg\n end\n\n #looping through sorted hash of model objects\n space_type_args_hash.sort.map do |key,value|\n #only include if space type is used in the model\n if value.spaces.size > 0\n space_type_handles << value.handle.to_s\n space_type_display_names << key\n end\n end\n\n #add building to string vector with space type\n building = model.getBuilding\n space_type_handles << building.handle.to_s\n space_type_display_names << \"*Entire Building*\"\n\n #make a choice argument for space type\n space_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"space_type\", space_type_handles, space_type_display_names)\n space_type.setDisplayName(\"Add Occ Sensors to Lights in a Specific Space Type or in the Entire Model.\")\n space_type.setDefaultValue(\"*Entire Building*\") #if no space type is chosen this will run on the entire building\n args << space_type \n \n #make an argument for the number of lamps\n percent_runtime_reduction = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"percent_runtime_reduction\",true)\n percent_runtime_reduction.setDisplayName(\"Percent Runtime Reduction due to Occupancy Sensors (%)\")\n percent_runtime_reduction.setDefaultValue(15.0)\n args << percent_runtime_reduction\n \n #make an argument for material and installation cost per fixture\n material_and_installation_cost_per_space = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"material_and_installation_cost_per_space\",true)\n material_and_installation_cost_per_space.setDisplayName(\"Cost per Space to Install Occ Sensor ($).\")\n args << material_and_installation_cost_per_space\n \n return args\n end",
"def initialize(attributes)\n @name = name\n @birthday = birthday\n @hair_color = hair_color\n @eye_color = eye_color\n @height = height\n @weight = weight\n @handed = handed\n @complexion = complexion\n @t_shirt_size = t_shirt_size\n @wrist_size = wrist_size\n @glove_size = glove_size\n @pant_length = pant_length\n @pant_width = pant_width\n attributes.each {|key, value| self.send((\"#{key}=\"), value)}\n end",
"def generate_constructions\n # TODO? delete and re-create or check that it exists and update?\n # self.construct_assemblies.destroy_all\n # self.materials.destroy_all\n # self.fenestration_constructions.destroy_all\n # self.door_construction.destroy_all\n\n # model names\n constructions = %w(UndergroundWall UndergroundFloor InteriorWall InteriorFloor ExteriorWall ExteriorFloor Roof)\n fenestrations = %w(Window Skylight)\n doors = ['Door']\n space_ids = []\n\n # get all building -> stories -> spaces (that's what constructions are attached to)\n stories = building.building_stories\n spaces = []\n stories.each do |story|\n story.spaces.each do |space|\n spaces << space\n end\n end\n space_ids = spaces.collect(&:id)\n logger.debug(\"*****SPACES: #{space_ids.inspect} *****\")\n\n project_cas = []\n project_mats = []\n project_fens = []\n project_doors = []\n\n # to find doors, windows, skylights\n int_wall_ids = []\n ext_wall_ids = []\n roof_ids = []\n\n # assign regular constructions\n constructions.each do |con|\n con_model = con.constantize\n instances = con_model.any_in(space_id: space_ids)\n\n if con === 'InteriorWall'\n int_wall_ids = instances.collect(&:id)\n elsif con === 'ExteriorWall'\n ext_wall_ids = instances.collect(&:id)\n elsif con === 'Roof'\n roof_ids = instances.collect(&:id)\n end\n\n # puts \"#{instances.size} instances of #{con}\"\n # logger.info \"#{instances.size} instances of #{con}\"\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Construction.find(instance.construction_library_id)\n\n # TODO: check that it doesn't exist yet or skip?\n ca = construct_assemblies.find_or_create_by(name: lib.name)\n ca.compatible_surface_type = lib.compatible_surface_type\n # save other attributes here (for floors)\n ca.slab_type = lib.slab_type\n ca.slab_insulation_orientation = lib.slab_insulation_orientation\n ca.slab_insulation_thermal_resistance = lib.slab_insulation_thermal_resistance\n\n material_refs = []\n # material references\n logger.debug(\"!!!!! LAYERS: #{lib['layers']}\")\n unless lib['layers'].nil?\n lib.layers.each do |layer|\n mat = materials.find_or_create_by(name: layer['name'])\n mat.code_category = layer['code_category']\n mat.code_item = layer['code_item']\n # save framing_configuration and material (required)\n mat.framing_depth = layer['framing_depth']\n mat.framing_configuration = layer['framing_configuration']\n mat.framing_material = layer['framing_material']\n mat.framing_material = layer['framing_material']\n mat.cavity_insulation = layer['cavity_insulation_r_value']\n\n mat.save\n material_refs << mat.name\n # only save unique records to project\n match = project_mats.find { |m| m['name'] === mat.name }\n logger.info(\"MATCH: #{match}, for material #{mat.name}\")\n project_mats << mat if match.nil?\n end\n end\n\n # save material references to construction assembly\n ca.material_reference = material_refs\n ca.save\n # only save unique records to project\n match = project_cas.find { |m| m['name'] === ca.name }\n # puts \"MATCH: #{match} for ca #{ca.name}\"\n logger.info \"MATCH: #{match} for ca #{ca.name}\"\n project_cas << ca if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.construct_assembly_reference = ca.name\n instance.save\n end\n end\n end\n\n\n logger.info \"Exterior Wall ids are #{ext_wall_ids}\"\n\n # assign doors\n door_instances = Door.or({:interior_wall_id.in => int_wall_ids}, {:exterior_wall_id.in => ext_wall_ids})\n\n logger.info(\"Door instances: #{door_instances.size}\")\n door_instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = DoorLookup.find(instance.construction_library_id)\n dc = door_constructions.find_or_create_by(name: lib.name)\n # add other lib fields\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n dc[key] = value\n end\n end\n dc.save\n\n # only save unique records to project\n match = project_doors.find { |m| m['name'] === dc.name }\n logger.info(\"MATCH: #{match} for door construction #{dc.name}\")\n project_doors << dc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.door_construction_reference = dc.name\n instance.save\n end\n end\n\n # assign fenestrations\n fenestrations.each do |fen|\n fen_model = fen.constantize\n if fen === 'Window'\n instances = fen_model.any_in(exterior_wall_id: ext_wall_ids)\n else\n # skylight\n instances = fen_model.any_in(roof_id: roof_ids)\n end\n # puts \"#{instances.size} instances of #{fen}\"\n # logger.info(\"#{instances.size} instances of #{fen}\")\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Fenestration.find(instance.construction_library_id)\n # TODO: check that it doesn't exist yet or skip?\n fc = fenestration_constructions.find_or_create_by(name: lib.name)\n # save all lib attributes to construction instance\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n fc[key] = value\n end\n end\n fc.save\n\n # only save unique records to project\n match = project_fens.find { |m| m['name'] === fc.name }\n logger.info(\"MATCH: #{match} for fen construction #{fc.name}\")\n project_fens << fc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.fenestration_construction_reference = fc.name\n instance.save\n end\n end\n end\n\n # save all to project\n self.door_constructions = project_doors\n self.fenestration_constructions = project_fens\n self.construct_assemblies = project_cas\n self.materials = project_mats\n self.save!\n end",
"def import_attributes(array)\n index = 0\n map_values = Array.new \n\n while index < array.length\n current_line = array[index].strip\n #puts current_line\n if assert_tag(\"map\", current_line)\n map_values = Map.extract_tag(\"map\", current_line)\n index = array.length\n end\n index = index.next\n end\n\n if map_values.length >= 7\n self.name = map_values[0]\n self.container_width = map_values[1]\n self.container_height = map_values[2]\n self.width = map_values[3]\n self.height = map_values[4]\n self.tile_width = map_values[5]\n self.tile_height = map_values[6]\n end\n end",
"def initialize(attrs)\n @name = attrs.fetch(:name)\n @engine = Engine.new(attrs.fetch(:max_speed), attrs.fetch(:max_jump_length), attrs.fetch(:max_fuel_amount))\n @navigator = Navigator.new(self, attrs.fetch(:map), attrs.fetch(:current_star_system))\n @cargo_bay = CargoBay.new\n end",
"def initialize(attrs)\n @attributes = {}\n attrs.each { |k, v| self[k] = v }\n end",
"def add_space_attribute_definition(name, description, allows_multiple, headers=default_headers)\n body = {\n \"allowsMultiple\" => allows_multiple,\n \"description\" => description,\n \"name\" => name\n }\n info(\"Adding Space attribute definition \\\"#{name}\\\" to the \\\"#{space_slug}\\\" space.\")\n # Create the attribute definition\n post(\"#{@api_url}/spaceAttributeDefinitions\", body, headers)\n end",
"def attrs(floor, overrides)\n build(floor, overrides).attributes\n end"
] |
[
"0.611803",
"0.6085056",
"0.5997785",
"0.5940728",
"0.59002346",
"0.58168894",
"0.5804175",
"0.57987696",
"0.5790312",
"0.5676507",
"0.5630534",
"0.5558698",
"0.5489158",
"0.54428154",
"0.5432241",
"0.542564",
"0.5409423",
"0.5404589",
"0.53909713",
"0.53798634",
"0.5369933",
"0.53656745",
"0.53612506",
"0.5353582",
"0.53499126",
"0.5343945",
"0.53401655",
"0.53325796",
"0.5295324",
"0.5294228",
"0.5279375",
"0.5278615",
"0.5278615",
"0.5275892",
"0.5260009",
"0.52586997",
"0.5251065",
"0.52454674",
"0.52420485",
"0.5239617",
"0.5232654",
"0.5232434",
"0.5232434",
"0.5232434",
"0.5232434",
"0.5232434",
"0.5231949",
"0.5225066",
"0.52189285",
"0.52189285",
"0.5211105",
"0.5210072",
"0.5193707",
"0.51821387",
"0.51805496",
"0.5179038",
"0.5177499",
"0.51727813",
"0.5171982",
"0.51586115",
"0.5153994",
"0.515258",
"0.51476914",
"0.51476914",
"0.5147478",
"0.51448387",
"0.51440287",
"0.51425874",
"0.51317406",
"0.51317406",
"0.5127374",
"0.51242054",
"0.5122457",
"0.51158726",
"0.5115261",
"0.511435",
"0.510803",
"0.5099216",
"0.50968033",
"0.50898665",
"0.50874144",
"0.50865436",
"0.50827324",
"0.50827324",
"0.5082369",
"0.5081963",
"0.5080325",
"0.5078317",
"0.50705963",
"0.5064426",
"0.50627905",
"0.50610876",
"0.5055824",
"0.5053586",
"0.5052099",
"0.5051765",
"0.5036928",
"0.50352204",
"0.50329286",
"0.5031563"
] |
0.6214794
|
0
|
45 minutes Executes this stage and updates the commit log. If the commit has been fully translated, the commit log will be updated with a +FINALIZED+ status, and the +finalize+ method will be called on the translation management system. If the commit has not been fully translated, the commit log's status won't be updated and +finalize+ will not be called. In both cases, commit log locale entries will be updated to track translation progress.
|
def execute!
logger.info("Finalizing commit #{commit_log.commit_id}")
status = repo_config.tms.status(commit_log.commit_id)
repo_config.locales.each do |locale|
locale_code = locale.code
rosette_config.datastore.add_or_update_commit_log_locale(
commit_log.commit_id, locale_code, status.locale_count(locale_code)
)
end
if status.fully_translated?
repo_config.tms.finalize(commit_log.commit_id)
commit_log.finalize
save_commit_log
end
logger.info("Finished finalizing commit #{commit_log.commit_id}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def execute!\n logger.info(\"Pushing commit #{commit_log.commit_id}\")\n\n if phrases.size > 0\n commit_log.phrase_count = phrases.size\n repo_config.tms.store_phrases(phrases, commit_log.commit_id)\n commit_log.push\n else\n commit_log.finalize!\n end\n\n logger.info(\"Finished pushing commit #{commit_log.commit_id}\")\n rescue Java::OrgEclipseJgitErrors::MissingObjectException => ex\n commit_log.missing\n ensure\n save_commit_log\n end",
"def bt_finalize(commit_time=Time.zone.now)\n if !changed? and active?\n finalized = !self.class.where(id: id, ttend_at: InfinityLiteral).update_all(ttend_at: commit_time).zero?\n self.ttend_at = commit_time if finalized\n finalized\n else\n raise ArgumentError, \"invalid finalization of modified or finalized record\"\n end\n end",
"def notify_translation_finished(commit)\n @commit = commit\n if @commit.user.try!(:email)\n mail to: @commit.user.email, subject: t('mailer.commit.notify_translation_finished.subject')\n end\n end",
"def commit!\n git add: \".\"\n git commit: \"-m '#{config.dig('commit_msg')}'\"\n end",
"def finalize(success = true)\n @committer.finalize(success) if @committer\n end",
"def commit\n cfm.commit_change_on(self) if do_commit?\n end",
"def commit\n system(\"cd #{repo_path};git commit -m 'to the cloud'\")\n end",
"def commit(on_kill = false)\n\n unless @destination.sql.empty?\n\n $log.debug(self) {'Launch last commit'} if on_kill\n\n if @use_cache\n cache_time = Time.now\n\n # And add to the cache\n @cache.commit\n\n Thread.current[:threshold_log].add 'Cache time', (Time.now - cache_time).round(3)\n end\n\n pg_time = Time.now\n # Launch SQL commands\n @destination.commit\n Thread.current[:threshold_log].add 'Replicate time', (Time.now - pg_time).round(3)\n\n end\n\n end",
"def commit\n if defined? _commit\n if dirty?\n _commit\n end\n end\n nil\n end",
"def to_job\n super.tap do |job|\n if commit_log.status == PhraseStatus::PUSHED\n job.set_delay(random_delay)\n job.set_queue('finalize')\n end\n end\n end",
"def finalize(success = true)\n committer.finalize(success)\n end",
"def commit_message\n @commit.sub '%.%.%', @after_version\n end",
"def commit( commit_msg )\n\n log.info(x) { \"[git] commit msg => #{commit_msg}\" }\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_commit_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} commit -m \\\"#{commit_msg}\\\";\"\n log.info(x) { \"[git] commit command => #{git_commit_cmd}\" }\n %x[#{git_commit_cmd}];\n log.info(x) { \"[git] has committed resources into the local repository.\" }\n\n end",
"def run!\n report_startup\n setup_stage\n stage_operations\n managed_copy\n remove_stage\n report_complete\n end",
"def commit\n @translation = Translation.find(params[:id])\n @event = @translation.event\n if [email protected]_es.nil? && @event.des_es.empty?\n @event.title_es = @translation.title_es\n @event.des_es = @translation.des_es\n end\n if [email protected]_eu.nil? && @event.des_eu.empty?\n @event.title_eu = @translation.title_eu\n @event.des_eu = @translation.des_eu\n end\n if [email protected]_fr.nil? && @event.des_fr.empty?\n @event.title_fr = @translation.title_fr\n @event.des_fr = @translation.des_fr\n end\n if [email protected]_en.nil? && @event.des_en.empty?\n @event.title_en = @translation.title_en\n @event.des_en = @translation.des_en\n end\n @event.save\n @user= @translation.user\n @content = \"5\"\n @translation.committed = true\n @translation.user.translated += 1 \n @translation.user.save\n @translation.save\n redirect_to @event\n end",
"def after_generate\n git_init if @gitinit\n info_message\n end",
"def after_generate\n git_init if @gitinit\n info_message\n end",
"def commit_message\n user_name = user ? user.login : \"anonymous\"\n \n if revisions.empty?\n \"initial #{user_name}\"\n elsif @rollback\n \"rollback #{self.log.first} #{user_name}\"\n else\n \"edit #{self.log.first} #{user_name}\"\n end\n end",
"def commit!\n _commit( false )\n end",
"def update_commit\n commit.update_scalars\n commit.save\n test_case_commits.each { |tcc| tcc.update_and_save_scalars }\n end",
"def commit_all(index, last_commit, last_tree)\n callback = self.git_settings.commit_message\n # $stderr.puts self.git_settings.inspect\n message = case callback\n when Symbol\n self.send(callback)\n when Proc\n callback.call(self)\n else\n \"new version of #{self.class}, id: #{self.id.to_s}\" \n end\n lc = (last_commit ? [last_commit.id] : nil)\n index.commit(message, lc, @model_user)\n end",
"def advance(commit_log)\n create_stage_instance(commit_log).tap do |stage|\n return unless stage\n stage.execute!\n return if finished?(stage)\n enqueue_job(stage.to_job)\n end\n end",
"def commit\n # no op\n end",
"def commit\n @repo.commit\n end",
"def committed!\n @on_commit.each do |callback|\n callback.call\n end\n clear\n end",
"def treat_as_new_commit!\n self.current_region = self.application.regions.first\n self.state = \"awaiting_deploy\"\n self.build_statuses_dataset.destroy\n self.save\n self.fire_events(:begin_deploy)\n end",
"def commit\n freeze_time\n release_expired\n store_staged_data\n clean\n\n was_dirty?\n end",
"def commit\n self.index.commit(@commit_msg, @commit_author)\n end",
"def commit(message = nil)\n # Write current index back to the repository\n index = @repo.index\n commit_tree = index.write_tree @repo\n\n # Commit message\n message = \"Affected files: #{@affected_files.uniq.join(', ')}\" if message.nil?\n\n # User handling\n user = ENV['USER']\n user = \"cir-out-commit\" if user.nil?\n\n # Commit author structure for git\n commit_author = {\n email: '[email protected]',\n name: user,\n time: Time.now\n }\n\n # And finally commit itself\n Rugged::Commit.create @repo,\n author: commit_author,\n committer: commit_author,\n message: message,\n parents: @repo.empty? ? [] : [ @repo.head.target ].compact,\n tree: commit_tree,\n update_ref: 'HEAD'\n\n # Reset list of files that were changed since last commit\n @affected_files = []\n end",
"def finished!\n t = Time.now.utc\n update_attribute(:finished_at, t)\n # Save errors counts\n if errs = error_messages\n BackupJobError.increment_errors_count(*errs)\n end\n backup_source.backup_complete!\n on_finish :errors => errs, :messages => messages\n end",
"def commit\n sanity_check\n @handle.commit\n end",
"def bt_commit(commit_time=nil)\n if new_record?\n self.ttstart_at = commit_time\n self.save ? [self] : []\n else\n bt_revise\n end\n end",
"def stage_and_commit(msg, actor=nil, &block)\n stage(&block)\n sha = staging.commit(msg, actor)\n unstage\n sha\n end",
"def commit!\n rsp = post(\"<commit/>\")\n success?(rsp.body) or log_error(rsp.body)\n end",
"def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end",
"def commit\n if !@rollback\n @indexes.each_value do |index| \n $LUCENE_LOGGER.debug{\"BEGIN: Commit index #{index} txt #{to_s}\"} \n index.commit\n $LUCENE_LOGGER.debug{\"END: Commited index #{index} txt #{to_s}\"}\n end \n end\n @commited = true\n $LUCENE_LOGGER.error(\"Index was not removed from commited transaction: #{@indexes.inspect}\") if [email protected]? && !@rollback \n @indexes.clear\n Thread.current[:lucene_transaction] = nil\n end",
"def log\n logger.info \"Apply migration #{version}\\n\"\n end",
"def execute\n filename = log_filename\n @logger = logger(filename)\n ::AlmaCourseLoader::Diff.diff(old_file, new_file,\n create: create, delete: delete,\n rollover: rollover?,\n update: update) do |old, new, op, opts|\n log(old, new, op, opts) if @logger\n end\n @logger.close if @logger && filename\n exit(EXIT_OK)\n end",
"def generate_commit_message\n [\n \"[fastlane]\",\n \"Updated\",\n self.type,\n \"and platform\",\n self.platform\n ].join(\" \")\n end",
"def commit_changes\n @message = \"commiting changes for #{@issue_key}\"\n begin\n ui.info \"Commiting changes...\"\n @git.commit_all(@user_message.empty? ? @message : @user_message)\n rescue Git::GitExecuteError => e\n error_message = e.message.split(':').last\n ui.info error_message\n unless error_message =~ /nothing to commit/\n exit 1\n end\n end\n push_changes\n end",
"def commit\n @git = YMDP::GitHelper.new\n @git.do_commit(@message)\n @git_hash = git.get_hash(options[:branch]) \n end",
"def finalize!\n update_attribute(:completed_at, Time.now)\n end",
"def commit\n {}\n end",
"def commit\n {}\n end",
"def commit_all(_message)\n puts 'TODO: Implement Git.commit_all'\n end",
"def on_prepare_commit(unit, aggregates, events); end",
"def commit\n @commit ||= $repo.log.object(@rev || 'master').path(@name).first\n end",
"def commit(msg = nil)\n require_dep! 'awesome_spawn'\n require_cmd! git_cmd\n\n in_repo { AwesomeSpawn.run \"#{git_cmd} add #{pkg_files.join(' ')}\" }\n super(msg.nil? ? \"updated to #{version}\" : msg)\n self\n end",
"def finalize_production\n @project = Project.find_by_id params[:project_id]\n production_finish_date = Project.extract_event_date(params[:project][:production_finish_date])\n \n @project.finalize_production( current_user, production_finish_date ) \n \n if @project.is_production_finished == true \n flash[:notice] = \"The project '#{@project.title}' has been finalized.\" \n else\n flash[:error] = \"Hey, do something better\" \n end\n \n redirect_to new_project_draft_url( @project ) \n \n end",
"def commit\n return if iv_check(:@committed)\n raise Error, \"#{name} has no leaves\" unless iv_check(:@leaves, &:any?)\n\n # add the whitespace rule unless told otherwise\n if iv_check(:@keep_whitespace)\n remove_instance_variable :@keep_whitespace\n else\n used_rules = (@rules.map(&:name) + @leaves.map(&:name)).to_set\n base = '_ws'\n count = nil\n count = count.to_i + 1 while used_rules.include? \"#{base}#{count}\".to_sym\n _leaf \"#{base}#{count}\".to_sym, /\\s+/, ignorable: true\n end\n\n # vet on commit so rule definition is order-independent\n [@leaves, @rules].flatten.each do |r|\n vetted_tests = r.tests.map { |t| vet t }\n vetted_preconds = r.preconditions.map { |pc| vet_precondition pc }\n r._post_init(vetted_tests, vetted_preconds)\n end\n completeness_check\n loop_check\n # arrange things so we first try rules that can complete more of the parse;\n # better would be sorting by frequency in parse trees, but we don't have\n # that information\n @starters.transform_values { |atoms| atoms.sort_by(&:max_consumption).reverse }\n remove_instance_variable :@leaf_dup_check if iv_check(:@leaf_dup_check)\n remove_instance_variable :@rule_dup_check if iv_check(:@rule_dup_check)\n @committed = true\n end",
"def commit_message\n commit_message_lines.join\n end",
"def commit!(msg=status)\n setup unless head\n \n sha = git.commit!(msg)\n index.write(sha)\n sha\n end",
"def commit_stage\n @stage_monitor.synchronize do\n @service_stages << @current_stage unless @current_stage.empty?\n @stage_counter ||= 0\n @stage_counter += 1\n @current_stage = []\n end\n end",
"def git_commit_initial\n commit \"Initial Commit\"\n end",
"def report_complete\n report \"\\nFinished in %.3f seconds.\" % [Time.now - @time]\n end",
"def commit\n query 'commit'\n self\n end",
"def solr_commit\n Solarize::Post.execute(Solr::Request::Commit.new)\n end",
"def git_commit\n init_structure\n sha = add_all_changes_to_git\n \n if self.attributes.has_key?(\"version\") \n self.version = sha\n self.connection.update(\"UPDATE #{self.class.table_name} SET version='#{sha}' WHERE id='#{self.id}'\")\n end\n \n return sha\n end",
"def migrate(commit, delete_old_keys=false)\n say \"Processing commit ##{commit.id} (#{commit.project.name} #{commit.revision})...\"\n\n # first store all the keys that used to be associated with this commit\n old_keys = commit.keys.includes(translations: :translation_changes).to_a\n\n # reimport the commit to get potentially new android strings\n say \"Re-importing...\", true\n commit.import_strings force: true, inline: true\n\n # match old keys to new keys and update translations as necessary\n say \"Recombobulating translations from old keys...\", true\n commit.reload.keys.includes(:translations).each do |new_key|\n next unless new_key.importer == 'android'\n\n new_key_string = new_key.key.split(':').last\n blob_sha = cached_blob_sha(new_key.project, commit.revision, new_key.source[1..-1])\n xml = Nokogiri::XML(cached_blob_contents(new_key.project, blob_sha))\n tag = find_new_key(xml, new_key_string)\n old_key_string = old_key(tag)\n\n old_key = old_keys.detect { |k| k.key == \"#{new_key.source}:#{old_key_string}\" }\n unless old_key\n say \"[#{new_key.source}] Skipping #{new_key_string}; couldn't find corresponding #{old_key_string}\", true\n next\n end\n\n old_key.translations.each do |old_translation|\n next if old_translation.rfc5646_locale == commit.project.base_rfc5646_locale\n\n new_translation = new_key.translations.detect { |t| t.rfc5646_locale == old_translation.rfc5646_locale }\n new_translation.copy = old_translation.copy\n new_translation.approved = old_translation.approved\n new_translation.translator_id = old_translation.translator_id\n new_translation.reviewer_id = old_translation.reviewer_id\n new_translation.save!\n\n new_translation.translation_changes.delete_all\n old_translation.translation_changes.each do |tc|\n new_translation.translation_changes.create!(user: tc.user, diff: tc.diff)\n end\n end\n end\n\n if delete_old_keys\n say \"Destroying old keys...\", true\n Key.where(id: old_keys.map(&:id)).destroy_all\n end\nend",
"def commit(msg=status)\n setup unless head\n \n sha = git.commit(msg)\n index.write(sha)\n sha\n end",
"def commit \n results = submit_cmd('commit plant',:db, \"-env #{self.env}\")\n puts results\n end",
"def text_run_finalize\n if '' != @rt_run_context.collected_text\n # Add run only if we collected any text\n @rt_current_block_node.text(\n @rt_run_context.collected_text,\n @rt_run_context.run_attributes_stack.last\n )\n end\n # Reset run_context\n @rt_run_context.collected_text = ''\n @rt_run_context.inside_a_run = false\n @rt_run_context.run_attributes_stack.pop\n\n text_run_continue_existing\n true\n end",
"def finish\n self.class.debug_log(\"SAVE #{flavor} \" \\\n \"from=#{begin\n user.login\n rescue StandardError\n \"nil\"\n end} \" \\\n \"to=#{begin\n to_user.login\n rescue StandardError\n \"nil\"\n end} \" +\n queued_email_integers.map { |x| \"#{x.key}=#{x.value}\" }.join(\" \") +\n queued_email_strings.map { |x| \"#{x.key}=\\\"#{x.value}\\\"\" }.join(\" \"))\n current_locale = I18n.locale\n unless MO.queue_email || QueuedEmail.queue\n deliver_email if RunLevel.is_normal?\n destroy\n end\n I18n.locale = current_locale\n end",
"def completed\n logger.debug \"Beetle: message processing completed\"\n logger.flush if logger.respond_to?(:flush)\n end",
"def commit_db_transaction() \n log(\"Committing boxcar with #{@command_boxcar.length} commands\", 'commit_db_transaction()')\n \n previous_command = nil\n commands = []\n \n @command_boxcar.each do |command|\n if commands.length >= MAX_BOXCAR_SIZE or (previous_command and (command.verb != previous_command.verb))\n send_commands(commands)\n \n commands = []\n previous_command = nil\n else\n commands << command\n\t previous_command = command\n end\n end\n \n # Finish off the partial boxcar\n send_commands(commands) unless commands.empty?\n \n end",
"def finish_building(commit_id, build_status, build_output)\n raise NotImplementedError\n end",
"def commit\n @handle.commit\n super\n end",
"def satellite_commit(repo, message, author, branch)\n options = rugged_commit_options(author, repo, message)\n commit_id = Rugged::Commit.create repo, options\n repo.index.write\n pushtobare branch\n touch # use current updated_at time\n commit_id\n end",
"def git_commit(message)\n yield\n git add: '.'\n git commit: %{ -m #{message.inspect} }\n end",
"def commit_transaction\n # The relation graph handling is a bit tricky. We resolve the graphs\n # exclusively using self (NOT other) because if 'other' was a new\n # task, it has been already moved to the new plan (and its relation\n # graph resolution is using the new plan's new graphs already)\n\n super\n\n if @executable != __getobj__.instance_variable_get(:@executable)\n __getobj__.executable = @executable\n end\n\n finalization_handlers.each do |handler|\n __getobj__.when_finalized(handler.as_options, &handler.block)\n end\n end",
"def git\n require 'parsedate'\n puts 'Doing local Git commit...'\n d = Time.new()\n git_comment = \"#{d}\"\n `git add ../.`\n `git commit ../. -m \"#{git_comment}\"`\nend",
"def do_hook(c)\n sp = c[\"head_commit\"][\"message\"].split \"#\"\n taskid = sp[-1].to_i\n da_task = self.tasks.find(taskid)\n\n if da_task then\n commit = Commit.new\n commit.author_email = c[\"head_commit\"][\"author\"][\"email\"]\n commit.author_name = c[\"head_commit\"][\"author\"][\"name\"]\n commit.message = c[\"head_commit\"][\"message\"]\n commit.url = c[\"head_commit\"][\"url\"]\n commit.sha = c[\"head_commit\"][\"id\"]\n commit.date = c[\"head_commit\"][\"timestamp\"]\n commit.task_id = taskid\n commit.save\n end\n end",
"def git_commit_initial\n author = {:email => \"admin@localhost\", :name => \"admin\", :time => Time.now.utc}\n\n Rugged::Commit.create(\n repo,\n :message => \"Initial Commit\",\n :parents => [],\n :tree => index.write_tree(repo),\n :update_ref => \"HEAD\",\n :author => author,\n :committer => author\n )\n end",
"def complete()\n if @status.status == 'running'\n @logger.info \"Workflow #{self.class.name} has completed successfully\"\n @status.finished\n end\n end",
"def finalize!\n # lock all adjustments (coupon promotions, etc.)\n all_adjustments.each{|a| a.close}\n\n # update payment and shipment(s) states, and save\n updater.update_payment_state\n shipments.each do |shipment|\n shipment.update!(self)\n shipment.finalize!\n end\n\n updater.update_shipment_state\n save!\n updater.run_hooks\n\n touch :completed_at\n\n # Deshabilitamos el envio de correos estandar de spree para gestionarlo de forma personalizada.\n # deliver_order_confirmation_email unless confirmation_delivered?\n\n consider_risk\n end",
"def commit\n # TODO\n # Update ./docProps\n # app.xml slides, notes, counts, etc\n # core.xml Times\n entries.each do |path, buffer|\n path = path.to_s\n if @original_files.include? path\n @zip.replace_buffer path, buffer\n else\n @zip.add_buffer path, buffer\n end\n end\n @zip.commit\n end",
"def status_hook\n # We're not interested in PR statuses or branches other than deploy\n unless params[:branches].index { |b| b[:name] == 'deploy' }\n render(plain: 'Not a commit on deploy. Uninterested.') && return\n end\n\n # Create a new CommitStatus\n\n if CommitStatus.find_by(commit_sha: params[:sha])\n render plain: 'Already recorded status for commit', status: 200\n return\n end\n\n if params[:state] == 'pending'\n render plain: \"We don't record pending statuses\", status: 200\n return\n end\n\n commit_sha = params[:sha]\n status = params[:state]\n commit_message = params[:commit][:commit][:message]\n ci_url = params[:target_url]\n\n ActionCable.server.broadcast 'smokedetector_messages', commit_status: {\n status: status,\n ci_url: ci_url,\n commit_sha: commit_sha,\n commit_message: commit_message\n }\n CommitStatus.create(commit_sha: commit_sha, status: status)\n\n render plain: 'OK', status: 200\n end",
"def perform!\r\n super\r\n backup\r\n log!(:finished)\r\n end",
"def commit(repo)\n # First, ensure everything up-to-date\n # The fourth argument as true tells update to ignore externals.\n repo.ctx.update(repo.wc_path, \"HEAD\", nil, true)\n \n root = Directory.new(repo.ctx, repo.wc_path)\n root.instance_eval(&@block) if @block\n ci = repo.ctx.ci(repo.wc_path)\n unless ci.revision == Svn::Core::INVALID_REVNUM\n rev = ci.revision\n repo.repos.fs.set_prop('svn:log', @message, rev) if @message\n repo.repos.fs.set_prop('svn:author', @author, rev) if @author\n repo.repos.fs.set_prop('svn:date', @date, rev) if @date\n @revprops.each do | key, val |\n val = SvnFixture.svn_time(val) if val.respond_to?(:strftime)\n repo.repos.fs.set_prop(key.to_s, val.to_s, rev)\n end\n else\n puts \"Warning: No change in revision #{name} (SvnFixture::Revision#commit)\"\n end\n return true\n end",
"def after_sync\n super()\n Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, {\n success: success?,\n step: 'prepare',\n counts: counts,\n files: files,\n }.tap { |e| e[:duration] = duration if duration })\n Wukong::Deploy.vayacondios_client.set(vayacondios_topic, \"prepare.last\", { state: (success? ? 1 : 0), time: Time.now.utc.to_i })\n end",
"def finalize!\n @finalized = true\n configure!\n @config.lint!\n end",
"def commit(message, options={})\n raise \"no changes to commit\" if status.empty?\n commit!(message, options)\n end",
"def commit_file\n if @upload.public? && @upload.file_type.public? && @upload.address.blank? && (@upload.creating? || @upload.failed?)\n BlockchainCommitJob.perform_later(@upload.id)\n end\n end",
"def github_released\n puts green(\"Release completed\")\n end",
"def commit(*args)\n super(*args)\n\n ret = nil\n\n if next_action\n ret = next_action.call(*args)\n self.next_action = nil\n end\n\n ret\n end",
"def _run_commit_callbacks\n if destroyed? || transaction_changed_attributes.present?\n expire_cache\n end\n super\n end",
"def db_completed(message = \"Completed at #{Time.zone.now}\" )\n update_db_status({ status: STATUS_COMPLETED, message: message })\n end",
"def commit(message)\n @repo.commit_index(\"Cron Job: #{message}\") # Commit.\nend",
"def after_commit(unit); end",
"def commit\n @commit ||= @repo.commit(@repo.head.commit)\n end",
"def stage\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_add_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} add -A\"\n log.info(x) { \"[git] add command => #{git_add_cmd}\" }\n %x[#{git_add_cmd}];\n log.info(x) { \"[git] has recursively added resources to version management.\" }\n\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 final_summary\n puts\n puts <<-eos\n --------------------------------------------------------------------------\n Complete Summary:\n Execution time: #{as_time_elapsed(Time.now - @start)}\n\n Up To Date: #{@uptodate}\n\n Failures: #{@failed}\n\n Added: #{@added}\n Updated: #{@updated}\n Bytes copied: #{as_byte_size(@copied_bytes)}\n\n Removed: #{@removed}\n Bytes freed: #{as_byte_size(@freed_bytes)}\n --------------------------------------------------------------------------\n eos\n puts\n STDOUT.flush\n end",
"def git_commit_log\n ENV['GIT_COMMIT_LOG'] || ENV['GIT_COMMIT_LOG'] = generate_git_commit_log\nend",
"def git_commit_log\n ENV['GIT_COMMIT_LOG'] || ENV['GIT_COMMIT_LOG'] = generate_git_commit_log\nend",
"def git_commit_log\n ENV['GIT_COMMIT_LOG'] || ENV['GIT_COMMIT_LOG'] = generate_git_commit_log\nend",
"def commit\n submissions.each(&:commit)\n end",
"def commit_changes(description)\n git :add => '-A'\n git :commit => %Q(-qm \"thegarage-template: [#{@current_recipe}] #{description}\")\nend",
"def commit( recurse = true )\n return true\n end",
"def commiter() end"
] |
[
"0.60674495",
"0.5897237",
"0.57185316",
"0.5485851",
"0.54247266",
"0.524159",
"0.52088076",
"0.5203131",
"0.51798517",
"0.5177751",
"0.5172749",
"0.5158065",
"0.51480746",
"0.50927216",
"0.50833577",
"0.50811106",
"0.50811106",
"0.5072285",
"0.50721663",
"0.5065324",
"0.5057544",
"0.5044973",
"0.50158846",
"0.5003086",
"0.49936014",
"0.4954809",
"0.49490544",
"0.49370053",
"0.49143967",
"0.49130568",
"0.49123213",
"0.4911958",
"0.49027905",
"0.4898304",
"0.48778126",
"0.48765898",
"0.4865751",
"0.48656198",
"0.48632643",
"0.48588654",
"0.48553383",
"0.48435396",
"0.48186657",
"0.48186657",
"0.4813575",
"0.48094803",
"0.47887185",
"0.4777628",
"0.4773399",
"0.47646508",
"0.47522137",
"0.47415212",
"0.47406137",
"0.47203916",
"0.4711918",
"0.46978608",
"0.46966007",
"0.46949852",
"0.46926984",
"0.4683983",
"0.46756238",
"0.4672883",
"0.46711478",
"0.46633494",
"0.46631193",
"0.4662461",
"0.46614456",
"0.46607494",
"0.4656788",
"0.46445823",
"0.46413037",
"0.46408486",
"0.46389",
"0.46378848",
"0.4628548",
"0.46140167",
"0.46036506",
"0.46002182",
"0.4590519",
"0.45880723",
"0.45734236",
"0.45710272",
"0.45682722",
"0.45669672",
"0.45565194",
"0.4555708",
"0.45536584",
"0.45523223",
"0.45511973",
"0.45510855",
"0.45426613",
"0.4538222",
"0.45367402",
"0.45362842",
"0.45362842",
"0.45362842",
"0.4535979",
"0.45325077",
"0.45314273",
"0.45259058"
] |
0.7854903
|
0
|
Converts this stage to a job that can be enqueued. This method should be called after +execute!+, meaning the commit log has been updated to the next status in the pipeline. If that next status also happens to be PUSHED, this method adds a delay to avoid finalizing too often. If the chosen queue implementation does not support delays, setting this value should be a safe noop (i.e. have no adverse sideeffects).
|
def to_job
super.tap do |job|
if commit_log.status == PhraseStatus::PUSHED
job.set_delay(random_delay)
job.set_queue('finalize')
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def queue\n pending_duplicate_job || Delayed::Job.enqueue(self)\n end",
"def enqueue!\n return nil unless persisted?\n \"#{job_type.camelize}Job\".constantize.perform_later(self)\n end",
"def queue_job(priority = nil, delay = default_delay)\n args = { }\n args[:wait] = delay if delay\n args[:priority] = priority if priority\n\n enqueue(args)\n end",
"def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end",
"def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end",
"def queue(delay = 0, &block)\n queue_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) + delay\n job = [queue_time, block]\n\n @mutex.synchronize do\n i = @jobs.length\n while i > 0\n i -= 1\n current, _ = @jobs[i]\n if current < queue_time\n i += 1\n break\n end\n end\n @jobs.insert(i, job)\n @next = queue_time if i == 0\n end\n\n unless @thread.alive?\n @mutex.synchronize do\n @thread = Thread.new { do_work } unless @thread.alive?\n end\n end\n\n if @thread.status == \"sleep\"\n @thread.wakeup\n end\n\n Cancelable.new(job)\n end",
"def enqueue_self\n\n BgJob.enqueue(\n ::RegisterBrandedToken::GetAirdropDeployStatusJob,\n {\n parent_id: @parent_id\n },\n {\n wait: 10.seconds\n }\n )\n\n end",
"def requeue\n update_attributes(failed: false, failed_at: nil, failure_reason: nil,\n delivered: false, delivered_at: nil)\n queue\n end",
"def queue_job; end",
"def queue\n @queue.pending\n end",
"def requeue_perform_delay\n 1.0\n end",
"def requeue_perform_delay\n 1.0\n end",
"def enqueue\n # We need to save before passing to perform_later b/c perform_later will need our ID.\n # For this reason, the job_id col can't have a null constraint.\n save! unless persisted?\n job = job_class.constantize.perform_later(self, **job_params)\n update!(job_id: job.job_id, provider_job_id: job.provider_job_id)\n end",
"def enqueue_job(job, event)\n delayed_job = job.queue\n\n logger.info \"Queued #{event.event_description} as job #{delayed_job.id}\"\n\n {\n 'status' => 'ok',\n 'job_id' => delayed_job.id,\n 'queue' => delayed_job.queue,\n 'priority' => delayed_job.priority,\n 'created_at' => delayed_job.created_at,\n }\n end",
"def perform\n self.status = STATUS_DONE\n self.save\n job.update_status\n end",
"def enqueue_job!(job, wait_until)\n job.run_callbacks :enqueue do\n job.enqueue!\n job.save! do\n Burstflow::Worker.set(wait_until: wait_until).perform_later(workflow.id, job.id)\n end\n end\n end",
"def queued\n @queued\n end",
"def delayed_push(timestamp, item)\n # This line could raise `LockingError` and it should be handled in the\n # `enqueue_at_with_queue` method\n #\n # We can't handle exception here, because of jobs, which raise an error on locking\n # will run after hooks, but its unexpected behavior.\n Resque::Job.new(item[:queue], 'class' => item[:class], 'args' => item[:args])\n .uniqueness\n .try_lock_queueing(timestamp.to_i - Time.now.to_i)\n super\n end",
"def delayed_build\n update_attributes(status: 3)\n self.delay.build\n end",
"def queue\n Future.new(super)\n end",
"def job(body)\n @queue.push(@config.get('DISQUE_QUEUE'), body, 1000)\n end",
"def enqueue(active_job)\n enqueue_at(active_job, nil)\n end",
"def add_to_queue\n if !queue_id.blank? && cancelling?\n # cancelling items already have a valid job payload on the queue - do not add again\n return\n end\n\n payload = AnalysisJobsItem.create_action_payload(analysis_job, audio_recording)\n\n result = nil\n error = nil\n\n begin\n result = BawWorkers::Jobs::Analysis::Job.action_enqueue(payload)\n\n # the assumption here is that result is a unique identifier that we can later use to interrogate the message queue\n self.queue_id = result\n rescue StandardError => e\n # NOTE: exception used to be swallowed. We might need better error handling here later on.\n Rails.logger.error \"An error occurred when enqueuing an analysis job item: #{e}\"\n raise\n end\n\n @enqueue_results = { result: result, error: error }\n end",
"def queue(&b)\n @queue << b\n end",
"def enqueue_at_with_queue(queue, timestamp, klass, *args)\n return false unless plugin.run_before_schedule_hooks(klass, *args)\n\n if Resque.inline? || timestamp.to_i < Time.now.to_i\n # Just create the job and let resque perform it right away with\n # inline. If the class is a custom job class, call self#scheduled\n # on it. This allows you to do things like\n # Resque.enqueue_at(timestamp, CustomJobClass, :opt1 => val1).\n # Otherwise, pass off to Resque.\n if klass.respond_to?(:scheduled)\n klass.scheduled(queue, klass.to_s, *args)\n else\n Resque::Job.create(queue, klass, *args)\n end\n else\n delayed_push(timestamp, job_to_hash_with_queue(queue, klass, args))\n end\n\n plugin.run_after_schedule_hooks(klass, *args)\n end",
"def enqueue_at(job, timestamp)\n delay = timestamp.to_i - Time.current.to_i\n sqs.send_message(\n queue_url: get_queue_url(job),\n message_body: MultiJson.dump(job.serialize),\n delay_seconds: delay,\n )\n end",
"def apply_async!(queue: 'eventually')\n super\n end",
"def queue(queue, klass, **options)\n check_exists\n SideJob.queue(queue, klass, options.merge({parent: self, by: \"job:#{id}\"}))\n end",
"def queued?\n status.queued?\n end",
"def perform!\n Quebert.config.before_job(self)\n Quebert.config.around_job(self)\n\n # Honor the timeout and kill the job in ruby-space. Beanstalk\n # should be cleaning up this job and returning it to the queue\n # as well.\n val = ::Timeout.timeout(ttr, Job::Timeout){ perform(*args) }\n\n Quebert.config.around_job(self)\n Quebert.config.after_job(self)\n\n val\n end",
"def enqueue(job_id)\n create_job_record(job_id)\n BEANSTALK_QUEUE.yput(:job_id => job_id)\n @last_queried[job_id] = Time.now\n end",
"def enqueue_in(delay, job_class, *args)\n with_error_handling(\"Unable to enqueue #{job_class} job\", args: args) do\n Ladon.q.enqueue_in(delay, job_class, *args)\n end\n end",
"def queued?\n job_queued?\n end",
"def on_before_enqueue\n return unless topic.long_running_job?\n\n # This ensures, that when running LRJ with VP, things operate as expected\n coordinator.on_enqueued do |first_group_message|\n # Pause at the first message in a batch. That way in case of a crash, we will not loose\n # any messages\n pause(first_group_message.offset, MAX_PAUSE_TIME)\n end\n end",
"def set_queue_delay\n new_delay = params[:delay].to_f\n if new_delay == 0\n head :bad_request\n else\n Rails.application.config.queue_delay = new_delay\n render :get_queue_delay\n end\n end",
"def initial_queue_for(processing_queue, data, options = {})\n if has_external_dependencies_for?(data)\n return Pipeline::AWAITING_EXTERNAL_DEPENDENCY_QUEUE\n end\n\n options_queue = options[:queue]\n return options_queue if options_queue && processing_queue == :plines\n\n processing_queue\n end",
"def enqueue(job)\n enqueue_at(job, nil)\n end",
"def perform(*args)\n if Service.get_service.jobs_enabled?\n # Job processing is enabled.\n Delayed::Worker.logger.info \"---> running #{self.class}(#{args.join(',')}) on #{self.queue_name} at priority #{Process::getpriority(Process::PRIO_PROCESS, 0)}\"\n start_time = Time.current\n perform_if_enabled(*args)\n Delayed::Worker.logger.info \"<--- finished #{self.class} after #{time_ago_in_words(start_time)}\"\n else\n # Resubmit the job with the required parameters after the specified delay. If the inline adapter is being used, we just ignore this.\n Delayed::Worker.logger.warn \"**** job processing disabled for #{self.class}\"\n begin\n self.class.set(wait: DISABLED_RETRY_INTERVAL).perform_later(*args)\n rescue NotImplementedError => _e\n Delayed::Worker.logger.error \"**** no job queue available for future job #{self.class}\"\n end\n end\n end",
"def queue\n @queue ||= produce_queue\n end",
"def queue_pending\n \"resque:queue:prgov_cap\"\n end",
"def enqueue_at(_job, _timestamp)\n raise NotImplementedError, 'This queueing backend does not support scheduling jobs.'\n end",
"def job_class\n SingleInstanceQueueJob\n end",
"def status\n job = delayed_job\n return 'queued' if job_queued?(job)\n return 'working' if job_working?(job)\n return 'completed' if job_completed?(job)\n return 'failed' if job_failed?(job)\n return 'unknown'\n end",
"def queue(*args)\n @queue = args.first unless args.empty?\n (@queue || :default).to_s\n end",
"def queue(job_id)\n redis do |conn|\n conn.lpush(key.queued, job_id)\n end\n end",
"def set(options = {}) # :nodoc:\n self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait]\n self.scheduled_at = options[:wait_until].to_f if options[:wait_until]\n self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue]\n self.priority = options[:priority].to_i if options[:priority]\n\n self\n end",
"def queue_time\n NotImplementedError\n end",
"def queued?\n @state == STATE_QUEUED\n end",
"def tomqueue_payload\n JSON.dump({\n \"delayed_job_id\" => self.id,\n \"delayed_job_digest\" => tomqueue_digest,\n \"delayed_job_updated_at\" => self.updated_at.iso8601(0)\n })\n end",
"def later(pathname)\n if klass = job_class\n logger.measure_info \"Enqueued: #{name}, Job class: #{job_class_name}\" do\n job = klass.new(properties)\n upload_file(job, pathname)\n job.save!\n job\n end\n else\n raise(ArgumentError, \"Cannot instantiate a class for: #{job_class_name.inspect}\")\n end\n end",
"def enqueue(override = false)\n if self.job_id.nil? && !(self.last_fetch_at.present? && (Time.now - self.last_fetch_at) < UPDATE_TIME) && !override\n Delayed::Job.enqueue(ArtistWorker.new(self.id), 0, Time.now)\n self.job_id = Delayed::Job.last.id\n save\n end \n end",
"def schedule_queue_bill(*args)\n self.class.schedule_queue_bill(*args)\n end",
"def queue_job(priority = default_priority, time = default_delay.from_now, allow_duplicate = allow_duplicate_jobs?)\n if allow_duplicate || !exists?\n Delayed::Job.enqueue(self, priority: priority, queue: queue_name, run_at: time)\n end\n end",
"def db_queued(message = \"Queued at #{Time.zone.now}\")\n update_db_status({ status: STATUS_QUEUED, message: message })\n end",
"def step\n @queue << \"step\"\n end",
"def queueable(queue = nil)\n scope = where(state: :created).order('jobs.id')\n scope = scope.where(queue: queue) if queue\n scope\n end",
"def waiting_queue_name\n @waiting_queue_name\n end",
"def queue(whois=nil, &block)\n job = Job.new\n job.block = block\n job.whois = whois\n\n if @busy_count >= MAX_FIBERS\n @queued_jobs << job\n #puts \"[FiberPool] There are already #@busy_count/#{MAX_FIBERS} busy fibers, queued job #{job.id}\"\n return false\n end\n\n @busy_count += 1\n fiber = @idle_fibers.pop || create_new_fiber\n fiber.resume(job)\n\n job\n end",
"def enqueue_at(active_job, timestamp)\n good_job = GoodJob::Job.enqueue(\n active_job,\n scheduled_at: timestamp ? Time.zone.at(timestamp) : nil,\n create_with_advisory_lock: execute_inline?\n )\n\n if execute_inline?\n begin\n good_job.perform\n ensure\n good_job.advisory_unlock\n end\n end\n\n executed_locally = execute_async? && @scheduler.create_thread(queue_name: good_job.queue_name)\n Notifier.notify(queue_name: good_job.queue_name) unless executed_locally\n\n good_job\n end",
"def queued(options={})\n url_params = options.empty? ? '' : \"?locator=#{locator(options)}\"\n response = get(\"buildQueue#{url_params}\")\n response['build']\n end",
"def enqueued_at\n Time.parse(self.result_payload[\"enqueued_at\"]) if self.result_payload && self.result_payload[\"enqueued_at\"]\n end",
"def queue(_); end",
"def queue(_); end",
"def queue_path_change_job\n return if previous_changes['string_key'].blank? || previous_changes['path'].blank? || previous_changes['path'][0].nil?\n previous_changes['path'].tap { |arr| ChangeDynamicFieldPathsJob.perform_later(arr[0] => arr[1]) }\n end",
"def submit(job)\n if @queue.length >= QUEUE_SIZE\n job[:callback].call(:error, 'System busy; ask again later.')\n return\n end\n\n @queue.push(job)\n end",
"def perform_later(*args, **options)\n __debug_job(__method__) { \"options = #{item_inspect(options)}\" } # TODO: remove\n job_warn { \"ignoring method args #{args.inspect}\" } if args.present?\n enqueue(options)\n end",
"def deliver\n @queue << self\n end",
"def queued?\n attributes['status'] == 3\n end",
"def advance(commit_log)\n create_stage_instance(commit_log).tap do |stage|\n return unless stage\n stage.execute!\n return if finished?(stage)\n enqueue_job(stage.to_job)\n end\n end",
"def enqueue(job:, method:, args:, delay: nil)\n meta = { \"enqueued_at\" => Time.now.to_i }\n task = Task.new(self, generate_task_id, job, method, args, meta)\n client_push(task)\n end",
"def reset\n self.update_attributes(status: \"QUEUED\",\n rescheduled_at: nil,\n sent_at: nil,\n tweet_id: nil)\n\n TweetJob.set(queue: self.user_id,\n wait_until: self.scheduled_for).perform_later(self)\n end",
"def queued?\n @queued\n end",
"def publish_queued_task(name, cur_publish_on, options={})\n cur_publish_on = Time.now + cur_publish_on if cur_publish_on.kind_of?(Fixnum)\n raise \"Expected Time type. Got:\" + cur_publish_on.class.name unless cur_publish_on.kind_of?(Time)\n queued_task_class.publish(name, cur_publish_on, {:actor => self}.merge(options))\n end",
"def enqueue(job)\n build_worker(job).schedule\n end",
"def initialize(priority, threshold, options = {})\n self.priority = Integer(priority)\n self.threshold = Integer(threshold)\n self.queue = options[:queue]\n self.include_locked = !!options[:include_locked]\n self.include_errored = !!options[:include_errored]\n self.greater_than_priority = !!options[:greater_than_priority]\n self.name = greater_than_priority ? \"Delayed Jobs with priority higher than '#{priority}'\" : \"Delayed Jobs with priority lower than '#{priority}'\"\n end",
"def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end",
"def run(parent: false, force: false, at: nil, wait: nil)\n if parent\n pj = self.parent\n return pj ? pj.run(force: force, at: at, wait: wait) : nil\n end\n\n return nil unless force || %w{running queued suspended completed}.include?(status)\n\n self.status = 'queued'\n\n time = nil\n if at\n time = at\n time = time.to_f if time.is_a?(Time)\n elsif wait\n time = Time.now.to_f + wait\n end\n sidekiq_queue(time)\n\n self\n end",
"def stage\n if status == \"Staging\" # ActiveJob being retried could cause this state\n transaction do\n core_records_fields.delete_all\n dataset_records.delete_all\n end\n end\n\n update!(status: \"Staging\") if status == \"Uploaded\"\n\n if status != \"Ready\"\n perform_staging\n update!(status: \"Ready\")\n end\n end",
"def queue() = @queue ||= CommandQueue.new",
"def work_queue(queue)\n if job = Riaque.reserve(queue)\n if klass = self.qualified_const_get(job.klass)\n klass.send(:perform, *job.payload)\n end\n\n job.dequeue\n end\n end",
"def enqueue_in_with_queue(queue, number_of_seconds_from_now,\n klass, *args)\n enqueue_at_with_queue(queue, Time.now + number_of_seconds_from_now,\n klass, *args)\n end",
"def requeue\n Sidekiq.redis { |conn| conn.rpush(QueueName.expand(queue_name), job) }\n end",
"def update_status(worker)\n worker.status = \"queued\"\n BackgroundWorkerRepository.update(worker)\n end",
"def processed!\n Resque::Stat << \"processed\"\n Resque::Stat << \"processed:#{self}\"\n Resque::Stat << \"processed_#{job.queue}\"\n end",
"def add_to_queue(result)\n @last_twid = @last_twid > result.id ? @last_twid : result.id\n App.log.info(\"pushing job to queue #{@queue.name}:\\n#{result.text}\\n#{\"-\"*80}\")\n @queue.push(ConversionJob.new({\n \"queue_id\" => @queue.id,\n \"twid\" => result.id,\n \"from_user_id\" => result.from_user_id,\n \"to_user_id\" => result.to_user_id,\n \"from_user\" => result.from_user,\n \"to_user\" => result.to_user,\n \"profile_image_url\" => result.profile_image_url,\n \"iso_language_code\" => result.iso_language_code,\n \"text\" => result.text,\n \"created_at\" => result.created_at\n }).to_json)\n end",
"def make_ready\n return true if ready # Do nothing if it's ready\n\n unless pending # Ready by default\n if Rails.env.development?\n perform\n else\n Delayed::Job.enqueue self, priority: 1\n self.pending = true\n save\n end\n end\n end",
"def process_queue\n begin\n while blk = Merb::Dispatcher.work_queue.pop\n # we've been blocking on the queue waiting for an item sleeping.\n # when someone pushes an item it wakes up this thread so we \n # immediately pass execution to the scheduler so we don't \n # accidentally run this block before the action finishes \n # it's own processing\n Thread.pass\n blk.call\n end\n rescue Exception => e\n Merb.logger.warn! %Q!Worker Thread Crashed with Exception:\\n#{Merb.exception(e)}\\nRestarting Worker Thread!\n retry\n end\n end",
"def queue_dj\n if persisted?\n handler_matcher = \"%SyncRequest%id: #{id}%school_id: #{school_id}%year: #{year}%priority: #{priority}%month: #{month}%\"\n if filter_by_event\n handler_matcher = \"#{handler_matcher}%filter_by_event: #{filter_by_event}%\"\n end\n\n unless Delayed::Job.where(\"handler like ? AND attempts = 0\", handler_matcher).exists?\n # delayed job prioity is lower number -> higher priority\n # queue on DelayedJob starting sync. safe=false for exception to force retrying\n delay(priority: -priority).start(false)\n end\n end\n end",
"def enter_queue(time)\n self.entered_queue_at = time\n end",
"def queue_url(*_)\n if Settings.active_job_queue.url\n Settings.active_job_queue.url\n else\n super\n end\n end",
"def delayed_push(timestamp, item)\n redis.zadd(:delayed_queue, timestamp.to_i, encode_with_nonce(item))\n end",
"def initialize(queue, uuid, payload)\n @uuid = uuid || self.generate_uuid\n payload[\"args\"].unshift(@uuid)\n super(queue, payload)\n set_result('enqueued_at' => Time.now.utc)\n end",
"def apply\n unless agent.state[\"busy\"] > 0 || agent.state[\"queued_actions\"].empty?\n # Pull the first entry off the action queue\n queue = @agent.state[\"queued_actions\"]\n if queue && queue.size > 0\n if @action_queue_number != queue[0][2]\n @engine.admin_warning(\"Somehow the agent's action queue has gotten screwed up mid-offer!\", \"agent\" => @name)\n else\n queue.shift # Remove the queue entry\n end\n end\n agent.run_action(@action_name, *@action_args, current_intention: self)\n agent.state[\"busy\"] += (@action_struct[\"busy\"] || 1)\n end\n end",
"def reserve\n db.transaction do\n if job = waiting.order(:id).last # asc\n job[:started_working_at] = Time.now\n update_job!(job)\n payload = job[:payload].nil? ? nil : Marshal.load(job[:payload])\n EQ::Job.new(job[:id], job[:queue], payload)\n end\n end\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def queue_plan(plan: nil , custom_revision: nil ,stage: nil, executeAllStages: true, variables: {})\n url = queue_plan_url(plan, custom_revision, stage,executeAllStages,variables)\n puts \"url = #{url}\" \n begin\n @logger.debug(\"url = #{url}\") \n response= RestClient::Request.execute(method: :post, url: url,\n user: @config[:user], password: @config[:password], :verify_ssl =>OpenSSL::SSL::VERIFY_NONE)\n @logger.info(\"plan queued successfully: #{response}\")\n return true\n rescue RestClient::Exception => error\n @logger.fatal(\"Cannot queue plan, #{error.class}\")\n response_code = error.http_code\n case response_code\n when 415 \n # post method payload is not form encoded\n @logger.fatal(\"post payload is not form encoded: url\")\n when 400\n #plan not queued due to bamboo limitation, like too many cocurrent builds for the current plan\n @logger.fatal(\"bamboo limitation, too many builds queued for current plan?\")\n when 404\n #plan does not exist\n @logger.fatal(\"current plan #{plan} not found\")\n when 401\n #user pemission issue\n @logger.fatal(\"user #{@config[:user]} permission issue, check username and password.\")\n when 405\n @logger.fatal(\"http method not allowd\")\n when 200\n @logger.info(\"plan queued successfully: #{error.to_s}\")\n else\n @logger.warn(\"Unexpected response code: #{response_code}, #{error.to_s}\")\n end \n return false\n end\n \n end",
"def queue(options={})\n# puts 'in queue'\n set_auto_attributes\n upload_if_needed\n\n response = SimpleWorker.service.queue(self.class.name, sw_get_data, options)\n# puts 'queue response=' + response.inspect\n# @task_set_id = response[\"task_set_id\"]\n @task_id = response[\"task_id\"]\n response\n end",
"def processed!\n Resque::Stat << \"processed\"\n Resque::Stat << \"processed:#{self}\"\n Resque::Stat << \"processed_#{job['queue']}\"\n end",
"def post( event )\n raise CFSM::EventDoesNotHaveExpiry.new(event) if event.expiry.nil?\n\n # Start the wait thread once we have something to wait for.\n start_wait_thread if @wait_thread.nil?\n\n @queue_mutex.synchronize do\n self.push event\n event.instance_exec { set_status(:delayed) }\n end\n CFSM.logger.info \"Pushed delayed event #{event.inspect}\"\n @wait_thread.wakeup if self.length > 0 && self.first == event\n end",
"def requeue\n __requeue__(\"RPUSH\")\n end",
"def queue\n @queue ||= Queue.new\n end"
] |
[
"0.6162002",
"0.5973482",
"0.5795701",
"0.5727709",
"0.5727709",
"0.5720016",
"0.56973886",
"0.56925946",
"0.5675933",
"0.5663017",
"0.5655041",
"0.5655041",
"0.5647108",
"0.56205755",
"0.55645233",
"0.5553462",
"0.5468759",
"0.54303014",
"0.5375386",
"0.53600365",
"0.5342791",
"0.5328292",
"0.5315916",
"0.5302557",
"0.52857804",
"0.52846545",
"0.5280288",
"0.52705425",
"0.5254483",
"0.5201752",
"0.5196677",
"0.5186501",
"0.5184215",
"0.5157067",
"0.51493543",
"0.51397836",
"0.5132527",
"0.5124688",
"0.5118972",
"0.510558",
"0.5084752",
"0.50599897",
"0.50524294",
"0.5042172",
"0.5036258",
"0.50261384",
"0.5013057",
"0.50115883",
"0.50057024",
"0.50049734",
"0.49956343",
"0.49645916",
"0.49644148",
"0.4962255",
"0.49604768",
"0.49579224",
"0.49497998",
"0.4945876",
"0.49422246",
"0.49304384",
"0.49276683",
"0.48926044",
"0.48926044",
"0.48904282",
"0.48886484",
"0.48869765",
"0.48868516",
"0.48823282",
"0.488043",
"0.48796928",
"0.48771617",
"0.4873296",
"0.48725665",
"0.4856713",
"0.48545852",
"0.4850574",
"0.4849487",
"0.48366848",
"0.48366243",
"0.48332092",
"0.4832312",
"0.48295343",
"0.4825361",
"0.48248202",
"0.4821568",
"0.4813941",
"0.48136878",
"0.4812138",
"0.48049662",
"0.4803778",
"0.4795827",
"0.47871426",
"0.47865248",
"0.47787163",
"0.477649",
"0.47727218",
"0.4767287",
"0.47661176",
"0.4758875",
"0.47569838"
] |
0.67357874
|
0
|
desc 'search ', 'searches vimpack.org for scripts'
|
def search(pattern)
Vimpack::Commands::Search.run(self, pattern)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def search; end",
"def search\n\n end",
"def search \n\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search(query); end",
"def search\n\n end",
"def search(*args)\n end",
"def search_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [search | s] <name=> searchs a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [search | s] name=my_animal_name\"\n end",
"def search(*args)\n search_internal([\"SEARCH\"], *args)\n end",
"def search\r\nend",
"def search\nend",
"def search(args)\n raise NotImplementedError, \"Not implemented\"\n end",
"def search\n begin\n words= params[:search][:qw].strip\n @query_info=words\n\n # search in the descriptions\n @videos=VMetadata.search(words, :page => params[:page], :per_page => @@per_page,\n :match_mode => :any, :rank_mode => :proximity_bm25)\n\n respond_to do |format|\n format.html { render 'query/show' }\n end\n rescue ActiveRecord::RecordNotFound\n render(:file => \"#{Rails.root}/public/404.html\",\n :status => \"404 Not Found\")\n end\n end",
"def parse_search(q)\n # TODO continue\n end",
"def search_command\n name = get_param(\"name=\", \"([a-zA-Z]+)\")\n\n if name\n @app.search name\n else\n puts \"Error!: A name is required to search an animal\"\n search_command_help()\n end\n end",
"def parse_search; end",
"def search(target)\n end",
"def search(word)\r\n \r\n end",
"def searchGeoShellDocs( nick, uhost, handle, chan, arg )\n searchSite( nick, uhost, handle, chan, arg, \"docs.geoshell.com\" )\n end",
"def legacy_search(args)\n warn \"WARNING: Calling Technorati#search this way is deprecated.\"\n warn \"WARNING: Please update your code.\"\n\n { 'start' => args } \n end",
"def search_helper *args\n matches = []\n @script_executor.search(*args) { |match|\n matches << match\n }\n matches\nend",
"def search(word)\n \n end",
"def search(query, options = {}); end",
"def search\n\tuser_search = gets.strip.downcase\n\tsearch_input(user_search)\nend",
"def searchtitle\n end",
"def search(search, admin)\n if !search.blank?\n @results = []\n if !search.strip.include? \" \"\n @results = self.search_keyword(search, admin)\n else\n @results = self.search_phrase(search, admin)\n end\n end\n end",
"def searchdescription\n end",
"def scsearch(squery)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/api/?s=#{squery.downcase}\", {'User-Agent' => 'Shell-Storm Ruby API - Search'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tt=[ [ \"Author\", 'Platform', 'Description', 'ID' ] ]\n\t\tres.body.split(\"\\n\").each do |entry|\n\t\t\tshow = entry.split(\"::::\")\n\t\t\tt << [ \"#{show[0]}\", \"#{show[1]}\", \"#{show[2]}\", \"#{show[3]}\" ]\n\t\tend\n\t\ttable = t.to_table(:first_row_is_head => true)\n\t\tputs \"#{HC}#{FGRN}\" + table.to_s + \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend",
"def findorsuggest()\n \n end",
"def search_input(passthrough)\t\t\n\tcase passthrough\n\t\twhen \"mv\"\n\t\t\tputs `man mv`\n\t\twhen \"cp\"\n\t\t\tputs `man cp`\n\t\twhen \"mkdir\"\n\t\t\tputs `man mkdir`\n\t\twhen \"ls\"\n\t\t\tputs `man ls`\n\t\twhen \"rm\"\n\t\t\tputs `man rm`\n\t\telse\t\n\t\t\tputs \"Not a valid search term. Common search terms are: 'mv', 'cp', 'mkdir', 'ls', 'rm'.\"\n\t\tsearch\n\tend\n\tmenu\nend",
"def usage()\n puts \"you can use it wih the following options\"\n puts \"-w <a word> search sentences containing this word\"\n puts \"-i <id> search sentences with this id\"\n puts \"-l <lang> search sentences from this lang (lang is its iso 639 alpha 3 code\"\nend",
"def search_videos(searchterm,params={})\n @opensearch.search_videos(searchterm,params) \n end",
"def search(user, query, collection, wiki)\n end",
"def search_function\n puts \"Please search command line prompts only\"\n puts \"Search:\"\n puts `man #{gets.strip}`\n\nend",
"def search(*args)\n search_provider.search(*args)\n end",
"def search\n unless params[:search].blank?\n @search = Sunspot.search(KyuEntry) do\n fulltext params[:search]\n end\n @kyu = @search.results\n end\n end",
"def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n else\n browse\n end\n end",
"def srch(opts={})\n\t\t\t\tsrch_client.search(opts)\n\t\t\tend",
"def grep_search search_dir\n args = ['-r']\n end",
"def search(params={})\n rpc_call :search, params\n end",
"def search\n begin\n @active_page = \"videos\"\n @search_text = get_unescaped_search_text\n @search_result = Video.search ThinkingSphinx::Query.escape(\"*#{@search_text}*\")\n @success = true\n rescue Exception => e\n @success = false\n log_error(e, \"Error occured in search action of VideosController\")\n end\n end",
"def search_for(host, options = T.unsafe(nil)); end",
"def search(plaintext)\n call(:search, :plaintext => plaintext)[:search_response][:return]\n end",
"def search\n if Config[\"ISEARCH\"]\n incremental_search\n else\n str = getstr('/')\n do_search NEXT, str\n end\n end",
"def searchCode(search,instruction)\n @searchMethods.searchCode(search,instruction)\n end",
"def search(cmd)\n songs = select_songs_with cmd\n\n if songs.empty?\n failure('It matches not even one')\n else\n playlists[:focus] <= songs\n playlists[:search] <= songs\n success(songs: songs, response_type: :songs)\n end\n end",
"def suggest\n end",
"def search_watir\n # data validation\n # if no ARGV, print errormessage and shut the prog\n if ARGV.empty?\n abort(\"Missing input. \\nPlease explict your question.\")\n else\n question = ARGV.join(' ')\n end\n\n # open browser\n browser = Watir::Browser.new:chrome\n\n # equivalence type the address of searching engine\n browser.goto 'google.com'\n\n # equivalence finding the search bar\n search_bar = browser.text_field(class:'gsfi')\n\n # equivalence tying the word\n search_bar.set(question)\n\n # pressing the searching button\n search_bar.send_keys(:enter)\n browser.button(type:\"submit\").click\nend",
"def search_lib(lib)\r\n\tsearch_type = ''\r\n\twhile search_type != 'g'\r\n\t\tputs \"search by [A]uthor, [T]itle, or [I]ndex number, or [G]o back\"\r\n\t\tsearch_type = gets.chomp.downcase[0]\r\n\t\tif search_type == 'a'\r\n\t\t\tputs \"author last name to search?\"\r\n\t\t\tsearch_term = gets.chomp.downcase.split.map(&:capitalize).join(' ')\r\n\t\t\ttest_book = searchby(\"authors.l_name\", search_term, lib)\r\n\t\t\tshow_books(test_book)\r\n\t\telsif search_type == 't'\r\n\t\t\tputs \"title to search?\"\r\n\t\t\tsearch_term = gets.chomp.downcase.split.map(&:capitalize).join(' ')\r\n\t\t\ttest_book = searchby(\"books.title\", search_term, lib)\r\n\t\t\tshow_books(test_book)\r\n\t\telsif search_type == 'i'\r\n\t\t\tputs \"index to search?\"\r\n\t\t\tsearch_term = gets.chomp.downcase\r\n\t\t\ttest_book = searchby(\"books.id\", search_term, lib)\r\n\t\t\tshow_books(test_book)\r\n\t\telsif search_type != 'g'\r\n\t\t\tputs \"did not understand query\"\r\n\t\telse\r\n\t\t\tputs \"***** returning to main menu *****\"\r\n\t\t\tputs \"\"\r\n\t\t\tputs \"\"\r\n\t\tend\r\n\tend\r\nend",
"def searchauthor\n end",
"def search(terms)\n agent = Mechanize.new\n agent.get 'https://eztv.ch'\n search_form = agent.page.form('search')\n search_form.SearchString1 = terms\n search_form.submit\n parse_html(agent.page)\n end",
"def search(word, options)\n session.options = adapt_to_dev_env(options)\n session.get(\"/publications?keyword=#{CGI.escape(word)}\")\n end",
"def url_for_search(term)\n require 'cgi'\n\n 'http://aur.archlinux.org/rpc.php' +\n '?type=search&arg=' + CGI::escape(term)\n end",
"def search\n @config[:search]\n end",
"def production_search\n system(\"clear\")\n puts \"====================================\"\n puts \"What show would you like to explore?\"\n puts \"====================================\"\n puts \"\"\n input = gets.strip\n if input == \"exit\"\n goodbye \n else\n #Creates hash with query results as keys and urls as values\n options = Scraper.new.show_search(input)\n if options.keys.size == 0\n begin\n raise SearchError\n rescue SearchError => error\n puts error.message\n end\n else\n #Displays query results\n options.keys.each.with_index(1) {|option, index| puts \"#{index}) \\t #{option}\"}\n puts \"Which result would you like to explore?\"\n input = gets.strip.to_i\n if input.between?(1,options.keys.size)\n selection = options[options.keys[input - 1]]\n #Scrapes and instantiates production object based on selection.\n show = Scraper.new.production(\"https://www.broadwayworld.com#{selection}\")\n show.print\n else\n puts \"Input error\"\n sleep(1)\n production_search\n end\n end\n continue_prompt\n end\n end",
"def query_param\n return unless search_query\n \"search=#{search_query}&phrase=true\"\n end",
"def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end",
"def search(criteria = {})\r\n \r\n end",
"def interactive_search\n what = input('Series (s), track (t), or quit (q)', nil)\n case what[0]\n when 't'\n interactive_search_track\n when 's'\n interactive_search_series\n else\n exit\n end\n end",
"def search(terms)\n agent = Mechanize.new\n agent.get 'http://kattorrents.me/'\n search_form = agent.page.form_with(id:'searchform')\n search_form.q = terms\n search_form.submit\n parse_html(agent.page)\n end",
"def kitties_search( q )\r\n \"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}\"\r\nend",
"def find(search_string)\n result_array = []\n search_words = search_string.split(/\\s+/)\n\n # Loop over all entries in the index.\n @data.each{ |entry|\n begin\n # Check whether this entry matches the search words.\n score = 0\n search_words.each{ |search_word|\n next if search_word.empty?\n\n s = 2 * AE::LaunchUp::Scorer.score(search_word, entry[:name]) if entry[:name].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:description]) if entry[:description].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:category]) if entry[:category].is_a?(String)\n s += exact_matches(search_word, entry[:keywords].join(\" \"))/(entry[:keywords].length|1).to_f if entry[:keywords].is_a?(Array) && !entry[:keywords].empty?\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:keywords].join(\" \")) if entry[:keywords].is_a?(Array)\n s += exact_matches( search_word.gsub(/\\/|\\\\/, \"\"), entry[:file].gsub(/\\/|\\\\/, \"\") ) if entry[:file].is_a?(String) && search_word.length > 4\n\n # Skip if no match has been found.\n break score = 0.0 if s == 0.0\n score += s\n }\n\n # Tweaks for relevance:\n # Entries with icons match better with users's expectation,\n # urls or \"about\" rather not.\n score *= 3 if entry[:icon].is_a?(String)\n #score *= 0.5 if entry[:name][/about|paypal/i] || entry[:description][/http/]\n\n # Check wether the command is available in the current context. We don't\n # want to reject it completely from the search results, so that the user\n # won't miss it in an explicit search will. We give a hint if it's disabled.\n if entry[:validation_proc]\n status = nil\n begin\n status = entry[:validation_proc].call == MF_ENABLED\n rescue LocalJumpError => e\n # Validation proc contains a \"return\"?\n $stderr.write(\"Validation proc of '#{entry[:name]}' (#{entry[:id]}) contains 'return'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n rescue Exception => e\n # Validation proc contains other bug.\n $stderr.write(\"Error in validation proc of '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/) if $VERBOSE\n end\n entry[:enabled] = status\n score *= 0.5 if status == false\n end\n\n # Skip if no match has been found.\n next if score < 1.0\n\n # Consider tracking data, how often this entry has been selected over others:\n # Divide track by half of average track (total_track/data.length).\n score += [entry[:track] / (@total_track|1).to_f * 0.5 * @data.length, 5].min if entry[:track]\n entry[:score] = score\n\n # Add it to results.\n result_array << entry\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n break\n end\n }\n\n return result_array\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{search_string}'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n return []\n end",
"def search(arg, by: nil)\n\t\t\tr={type: \"search\", arg: arg}\n\t\t\tr[:by]=by if by\n\t\t\t# if :by is not specified, aur defaults to name-desc\n\t\t\tself.query(r)\n\t\tend",
"def perform_search\n terms = { vehicle_year: 2006,\n vehicle_brand: \"Yamaha\",\n vehicle_model: \"Yz250\",\n vehicle_submodel: \"-- Base\",\n category_name: \"Complete Wheel Assembly\" }\n perform_search(terms)\n end",
"def search_results(load: true)\n Pseud.search(body: search_body, load: load)\n end",
"def search(query)\n @search_svc.search query\n end",
"def wildcard_search_version\n 'lower(reference.citation) like ?'\n end",
"def run_search\n agent = Mechanize.new\n agent.get('http://www.indeed.com/')\n fill_out_search_form(agent)\n search_and_create_job_application(agent)\n end",
"def google_search(query, sitelink)\n s = Google::Search::Web.new\n s.query = \"#{query}\" + \" site:#{sitelink}\"\n s.get_response\n end",
"def search(value)\n # YOUR WORK HERE\n end",
"def search\n @search = Sunspot.search(Job) do\n keywords(params[:searchterm])\n end\n end",
"def service\n :search\n end",
"def advsearch\n expose Challenge.advsearch(@oauth_token, params)\n end",
"def search_for(keywords, options = {})\n solr_server.find(keywords, options.merge(:results => PublicEarth::Search::PlaceResults))\n end",
"def rl_display_search(search_string, reverse_p, where)\r\n message = '('\r\n if (reverse_p)\r\n message << \"reverse-\"\r\n end\r\n message << \"i-search)`\"\r\n\r\n if (search_string)\r\n message << search_string\r\n end\r\n message << \"': \"\r\n\r\n rl_message(message)\r\n message = nil\r\n send(@rl_redisplay_function)\r\n end",
"def search(query='*', opts={})\n\n defaults = {\n :search_category => 'all',\n :load_search_page => true\n }\n \n opts = defaults.merge(opts)\n\n if (opts[:load_search_page])\n @request.add('/var/widgets.json?callback=define')\n @request.add('/system/me?_charset_=utf-8')\n @request.add('/var/templates/worlds.2.json?_charset_=utf-8')\n end\n \n case opts[:search_category]\n when 'all'\n @request.add(\"/var/search/general.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&page=0&items=18&_charset_=utf-8&_=1342558141063\",\n {}, { 'subst' => 'true' })\n when 'content'\n @request.add(\"/var/search/pool/all.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&page=0&items=18&_charset_=utf-8&_=1342558155346\",\n {}, { 'subst' => 'true' })\n when 'people'\n @request.add(\"/var/search/users.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&page=0&items=18&_charset_=utf-8&_=1342558158607\",\n {}, { 'subst' => 'true' })\n when 'groups'\n @request.add(\"/var/search/groups.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&category=group&page=0&items=18&_charset_=utf-8&_=1342558161747\",\n {}, { 'subst' => 'true' })\n when 'courses'\n @request.add(\"/var/search/groups.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&category=course&page=0&items=18&_charset_=utf-8&_=1342558164687\",\n {}, { 'subst' => 'true' })\n when 'research_projects'\n @request.add(\"/var/search/groups.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&category=research&page=0&items=18&_charset_=utf-8&_=1342558167607\",\n {}, { 'subst' => 'true' })\n end\n \n if (opts[:load_search_page])\n @request.add('/system/batch?_charset_=utf-8&requests=%5B%7B%22url%22%3A%22%2Fdevwidgets%2Fdisplayprofilesection%2Fdisplayprofilesection.html%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%2C%7B%22url%22%3A%22%2Fdevwidgets%2Fdisplayprofilesection%2Fbundles%2Fdefault.properties%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%5D&_=1324426870134')\n @request.add('/system/batch?_charset_=utf-8&requests=%5B%7B%22url%22%3A%22%2Fdevwidgets%2Fprofilesection%2Fprofilesection.html%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%2C%7B%22url%22%3A%22%2Fdevwidgets%2Fprofilesection%2Fbundles%2Fdefault.properties%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%5D&_=1324426870481')\n end\n \n end",
"def search_by_name\n puts 'Enter a name to search for'\n lookup_name = gets.chomp\n result = @search.name(lookup_name)\n puts \"\\n#{formatted_search_result(result)}\"\n rescue EntryNotFoundError => e\n puts e.message\n end",
"def handle_search(query)\n @results = search query unless query.empty?\n\n prompt_for_selection(query)\nend",
"def search_people(searchterm,params={})\n @opensearch.search_people(searchterm,params) \n end",
"def search_selection\n puts SEARCH\n @query = STDIN.gets.chomp\n\n case @query\n when EXIT_COMMAND\n @loop = false\n when HELP_COMMAND\n show_help\n when FILE_COMMAND\n specify_files_to_search\n else\n system 'clear'\n process_search\n end\n end",
"def search\n send_request\n parse_response\n end",
"def php_search(function, nick = nil)\n require 'php_lookup'\n func = PHPFunctions.find(:first, :conditions => [\"name = ?\", function])\n if func\n self.say \"\\002PHP function:\\002 \\0034#{function}\\0031 \\002URL:\\002 http://www.php.net/#{function}\", nick\n self.say \"\\002Description:\\002 \\0037#{func.description}\", nick\n self.say \"\\002Use:\\002 \\0036#{func.use1}\", nick\n else\n self.say \"#{function}, not found.\"\n end\n end",
"def describe_search_if_present\n if params[:q].present?\n return \"matching “#{h params[:q]}”\".html_safe\n end\n end",
"def search\n expose Challenge.search(@oauth_token, params[:keyword])\n end",
"def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend",
"def search\n\t\t@articles = Article.where(\"text = ?\",params[:q])\n \n #Article.find_by_text(params[:q])\n \n #debug\n @articles.each do |article|\n puts article.title\n end\n \n \n\t\t#@articles = Article.where(:text => params[:q]) ' 1=1 -- '\n\n\t\t#@articles = Article.where(\"text = ?\", params[:q] )\n \n \n #TODO\n # add filter for other fields\n # Article.where(\"text = ? and title = ?\",params[:text],params[:title])\n \n # to add LIKE filter SQL : name like %aa%\n # \"name LIKE ? OR postal_code like ?\", \"%#{search}%\", \"%#{search}%\"\n \n end",
"def test_search\n fortunes = LinuxFortune.search('develop', ['chucknorris'])\n assert fortunes.is_a?(Array)\n assert fortunes.size > 0\n fortunes.each do |fortune|\n assert fortune.is_a?(LinuxFortune::Fortune)\n assert fortune.source.include?('chucknorris')\n end\n end",
"def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end",
"def search_for(search_term)\n type_into TestElements.search_box, search_term\n type_into TestElements.search_box, :return\n end",
"def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end"
] |
[
"0.75002444",
"0.72042704",
"0.71942186",
"0.71886533",
"0.71013886",
"0.71013886",
"0.71013886",
"0.71013886",
"0.71013886",
"0.71013886",
"0.71013886",
"0.71013886",
"0.71013886",
"0.71013886",
"0.70515406",
"0.7035824",
"0.7030495",
"0.6965785",
"0.6927803",
"0.6920154",
"0.6889973",
"0.68587804",
"0.68028957",
"0.67320895",
"0.6691175",
"0.6639966",
"0.66230494",
"0.6605358",
"0.65675706",
"0.65566295",
"0.6535939",
"0.65000147",
"0.64406455",
"0.643223",
"0.64172924",
"0.6413618",
"0.64113986",
"0.6393595",
"0.6387526",
"0.6367928",
"0.6365755",
"0.63571656",
"0.6340464",
"0.63264066",
"0.6324229",
"0.6315449",
"0.63040507",
"0.630193",
"0.6289594",
"0.6277154",
"0.62688947",
"0.6267369",
"0.6261235",
"0.62219906",
"0.6219675",
"0.6210381",
"0.6200269",
"0.6187121",
"0.61655986",
"0.6154658",
"0.61490554",
"0.61305135",
"0.61201817",
"0.6113882",
"0.6113358",
"0.61085826",
"0.61059487",
"0.61001736",
"0.6093862",
"0.609371",
"0.60869354",
"0.6081952",
"0.6077097",
"0.607503",
"0.6066455",
"0.6065856",
"0.60540473",
"0.6041047",
"0.6036668",
"0.6036001",
"0.60316324",
"0.60282344",
"0.6024879",
"0.6019503",
"0.6013688",
"0.60130733",
"0.6010584",
"0.6004195",
"0.6003321",
"0.6003306",
"0.5998906",
"0.59876513",
"0.5977364",
"0.5975247",
"0.597151",
"0.5965923",
"0.5962053",
"0.59582484",
"0.5956939",
"0.59556335"
] |
0.6732958
|
23
|
GET /rank_algorithms GET /rank_algorithms.xml
|
def index
@rank_algorithms = RankAlgorithm.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @rank_algorithms }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @ranking_algorithms = RankingAlgorithm.all.page(params[:page]).per(10)\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end",
"def show\n @rank_algorithm = RankAlgorithm.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def index\n @algorithms = Algorithm.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @algorithms }\n end\n end",
"def index\n @algorithms = Algorithm.all\n end",
"def index\n @ranks = @rank_class.rank_order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ranks }\n end\n end",
"def index\n @algorithms = Algorithm.all\n end",
"def new\n @rank_algorithm = RankAlgorithm.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end",
"def set_ranking_algorithm\n @ranking_algorithm = RankingAlgorithm.find(params[:id])\n end",
"def get_event_rankings ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/rankings\"\n end",
"def search_ranked\n render json: Article.with_ranked_terms(params[:query]).map(&:title)\n end",
"def rank(prog); @ranks[prog]; end",
"def algorithms\n get_info :algorithms\n end",
"def index\n @requirements = apply_scopes(Requirement).paginate(page: params[:page], per_page: 38).order('sortOrder,rank_id ASC')\n @rank = Rank.find(params[:by_rank_id]).name unless params[:by_rank_id].nil?\n end",
"def index\n @comp_ranks = Ranking.get_all_by_player\n end",
"def rank\n fetch('games.league_of_legends.rank')\n end",
"def ranks\n Outpost::Config.instance.ranks\n end",
"def navy_rank; end",
"def index\n @vendedores_ranking = VendedoresRanking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendedores_ranking }\n end\n end",
"def index\n CARDs_RANKS[@face]\n end",
"def compose_fin_ranking_uri( name, surname, gender, length )\n \"#{ FIN_RANKING_URL }?txtnurighe=#{ DEFAULT_FIN_RANKING_RESULTS }\" <<\n \"&txtanno=#{ DEFAULT_FIN_RANKING_SEASON }&txtcat=#{ DEFAULT_FIN_RANKING_CATEGORY }\" <<\n \"txtdalyy=01%2F01%2F1900&txtalyy=#{ Date.today.day }%2F#{ Date.today.month }%2F#{ Date.today.year }\" <<\n \"&txtdallanno=&txtallanno=\" <<\n \"&txtcognome=#{ surname }&txtnome=#{ name }&txtsesso=#{ gender }\" <<\n \"&txtvasca=#{ length }&txtgara=#{ DEFAULT_FIN_RANKING_EVENT }&xricerca=Ricerca\"\n end",
"def index\n \n\t@rankings = User.all(:order => 'entire_stars_count DESC', :conditions => {:fam_id => @user.fam_id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def index\n @ranks = Rank.all\n end",
"def create\n @rank_algorithm = RankAlgorithm.new(params[:rank_algorithm])\n \n respond_to do |format|\n if @rank_algorithm.save\n flash[:notice] = 'RankAlgorithm was successfully created.'\n format.html { redirect_to(@rank_algorithm) }\n format.xml { render :xml => @rank_algorithm, :status => :created, :location => @rank_algorithm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def get_ranks stream\n begin\n user_ids, niceranks = [], {}\n stream.posts.each do |post|\n id = post.user.id\n user_ids << id if @store[id].nil?\n end\n user_ids.uniq!\n got = CNX.get \"#{@url}#{user_ids.join(',')}\" unless user_ids.empty?\n if got.nil? || got == \"\"\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n else\n\n begin\n parsed = JSON.parse(got)\n rescue\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n end\n\n unless parsed['data'].is_a?(Array)\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n end\n\n end\n parsed['data'].each do |obj|\n res = @store[obj['user_id']]\n if res.nil?\n obj['is_human'] ? is_human = 1 : is_human = 0\n content = {\n rank: obj['rank'],\n is_human: is_human\n }\n @store[obj['user_id']] = content\n niceranks[obj['user_id']] = content\n else\n @hits += 1\n niceranks[obj['user_id']] = res\n end\n end\n\n\n @posts += stream.posts.size\n @ids += user_ids.size\n\n if Settings.options.timeline.debug\n deb = \"\\n\"\n deb << \"+ NICERANK\\n\"\n deb << \"* t#{Time.now.to_i}\\n\"\n deb << \"Posts:\\t\\t#{stream.posts.size}\\n\"\n deb << \"Requested NR:\\t#{user_ids.size}\\n\"\n deb << \"* TOTALS\\n\"\n deb << \"Posts:\\t\\t#{@posts}\\n\"\n deb << \"Fetched ranks:\\t#{@ids}\\n\"\n deb << \"DB hits:\\t#{@hits}\\n\"\n deb << \"Uniques:\\t#{@store.count}\\n\"\n deb << \"\\n\"\n puts deb.color(Settings.options.colors.debug)\n Logs.rec.debug \"NICERANK/POSTS: #{@posts}\"\n Logs.rec.debug \"NICERANK/NR CALLS: #{@ids}\"\n Logs.rec.debug \"NICERANK/CACHE HITS: #{@hits}\"\n Logs.rec.debug \"NICERANK/CACHED IDS: #{@store.count}\"\n end\n return niceranks\n rescue => e\n Errors.global_error({error: e, caller: caller, data: [user_ids, niceranks, parsed]})\n end\n end",
"def page_rank\n\n end",
"def negotiate_algorithms; end",
"def list(method, question_id = nil, rank_algorithm_id = nil)\n case method\n when :item\n res = send_pairwise_request(\"items/list/#{question_id.to_i}/#{rank_algorithm_id.to_i}\")\n fetch_xml_attr('items/item', res).zip(fetch_xml_attr('items/item', res, 'rank')) if res\n end\n end",
"def index\n @graduate_school_rankings = GraduateSchoolRanking.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graduate_school_rankings }\n end\n end",
"def base_url\n\t\t\"http://www.quandl.com/api/v1/datasets/WORLDBANK/\"\n\tend",
"def rank; end",
"def rank; end",
"def index\n unless params[:only_id]\n @neural_strategies = NeuralStrategy.find(:all, :limit=>250)\n else\n @neural_strategies = NeuralStrategy.find(:all, :limit=>250)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @neural_strategies }\n end\n end",
"def show\n @rankings = Rankings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def index\n @algorithm_names = AlgorithmName.all\n end",
"def index\n @rankings = Prediction.select(\"user_id, name, sum(score) as score\")\n .joins(:user) \n .group(\"user_id, name\")\n .order(\"score DESC, name ASC\")\n .paginate(page: params[:page])\n end",
"def get_district_rankings ( district_key, year )\n get_api_resource \"#{@@api_base_url}district/#{district_key}/#{year}/rankings\"\n end",
"def show\n @algorithm = Algorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @algorithm }\n end\n end",
"def priorities\n Sifter.\n get(\"/api/priorities\").\n parsed_response[\"priorities\"]\n end",
"def show\n @app = App.find(params[:id])\n \n @rankData = []\n orderType = params[:orderType] || ((@app.platform == \"nate\")? \"1\" : \"POPULARITY\")\n\n @app.ranks.find(:all, :conditions=>{:orderType=>orderType}).each do |r|\n @rankData << [r.created_at.localtime.to_time.to_i*1000, r.rank]\n end\n \n @graphOptions = {\n :series => {\n :lines => { :show => true },\n :points => { :show => true }\n },\n :legend => { :noColumns => 3},\n :xaxis => {\n :mode => \"time\",\n :tickSize => [1, \"day\"],\n :timeformat => \"%y/%m/%d\"\n },\n :grid => { \n :hoverable => \"true\",\n :clickable => \"true\"\n },\n :selection => { :mode => \"x\" }\n }\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end",
"def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end",
"def index\n @user_ranks = UserRanks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_ranks }\n end\n end",
"def genre_ranking\n ranked_albums = SortCollection.sort_albums('genre')\n render json: ranked_albums.sort_by(&:last).reverse.to_h, status: 200\n end",
"def destroy\n @rank_algorithm = RankAlgorithm.find(params[:id])\n @rank_algorithm.destroy\n \n respond_to do |format|\n format.html { redirect_to(rank_algorithms_url) }\n format.xml { head :ok }\n end\n end",
"def index\n @ranks = Rank.includes(:users).order('power asc').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def generate_rank_values\n\t\tlist = \"<select name=\\\"rank\\\">\"\n\t\tfor i in 1..100\n\t\t\tlist += \"<option value=\\\"#{i}\\\">#{i}</option>\"\n\t\tend\n\t\tlist += \"</select>\"\n\tend",
"def year_ranking\n ranked_albums = SortCollection.sort_albums('year')\n render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @evaluators }\n end\n end",
"def index\n @item_rankings = ItemRanking.all\n end",
"def army_rank; end",
"def index\n @grupos = Grupo.find(:all).sort_by {|p| p.asignatura.curso.codigo }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @grupos }\n end\n end",
"def run\n\n #@experiment = Hash.from_xml( xml )['request']\n \n #non_coherent_nodes = get_non_coherent_nodes(@functionalities)\n #if non_coherent_nodes.empty?\n # print xml#return xml\n #end\n #n1 = non_coherent_nodes.second\n\n #print @functionalities.size\n #print \"\\n\\n\"\n #array = n1[:missing]==\"child\" ? possible_children(n1[:element], @functionalities) : possible_parents(n1[:element], @functionalities)\n #array.each do |k|\n # print \"\\n#{k[:parent][\"id\"]} -> #{k[:child][\"id\"]} \\n\\n\"\n #end\n #@functionalities = Hash.from_xml( xml )['request']['functionalities']['functionality']\n print(params[:sla].inspect)\n @functionalities = Hash.from_xml(params[:sla])['functionalities']['functionality'].to_a\n print @functionalities.inspect\n @new_functionalities = concepts_similarity_algorithm( @functionalities )\n \n render 'show_functionalities.xml.erb', :layout => false\n \nend",
"def index\n @nodes = Node.find(:all, :conditions => [\"nodes.name != ''\"], :select => \"nodes.*, SUM(scores.score) AS score \",\n :joins => :scores, :group => 'nodes.id', :order => 'SUM(scores.score) DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n #format.xml { render :xml => @nodes }\n end\n end",
"def index\n @ped_strategies = PedStrategy.order(\"hierarchy\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_strategies }\n end\n end",
"def print_reindeer_ranking\n puts @reindeer_ranking\n end",
"def rank_avg()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rank_Avg::RankAvgRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end",
"def ranking_params\n params[:ranking]\n end",
"def update\n @rank_algorithm = RankAlgorithm.find(params[:id])\n \n respond_to do |format|\n if @rank_algorithm.update_attributes(params[:rank_algorithm])\n flash[:notice] = 'RankAlgorithm was successfully updated.'\n format.html { redirect_to(@rank_algorithm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_reindeer_ranking\n return @reindeer_ranking\n end",
"def sogou_rank(wd)\n\tpage = Query::Engine::Sogou.query(wd)\n\tranks = page.seo_ranks\n\n\tranks.each do |rank|\n\t\tif rank[:text].include? \"艺龙\"\n\t\t\tputs \"艺龙搜索结果在搜狗中排名第#{rank[:rank]}\"\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def index\n @rankins = Rankin.all\n end",
"def index\n @rebalancegroup = Rebalancegroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rebalancegroups }\n format.xml {rendder xml: @rebalancegroups}\n end\n end",
"def index\n @crunch_algorithms = CrunchAlgorithm.all\n end",
"def index\n @featured_prank = Prank.featured_prank\n @featured_tags = @featured_prank.tag_counts\n @popular_pranks = Prank.popular_pranks\n tag_cloud\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pranks }\n end\n end",
"def index\n @users = User.all\n @users = User.order(\"rank ASC\").paginate(page: params[:page], :per_page => 20)\n end",
"def recommendations(url,num=5)\n url = url_host_path(url)\n uid = REDIS[\"id:#{url}\"]\n results = REDIS.zrevrangebyscore(\"recos:#{uid}\", '+inf', '-inf', {:withscores => true} )\n \n recos = results[0...num].map do |x| uid,score = x[0],x[1]\n { :title=>REDIS[\"title:#{uid}\"], :url=>REDIS[\"url:#{uid}\"], :score=>score }\n end\n \n return recos\nend",
"def index\n @pitcher_list_rankings = get_rankings\n @pitcher_list_rankings_stub = []\n end",
"def percent_rank_inc()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::PercentRank_Inc::PercentRankIncRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @strategies = Strategy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @strategies }\n end\n end",
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",
"def index\n @event_rankings = EventRanking.all\n end",
"def index\n @nodes = @job.nodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n format.json { render :json => @nodes }\n end\n end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def rank\n @data['rank']\n end",
"def negotiate(algorithm); end",
"def index\n @operations_centers = if params[:neighborhood_id]\n Neighborhood.find(params[:neighborhood_id]).operations_centers.alphabetical\n else\n OperationsCenter.alphabetical\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations_centers }\n end\n end",
"def index\n iterations = policy_scope(Iteration)\n render json: iterations\n end",
"def show\n @rank = Rank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rank }\n end\n end",
"def get_xml(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'n',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group'\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\t\t\t\n\t\t\tputs full_query if options[:debug]\n\t\t\t\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\t\t\t\t\t\n\t\t\tdoc = Hpricot.XML(response)\n\t\t\terrors = doc.search(\"*[@errCode]\")\n\t\t\tif errors.size > 0\nbegin\n\t\t\t\terrors.each do |error|\n\t\t\t\t\traise Wowr::Exceptions::raise_me(error[:errCode], options)\n\t\t\t\tend\nrescue\nend\n\t\t\telsif (doc%'page').nil?\n\t\t\t\traise Wowr::Exceptions::EmptyPage\n\t\t\telse\n\t\t\t\treturn (doc%'page')\n\t\t\tend\n\t\tend",
"def index\n @group = @authorized_group\n @candidates = @group.candidates\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @candidates }\n end\n end",
"def cinii_nrid_search( nrid, opts = {} )\n q = URI.escape( nrid )\n base_uri = \"http://ci.nii.ac.jp/opensearch/nrid/\"\n cont = nil\n cache_file = cache_xml( \"cinii_nrid\", q, opts[:start] )\n #p File.mtime( cache_file )\n if File.exist?( cache_file ) and ( Time.now - File.mtime( cache_file ) ) < CACHE_TIME\n cont = open( cache_file ){|io| io.read }\n else\n opts[ :format ] = \"atom\"\n # opts[ :sortorder ] ||= 3\n opts_s = opts.make_uri_params\n opensearch_uri = URI.parse( \"#{ base_uri }#{ q }?appid=#{ CINII_APPID }&#{ opts_s }\" )\n response = http_get( opensearch_uri )\n cont = response.body\n open( cache_file, \"w\" ){|io| io.print cont }\n end\n data = {}\n parser = LibXML::XML::Parser.string( cont )\n doc = parser.parse\n # ref. http://ci.nii.ac.jp/info/ja/if_opensearch_auth.html\n data[ :q ] = nrid\n data[ :link ] = doc.find( \"//atom:id\", \"atom:http://www.w3.org/2005/Atom\" )[0].content.gsub( /&(format=atom|appid=#{ CINII_APPID })\\b/, \"\" )\n data[ :totalResults ] = doc.find( \"//opensearch:totalResults\" )[0].content.to_i\n entries = doc.find( \"//atom:entry\", \"atom:http://www.w3.org/2005/Atom\" )\n data[ :entries ] = []\n entries.each do |e|\n title = e.find( \"./atom:title\", \"atom:http://www.w3.org/2005/Atom\" )[0].content\n url = e.find( \"./atom:id\", \"atom:http://www.w3.org/2005/Atom\" )[0].content\n author = e.find( \".//atom:author/atom:name\", \"atom:http://www.w3.org/2005/Atom\" ).to_a.map{|name| name.content }.join( \"; \" )\n pubname = e.find( \"./prism:publicationName\", \"prism:http://prismstandard.org/namespaces/basic/2.0/\" )[0]\n if pubname.nil?\n pubname = e.find( \"./dc:publisher\", \"dc:http://purl.org/dc/elements/1.1/\" )[0]\n pubname = pubname.content if pubname\n else\n pubname = pubname.content\n end\n pubdate = e.find( \"./prism:publicationDate\", \"prism:http://prismstandard.org/namespaces/basic/2.0/\" )[0] #.content\n pubdate = pubdate.nil? ? \"\" : pubdate.content\n description = e.find( \"./atom:content\", \"atom:http://www.w3.org/2005/Atom\" )[0]\n description = description.nil? ? \"\" : description.content\n data[ :entries ] << {\n :title => title,\n :url => url,\n :author => author,\n :publicationName => pubname,\n :publicationDate => pubdate,\n :description => description,\n }\n end\n data\n end",
"def index\n @gigs = Gig.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gigs, callback: params[:callback] }\n format.xml { render xml: @gigs }\n end\n end",
"def index\n @jido_grp_rels = JidoGrpRel.find(:all)\n if params[:sort]==\"grp\"\n @jido_grp_rels = JidoGrpRel.find(:all, :order => :group_id )\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_grp_rels }\n end\n end",
"def oldrank(prog); @oldranks[prog]; end",
"def nodes\n request.get(path: node_index_path, auth_token: auth_token)\n end",
"def initial_ranks\n raise NotImplementedError\n end",
"def show\n @ranking = Ranking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ranking }\n end\n end",
"def index\n users = User.all.select(:id, :username, :guild_id).with_otp\n @result = users.map{|user| user.as_json.merge({\n guild_name: user.guild ? user.guild.name : \"Not in a guild\",\n score: Match.where(challenged: false, winner: user.id).size,\n my_user: (user == current_user),\n route: '#users/' + user.id.to_s\n })}\n @result.sort_by! { |res| -res[:score] }\n @result = @result.map { |i| i.merge({ rank: @result.find_index{ |user| user[\"id\"] == i[\"id\"] }.to_i + 1 }) }\n render json: @result.as_json, status: :ok\n end",
"def calculate_page_rank(iterations=20)\n # zero everyone's page rank out\n Url.update_all(\"page_rank = 1.0\")\n\n iterations.times do |i|\n puts \"Iteration #{i}\"\n Url.find(:all).each do |url|\n pr = 0.15\n \n # loop through all the pages that link to this one\n Link.find(:all,\n :select => \"DISTINCT from_id\",\n :conditions => { :to_id => url.id }) do |link|\n from_id = link.from_id\n # get the page rank of the linker\n linking_pr = Url.find_by_id(from_id).page_rank\n \n # get the total number of links from the linker\n linking_count = Link.count(:conditions => { :from_id => from_id })\n\n pr += 0.85 * (linking_pr / linking_count)\n end\n\n Url.update_all([\"page_rank = ?\", pr], [\"id = ?\", url.id])\n end\n end\n end",
"def index\n @compares = current_user.compares\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @compares }\n end\n end",
"def index\n @predicitions = Predicition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @predicitions }\n end\n end"
] |
[
"0.68819183",
"0.6572817",
"0.63816816",
"0.62393034",
"0.5785932",
"0.57728744",
"0.5680099",
"0.5634229",
"0.5599976",
"0.5534475",
"0.55243635",
"0.5498352",
"0.5486594",
"0.5484028",
"0.54786384",
"0.5461728",
"0.5411162",
"0.54070324",
"0.53442574",
"0.5340064",
"0.53359956",
"0.52590704",
"0.5242517",
"0.5218088",
"0.520332",
"0.5188823",
"0.51687413",
"0.51644075",
"0.5145497",
"0.51268286",
"0.5117148",
"0.50942254",
"0.5079297",
"0.5079297",
"0.5076822",
"0.507096",
"0.50537974",
"0.50448275",
"0.50432944",
"0.50412506",
"0.50215816",
"0.5016905",
"0.50163853",
"0.50161415",
"0.50121576",
"0.5008349",
"0.49861002",
"0.49647793",
"0.49505147",
"0.491237",
"0.490381",
"0.4874514",
"0.48705196",
"0.48506758",
"0.48500407",
"0.48492223",
"0.48412892",
"0.48209944",
"0.4820851",
"0.48203343",
"0.48137873",
"0.47982177",
"0.47929087",
"0.47927895",
"0.47920147",
"0.47918123",
"0.47890222",
"0.4779347",
"0.4779043",
"0.47789207",
"0.47650653",
"0.47543555",
"0.47543555",
"0.4751025",
"0.47500452",
"0.47480562",
"0.47453114",
"0.47450447",
"0.47450447",
"0.47450447",
"0.47450447",
"0.47450447",
"0.47386482",
"0.4736409",
"0.47357905",
"0.4732099",
"0.4728855",
"0.47258437",
"0.47225788",
"0.47207654",
"0.4720341",
"0.47181666",
"0.47143826",
"0.47141078",
"0.47095892",
"0.47079203",
"0.47017232",
"0.4697729",
"0.46955448",
"0.469445"
] |
0.72858334
|
0
|
GET /rank_algorithms/1 GET /rank_algorithms/1.xml
|
def show
@rank_algorithm = RankAlgorithm.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @rank_algorithm }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @rank_algorithms = RankAlgorithm.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rank_algorithms }\n end\n end",
"def index\n @ranking_algorithms = RankingAlgorithm.all.page(params[:page]).per(10)\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end",
"def index\n @algorithms = Algorithm.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @algorithms }\n end\n end",
"def new\n @rank_algorithm = RankAlgorithm.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def index\n @ranks = @rank_class.rank_order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ranks }\n end\n end",
"def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end",
"def index\n @vendedores_ranking = VendedoresRanking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendedores_ranking }\n end\n end",
"def set_ranking_algorithm\n @ranking_algorithm = RankingAlgorithm.find(params[:id])\n end",
"def index\n @algorithms = Algorithm.all\n end",
"def create\n @rank_algorithm = RankAlgorithm.new(params[:rank_algorithm])\n \n respond_to do |format|\n if @rank_algorithm.save\n flash[:notice] = 'RankAlgorithm was successfully created.'\n format.html { redirect_to(@rank_algorithm) }\n format.xml { render :xml => @rank_algorithm, :status => :created, :location => @rank_algorithm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @requirements = apply_scopes(Requirement).paginate(page: params[:page], per_page: 38).order('sortOrder,rank_id ASC')\n @rank = Rank.find(params[:by_rank_id]).name unless params[:by_rank_id].nil?\n end",
"def show\n @rankings = Rankings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def compose_fin_ranking_uri( name, surname, gender, length )\n \"#{ FIN_RANKING_URL }?txtnurighe=#{ DEFAULT_FIN_RANKING_RESULTS }\" <<\n \"&txtanno=#{ DEFAULT_FIN_RANKING_SEASON }&txtcat=#{ DEFAULT_FIN_RANKING_CATEGORY }\" <<\n \"txtdalyy=01%2F01%2F1900&txtalyy=#{ Date.today.day }%2F#{ Date.today.month }%2F#{ Date.today.year }\" <<\n \"&txtdallanno=&txtallanno=\" <<\n \"&txtcognome=#{ surname }&txtnome=#{ name }&txtsesso=#{ gender }\" <<\n \"&txtvasca=#{ length }&txtgara=#{ DEFAULT_FIN_RANKING_EVENT }&xricerca=Ricerca\"\n end",
"def rank(prog); @ranks[prog]; end",
"def index\n @algorithms = Algorithm.all\n end",
"def show\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def index\n \n\t@rankings = User.all(:order => 'entire_stars_count DESC', :conditions => {:fam_id => @user.fam_id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def index\n unless params[:only_id]\n @neural_strategies = NeuralStrategy.find(:all, :limit=>250)\n else\n @neural_strategies = NeuralStrategy.find(:all, :limit=>250)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @neural_strategies }\n end\n end",
"def search_ranked\n render json: Article.with_ranked_terms(params[:query]).map(&:title)\n end",
"def index\n @comp_ranks = Ranking.get_all_by_player\n end",
"def index\n @graduate_school_rankings = GraduateSchoolRanking.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graduate_school_rankings }\n end\n end",
"def index\n @ranks = Rank.all\n end",
"def get_event_rankings ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/rankings\"\n end",
"def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end",
"def run\n\n #@experiment = Hash.from_xml( xml )['request']\n \n #non_coherent_nodes = get_non_coherent_nodes(@functionalities)\n #if non_coherent_nodes.empty?\n # print xml#return xml\n #end\n #n1 = non_coherent_nodes.second\n\n #print @functionalities.size\n #print \"\\n\\n\"\n #array = n1[:missing]==\"child\" ? possible_children(n1[:element], @functionalities) : possible_parents(n1[:element], @functionalities)\n #array.each do |k|\n # print \"\\n#{k[:parent][\"id\"]} -> #{k[:child][\"id\"]} \\n\\n\"\n #end\n #@functionalities = Hash.from_xml( xml )['request']['functionalities']['functionality']\n print(params[:sla].inspect)\n @functionalities = Hash.from_xml(params[:sla])['functionalities']['functionality'].to_a\n print @functionalities.inspect\n @new_functionalities = concepts_similarity_algorithm( @functionalities )\n \n render 'show_functionalities.xml.erb', :layout => false\n \nend",
"def base_url\n\t\t\"http://www.quandl.com/api/v1/datasets/WORLDBANK/\"\n\tend",
"def destroy\n @rank_algorithm = RankAlgorithm.find(params[:id])\n @rank_algorithm.destroy\n \n respond_to do |format|\n format.html { redirect_to(rank_algorithms_url) }\n format.xml { head :ok }\n end\n end",
"def list(method, question_id = nil, rank_algorithm_id = nil)\n case method\n when :item\n res = send_pairwise_request(\"items/list/#{question_id.to_i}/#{rank_algorithm_id.to_i}\")\n fetch_xml_attr('items/item', res).zip(fetch_xml_attr('items/item', res, 'rank')) if res\n end\n end",
"def navy_rank; end",
"def rank\n fetch('games.league_of_legends.rank')\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @evaluators }\n end\n end",
"def get_ranks stream\n begin\n user_ids, niceranks = [], {}\n stream.posts.each do |post|\n id = post.user.id\n user_ids << id if @store[id].nil?\n end\n user_ids.uniq!\n got = CNX.get \"#{@url}#{user_ids.join(',')}\" unless user_ids.empty?\n if got.nil? || got == \"\"\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n else\n\n begin\n parsed = JSON.parse(got)\n rescue\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n end\n\n unless parsed['data'].is_a?(Array)\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n end\n\n end\n parsed['data'].each do |obj|\n res = @store[obj['user_id']]\n if res.nil?\n obj['is_human'] ? is_human = 1 : is_human = 0\n content = {\n rank: obj['rank'],\n is_human: is_human\n }\n @store[obj['user_id']] = content\n niceranks[obj['user_id']] = content\n else\n @hits += 1\n niceranks[obj['user_id']] = res\n end\n end\n\n\n @posts += stream.posts.size\n @ids += user_ids.size\n\n if Settings.options.timeline.debug\n deb = \"\\n\"\n deb << \"+ NICERANK\\n\"\n deb << \"* t#{Time.now.to_i}\\n\"\n deb << \"Posts:\\t\\t#{stream.posts.size}\\n\"\n deb << \"Requested NR:\\t#{user_ids.size}\\n\"\n deb << \"* TOTALS\\n\"\n deb << \"Posts:\\t\\t#{@posts}\\n\"\n deb << \"Fetched ranks:\\t#{@ids}\\n\"\n deb << \"DB hits:\\t#{@hits}\\n\"\n deb << \"Uniques:\\t#{@store.count}\\n\"\n deb << \"\\n\"\n puts deb.color(Settings.options.colors.debug)\n Logs.rec.debug \"NICERANK/POSTS: #{@posts}\"\n Logs.rec.debug \"NICERANK/NR CALLS: #{@ids}\"\n Logs.rec.debug \"NICERANK/CACHE HITS: #{@hits}\"\n Logs.rec.debug \"NICERANK/CACHED IDS: #{@store.count}\"\n end\n return niceranks\n rescue => e\n Errors.global_error({error: e, caller: caller, data: [user_ids, niceranks, parsed]})\n end\n end",
"def index\n CARDs_RANKS[@face]\n end",
"def rank; end",
"def rank; end",
"def page_rank\n\n end",
"def show\n @algorithm = Algorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @algorithm }\n end\n end",
"def index\n @rebalancegroup = Rebalancegroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rebalancegroups }\n format.xml {rendder xml: @rebalancegroups}\n end\n end",
"def show\n @app = App.find(params[:id])\n \n @rankData = []\n orderType = params[:orderType] || ((@app.platform == \"nate\")? \"1\" : \"POPULARITY\")\n\n @app.ranks.find(:all, :conditions=>{:orderType=>orderType}).each do |r|\n @rankData << [r.created_at.localtime.to_time.to_i*1000, r.rank]\n end\n \n @graphOptions = {\n :series => {\n :lines => { :show => true },\n :points => { :show => true }\n },\n :legend => { :noColumns => 3},\n :xaxis => {\n :mode => \"time\",\n :tickSize => [1, \"day\"],\n :timeformat => \"%y/%m/%d\"\n },\n :grid => { \n :hoverable => \"true\",\n :clickable => \"true\"\n },\n :selection => { :mode => \"x\" }\n }\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end",
"def ranks\n Outpost::Config.instance.ranks\n end",
"def get_xml(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'n',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group'\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\t\t\t\n\t\t\tputs full_query if options[:debug]\n\t\t\t\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\t\t\t\t\t\n\t\t\tdoc = Hpricot.XML(response)\n\t\t\terrors = doc.search(\"*[@errCode]\")\n\t\t\tif errors.size > 0\nbegin\n\t\t\t\terrors.each do |error|\n\t\t\t\t\traise Wowr::Exceptions::raise_me(error[:errCode], options)\n\t\t\t\tend\nrescue\nend\n\t\t\telsif (doc%'page').nil?\n\t\t\t\traise Wowr::Exceptions::EmptyPage\n\t\t\telse\n\t\t\t\treturn (doc%'page')\n\t\t\tend\n\t\tend",
"def show\n @vendedores_ranking = VendedoresRanking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedores_ranking }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end",
"def update\n @rank_algorithm = RankAlgorithm.find(params[:id])\n \n respond_to do |format|\n if @rank_algorithm.update_attributes(params[:rank_algorithm])\n flash[:notice] = 'RankAlgorithm was successfully updated.'\n format.html { redirect_to(@rank_algorithm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @rank = Rank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rank }\n end\n end",
"def index\n @user_ranks = UserRanks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_ranks }\n end\n end",
"def index\n @node = Fedora.rest('rest/')\n end",
"def index\n @predicitions = Predicition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @predicitions }\n end\n end",
"def show\n @ranking = Ranking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ranking }\n end\n end",
"def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end",
"def index\n @rankings = Prediction.select(\"user_id, name, sum(score) as score\")\n .joins(:user) \n .group(\"user_id, name\")\n .order(\"score DESC, name ASC\")\n .paginate(page: params[:page])\n end",
"def show\n @algorithm_binary = AlgorithmBinary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @algorithm_binary }\n end\n end",
"def index\n @nodes = Node.find(:all, :conditions => [\"nodes.name != ''\"], :select => \"nodes.*, SUM(scores.score) AS score \",\n :joins => :scores, :group => 'nodes.id', :order => 'SUM(scores.score) DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n #format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = @job.nodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n format.json { render :json => @nodes }\n end\n end",
"def print_reindeer_ranking\n puts @reindeer_ranking\n end",
"def index\n @votes = @retort.votes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def rank_eq()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rank_Eq::RankEqRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @item_rankings = ItemRanking.all\n end",
"def algorithms\n get_info :algorithms\n end",
"def rank_avg()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rank_Avg::RankAvgRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get(schema, args = {}, method = nil)\n \n # convert arguments\n method ||= schema\n url = (\"/#{method}?\" << map_args(args))\n\n content = http_get(url)\n doc = REXML::Document.new(content)\n schema_keys = QUERY_SCHEMAS[schema].keys\n\n # if there was an error, raise an exception\n doc.root.elements.each('//error') do |e|\n raise APIError, \"#{e.text}\"\n end\n\n # grab toplevel result info\n result_elem = doc.root.elements['//document/result']\n ret = schema_keys.inject({}) do |elem_vals, key|\n if val = result_elem.elements[key]\n # out_key = key.gsub(/\\//, '_')\n out_val = TYPE_PROCS[QUERY_SCHEMAS[schema][key]].call(val.text)\n elem_vals[key] = out_val\n end\n elem_vals\n end\n\n # grab each result item and toss it in the return array\n ret['items'] = []\n doc.root.elements.each('//document/item') do |e|\n # elements to grab from return XML\n item_hash = schema_keys.inject({}) do |elem_vals, key| \n if val = e.elements[key]\n # out_key = key.gsub(/\\//, '_')\n out_val = TYPE_PROCS[QUERY_SCHEMAS[schema][key]].call(val.text)\n elem_vals[key] = out_val\n end\n elem_vals\n end\n\n ret['items'] << magify_hash(item_hash)\n end\n\n # return results\n magify_hash(ret)\n end",
"def index\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = UtilizationMetricsByNodeGroup\n allparams[:webparams] = params\n results = Search.new(allparams).search\n\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:dasherize => false) }\n end\n end",
"def percent_rank_inc()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::PercentRank_Inc::PercentRankIncRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @kpis = Kpi.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kpis }\n end\n end",
"def index\n @ranks = Rank.includes(:users).order('power asc').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def uri\n @uri ||= URI.parse('https://www.umbrasearch.org/flag_votes.json?flags_by_record=true')\n end",
"def index\n @provider_stats = ProviderStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_stats }\n end\n end",
"def cinii_nrid_search( nrid, opts = {} )\n q = URI.escape( nrid )\n base_uri = \"http://ci.nii.ac.jp/opensearch/nrid/\"\n cont = nil\n cache_file = cache_xml( \"cinii_nrid\", q, opts[:start] )\n #p File.mtime( cache_file )\n if File.exist?( cache_file ) and ( Time.now - File.mtime( cache_file ) ) < CACHE_TIME\n cont = open( cache_file ){|io| io.read }\n else\n opts[ :format ] = \"atom\"\n # opts[ :sortorder ] ||= 3\n opts_s = opts.make_uri_params\n opensearch_uri = URI.parse( \"#{ base_uri }#{ q }?appid=#{ CINII_APPID }&#{ opts_s }\" )\n response = http_get( opensearch_uri )\n cont = response.body\n open( cache_file, \"w\" ){|io| io.print cont }\n end\n data = {}\n parser = LibXML::XML::Parser.string( cont )\n doc = parser.parse\n # ref. http://ci.nii.ac.jp/info/ja/if_opensearch_auth.html\n data[ :q ] = nrid\n data[ :link ] = doc.find( \"//atom:id\", \"atom:http://www.w3.org/2005/Atom\" )[0].content.gsub( /&(format=atom|appid=#{ CINII_APPID })\\b/, \"\" )\n data[ :totalResults ] = doc.find( \"//opensearch:totalResults\" )[0].content.to_i\n entries = doc.find( \"//atom:entry\", \"atom:http://www.w3.org/2005/Atom\" )\n data[ :entries ] = []\n entries.each do |e|\n title = e.find( \"./atom:title\", \"atom:http://www.w3.org/2005/Atom\" )[0].content\n url = e.find( \"./atom:id\", \"atom:http://www.w3.org/2005/Atom\" )[0].content\n author = e.find( \".//atom:author/atom:name\", \"atom:http://www.w3.org/2005/Atom\" ).to_a.map{|name| name.content }.join( \"; \" )\n pubname = e.find( \"./prism:publicationName\", \"prism:http://prismstandard.org/namespaces/basic/2.0/\" )[0]\n if pubname.nil?\n pubname = e.find( \"./dc:publisher\", \"dc:http://purl.org/dc/elements/1.1/\" )[0]\n pubname = pubname.content if pubname\n else\n pubname = pubname.content\n end\n pubdate = e.find( \"./prism:publicationDate\", \"prism:http://prismstandard.org/namespaces/basic/2.0/\" )[0] #.content\n pubdate = pubdate.nil? ? \"\" : pubdate.content\n description = e.find( \"./atom:content\", \"atom:http://www.w3.org/2005/Atom\" )[0]\n description = description.nil? ? \"\" : description.content\n data[ :entries ] << {\n :title => title,\n :url => url,\n :author => author,\n :publicationName => pubname,\n :publicationDate => pubdate,\n :description => description,\n }\n end\n data\n end",
"def index\n if !params[:format]\n @scope = @scope.paginate :page => params[:page] , :order => 'name ASC' if !params[:format]\n\t else\n @scope = @scope.all\n\t end\n\t @occurrences = @scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @occurrences }\n format.kml\n format.csv\n end\n end",
"def show\n @neural_strategy = NeuralStrategy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @neural_strategy }\n end\n end",
"def index\n @rating_plans = RatingPlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rating_plans }\n end\n end",
"def get_repo (repoName='ComputerScience_test')\n puts \"get_repo\"\n set_repository repoName\n puts \"set_repository #{@repository}\"\n result = @repository.query.perform \"select ?s ?p ?o {?s ?p ?o} order by ?s\"\n #puts \"@repository.query.perform #{result}\"\n \n graph = RDF::Graph.new(\"http://ninjalearning.info:8080/repositories/ComputerScience_test\") # TODO: repo name, host, port, ...\n \n result['values'].each do |triple|\n graph << RDF::Statement.new(\n RDF::URI.new(triple[0]),\n RDF::URI.new(triple[1]),\n RDF::URI.new(triple[2]),\n )\n end\n graph\n end",
"def index\n\n @networks = Network.search(params[:network], { :order => \"created_at DESC\"})\n @pages = @networks.paginate :page => params[:page], :per_page => 5\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @networks }\n end\n end",
"def index\n @grupos = Grupo.find(:all).sort_by {|p| p.asignatura.curso.codigo }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @grupos }\n end\n end",
"def recommendations(url,num=5)\n url = url_host_path(url)\n uid = REDIS[\"id:#{url}\"]\n results = REDIS.zrevrangebyscore(\"recos:#{uid}\", '+inf', '-inf', {:withscores => true} )\n \n recos = results[0...num].map do |x| uid,score = x[0],x[1]\n { :title=>REDIS[\"title:#{uid}\"], :url=>REDIS[\"url:#{uid}\"], :score=>score }\n end\n \n return recos\nend",
"def index\n @clusters = Cluster.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clusters }\n end\n end",
"def index\n @group = @authorized_group\n @candidates = @group.candidates\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @candidates }\n end\n end",
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",
"def index\n @criterions = Criterion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criterions }\n end\n end",
"def generate_rank_values\n\t\tlist = \"<select name=\\\"rank\\\">\"\n\t\tfor i in 1..100\n\t\t\tlist += \"<option value=\\\"#{i}\\\">#{i}</option>\"\n\t\tend\n\t\tlist += \"</select>\"\n\tend",
"def index\n @gigs = Gig.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gigs, callback: params[:callback] }\n format.xml { render xml: @gigs }\n end\n end",
"def get_district_rankings ( district_key, year )\n get_api_resource \"#{@@api_base_url}district/#{district_key}/#{year}/rankings\"\n end",
"def index\n @featured_prank = Prank.featured_prank\n @featured_tags = @featured_prank.tag_counts\n @popular_pranks = Prank.popular_pranks\n tag_cloud\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pranks }\n end\n end",
"def index\n @compares = @chapter.compares\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @compares }\n end\n end",
"def index\n @jido_grp_rels = JidoGrpRel.find(:all)\n if params[:sort]==\"grp\"\n @jido_grp_rels = JidoGrpRel.find(:all, :order => :group_id )\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_grp_rels }\n end\n end",
"def get(id: nil, name: nil, rank: nil, extinct: nil)\n response = @conn.get do |req|\n req.url 'col/webservice?'\n req.params['format'] = @format.to_s\n req.params['response'] = 'full'\n req.params['id'] = id if id\n req.params['name'] = name if name\n req.params['rank'] = rank if rank\n req.params['extinct'] = extinct if extinct\n end\n response.body['results']\n end",
"def genre_ranking\n ranked_albums = SortCollection.sort_albums('genre')\n render json: ranked_albums.sort_by(&:last).reverse.to_h, status: 200\n end",
"def index\n @neural_populations = NeuralPopulation.find(:all, :limit=>250)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @neural_populations }\n end\n end",
"def add_ranked_query_result\n \n @query_result = Retreval::RankedQueryResult.new :query => \"query1\", :gold_standard => @gold_standard\n \n @query_result.add_document :id => \"doc1\"\n @query_result.add_document :id => \"doc2\"\n @query_result.add_document :id => \"doc5\"\n @query_result.add_document :id => \"doc3\"\n @query_result.add_document :id => \"doc6\"\n @query_result.add_document :id => \"doc4\"\n @query_result.add_document :id => \"doc7\"\n @query_result.add_document :id => \"doc8\"\n @query_result.add_document :id => \"doc9\"\n @query_result.add_document :id => \"doc10\"\n \n end",
"def index\n @init_url = \"https://crest-tq.eveonline.com/market/\" +\n \"10000002\" +\n \"/orders/\"+ \"sell\" + \"/?type=https://crest-tq.eveonline.com/types/\" +\n \"34\" +\n \"/\"\n end",
"def show\n @graduate_school_ranking = GraduateSchoolRanking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @graduate_school_ranking }\n end\n end",
"def ranking_params\n params[:ranking]\n end",
"def get_results\n begin\n results = Nokogiri::XML(open(URI.encode(@request.full)))\n rescue SystemCallError, EOFError\n retry\n end\n # puts results\n parse results, :query => @request.q\n end",
"def index\n @compares = current_user.compares\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @compares }\n end\n end",
"def create\n @ranking_algorithm = RankingAlgorithm.new(ranking_algorithm_params)\n\n respond_to do |format|\n if @ranking_algorithm.save\n format.html { redirect_to @ranking_algorithm, notice: 'Алгоритм успешно создан' }\n format.json { render :show, status: :created, location: @ranking_algorithm }\n else\n format.html { render :new }\n format.json { render json: @ranking_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def army_rank; end",
"def index\n @nodes = Node.all\n @title = \"List of taxonomy nodes - Browse organisms\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end"
] |
[
"0.7299873",
"0.6599532",
"0.649089",
"0.6257379",
"0.59772134",
"0.5957035",
"0.5539556",
"0.55345994",
"0.55237025",
"0.5482007",
"0.54712814",
"0.54339933",
"0.54301435",
"0.5414407",
"0.53884244",
"0.53690124",
"0.5300097",
"0.5289254",
"0.5289097",
"0.52772546",
"0.52572566",
"0.5251844",
"0.5248509",
"0.5240745",
"0.52371025",
"0.5236364",
"0.51881576",
"0.51764077",
"0.51625514",
"0.51513386",
"0.5148104",
"0.5137249",
"0.51291376",
"0.5104743",
"0.50909936",
"0.50909936",
"0.50741905",
"0.50650495",
"0.50640017",
"0.5059605",
"0.50470954",
"0.50361365",
"0.5027197",
"0.50232905",
"0.50232905",
"0.5018303",
"0.5012934",
"0.5009799",
"0.49950144",
"0.4986146",
"0.49738213",
"0.49300468",
"0.49190232",
"0.49185047",
"0.49177513",
"0.49107802",
"0.4909772",
"0.48974165",
"0.48813418",
"0.48783046",
"0.48744628",
"0.48694003",
"0.4867117",
"0.4858302",
"0.48580307",
"0.485622",
"0.48428097",
"0.48425522",
"0.48369938",
"0.48354962",
"0.4833299",
"0.4832015",
"0.48245186",
"0.48227888",
"0.48149067",
"0.4813084",
"0.4812265",
"0.48087674",
"0.48012102",
"0.4799472",
"0.47943634",
"0.47931448",
"0.4791088",
"0.47876337",
"0.4779427",
"0.47777086",
"0.4775945",
"0.47759297",
"0.47733676",
"0.4772812",
"0.47726166",
"0.4771575",
"0.47711033",
"0.4769932",
"0.47693795",
"0.47684306",
"0.4763919",
"0.4763727",
"0.47621596",
"0.47582862"
] |
0.66421396
|
1
|
GET /rank_algorithms/new GET /rank_algorithms/new.xml
|
def new
@rank_algorithm = RankAlgorithm.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @rank_algorithm }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @rank_algorithms = RankAlgorithm.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rank_algorithms }\n end\n end",
"def create\n @rank_algorithm = RankAlgorithm.new(params[:rank_algorithm])\n \n respond_to do |format|\n if @rank_algorithm.save\n flash[:notice] = 'RankAlgorithm was successfully created.'\n format.html { redirect_to(@rank_algorithm) }\n format.xml { render :xml => @rank_algorithm, :status => :created, :location => @rank_algorithm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @algorithm = Algorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @algorithm }\n end\n end",
"def new\n @rankings = Rankings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def new\n @rank = @rank_class.new(params[:rank])\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rank }\n end\n end",
"def new\n @scraping_algorithm = ScrapingAlgorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def new\n @algorithm = Algorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @algorithm }\n end\n end",
"def new\n @rank = Rank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rank }\n end\n end",
"def show\n @rank_algorithm = RankAlgorithm.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def create\n @ranking_algorithm = RankingAlgorithm.new(ranking_algorithm_params)\n\n respond_to do |format|\n if @ranking_algorithm.save\n format.html { redirect_to @ranking_algorithm, notice: 'Алгоритм успешно создан' }\n format.json { render :show, status: :created, location: @ranking_algorithm }\n else\n format.html { render :new }\n format.json { render json: @ranking_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ranking = Ranking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ranking }\n end\n end",
"def new\n @vendedores_ranking = VendedoresRanking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedores_ranking }\n end\n end",
"def index\n @algorithms = Algorithm.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @algorithms }\n end\n end",
"def new\n @algorithm_comparison_join = AlgorithmComparisonJoin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @algorithm_comparison_join }\n end\n end",
"def index\n @ranking_algorithms = RankingAlgorithm.all.page(params[:page]).per(10)\n end",
"def create\n @algorithm = current_user.algorithms.new(params[:algorithm])\n\n respond_to do |format|\n if @algorithm.save\n flash[:notice] = 'Algorithm was successfully created.'\n format.html { redirect_to(@algorithm) }\n format.xml { render :xml => @algorithm, :status => :created, :location => @algorithm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @algorithm_binary = AlgorithmBinary.new\n @algorithm_binary.algorithm = @algorithm\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @algorithm_binary }\n end\n end",
"def create\n @rank = @rank_class.new(params[:rank])\n\n respond_to do |format|\n if @rank.save\n format.html { redirect_to(send(\"#{@rank_path}s_path\"), :notice => 'Rank was successfully created.') }\n format.xml { render :xml => @rank, :status => :created, :location => @rank }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rank.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @ranking = Ranking.new\n end",
"def new\n @national_rank = NationalRank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @national_rank }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @cluster = Cluster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cluster }\n end\n end",
"def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end",
"def create\n\t\t\n\t\t@score = params[:score].to_i.round\n\t\t@namespace = Nuniverse.find_by_unique_name(params[:namespace])\n\t\t@ranking = Ranking.find_or_create(:user_id => current_user.id, :score => @score, :rankable_id => @namespace.id, :rankable_type => @namespace.class.to_s)\n\t\t\n respond_to do |format|\n if @ranking.save\n flash[:notice] = 'Rankings was successfully created.'\n format.html { redirect_to(@ranking) }\n\t\t\t\tformat.js\t\t{ }\n\t\t\t\tformat.json { \n\t\t\t\t\tsc = @namespace.total_score\n\t\t\t\t\trender :json => {'user' => current_user.login,'color' => @ranking.color, 'score' => sc, 'score_label' => Ranking.label(@namespace.score),'vote' => @ranking, 'stats' => @namespace.stats}\n\t\t\t\t}\n format.xml { render :xml => @ranking, :status => :created, :location => @ranking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ranking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @prediction = Prediction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prediction }\n end\n end",
"def new\n @title = \"New Networks\"\n @network = Network.new\n @computers = Computer.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network }\n end\n end",
"def new\n @scoring_method = ScoringMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_method }\n end\n end",
"def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end",
"def new\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end",
"def index\n @ranks = @rank_class.rank_order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ranks }\n end\n end",
"def new\n @sortie = Sortie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sortie }\n end\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end",
"def new\n @user_rank = UserRanks.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_rank }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @predicition = Predicition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @predicition }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @positioncoefficient = Positioncoefficient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def new\n\t @rank = Rank.new\n end",
"def new\n @rcrieval = Rcrieval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rcrieval }\n end\n end",
"def new\n @retain_node_selector = RetainNodeSelector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node_selector }\n end\n end",
"def new\n @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end",
"def create\n @scraping_algorithm = ScrapingAlgorithm.new(params[:scraping_algorithm])\n\n respond_to do |format|\n if @scraping_algorithm.save\n format.html { redirect_to @scraping_algorithm, notice: 'Scraping algorithm was successfully created.' }\n format.json { render json: @scraping_algorithm, status: :created, location: @scraping_algorithm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scraping_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @prank = Prank.new\n @prank.tools = ['']\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @node_index = NodeIndex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_index }\n end\n end",
"def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end",
"def create\n @algorithm = Algorithm.new(params[:algorithm])\n\n respond_to do |format|\n if @algorithm.save\n format.html { redirect_to @algorithm, notice: 'Algorithm was successfully created.' }\n format.json { render json: @algorithm, status: :created, location: @algorithm }\n else\n format.html { render action: 'new' }\n format.json { render json: @algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @risk_probability = RiskProbability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @risk_probability }\n end\n end",
"def new\n @protocol = Protocol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocol }\n end\n end",
"def new\n @intelligence = Intelligence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @intelligence }\n end\n end",
"def create\n @rank = Rank.new(rank_params)\n\n respond_to do |format|\n if @rank.save\n format.html { redirect_to @rank, notice: 'Звание было успешно создано.' }\n format.json { render :show, status: :created, location: @rank }\n else\n format.html { render :new }\n format.json { render json: @rank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @network_model = NetworkModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network_model }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def new\n @evaluacione = Evaluacione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evaluacione }\n end\n end",
"def create\n @rank = Rank.new(rank_params)\n\n respond_to do |format|\n if @rank.save\n format.html { redirect_to @rank, :notice => 'Rank was successfully created.' }\n format.json { render :json => @rank, :status => :created, :location => @rank }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rank.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end",
"def new\n @namespace = Namespace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @namespace }\n end\n end",
"def new\n @lookup_demographichandedness = LookupDemographichandedness.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_demographichandedness }\n end\n end",
"def new\n @rig = Rig.new\n @main_header = \"New Rig\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rig }\n end\n end",
"def new_rest\n @answer_localized = AnswerLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @answer_localized }\n end\n end",
"def new\n @v_netweight = VNetweight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @v_netweight }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new\n @weight_percentile = WeightPercentile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight_percentile }\n end\n end",
"def new\n @guess = Guess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @guess }\n end\n end",
"def new\n @ocs_rating_factor = OcsRatingFactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ocs_rating_factor }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @scrape_order = ScrapeOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrape_order }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end",
"def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end",
"def index\n @newnodes = Newnode.all\n end",
"def index\n @vendedores_ranking = VendedoresRanking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendedores_ranking }\n end\n end",
"def new\n @abstractnmap = Abstractnmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abstractnmap }\n end\n end",
"def compose_fin_ranking_uri( name, surname, gender, length )\n \"#{ FIN_RANKING_URL }?txtnurighe=#{ DEFAULT_FIN_RANKING_RESULTS }\" <<\n \"&txtanno=#{ DEFAULT_FIN_RANKING_SEASON }&txtcat=#{ DEFAULT_FIN_RANKING_CATEGORY }\" <<\n \"txtdalyy=01%2F01%2F1900&txtalyy=#{ Date.today.day }%2F#{ Date.today.month }%2F#{ Date.today.year }\" <<\n \"&txtdallanno=&txtallanno=\" <<\n \"&txtcognome=#{ surname }&txtnome=#{ name }&txtsesso=#{ gender }\" <<\n \"&txtvasca=#{ length }&txtgara=#{ DEFAULT_FIN_RANKING_EVENT }&xricerca=Ricerca\"\n end",
"def new_rest\n @entry_answer = EntryAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_answer }\n end\n end",
"def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end",
"def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def new\n @ipsearch = Ipsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ipsearch }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end",
"def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"def create\n @ranking = Ranking.new(params[:ranking])\n\n respond_to do |format|\n if @ranking.save\n format.html { redirect_to @ranking, notice: 'Ranking was successfully created.' }\n format.json { render json: @ranking, status: :created, location: @ranking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @graduate_school_ranking = GraduateSchoolRanking.new\n\t@college_lists = CollegeList.find_by_sql(\"select name_en, id from college_lists order by name_en\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graduate_school_ranking }\n end\n end",
"def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def new\n @package = Package.new\n @priority = Priority.find(:all)\n #logger.debug @priority[0]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @package }\n end\n end",
"def new\n @modes = Mode.all\n @mode = Mode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mode }\n end\n end",
"def new\n @prizecount = Prizecount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prizecount }\n end\n end",
"def new\n @repo = Repo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repo }\n end\n end",
"def run\n\n #@experiment = Hash.from_xml( xml )['request']\n \n #non_coherent_nodes = get_non_coherent_nodes(@functionalities)\n #if non_coherent_nodes.empty?\n # print xml#return xml\n #end\n #n1 = non_coherent_nodes.second\n\n #print @functionalities.size\n #print \"\\n\\n\"\n #array = n1[:missing]==\"child\" ? possible_children(n1[:element], @functionalities) : possible_parents(n1[:element], @functionalities)\n #array.each do |k|\n # print \"\\n#{k[:parent][\"id\"]} -> #{k[:child][\"id\"]} \\n\\n\"\n #end\n #@functionalities = Hash.from_xml( xml )['request']['functionalities']['functionality']\n print(params[:sla].inspect)\n @functionalities = Hash.from_xml(params[:sla])['functionalities']['functionality'].to_a\n print @functionalities.inspect\n @new_functionalities = concepts_similarity_algorithm( @functionalities )\n \n render 'show_functionalities.xml.erb', :layout => false\n \nend",
"def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"def set_ranking_algorithm\n @ranking_algorithm = RankingAlgorithm.find(params[:id])\n end",
"def new\n @rating_plan = RatingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating_plan }\n end\n end",
"def create\n @ranking = Ranking.new(ranking_params)\n\n respond_to do |format|\n if @ranking.save\n format.html { redirect_to @ranking, notice: 'Ranking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ranking }\n else\n format.html { render action: 'new' }\n format.json { render json: @ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @serie_comparativa = SerieComparativa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @serie_comparativa }\n end\n end",
"def new\n @topiccluster = Topiccluster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topiccluster }\n end\n end",
"def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"def new\n @query = CannedQuery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end"
] |
[
"0.6644772",
"0.6592853",
"0.6507366",
"0.63442194",
"0.63269013",
"0.61653304",
"0.60608935",
"0.60303056",
"0.6016412",
"0.5949583",
"0.5922413",
"0.59055024",
"0.5897164",
"0.58289045",
"0.5809351",
"0.57677543",
"0.5735561",
"0.56119305",
"0.5584854",
"0.5548083",
"0.55215675",
"0.5519671",
"0.54967695",
"0.5449189",
"0.544713",
"0.5443428",
"0.54339457",
"0.5430626",
"0.5427565",
"0.54092306",
"0.5403458",
"0.53880596",
"0.5358161",
"0.5357652",
"0.5357117",
"0.53554004",
"0.5352786",
"0.534595",
"0.5345181",
"0.5329149",
"0.5327589",
"0.53189516",
"0.53160864",
"0.5309971",
"0.5309971",
"0.5304212",
"0.5303954",
"0.5297225",
"0.52925867",
"0.5288383",
"0.52858716",
"0.52797496",
"0.5275034",
"0.5261747",
"0.52615494",
"0.52600694",
"0.5247142",
"0.5246564",
"0.5245141",
"0.5244263",
"0.5243934",
"0.5243806",
"0.52354866",
"0.5232959",
"0.52220625",
"0.52161705",
"0.521095",
"0.52094144",
"0.52094144",
"0.5206032",
"0.520196",
"0.5201937",
"0.5201937",
"0.519903",
"0.5189897",
"0.5188978",
"0.5187521",
"0.51862895",
"0.51830405",
"0.51815486",
"0.5180637",
"0.5179626",
"0.5172383",
"0.51681125",
"0.5164222",
"0.51639104",
"0.5159383",
"0.51568604",
"0.51560193",
"0.51554847",
"0.51549065",
"0.51478565",
"0.51478565",
"0.5147243",
"0.51462364",
"0.514014",
"0.51398736",
"0.51388067",
"0.51379406",
"0.51366633"
] |
0.7286456
|
0
|
POST /rank_algorithms POST /rank_algorithms.xml
|
def create
@rank_algorithm = RankAlgorithm.new(params[:rank_algorithm])
respond_to do |format|
if @rank_algorithm.save
flash[:notice] = 'RankAlgorithm was successfully created.'
format.html { redirect_to(@rank_algorithm) }
format.xml { render :xml => @rank_algorithm, :status => :created, :location => @rank_algorithm }
else
format.html { render :action => "new" }
format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ranking_algorithm_params\n params.require(:ranking_algorithm).permit(:algorithm_name, :template)\n end",
"def index\n @rank_algorithms = RankAlgorithm.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rank_algorithms }\n end\n end",
"def create\n @ranking_algorithm = RankingAlgorithm.new(ranking_algorithm_params)\n\n respond_to do |format|\n if @ranking_algorithm.save\n format.html { redirect_to @ranking_algorithm, notice: 'Алгоритм успешно создан' }\n format.json { render :show, status: :created, location: @ranking_algorithm }\n else\n format.html { render :new }\n format.json { render json: @ranking_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_search_rankings(date, expires_in: 1.minute)\n request(\"#{reportbooru_server}/post_searches/rank?date=#{date}\", expires_in)\n end",
"def index\n @ranking_algorithms = RankingAlgorithm.all.page(params[:page]).per(10)\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end",
"def set_ranking_algorithm\n @ranking_algorithm = RankingAlgorithm.find(params[:id])\n end",
"def rank(prog); @ranks[prog]; end",
"def new\n @rank_algorithm = RankAlgorithm.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def rank; end",
"def rank; end",
"def ranking_params\n params[:ranking]\n end",
"def navy_rank; end",
"def create\n\t\t\n\t\t@score = params[:score].to_i.round\n\t\t@namespace = Nuniverse.find_by_unique_name(params[:namespace])\n\t\t@ranking = Ranking.find_or_create(:user_id => current_user.id, :score => @score, :rankable_id => @namespace.id, :rankable_type => @namespace.class.to_s)\n\t\t\n respond_to do |format|\n if @ranking.save\n flash[:notice] = 'Rankings was successfully created.'\n format.html { redirect_to(@ranking) }\n\t\t\t\tformat.js\t\t{ }\n\t\t\t\tformat.json { \n\t\t\t\t\tsc = @namespace.total_score\n\t\t\t\t\trender :json => {'user' => current_user.login,'color' => @ranking.color, 'score' => sc, 'score_label' => Ranking.label(@namespace.score),'vote' => @ranking, 'stats' => @namespace.stats}\n\t\t\t\t}\n format.xml { render :xml => @ranking, :status => :created, :location => @ranking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ranking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @rank_algorithm = RankAlgorithm.find(params[:id])\n \n respond_to do |format|\n if @rank_algorithm.update_attributes(params[:rank_algorithm])\n flash[:notice] = 'RankAlgorithm was successfully updated.'\n format.html { redirect_to(@rank_algorithm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def generate_rank_values\n\t\tlist = \"<select name=\\\"rank\\\">\"\n\t\tfor i in 1..100\n\t\t\tlist += \"<option value=\\\"#{i}\\\">#{i}</option>\"\n\t\tend\n\t\tlist += \"</select>\"\n\tend",
"def army_rank; end",
"def rank_params\n params.require(:rank).permit(:name)\n end",
"def ranking_params\n params.require(:ranking).permit(:user_id, :points, :sos)\n end",
"def ranking_params\n params.fetch(:ranking, {})\n end",
"def post_view_rankings(date, expires_in: 1.minute)\n request(\"#{reportbooru_server}/post_views/rank?date=#{date}\", expires_in)\n end",
"def search_ranked\n render json: Article.with_ranked_terms(params[:query]).map(&:title)\n end",
"def page_rank\n\n end",
"def destroy\n @rank_algorithm = RankAlgorithm.find(params[:id])\n @rank_algorithm.destroy\n \n respond_to do |format|\n format.html { redirect_to(rank_algorithms_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @algorithm = Algorithm.new(algorithm_params)\n if(algorithm_params[:name]=='palindrome')\n @algorithm.isPalindrome()\n end\n if(algorithm_params[:name]=='fibonacci')\n @algorithm[:output] = @algorithm.fibonacci(algorithm_params[:input].to_i)\n end\n respond_to do |format|\n if @algorithm.save\n format.html { redirect_to @algorithm, notice: 'Algorithm was successfully created.' }\n format.json { render :show, status: :created, location: @algorithm }\n else\n format.html { render :new }\n format.json { render json: @algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initial_ranks\n raise NotImplementedError\n end",
"def rank_params\n params.require(:rank).permit(:title)\n end",
"def percent_rank_inc()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::PercentRank_Inc::PercentRankIncRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def algorithm_params\n params.require(:algorithm).permit(:name, :input, :runtime)\n end",
"def run\n\n #@experiment = Hash.from_xml( xml )['request']\n \n #non_coherent_nodes = get_non_coherent_nodes(@functionalities)\n #if non_coherent_nodes.empty?\n # print xml#return xml\n #end\n #n1 = non_coherent_nodes.second\n\n #print @functionalities.size\n #print \"\\n\\n\"\n #array = n1[:missing]==\"child\" ? possible_children(n1[:element], @functionalities) : possible_parents(n1[:element], @functionalities)\n #array.each do |k|\n # print \"\\n#{k[:parent][\"id\"]} -> #{k[:child][\"id\"]} \\n\\n\"\n #end\n #@functionalities = Hash.from_xml( xml )['request']['functionalities']['functionality']\n print(params[:sla].inspect)\n @functionalities = Hash.from_xml(params[:sla])['functionalities']['functionality'].to_a\n print @functionalities.inspect\n @new_functionalities = concepts_similarity_algorithm( @functionalities )\n \n render 'show_functionalities.xml.erb', :layout => false\n \nend",
"def create\n @algorithm = current_user.algorithms.new(params[:algorithm])\n\n respond_to do |format|\n if @algorithm.save\n flash[:notice] = 'Algorithm was successfully created.'\n format.html { redirect_to(@algorithm) }\n format.xml { render :xml => @algorithm, :status => :created, :location => @algorithm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rank = @rank_class.new(params[:rank])\n\n respond_to do |format|\n if @rank.save\n format.html { redirect_to(send(\"#{@rank_path}s_path\"), :notice => 'Rank was successfully created.') }\n format.xml { render :xml => @rank, :status => :created, :location => @rank }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rank.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rank_params\n params.require(:rank).permit(:name)\n end",
"def update\n respond_to do |format|\n if @ranking_algorithm.update(ranking_algorithm_params)\n format.html { redirect_to @ranking_algorithm, notice: 'Алгоритм успешно обновлен' }\n format.json { render :show, status: :ok, location: @ranking_algorithm }\n else\n format.html { render :edit }\n format.json { render json: @ranking_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ranks = @rank_class.rank_order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ranks }\n end\n end",
"def calculate_page_rank(iterations=20)\n # zero everyone's page rank out\n Url.update_all(\"page_rank = 1.0\")\n\n iterations.times do |i|\n puts \"Iteration #{i}\"\n Url.find(:all).each do |url|\n pr = 0.15\n \n # loop through all the pages that link to this one\n Link.find(:all,\n :select => \"DISTINCT from_id\",\n :conditions => { :to_id => url.id }) do |link|\n from_id = link.from_id\n # get the page rank of the linker\n linking_pr = Url.find_by_id(from_id).page_rank\n \n # get the total number of links from the linker\n linking_count = Link.count(:conditions => { :from_id => from_id })\n\n pr += 0.85 * (linking_pr / linking_count)\n end\n\n Url.update_all([\"page_rank = ?\", pr], [\"id = ?\", url.id])\n end\n end\n end",
"def ranks\n Outpost::Config.instance.ranks\n end",
"def rank(input, name: nil)\n _op(:rank, input, name: name)\n end",
"def create\n @rank = Rank.new(rank_params)\n\n respond_to do |format|\n if @rank.save\n format.html { redirect_to @rank, notice: 'Звание было успешно создано.' }\n format.json { render :show, status: :created, location: @rank }\n else\n format.html { render :new }\n format.json { render json: @rank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rank _args\n \"rank _args;\" \n end",
"def add_ranked_query_result\n \n @query_result = Retreval::RankedQueryResult.new :query => \"query1\", :gold_standard => @gold_standard\n \n @query_result.add_document :id => \"doc1\"\n @query_result.add_document :id => \"doc2\"\n @query_result.add_document :id => \"doc5\"\n @query_result.add_document :id => \"doc3\"\n @query_result.add_document :id => \"doc6\"\n @query_result.add_document :id => \"doc4\"\n @query_result.add_document :id => \"doc7\"\n @query_result.add_document :id => \"doc8\"\n @query_result.add_document :id => \"doc9\"\n @query_result.add_document :id => \"doc10\"\n \n end",
"def rank(key)\n node_rank(@root, key)\n end",
"def create\n @rank = Rank.new(rank_params)\n\n respond_to do |format|\n if @rank.save\n format.html { redirect_to @rank, :notice => 'Rank was successfully created.' }\n format.json { render :json => @rank, :status => :created, :location => @rank }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rank.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def calc_rank\n return (self.score * 20001) + self.speaks;\n end",
"def event_ranking_params\n params.require(:event_ranking).permit(:event_count, :ranking, :name, :rank, :total_kill, :total_contribution)\n end",
"def ranking_params\n params.require(:ranking).permit(:user_id, :song_id, :artist_id, :weight)\n end",
"def compose_fin_ranking_uri( name, surname, gender, length )\n \"#{ FIN_RANKING_URL }?txtnurighe=#{ DEFAULT_FIN_RANKING_RESULTS }\" <<\n \"&txtanno=#{ DEFAULT_FIN_RANKING_SEASON }&txtcat=#{ DEFAULT_FIN_RANKING_CATEGORY }\" <<\n \"txtdalyy=01%2F01%2F1900&txtalyy=#{ Date.today.day }%2F#{ Date.today.month }%2F#{ Date.today.year }\" <<\n \"&txtdallanno=&txtallanno=\" <<\n \"&txtcognome=#{ surname }&txtnome=#{ name }&txtsesso=#{ gender }\" <<\n \"&txtvasca=#{ length }&txtgara=#{ DEFAULT_FIN_RANKING_EVENT }&xricerca=Ricerca\"\n end",
"def rank_params\n params.require(:rank).permit(:rank, :end_time)\n end",
"def rank(p,n)\n r(p,n,1,0)\n end",
"def create\n @scraping_algorithm = ScrapingAlgorithm.new(params[:scraping_algorithm])\n\n respond_to do |format|\n if @scraping_algorithm.save\n format.html { redirect_to @scraping_algorithm, notice: 'Scraping algorithm was successfully created.' }\n format.json { render json: @scraping_algorithm, status: :created, location: @scraping_algorithm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scraping_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @rank_algorithm = RankAlgorithm.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def create\n @ranking = Ranking.new(params[:ranking])\n\n respond_to do |format|\n if @ranking.save\n format.html { redirect_to @ranking, notice: 'Ranking was successfully created.' }\n format.json { render json: @ranking, status: :created, location: @ranking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_ranked_tree(model)\n # inflate the node id to test id wrap around edge cases\n # NODES=4..9 seem like edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!(:rank => 0)\n n2 = model.create!(:rank => 1)\n n3 = model.create!(:rank => 3, :parent => n1)\n n4 = model.create!(:rank => 0, :parent => n2)\n n5 = model.create!(:rank => 0, :parent => n1)\n n6 = model.create!(:rank => 1, :parent => n2)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end",
"def ranking_params\n params.require(:ranking).permit(:title, :position, :deleted_at)\n end",
"def create\n @testing_algorithm = TestingAlgorithm.new(params[:testing_algorithm])\n\n if @testing_algorithm.save\n render json : @testing_algorithm, status : :created, location : @testing_algorithm\n else\n render json : @testing_algorithm.errors, status : :unprocessable_entity\n end\n end",
"def run_intelligent_assignment\n priority_info = []\n assignment = Assignment.find_by(id: params[:id])\n topics = assignment.sign_up_topics\n teams = assignment.teams\n teams.each do |team|\n # grab student id and list of bids\n bids = []\n topics.each do |topic|\n bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)\n bids << (bid_record.nil? ? 0 : bid_record.priority ||= 0)\n end\n team.users.each {|user| priority_info << {pid: user.id, ranks: bids} if bids.uniq != [0] }\n end\n data = {users: priority_info, max_team_size: assignment.max_team_size}\n url = WEBSERVICE_CONFIG[\"topic_bidding_webservice_url\"]\n begin\n response = RestClient.post url, data.to_json, content_type: :json, accept: :json\n # store each summary in a hashmap and use the question as the key\n teams = JSON.parse(response)[\"teams\"]\n create_new_teams_for_bidding_response(teams, assignment)\n run_intelligent_bid(assignment)\n rescue StandardError => err\n flash[:error] = err.message\n end\n redirect_to controller: 'tree_display', action: 'list'\n end",
"def create\n @ranking = Ranking.new(ranking_params)\n\n respond_to do |format|\n if @ranking.save\n format.html { redirect_to @ranking, notice: 'Ranking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ranking }\n else\n format.html { render action: 'new' }\n format.json { render json: @ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end",
"def rerank\n s = score * DAY_POINTS\n self.rank = Time.now.to_i + s\n end",
"def create\n @rankin = Rankin.new(rankin_params)\n\n if @rankin.save\n render json: @rankin, status: :created, location: api_v1_rankin_url(@rankin, format: :json)\n else\n render json: @rankin.errors, status: :unprocessable_entity\n end\n end",
"def set_ranking(value)\n\t\t@ranking = value\n\tend",
"def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end",
"def rank\n return inv + neg + nsp\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def rank(key)\n recursive_rank(root, key)\n end",
"def acm_contest_rank_params\n params.fetch(:acm_contest_rank, {})\n end",
"def rank_eq()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rank_Eq::RankEqRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @rankings = Prediction.select(\"user_id, name, sum(score) as score\")\n .joins(:user) \n .group(\"user_id, name\")\n .order(\"score DESC, name ASC\")\n .paginate(page: params[:page])\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def ranking_params\n params.require(:ranking).permit(:first_name, :last_name, :position_id, :team)\n end",
"def user_rank!\n r = 1\n users.order('rating DESC').each do |u|\n user_universities.find_by_user_id(u.id).update_attribute(:rank, r)\n r += 1\n end\n end",
"def send_average_rank(event)\n send_points(event, true, true)\nrescue => e\n lex(e, \"Error computing average rank.\", event: event)\nend",
"def send_rankings(event, page: nil, type: nil, tab: nil, rtype: nil, ties: nil)\n # PARSE ranking parameters (from function arguments and message)\n initial = page.nil? && type.nil? && tab.nil? && rtype.nil? && ties.nil?\n reset_page = !type.nil? || !tab.nil? || !rtype.nil? || !ties.nil?\n msg = fetch_message(event, initial)\n tabs = parse_tabs(msg, tab)\n tab = tabs.empty? ? 'all' : (tabs.size == 1 ? tabs[0].to_s.downcase : 'tab')\n ties = !ties.nil? ? ties : parse_ties(msg, rtype)\n play = parse_many_players(msg)\n nav = parse_nav(msg) || !initial\n full = parse_global(msg) || parse_full(msg) || nav\n cool = !rtype.nil? && parse_cool(rtype) || rtype.nil? && parse_cool(msg)\n star = !rtype.nil? && parse_star(rtype, false, true) || rtype.nil? && parse_star(msg)\n maxed = !rtype.nil? && parse_maxed(rtype) || rtype.nil? && parse_maxed(msg)\n maxable = !maxed && (!rtype.nil? && parse_maxable(rtype) || rtype.nil? && parse_maxable(msg))\n rtype2 = rtype # save a copy before we change it\n rtype = rtype || parse_rtype(msg)\n whole = [\n 'average_point',\n 'average_rank',\n 'point',\n 'score',\n 'cool',\n 'star',\n 'maxed',\n 'maxable'\n ].include?(rtype) # default rank is top20, not top1 (0th)\n range = !parse_rank(rtype).nil? ? [0, parse_rank(rtype), true] : parse_range(rtype2.nil? ? msg : '', whole)\n rtype = fix_rtype(rtype, range[1])\n type = parse_type(msg, type, true, initial, rtype == 'score' ? 'Level' : nil)\n mappack = parse_mappack(msg)\n board = parse_board(msg, 'hs')\n\n raise OutteError.new \"Speedrun mode isn't available for Metanet levels yet.\" if board == 'sr' && !mappack\n raise OutteError.new \"#{format_board(board)} rankings aren't available yet.\" if ['gm', 'dual'].include?(board)\n\n # The range must make sense\n if !range[2]\n event << \"You specified an empty range! (#{format_range(range[0], range[1])})\"\n return\n end\n\n # Determine ranking type and max value of said ranking\n rtag = :rank\n case rtype\n when 'average_point'\n rtag = :avg_points\n max = find_max(:avg_points, type, tabs, !initial, mappack, board)\n when 'average_top1_lead'\n rtag = :avg_lead\n max = nil\n when 'average_rank'\n rtag = :avg_rank\n max = find_max(:avg_rank, type, tabs, !initial, mappack, board)\n when 'point'\n rtag = :points\n max = find_max(:points, type, tabs, !initial, mappack, board)\n when 'score'\n rtag = :score\n max = find_max(:score, type, tabs, !initial, mappack, board)\n when 'singular_top1'\n rtag = :singular\n max = find_max(:rank, type, tabs, !initial, mappack, board)\n range[1] = 1\n when 'plural_top1'\n rtag = :singular\n max = find_max(:rank, type, tabs, !initial, mappack, board)\n range[1] = 0\n when 'tied_top1'\n rtag = :tied_rank\n max = find_max(:rank, type, tabs, !initial, mappack, board)\n when 'maxed'\n rtag = :maxed\n max = find_max(:maxed, type, tabs, !initial, mappack, board)\n when 'maxable'\n rtag = :maxable\n max = find_max(:maxable, type, tabs, !initial, mappack, board)\n else\n rtag = :rank\n max = find_max(:rank, type, tabs, !initial, mappack, board)\n end\n\n # EXECUTE specific rankings\n rank = Score.rank(\n ranking: rtag, # Ranking type. Def: Regular scores.\n type: type, # Highscoreable type. Def: Levels and episodes.\n tabs: tabs, # Highscoreable tabs. Def: All tabs (SI, S, SU, SL, ?, !).\n players: play, # Players to ignore. Def: None.\n a: range[0], # Bottom rank of scores. Def: 0th.\n b: range[1], # Top rank of scores. Def: 19th.\n ties: ties, # Include ties or not. Def: No.\n cool: cool, # Only include cool scores. Def: No.\n star: star, # Only include * scores. Def: No.\n mappack: mappack, # Mappack to do rankings. Def: None.\n board: board # Highscore or speedrun. Def: Highscore.\n )\n\n # PAGINATION\n pagesize = nav ? PAGE_SIZE : 20\n page = parse_page(msg, page, reset_page, event.message.components)\n pag = compute_pages(rank.size, page, pagesize)\n\n # FORMAT message\n min = \"Minimum number of scores required: #{min_scores(type, tabs, !initial, range[0], range[1], star, mappack)}\" if ['average_rank', 'average_point'].include?(rtype)\n # --- Header\n prange = ![ # Don't print range for these rankings\n 'tied_top1',\n 'singular_top1',\n 'plural_top1',\n 'average_top1_lead',\n 'score'\n ].include?(rtype)\n full = format_full(full)\n cool = format_cool(cool)\n maxed = format_maxed(maxed)\n maxable = format_maxable(maxable)\n tabs = format_tabs(tabs)\n typeB = format_type(type, true).downcase\n range = format_range(range[0], range[1], !prange)\n star = format_star(star)\n rtypeB = format_rtype(rtype, ties: ties, range: false, basic: true)\n max = format_max(max, rtype == 'average_rank' || board == 'sr' && rtype == 'score')\n mappack = format_mappack(mappack)\n board = !mappack.nil? ? format_board(board) : ''\n play = !play.empty? ? ' without ' + play.map{ |p| \"#{verbatim(p.print_name)}\" }.to_sentence : ''\n header = \"#{full} #{cool} #{maxed} #{maxable} #{board} #{tabs} #{typeB}\"\n header << \" #{range}#{star} #{rtypeB} #{mappack} #{max} #{play} #{format_time}\"\n header = \"Rankings - #{format_header(header)}\"\n # --- Rankings\n if rank.empty?\n rank = format_block('These boards are empty!')\n else\n rank = rank[pag[:offset]...pag[:offset] + pagesize] if full.empty? || nav\n pad1 = rank.map{ |r| r[1].to_i.to_s.length }.max\n pad2 = rank.map{ |r| r[0].length }.max\n pad3 = rank.map{ |r| r[2].to_i.to_s.length }.max\n fmt = rank[0][1].is_a?(Integer) ? \"%#{pad1}d\" : \"%#{pad1 + 4}.3f\"\n rank = rank.each_with_index.map{ |r, i|\n line = \"#{Highscoreable.format_rank(pag[:offset] + i)}: #{format_string(r[0], pad2)} - #{fmt % r[1]}\"\n line += \" (%#{pad3}d)\" % [r[2]] if !r[2].nil?\n line\n }.join(\"\\n\")\n rank = format_block(rank)\n end\n # --- Footer\n rank.concat(min) if !min.nil? && (full.empty? || nav)\n\n # SEND message\n if nav\n view = Discordrb::Webhooks::View.new\n interaction_add_button_navigation(view, pag[:page], pag[:pages])\n interaction_add_type_buttons(view, type, ties)\n interaction_add_select_menu_rtype(view, rtype)\n interaction_add_select_menu_metanet_tab(view, tab)\n send_message_with_interactions(event, header + \"\\n\" + rank, view, !initial)\n else\n length = header.length + rank.length\n event << header\n length < DISCORD_CHAR_LIMIT && full.empty? ? event << rank : send_file(event, rank[4..-4], 'rankings.txt')\n end\nrescue => e\n lex(e, 'Failed to perform the rankings.', event: event)\n nil\nend",
"def get_ranks stream\n begin\n user_ids, niceranks = [], {}\n stream.posts.each do |post|\n id = post.user.id\n user_ids << id if @store[id].nil?\n end\n user_ids.uniq!\n got = CNX.get \"#{@url}#{user_ids.join(',')}\" unless user_ids.empty?\n if got.nil? || got == \"\"\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n else\n\n begin\n parsed = JSON.parse(got)\n rescue\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n end\n\n unless parsed['data'].is_a?(Array)\n parsed = {'meta' => {'code' => 404}, 'data' => []}\n end\n\n end\n parsed['data'].each do |obj|\n res = @store[obj['user_id']]\n if res.nil?\n obj['is_human'] ? is_human = 1 : is_human = 0\n content = {\n rank: obj['rank'],\n is_human: is_human\n }\n @store[obj['user_id']] = content\n niceranks[obj['user_id']] = content\n else\n @hits += 1\n niceranks[obj['user_id']] = res\n end\n end\n\n\n @posts += stream.posts.size\n @ids += user_ids.size\n\n if Settings.options.timeline.debug\n deb = \"\\n\"\n deb << \"+ NICERANK\\n\"\n deb << \"* t#{Time.now.to_i}\\n\"\n deb << \"Posts:\\t\\t#{stream.posts.size}\\n\"\n deb << \"Requested NR:\\t#{user_ids.size}\\n\"\n deb << \"* TOTALS\\n\"\n deb << \"Posts:\\t\\t#{@posts}\\n\"\n deb << \"Fetched ranks:\\t#{@ids}\\n\"\n deb << \"DB hits:\\t#{@hits}\\n\"\n deb << \"Uniques:\\t#{@store.count}\\n\"\n deb << \"\\n\"\n puts deb.color(Settings.options.colors.debug)\n Logs.rec.debug \"NICERANK/POSTS: #{@posts}\"\n Logs.rec.debug \"NICERANK/NR CALLS: #{@ids}\"\n Logs.rec.debug \"NICERANK/CACHE HITS: #{@hits}\"\n Logs.rec.debug \"NICERANK/CACHED IDS: #{@store.count}\"\n end\n return niceranks\n rescue => e\n Errors.global_error({error: e, caller: caller, data: [user_ids, niceranks, parsed]})\n end\n end",
"def ranks\r\n if params[:ranks]\r\n if params[:submit] == t(:update)\r\n if Rank.exists?(params[:id])\r\n Rank.update(params[:id], params[:ranks]) \r\n end\r\n elsif params[:submit] == t(:remove)\r\n if Rank.exists?(params[:id])\r\n begin\r\n Rank.destroy(params[:id])\r\n rescue => ex\r\n render :text => ex.message\r\n return\r\n end\r\n end\r\n else\r\n Rank.create(params[:ranks])\r\n end \r\n redirecting t(:redir), session[:last_page]\r\n return\r\n end\r\n @rank = Rank.new\r\n @ranks = Rank.all\r\n end",
"def rank=(value)\n @rank = value\n end",
"def create\n @algorithm = Algorithm.new(params[:algorithm])\n\n respond_to do |format|\n if @algorithm.save\n format.html { redirect_to @algorithm, notice: 'Algorithm was successfully created.' }\n format.json { render json: @algorithm, status: :created, location: @algorithm }\n else\n format.html { render action: 'new' }\n format.json { render json: @algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rank = Rank.new(rank_params)\n\n respond_to do |format|\n if @rank.save\n format.html { redirect_to @rank, notice: 'Rank was successfully created.' }\n format.json { render :show, status: :created, location: @rank }\n else\n format.html { render :new }\n format.json { render json: @rank.errors, status: :unprocessable_entity }\n format.js { render json: @rank.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def rank_avg()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rank_Avg::RankAvgRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def sort_ranks(_ranks)\n raise NotImplementedError\n end",
"def rank_index\n RANKS.keys.index(@rank)\n end",
"def change_rank\n if params[:to] == 'up'\n @faq.rank = @faq.rank.to_i + 1\n else\n @faq.rank = @faq.rank.to_i - 1\n end\n @faq.save\n end",
"def oldrank(prog); @oldranks[prog]; end",
"def raw_create_rank(name)\n id = raw_create('ranks', name: name)\n connection.exec_update(\"UPDATE ranks SET treat_as = #{id} WHERE ID = #{id}\", 'SQL', [id, id])\n id\n end",
"def update_rank\n age_in_days = (created_at - Time.new(1970,1,1)) / (60 * 60 * 24) # 1 day in seconds\n new_rank = points + age_in_days\n \n update_attribute(:rank, new_rank)\n end",
"def rank\n @data['rank']\n end",
"def update_rank\n age_in_days = (created_at - Time.new(1970,1,1)) / 1.day.seconds\n new_rank = points + age_in_days\n update_attribute(:rank, new_rank)\n end",
"def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end",
"def create\n\t @rank = Rank.new(params[:rank])\n if @rank.save\n flash[:notice] = t(:created, :thing => \"rank\")\n redirect_to admin_ranks_path\n else\n flash[:notice] = t(:not_created, :thing => \"rank\")\n render :action => \"new\"\n end\n end",
"def index\n @algorithms = Algorithm.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @algorithms }\n end\n end",
"def algorithm_params(step)\n params.require(:algorithm).permit(permitted_params(step))\n end",
"def get_event_rankings ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/rankings\"\n end",
"def create\n @algorithm = Algorithm.new(algorithm_params)\n\n respond_to do |format|\n if @algorithm.save\n format.html { redirect_to @algorithm, notice: 'Algorithm was successfully created.' }\n format.json { render :show, status: :created, location: @algorithm }\n else\n format.html { render :new }\n format.json { render json: @algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fix_ranks(options = {})\n options[:reload] = true if options[:reload].nil?\n options[:save] = true if options[:save].nil?\n questionings(options[:reload]).sort_by{|qing| qing.rank}.each_with_index{|qing, idx| qing.rank = idx + 1}\n save(:validate => false) if options[:save]\n end",
"def index\n @requirements = apply_scopes(Requirement).paginate(page: params[:page], per_page: 38).order('sortOrder,rank_id ASC')\n @rank = Rank.find(params[:by_rank_id]).name unless params[:by_rank_id].nil?\n end",
"def rank_participant_params\n params.require(:rank_participant).permit(:rank, :name, :bib_number)\n end",
"def set_ranks_challenge\n @ranks_challenge = RanksChallenge.find(params[:id])\n end",
"def rank_payment(ranks)\n rank_payment = Hash.new(0)\n payments_per_rank = if self.name == 'h2h rr'\n # Handle unfilled h2h rr. Ranks.length is number of entrants\n unplayed_games = self.max_entries - ranks.length\n get_payout_structure.slice(get_payout_structure.length-ranks.length, ranks.length).map{|amt| amt + unplayed_games * self.buy_in / (self.max_entries-1) }\n else\n get_payout_structure\n end\n payments_per_rank.each_with_index do |payment, i|\n rank_payment[ranks[i]] += payment\n end\n return rank_payment\n end",
"def representative_params\n\t\tparams.require(:representative).permit(:division, :name, :phone, :mobile, :email, :fax, :organization_id, :ranking)\n end",
"def set_rank\n @rank = Rank.find(params[:id])\n end"
] |
[
"0.5889296",
"0.5859113",
"0.5687356",
"0.5636704",
"0.55211806",
"0.5518879",
"0.54464114",
"0.53616726",
"0.5305081",
"0.5285669",
"0.5285669",
"0.52595484",
"0.5176032",
"0.51689893",
"0.5083349",
"0.5048326",
"0.5034209",
"0.5029309",
"0.50168264",
"0.5010272",
"0.500663",
"0.4994362",
"0.4989557",
"0.49708644",
"0.49683797",
"0.49671784",
"0.49656639",
"0.49473444",
"0.49297836",
"0.4928422",
"0.49240044",
"0.49173635",
"0.48969793",
"0.48918894",
"0.4873934",
"0.48704714",
"0.48374918",
"0.48325107",
"0.4827908",
"0.48155558",
"0.48072153",
"0.4794651",
"0.4787064",
"0.4780975",
"0.47786182",
"0.4771417",
"0.47574764",
"0.4749122",
"0.47363022",
"0.47282925",
"0.47033635",
"0.4695107",
"0.46935755",
"0.46926308",
"0.4674687",
"0.4668103",
"0.46652654",
"0.465847",
"0.4649302",
"0.4648567",
"0.4646937",
"0.4635641",
"0.46352407",
"0.46329114",
"0.4630078",
"0.46290454",
"0.46281922",
"0.4621232",
"0.46142116",
"0.46005756",
"0.45968604",
"0.4591636",
"0.45880803",
"0.4585521",
"0.45849028",
"0.4578152",
"0.45761365",
"0.45660642",
"0.45632842",
"0.45611262",
"0.45497337",
"0.4545996",
"0.45420882",
"0.4537606",
"0.4529715",
"0.452114",
"0.4519646",
"0.45113802",
"0.45094106",
"0.44984186",
"0.44968435",
"0.4492564",
"0.44886252",
"0.4482278",
"0.44810507",
"0.44804072",
"0.4476751",
"0.4476442",
"0.44673046",
"0.44632652"
] |
0.62922126
|
0
|
PUT /rank_algorithms/1 PUT /rank_algorithms/1.xml
|
def update
@rank_algorithm = RankAlgorithm.find(params[:id])
respond_to do |format|
if @rank_algorithm.update_attributes(params[:rank_algorithm])
flash[:notice] = 'RankAlgorithm was successfully updated.'
format.html { redirect_to(@rank_algorithm) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @ranking_algorithm.update(ranking_algorithm_params)\n format.html { redirect_to @ranking_algorithm, notice: 'Алгоритм успешно обновлен' }\n format.json { render :show, status: :ok, location: @ranking_algorithm }\n else\n format.html { render :edit }\n format.json { render json: @ranking_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rank_algorithm = RankAlgorithm.new(params[:rank_algorithm])\n \n respond_to do |format|\n if @rank_algorithm.save\n flash[:notice] = 'RankAlgorithm was successfully created.'\n format.html { redirect_to(@rank_algorithm) }\n format.xml { render :xml => @rank_algorithm, :status => :created, :location => @rank_algorithm }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_ranking_algorithm\n @ranking_algorithm = RankingAlgorithm.find(params[:id])\n end",
"def index\n @rank_algorithms = RankAlgorithm.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rank_algorithms }\n end\n end",
"def update\n @testing_algorithm = TestingAlgorithm.find(params[:id])\n\n if @testing_algorithm.update(params[:testing_algorithm])\n head :no_content\n else\n render json : @testing_algorithm.errors, status : :unprocessable_entity\n end\n end",
"def destroy\n @rank_algorithm = RankAlgorithm.find(params[:id])\n @rank_algorithm.destroy\n \n respond_to do |format|\n format.html { redirect_to(rank_algorithms_url) }\n format.xml { head :ok }\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @lore = Lore.find(params[:id])\n\n if params[:operation] == 'up'\n @lore.ranking = @lore.ranking + 1\n @lore.save\n return render :json => {ranking: @lore.ranking}\n elsif params[:operation] == 'down'\n @lore.ranking = @lore.ranking - 1 \n @lore.save\n return render :json => {ranking: @lore.ranking}\n end\n\n respond_to do |format|\n if @lore.update_attributes(params[:lore])\n format.html { redirect_to @lore, notice: 'Lore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @algorithm = Algorithm.find(params[:id])\n\n respond_to do |format|\n if @algorithm.update_attributes(params[:algorithm])\n flash[:notice] = 'Algorithm was successfully updated.'\n format.html { redirect_to(@algorithm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @algorithm.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @rank = @rank_class.find(params[:id])\n\n respond_to do |format|\n if @rank.update_attributes(params[:rank])\n format.html { redirect_to(send(\"#{@rank_path}s_path\"), :notice => 'Rank was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rank.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def ranking_algorithm_params\n params.require(:ranking_algorithm).permit(:algorithm_name, :template)\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update(json)\n response = DivaServicesApi.put(\"/algorithms/#{self.id}\", body: json, headers: { 'Content-Type' => 'application/json' })\n DivaServicesApi::Algorithm.new(response['identifier'])\n end",
"def update\n respond_to do |format|\n if @rank.update(rank_params)\n format.html { redirect_to @rank, notice: 'Звание было успешно обновлено.' }\n format.json { render :show, status: :ok, location: @rank }\n else\n format.html { render :edit }\n format.json { render json: @rank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_rank\n if params[:to] == 'up'\n @faq.rank = @faq.rank.to_i + 1\n else\n @faq.rank = @faq.rank.to_i - 1\n end\n @faq.save\n end",
"def update\n @rank = Rank.find(params[:id])\n\n respond_to do |format|\n if @rank.update_attributes(rank_params)\n format.html { redirect_to @rank, :notice => 'Rank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @rank.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rank\n age_in_days = (created_at - Time.new(1970,1,1)) / (60 * 60 * 24) # 1 day in seconds\n new_rank = points + age_in_days\n \n update_attribute(:rank, new_rank)\n end",
"def set_rank\n @rank = Rank.find(params[:id])\n end",
"def set_rank\n @rank = Rank.find(params[:id])\n end",
"def update\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n\n respond_to do |format|\n if @scraping_algorithm.update_attributes(params[:scraping_algorithm])\n format.html { redirect_to @scraping_algorithm, notice: 'Scraping algorithm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scraping_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rank\n age_in_days = (created_at - Time.new(1970,1,1)) / 1.day.seconds\n new_rank = points + age_in_days\n update_attribute(:rank, new_rank)\n end",
"def update\n respond_to do |format|\n if @algorithm.update(algorithm_params)\n format.html { redirect_to @algorithm, notice: 'Algorithm was successfully updated.' }\n format.json { render :show, status: :ok, location: @algorithm }\n else\n format.html { render :edit }\n format.json { render json: @algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n respond_to do |format|\n if @rank.update(rank_params)\n format.html { redirect_to @rank, notice: 'Rank was successfully updated.' }\n format.json { render :show, status: :ok, location: @rank }\n else\n format.html { render :edit }\n format.json { render json: @rank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @algorithm = Algorithm.find(params[:id])\n\n respond_to do |format|\n if @algorithm.update_attributes(params[:algorithm])\n format.html { redirect_to @algorithm, notice: 'Algorithm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @rank_algorithm = RankAlgorithm.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def update_rank\n self.score = calculate_score\n self.save\n end",
"def update_relative op\n sign = 0.send(op, 1)\n relative = relative op\n \n unless relative.blank?\n self.rank += 1*sign\n self.save\n relative.rank -= 1*sign\n relative.save\n end\n end",
"def update_post\n\t\tpost.update_rank\n\tend",
"def put!\n request! :put\n end",
"def create\n @ranking_algorithm = RankingAlgorithm.new(ranking_algorithm_params)\n\n respond_to do |format|\n if @ranking_algorithm.save\n format.html { redirect_to @ranking_algorithm, notice: 'Алгоритм успешно создан' }\n format.json { render :show, status: :created, location: @ranking_algorithm }\n else\n format.html { render :new }\n format.json { render json: @ranking_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_rank\n @rank = Rank.find(params[:id])\n end",
"def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end",
"def update\n respond_to do |format|\n if @algorithm.update(algorithm_params)\n format.html { redirect_to @algorithm, notice: 'Algorithm was successfully updated.' }\n format.json { render :show, status: :ok, location: @algorithm }\n else\n format.html { render :edit }\n format.json { render json: @algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end",
"def show\n @rank_algorithm = RankAlgorithm.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rank_algorithm }\n end\n end",
"def upgrade_rank\n if self.rank.nil? || self.rank.rank == 0\n rank1 = Rank.find_by_rank(1)\n self.update_attribute(:rank_id, rank1.id) unless rank1.nil?\n end\n end",
"def update\n @rankings = Rankings.find(params[:id])\n\n respond_to do |format|\n if @rankings.update_attributes(params[:rankings])\n flash[:notice] = 'Rankings was successfully updated.'\n format.html { redirect_to(@rankings) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rankings.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @ranking = Ranking.find(params[:id])\n\n respond_to do |format|\n if @ranking.update_attributes(params[:ranking])\n format.html { redirect_to @ranking, notice: 'Ranking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update!(**args)\n @kaltix_rank = args[:kaltix_rank] if args.key?(:kaltix_rank)\n @local_kaltix_rank = args[:local_kaltix_rank] if args.key?(:local_kaltix_rank)\n @site_kaltix_rank = args[:site_kaltix_rank] if args.key?(:site_kaltix_rank)\n end",
"def update\n respond_to do |format|\n if @ranking.update(ranking_params)\n format.html { redirect_to @ranking, notice: 'Ranking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ranking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_version\n ## First try this with a non-public user\n basic_authorization(users(:normal_user).email, \"test\")\n changeset_id = changesets(:normal_user_first_change).id\n \n # setup a simple XML node\n xml_doc = current_nodes(:visible_node).to_xml\n xml_node = xml_doc.find(\"//osm/node\").first\n nodeid = current_nodes(:visible_node).id\n\n # keep a hash of the versions => string, as we'll need something\n # to test against later\n versions = Hash.new\n\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n\n # randomly move the node about\n 20.times do \n # move the node somewhere else\n xml_node['lat'] = precision(rand * 180 - 90).to_s\n xml_node['lon'] = precision(rand * 360 - 180).to_s\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :forbidden, \"Should have rejected node update\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # add a bunch of random tags\n 30.times do \n xml_tag = XML::Node.new(\"tag\")\n xml_tag['k'] = random_string\n xml_tag['v'] = random_string\n xml_node << xml_tag\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :forbidden,\n \"should have rejected node #{nodeid} (#{@response.body}) with forbidden\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # probably should check that they didn't get written to the database\n\n \n ## Now do it with the public user\n basic_authorization(users(:public_user).email, \"test\")\n changeset_id = changesets(:public_user_first_change).id\n\n # setup a simple XML node\n xml_doc = current_nodes(:node_with_versions).to_xml\n xml_node = xml_doc.find(\"//osm/node\").first\n nodeid = current_nodes(:node_with_versions).id\n\n # keep a hash of the versions => string, as we'll need something\n # to test against later\n versions = Hash.new\n\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n\n # randomly move the node about\n 20.times do \n # move the node somewhere else\n xml_node['lat'] = precision(rand * 180 - 90).to_s\n xml_node['lon'] = precision(rand * 360 - 180).to_s\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :success\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # add a bunch of random tags\n 30.times do \n xml_tag = XML::Node.new(\"tag\")\n xml_tag['k'] = random_string\n xml_tag['v'] = random_string\n xml_node << xml_tag\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :success,\n \"couldn't update node #{nodeid} (#{@response.body})\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # check all the versions\n versions.keys.each do |key|\n get :version, :id => nodeid, :version => key.to_i\n\n assert_response :success,\n \"couldn't get version #{key.to_i} of node #{nodeid}\"\n\n check_node = Node.from_xml(versions[key])\n api_node = Node.from_xml(@response.body.to_s)\n\n assert_nodes_are_equal check_node, api_node\n end\n end",
"def update\n # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end",
"def update_ranks\n i = 0\n rank = 0\n ncon = nil\n Contributor.all_with_ncontributions.each do |contributor|\n i += 1\n if contributor.ncontributions != ncon\n rank = i\n ncon = contributor.ncontributions\n end\n contributor.update_attribute(:rank, rank) if contributor.rank != rank\n end\n end",
"def run\n\n #@experiment = Hash.from_xml( xml )['request']\n \n #non_coherent_nodes = get_non_coherent_nodes(@functionalities)\n #if non_coherent_nodes.empty?\n # print xml#return xml\n #end\n #n1 = non_coherent_nodes.second\n\n #print @functionalities.size\n #print \"\\n\\n\"\n #array = n1[:missing]==\"child\" ? possible_children(n1[:element], @functionalities) : possible_parents(n1[:element], @functionalities)\n #array.each do |k|\n # print \"\\n#{k[:parent][\"id\"]} -> #{k[:child][\"id\"]} \\n\\n\"\n #end\n #@functionalities = Hash.from_xml( xml )['request']['functionalities']['functionality']\n print(params[:sla].inspect)\n @functionalities = Hash.from_xml(params[:sla])['functionalities']['functionality'].to_a\n print @functionalities.inspect\n @new_functionalities = concepts_similarity_algorithm( @functionalities )\n \n render 'show_functionalities.xml.erb', :layout => false\n \nend",
"def refresh_rank(question)\n if refresh_rank?(question.id)\n ids_ext_to_rank = (pairwise_rank(question) || return).to_hash\n ItemsQuestion.all(:conditions => { 'items_questions.question_id' => question.id, 'items.item_id_ext' => ids_ext_to_rank.keys, 'items.active' => true }, :include => :item).each do |iq|\n iq.update_attribute(:position, ids_ext_to_rank[iq.item.item_id_ext.to_i])\n end if ids_ext_to_rank.keys.length > 0\n Response.update_last_response(LAST_RANK_RESPONSE, question.id)\n end\n end",
"def user_rank!\n r = 1\n users.order('rating DESC').each do |u|\n user_universities.find_by_user_id(u.id).update_attribute(:rank, r)\n r += 1\n end\n end",
"def update\n connection.put(element_path, to_xml)\n end",
"def update\n @user_rank = UserRanks.find(params[:id])\n\n respond_to do |format|\n if @user_rank.update_attributes(params[:user_rank])\n format.html { redirect_to @user_rank, notice: 'User rank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_rank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def admin!\n self.rank = 4\n save\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update_index(name, node); end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def update_ranks!\r\n conditions = \"account_status != 'active' OR hide_from_leaderboard = 1\"\r\n ineligible = ::User.first(:conditions => conditions)\r\n\r\n users_sql = <<SQL.chomp unless ineligible.nil?\r\nWHERE user_id NOT IN (SELECT id FROM `users` \\\r\nWHERE (`users`.account_status != 'active' AND `users`.proxy_user = 0) \\\r\nOR `users`.hide_from_leaderboard = 1)\r\nSQL\r\n\r\n connection.execute <<SQL.chomp\r\nSET @period = 'foobar', @rank = 0, @inc = 0, @points = 0\r\nSQL\r\n connection.execute <<SQL.chomp.gsub(/\\s+/, \" \") # Reformat.\r\nUPDATE `reputable_stats` outer_reputable_stats JOIN (\r\n SELECT IF (@period = period,\r\n IF (@points = points,\r\n @rank := @rank + least(0, @inc := @inc + 1),\r\n @rank := @rank + greatest(@inc, @inc := 1) +\r\n least(0, ABS(@points := points))),\r\n @rank := 1 + least(0, @period := period) +\r\n least(0, ABS(@points := points)) + least(0, @inc := 1))\r\n ranking, period, points, `reputable_stats`.id, (@rank + @inc - 1)\r\n AS inner_row FROM reputable_stats #{users_sql}\r\n ORDER BY section, period, points DESC\r\n) AS inner_reputable_stats\r\n ON outer_reputable_stats.id = inner_reputable_stats.id\r\nSET outer_reputable_stats.rank = ranking,\r\n outer_reputable_stats.row = inner_reputable_stats.inner_row,\r\n outer_reputable_stats.updated_on = CURDATE()\r\nSQL\r\n\r\n # NULLify rank and row for ineligible users.\r\n connection.execute <<SQL.chomp\r\nUPDATE `reputable_stats` \\\r\nJOIN `users` ON `reputable_stats`.user_id = `users`.id \\\r\nSET rank = NULL, row = NULL, updated_on = CURDATE() \\\r\nWHERE (`users`.account_status != 'active' \\\r\nOR `users`.proxy_user = 1 \\\r\nOR `users`.hide_from_leaderboard = 1)\r\nSQL\r\n end",
"def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\n end",
"def index\n @ranking_algorithms = RankingAlgorithm.all.page(params[:page]).per(10)\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def update\n @operation = Operation.find(params[:id])\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n format.html { redirect_to user_model_path(@model.user,@model), notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n send_request 'put', path, options\n end",
"def update_version\n self.update_attributes(version: self.version + 1)\n new_algorithm = self.deep_copy\n self.update_attributes(next: new_algorithm)\n new_algorithm\n end",
"def test_update\n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n size = set.resources.size\n #create a new resourceset. Note that the expression must return more resource than the first one.\n #we will check the number of resources to verify whether the set was updated.\n post :update, :exp => 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),:o)', :id => set.rsid\n assert @controller.resourceset.resources.size > size #assert that set was remove\n assert_response :success #assert that the request was executed successful\nend",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def test_putway_update_valid\n way = create(:way_with_nodes, :nodes_count => 3)\n cs_id = way.changeset.id\n user = way.changeset.user\n\n assert_not_equal({ \"test\" => \"ok\" }, way.tags)\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version, way.id, way.nds, { \"test\" => \"ok\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 1, new_way.version\n assert_equal way.nds, new_way.nds\n assert_equal({ \"test\" => \"ok\" }, new_way.tags)\n\n # Test changing the nodes in the way\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n\n assert_not_equal [a, b, c, d], way.nds\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 1, way.id, [a, b, c, d], way.tags, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 2, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 2, new_way.version\n assert_equal [a, b, c, d], new_way.nds\n assert_equal way.tags, new_way.tags\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 2, way.id, [a, -1, b, c], way.tags, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, b, 1, { \"test\" => \"ok\" }]], { d => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal way.version + 3, result[5]\n assert_equal({ new_node_id.to_s => 1, b.to_s => 2 }, result[6])\n assert_equal({ d.to_s => 1 }, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 3, new_way.version\n assert_equal [a, new_node_id, b, c], new_way.nds\n assert_equal way.tags, new_way.tags\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(b)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n deleted_node = Node.find(d)\n assert_equal 2, deleted_node.version\n assert_equal false, deleted_node.visible\n end",
"def rank(prog); @ranks[prog]; end",
"def perform_put(path, options = {})\n perform_request(:put, path, options)\n end",
"def fix_ranks(options = {})\n options[:reload] = true if options[:reload].nil?\n options[:save] = true if options[:save].nil?\n questionings(options[:reload]).sort_by{|qing| qing.rank}.each_with_index{|qing, idx| qing.rank = idx + 1}\n save(:validate => false) if options[:save]\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def rank_params\n params.require(:rank).permit(:title)\n end",
"def create\n\t\t\n\t\t@score = params[:score].to_i.round\n\t\t@namespace = Nuniverse.find_by_unique_name(params[:namespace])\n\t\t@ranking = Ranking.find_or_create(:user_id => current_user.id, :score => @score, :rankable_id => @namespace.id, :rankable_type => @namespace.class.to_s)\n\t\t\n respond_to do |format|\n if @ranking.save\n flash[:notice] = 'Rankings was successfully created.'\n format.html { redirect_to(@ranking) }\n\t\t\t\tformat.js\t\t{ }\n\t\t\t\tformat.json { \n\t\t\t\t\tsc = @namespace.total_score\n\t\t\t\t\trender :json => {'user' => current_user.login,'color' => @ranking.color, 'score' => sc, 'score_label' => Ranking.label(@namespace.score),'vote' => @ranking, 'stats' => @namespace.stats}\n\t\t\t\t}\n format.xml { render :xml => @ranking, :status => :created, :location => @ranking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ranking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, options={}, format=format)\n request(:put, path, options, format)\n end",
"def rank; end",
"def rank; end",
"def test_should_update_tag_rank\n login_as :admin\n\n a_tag = tags(:weapons)\n \n # Child tags are already ordered by rank.\n position1 = a_tag.children[0]\n position2 = a_tag.children[1]\n position3 = a_tag.children[2]\n\n # Call the list method, passing a tag name\n get :list, :id => a_tag.name\n assert_response :success\n assert_template 'list'\n\n # Initially we should have three visible tags.\n assert_select \"ul#tag_list\" do\n assert_select \"li\", :count => 3\n end\n\n # Tags should be ordered using ajax calls.\n xhr(:post, :update_tag_rank, :tag_list => [position2.id, position1.id, position3.id])\n \n # At this point, the call doesn't issue a rjs statement, the fields are just\n # sorted and the controller method executed, in the end the tags should be\n # ranked in another way.\n\n # Reload it an see if the order changed.\n a_tag.reload\n \n # Child tags are already ordered by rank.\n new_position1 = a_tag.children[0]\n new_position2 = a_tag.children[1]\n new_position3 = a_tag.children[2]\n\n # Compare the positions.\n assert_equal new_position1, position2\n assert_equal new_position2, position1\n assert_equal new_position3, position3\n end",
"def rank_params\n params.require(:rank).permit(:name)\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def ranks\r\n if params[:ranks]\r\n if params[:submit] == t(:update)\r\n if Rank.exists?(params[:id])\r\n Rank.update(params[:id], params[:ranks]) \r\n end\r\n elsif params[:submit] == t(:remove)\r\n if Rank.exists?(params[:id])\r\n begin\r\n Rank.destroy(params[:id])\r\n rescue => ex\r\n render :text => ex.message\r\n return\r\n end\r\n end\r\n else\r\n Rank.create(params[:ranks])\r\n end \r\n redirecting t(:redir), session[:last_page]\r\n return\r\n end\r\n @rank = Rank.new\r\n @ranks = Rank.all\r\n end",
"def update\n @algorithm.assign_attributes(algorithm_params(step))\n render_wizard @algorithm\n end",
"def algorithm_params\n params.require(:algorithm).permit(:name, :input, :runtime)\n end",
"def rank_params\n params.require(:rank).permit(:name)\n end",
"def put(*args)\n request :put, *args\n end",
"def update(algorithm)\n p 'Updating algorithm' if Rails.env.development?\n old_diva_algorithm = DivaServicesApi::Algorithm.by_id(algorithm.predecessor.diva_id)\n diva_algorithm = old_diva_algorithm.update(algorithm.to_schema)\n if diva_algorithm\n algorithm.update_attribute(:diva_id, diva_algorithm.id)\n algorithm.set_status(diva_algorithm.status_code, diva_algorithm.status_message)\n else\n algorithm.set_status(:error, \"Updating could not be started, just try again.\\n Please send this to the devs: \\\"#{diva_algorithm}\\\"\")\n end\n rescue Errno::ECONNREFUSED => error\n algorithm.set_status(:connection_error, 'The DIVAServices cannot be reached at the moment. Please try again later.')\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @vendedores_ranking = VendedoresRanking.find(params[:id])\n\n respond_to do |format|\n if @vendedores_ranking.update_attributes(params[:vendedores_ranking])\n flash[:notice] = 'VendedoresRanking was successfully updated.'\n format.html { redirect_to([:admin, @vendedores_ranking]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendedores_ranking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def set_ranks_challenge\n @ranks_challenge = RanksChallenge.find(params[:id])\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :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 401\r\n end"
] |
[
"0.57474405",
"0.55491173",
"0.5504826",
"0.5455035",
"0.53351843",
"0.53225654",
"0.5312142",
"0.52642125",
"0.5232523",
"0.5231709",
"0.522487",
"0.52039576",
"0.5172493",
"0.5114166",
"0.50983065",
"0.50731826",
"0.50572616",
"0.50522363",
"0.50516343",
"0.50516343",
"0.5040476",
"0.50271004",
"0.50158256",
"0.5015099",
"0.5014491",
"0.50046873",
"0.49907774",
"0.49763483",
"0.49379185",
"0.4927347",
"0.49119052",
"0.49068978",
"0.48996118",
"0.48670447",
"0.48617592",
"0.48562235",
"0.48559758",
"0.48549625",
"0.4845754",
"0.4839531",
"0.4836956",
"0.48329458",
"0.48319283",
"0.48255873",
"0.48051164",
"0.47808027",
"0.4780534",
"0.47786176",
"0.47739765",
"0.47587806",
"0.47565454",
"0.47511697",
"0.4740041",
"0.4739234",
"0.47340786",
"0.47265705",
"0.47259974",
"0.47153986",
"0.47034633",
"0.4702212",
"0.4702212",
"0.4698482",
"0.46983758",
"0.46965188",
"0.4693008",
"0.4692717",
"0.46811485",
"0.46800545",
"0.46781316",
"0.46768883",
"0.46664602",
"0.46654156",
"0.46628255",
"0.46536368",
"0.46526757",
"0.46461838",
"0.46405953",
"0.46382338",
"0.4637682",
"0.4637682",
"0.46306977",
"0.46297187",
"0.46252194",
"0.46249133",
"0.46249133",
"0.46204355",
"0.4613213",
"0.46054494",
"0.46026888",
"0.4600736",
"0.4598074",
"0.45948058",
"0.45938635",
"0.4589755",
"0.45878685",
"0.45765182",
"0.45681578",
"0.4562802",
"0.45578918",
"0.45577988"
] |
0.6424177
|
0
|
DELETE /rank_algorithms/1 DELETE /rank_algorithms/1.xml
|
def destroy
@rank_algorithm = RankAlgorithm.find(params[:id])
@rank_algorithm.destroy
respond_to do |format|
format.html { redirect_to(rank_algorithms_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @algorithm = Algorithm.find(params[:id])\n @algorithm.destroy\n\n respond_to do |format|\n format.html { redirect_to(algorithms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def destroy\n @ranking_algorithm.destroy\n respond_to do |format|\n format.html { redirect_to ranking_algorithms_url, notice: 'Алгоритм успешно удален' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scraping_algorithm = ScrapingAlgorithm.find(params[:id])\n @scraping_algorithm.destroy\n\n respond_to do |format|\n format.html { redirect_to scraping_algorithms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def delete_all(xpath); end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @geocache.destroy\n \n #add score to user rank\n del_score_to_rank('upload')\n \n respond_to do |format|\n format.html { redirect_to(geocaches_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/testsource\"\n \n @test_acl.create_principal(user)\n @test_acl.create_resource_object(res_ob_type, res_ob_adr, user)\n id = @test_acl.create_ace(user, \"allow\", priv, res_ob_type, res_ob_adr)\n \n @test_acl.delete_res_object(res_ob_type, res_ob_adr)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def destroy\n @rig = Rig.find(params[:id])\n @rig.destroy\n\n respond_to do |format|\n format.html { redirect_to(rigs_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end",
"def destroy\n @testing_algorithm = TestingAlgorithm.find(params[:id])\n @testing_algorithm.destroy\n\n head :no_content\n end",
"def clean_neo4j\n neo_connection.execute_query(\"START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx\")\nend",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n association.delete association[element.dataset[:index].to_i]\n end",
"def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end",
"def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend",
"def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end",
"def delete_node\n delete(@nodename)\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @retain_node = RetainNode.find(params[:id])\n @retain_node.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_nodes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @algorithm_binary = AlgorithmBinary.find(params[:id])\n @algorithm_binary.destroy\n\n respond_to do |format|\n format.html { redirect_to(@algorithm, :notice => 'Algorithm binary was deleted.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @ped_strategy = PedStrategy.find(params[:id])\n #<rck> Ing. César Reyes - Actualiza en Automatico la Jerarquia\n sql = ActiveRecord::Base.connection()\n sql.begin_db_transaction\n hierarchy = \"update ped_strategies\n set hierarchy = hierarchy - 1\n where hierarchy > #{@ped_strategy.hierarchy}\"\n sql.update hierarchy\n sql.commit_db_transaction \n #</rck>\n @ped_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to ped_strategies_url }\n format.json { head :no_content }\n end\n end",
"def after_delete\n redis.del(rank_key)\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @evaluacione = Evaluacione.find(params[:id])\n @evaluacione.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluaciones_url) }\n format.xml { head :ok }\n end\n end",
"def delete_node(current_node)\n\nend",
"def delete\n response = DivaServicesApi.delete(\"/algorithms/#{self.id}\")\n response.success?\n end",
"def destroy\n @risk = Risk.find(params[:id])\n @risk.destroy\n\n respond_to do |format|\n format.html { redirect_to(risks_url) }\n format.xml { head :ok }\n end\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end",
"def destroy\n @xlink = Xlink.find(params[:id])\n @xlink.destroy\n\n respond_to do |format|\n format.html { redirect_to xlinks_url }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def destroy\n @rankings = Rankings.find(params[:id])\n @rankings.destroy\n\n respond_to do |format|\n format.html { redirect_to(rankings_url) }\n format.xml { head :ok }\n end\n end",
"def delete_element(xpath)\n if NOKOGIRI\n @xml.xpath(xpath.to_s).remove\n else\n @xml.delete_element(xpath.to_s)\n end\n end",
"def delete_ontologies_and_submissions\n LinkedData::SampleData::Ontology.delete_ontologies_and_submissions\n end",
"def delete(node)\n remove_node(node)\n end",
"def destroy; delete end",
"def destroy\n @neural_strategy = NeuralStrategy.find(params[:id])\n @neural_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to(neural_strategies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n project = Project.where(:user_id => current_user[:id]).first\n project.optimized = false\n project.loading = false\n project.save\n @nodes = Node.where(:user_id => current_user[:id])\n @nodes.each do |node|\n node.jobnumber = nil\n node.vehicle_id = nil\n node.servicetime = nil\n node.tour_id = nil\n node.save\n end\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n n = Node.find_key(params[:id] || params[:name])\n render api_delete Node\n end",
"def xml_on_delete( xml )\r\n return unless @under_vlans\r\n return if @under_vlans.empty?\r\n \r\n _xml_rm_under_vlans( xml, @under_vlans )\r\n end",
"def delete_head\r\n delete_node @head\r\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @jido_grp_rel = JidoGrpRel.find(params[:id])\n @jido_grp_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(jido_grp_rels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy1\n @compare = Compare.find(params[:id])\n @compare.destroy\n\n respond_to do |format|\n format.html { redirect_to(compares_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n CMark.node_unlink(@pointer)\n end",
"def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to(clusters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def delete!\n graph.remove_edge element\n end",
"def delete!\n graph.remove_edge element\n end",
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def destroy\n @vendedores_ranking = VendedoresRanking.find(params[:id])\n @vendedores_ranking.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_vendedores_ranking_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n graph.removeVertex element\n end",
"def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end",
"def destroy\n @algorithm = Algorithm.find(params[:id])\n @algorithm.destroy\n\n respond_to do |format|\n format.html { redirect_to algorithms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @namespace = Namespace.find_by_name(params[:id])\n @namespace.destroy\n\n respond_to do |format|\n format.html { redirect_to(namespaces_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @odc_r = OdcR.find(params[:id])\n @odc_r.destroy\n\n respond_to do |format|\n format.html { redirect_to(odc_rs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n \n end",
"def deletepublish\n @question = Publishquiz.find(:all, :conditions=>\"question_id=\"+params[:question]+\" and quiz_id=\"+session[:quizid])\n @question[0].destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to datasets_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\n end\n end",
"def delete_rdf_file\n public_path = public_rdf_storage_path\n private_path = private_rdf_storage_path\n FileUtils.rm(public_path) if File.exist?(public_path)\n FileUtils.rm(private_path) if File.exist?(private_path)\n end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def rm path\n end",
"def delete!\n graph.remove_vertex element\n end",
"def destroy\n @group = Group.find_by_param(params[:id])\n @group.tuners.clear\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n end",
"def delete\n \n end",
"def remove(k)\n #First we must find the node, after this we can delete it.\n remove_avl(@root, k);\n end"
] |
[
"0.6254335",
"0.62243766",
"0.6159543",
"0.61574465",
"0.60247606",
"0.60084766",
"0.5941785",
"0.5923146",
"0.5916227",
"0.5914477",
"0.5872474",
"0.58657515",
"0.58558226",
"0.582",
"0.58148813",
"0.57818586",
"0.57775813",
"0.5769614",
"0.5764127",
"0.5763597",
"0.5762012",
"0.575301",
"0.57277477",
"0.5725305",
"0.5721702",
"0.572007",
"0.5696384",
"0.5696384",
"0.568867",
"0.56844795",
"0.5682866",
"0.5682677",
"0.56721985",
"0.56613165",
"0.56613165",
"0.56613165",
"0.56613165",
"0.56613165",
"0.5656701",
"0.5648058",
"0.5646489",
"0.5635422",
"0.56351286",
"0.5628813",
"0.56157106",
"0.56080514",
"0.55891186",
"0.5585432",
"0.5583647",
"0.5568136",
"0.5564771",
"0.55628425",
"0.55602443",
"0.55565464",
"0.5543603",
"0.55396575",
"0.5533645",
"0.5525034",
"0.55172",
"0.5513537",
"0.5503335",
"0.54948866",
"0.5491068",
"0.54909223",
"0.54909223",
"0.5490612",
"0.54888624",
"0.54865247",
"0.54852915",
"0.54818505",
"0.5481451",
"0.54805773",
"0.5477426",
"0.54736316",
"0.54676986",
"0.54676986",
"0.54607856",
"0.54585546",
"0.54558897",
"0.5443598",
"0.5442284",
"0.54418886",
"0.54405785",
"0.54403955",
"0.5434058",
"0.5434058",
"0.5433688",
"0.54290605",
"0.54247737",
"0.5419322",
"0.5417157",
"0.5415334",
"0.5412855",
"0.5406575",
"0.54051375",
"0.54008687",
"0.53926456",
"0.5390732",
"0.5388698",
"0.538689"
] |
0.69488746
|
0
|
Decrease / increase to [0, 2Pi]
|
def by_mod
l = self
if (l > Math::PI)
while (l > Math::PI)
l = l - 2*Math::PI
end
else
while (l < -Math::PI)
l = l + 2*Math::PI
end
end
l
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def increaseByTwo(a) #=> zwroci nam dwukrotnosc wartosci przypisanej do zmiennej a\n\n\ta = a * 2\n\nend",
"def calcpi()\n\n pi = 0.0\n rep = $PI_ITER\n \n while rep >= 0\n \n pi += 1.0 / pow(16.0, rep) * (4.0 / (8.0 * rep + 1.0) - 2.0 / (8.0 * rep + 4.0) - 1.0 / (8.0 * rep + 5.0) - 1 / (8.0 * rep + 6.0))\n rep -= 1\n\t\t\n end\n\t\n return pi\nend",
"def set_psi x\n if x>200\n x=200\n elsif x<0\n x=0\n end\n @@psi = x\n end",
"def change(x)\n x /= 2.2\n puts \"#{x} kilos.\"\nend",
"def calculate_pi(number)\n denominator = 1.0\n operation = 1.0\n pi = 0\n\n (1..number).each do |_count|\n pi += operation * (4.0 / denominator)\n denominator += 2.0\n operation *= -1.0\n end\n\n pi\nend",
"def ramp(step, total_steps)\n (255 * Math::sin(Math::PI/2.0/total_steps * step)).round\nend",
"def my_pi(n)\n\treturn Math::PI.round(n)\nend",
"def accel\n @speed += 7\n end",
"def my_pi(n)\n\t#p Math::PI\n\tMath::PI.round(n)\nend",
"def sbump(stop_increment)\n new_price = @stop_order.aux_price + stop_increment\n update_stop(new_price)\n end",
"def down\n self.x = (x+1)%10\n end",
"def round_down(num)\n\nend",
"def inc_by_2(numbers)\n # write your code here\nend",
"def reduce_angle(a)\n modtwopi(a)\n end",
"def perimetro\n return (@pi * 2) * @radio\n end",
"def reduce_angle2(a,k0=nil) # divisor of pi or nil for pi*2\n # we could reduce first to pi*2 to avoid the mod k0 operation\n k,r,divisor = num_class.context do\n num_class.context.precision *= 3\n m = k0.nil? ? one_cycle : half_cycle/k0\n a.divmod(m)+[m]\n end\n [r, k.modulo(k0*2).to_i, divisor]\n end",
"def volume_up(increase = 1)\n if (@volume + increase) >= 100\n @volume = 100\n else\n @volume += increase\n end\n end",
"def pv_up\n self.update!(pv: pv + 1)\n end",
"def drink_vodka\n power_down(3)\n end",
"def modulo(p0) end",
"def update_offset\n @offset_counter[1] += 0.01\n @offset_counter[1]=@offset_counter[1]%90\n @offset[1] = 30*Math.sin(@offset_counter[1]);\n @offset_counter[0]+=0.005\n @offset_counter[0]=@offset_counter[0]%90\n @offset[0] = 150*Math.sin(@offset_counter[0]);\n # @offset=[0,0]\n end",
"def W\n @x -= 1\n end",
"def converter(n, decimals=0, base=$pi)\r\n #your code here\r\nend",
"def S\n @y -= 1\n end",
"def funkcija()\nintervalo_pradzia = 10\nsandauga = 1\nwhile intervalo_pradzia <= 20\n sandauga *= intervalo_pradzia if intervalo_pradzia.even?\n intervalo_pradzia += 1\nend\nreturn sandauga\nend",
"def p_burglary\n flip(0.001, :B, :notB)\nend",
"def s1 num\n\tnum % 2\nend",
"def up\n self.x = ((x-1)+10)%10\n end",
"def doubler(num)\n return num * 2\nend",
"def s1 number\n number % 2\nend",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end",
"def set_velocity action = :increment\n if action == :increment and @velocity <= 3\n @velocity += 1\n\n elsif action == :decrement and @velocity > 1\n @velocity -= 1\n end\n end",
"def power(curr_value, to_power)\n curr_value**to_power\nend",
"def sine(float)\n Math.sin(float)\nend",
"def toggle_up(ul,lr)\r\n update_lights(ul,lr) do |i,j|\r\n\t @lights[i][j] += 2\r\n end\r\n end",
"def adjust_interval\n if @az_max - @az_min >= 2*Math::PI\n # have come full circle\n @az_min = 0\n @az_max = 2*Math::PI\n else\n @az_max %= 2*Math::PI\n @az_min %= 2*Math::PI\n end\n end",
"def advance_value2(value)\r\n raise ProgressBarError, \"Value must be a Numeric type\" \\\r\n unless value.is_a?(Numeric)\r\n raise ProgressBarError, \"Value must be between 0 and 100\" \\\r\n if (value < 0.0) || (value > 100.0)\r\n @value2 += value/100.0\r\n @value2 = 1.0 if @value2 > 1.0\r\n end",
"def violin_test(start = 0.0, dur = 1.0)\n violin(start, dur, 440, 0.5)\n $now = start + dur + 0.2\nend",
"def succ\n PowerOfTwo.new( @value + @value )\n end",
"def toggle(switches)\n 1.upto(1000) do |step|\n switches.map do |switch_num, on_or_off|\n if switch_num % step == 0\n switches[switch_num] = !on_or_off\n end\n end\n end\nend",
"def pi \n \"pi\" \n end",
"def falcon (vol)\r\n if vol < 50\r\n return 1\r\n else\r\n tubes = vol / 50\r\n if vol % 50 > 1\r\n return tubes + 1\r\n end\r\n end\r\n end",
"def pi(n)\n t = 0\n start_i = 0\n\n while start_i < n\n r = rand\n p = (1 - (r * r)) ** 0.5\n t += p\n start_i += 1\n end\n\n 4 * t / n\nend",
"def slow\n if @speed < 1.25\n @speed = 0.0\n else\n @speed = @speed - 1.25\n end\n end",
"def brake num\n @current_speed -= num\n if @current_speed < 0\n @current_speed = 0\n else\n @current_speed\n end\n end",
"def set_value(number)\n @value = offset + (number.to_i - offset) % cycle\n value\n end",
"def utilityF(delta)\n\treturn 1.0 if delta <= 0\n\treturn 2.0 ** (-delta / 30.0)\nend",
"def final_rate_adjustment rate\n (rate/100.0).ceil - 0.01\n end",
"def doubler(start)\n puts start * 2\nend",
"def up num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n #@oldindex = @current_index if num > 10\n @current_index -= num\n #unless is_visible? @current_index\n #if @prow > @current_index\n ##$status_message.value = \"1 #{@prow} > #{@current_index} \"\n #@prow -= 1\n #else\n #end\n #end\n $multiplier = 0\n end",
"def switch_angle _value=0\n send_cmd(\"switch_angle #{_value}\")\n end",
"def sin; end",
"def double(n)\n n.to_i * 2\n end",
"def speedup(amount)\n @speed += amount\n end",
"def decrease(counter)\n counter -= 1\nend",
"def slow\n if @speed < 7\n @speed = 0.0\n else\n @speed = @speed - 7\n end\n end",
"def stop\r\n accelerate((speed > 0) ? -1 : ((speed < 0) ? 1 :0))\r\n end",
"def fm_violin_test(start = 0.0, dur = 1.0)\n fm_violin(start, dur, 440, 0.5)\n $now = start + dur + 0.2\nend",
"def eat_cpu\n 100_000.times { Math.sin(0.321) } \n end",
"def spped number\n @velocity +=number\n puts \"You accelerator to #{@velocity}\"\n end",
"def turn_off\n @speed = 0\n puts \"Your current speed is now 0 mph\"\n end",
"def compute_pi(digits: 15)\n precision = digits\n result = BigMath.PI(precision)\n result = result.truncate(precision).to_s\n result = result[2..-1] # Remove '0.'\n result = result.split('e').first # Remove 'e1'\n result.insert(1, '.')\n end",
"def vat_spin_off()\n ((self.amount * self.vat.percentage) / (self.vat.percentage + 100))\n end",
"def down(side, num)\n return num > (side ** 2)-side ? num : num + side\nend",
"def pedal_faster num\n @current_speed += num\n end",
"def endless_method(num) = num * 2",
"def mirror_update pt\n pt.x = pt.x * (-1)\nend",
"def times_two(num)\n num * 2\nend",
"def flip_sign\n self * -1\n end",
"def set_psi_max x\n if x>100\n x=100\n end\n @@psi = x\n end",
"def litres(time)\n (time / 2).to_i\nend",
"def normal_speed(speed,takeoff_speed)\n return speed/takeoff_speed\nend",
"def brake\n @speed -= 5\n end",
"def stop\n accelerate((speed > 0) ? -1 : ((speed < 0) ? 1 : 0))\n end",
"def stripe_cycle\n cycle('odd', 'even')\n end",
"def increment(fast = false)\n if @type == :switch\n toggle\n else\n set_switch(true)\n self.value += calc_distance(fast)\n if @type == :variable\n self.value = self.min if self.value > @max\n else\n #barra\n self.value = @max if self.value > @max\n end\n end\n end",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\n counter - 1\nend",
"def decrease(counter)\r\n counter - 1\r\nend",
"def gpioinit yabm\n yabm.gpiosetdat(1 << 6)\nend",
"def increment\n if @type == :switch\n toggle\n else\n set_switch(true)\n self.value += @distance\n if :variable\n self.value = 0 if self.value > @max\n else\n self.value = @max if self.value > @max\n end\n end\n end",
"def npi; end",
"def f(a)\n return lsin(a) + calcpi() / 2\nend",
"def stop\n accelerate -speed\n end",
"def decrement(fast = false)\n if @type == :switch\n toggle\n else\n set_switch(true)\n self.value -= calc_distance(fast)\n if @type == :variable\n self.value = @max if self.value < self.min\n else\n #barra\n self.value = self.min if self.value < self.min\n end\n end\n end",
"def circumference_of_circle(r)\n puts PI * 2 * r\nend",
"def gpioinit yabm\n yabm.gpiosetdat(1 << 3 | 1 << 4)\nend",
"def somaDecrementa\n\t# regiao critica\n\t$var1 += 1\n\t$var2 -= 1\nend",
"def decrement\n @value -= 1\n end",
"def speed_up(number)\n @current_speed += number\n puts \"You push the gas and accelerate #{number} mph.\"\n end",
"def dec(v = 1)\n sync { @v -= v }\n end",
"def opposite(number)\n number*-1\nend",
"def sin\n math :sin\n end",
"def meth1(start, inc)\n start -= inc\n lambda{ start += inc }\nend",
"def brake num\n if num > @speed\n @speed = 0\n else\n @speed -= num\n end\n end",
"def shutter_speed_range; end",
"def increaseByThree(a)\n\n\tb = 3\n\n\ta = a + b\n\nend"
] |
[
"0.61294746",
"0.6029583",
"0.5868148",
"0.58160615",
"0.5800691",
"0.5776711",
"0.5618982",
"0.559714",
"0.5544676",
"0.55395025",
"0.5499583",
"0.54939467",
"0.5478512",
"0.5446193",
"0.54396635",
"0.543573",
"0.5425751",
"0.5408753",
"0.5383687",
"0.5367939",
"0.5357182",
"0.5350661",
"0.5348819",
"0.5338495",
"0.53339607",
"0.5332593",
"0.53313255",
"0.5315779",
"0.53136003",
"0.53080034",
"0.5307072",
"0.5298174",
"0.52966094",
"0.5274034",
"0.5231782",
"0.52219784",
"0.52094656",
"0.52091855",
"0.5204046",
"0.52020675",
"0.51948947",
"0.51907724",
"0.5188518",
"0.51876265",
"0.5187466",
"0.5181072",
"0.5176119",
"0.5175763",
"0.5171009",
"0.51695335",
"0.5169316",
"0.5168454",
"0.5165589",
"0.5164935",
"0.51495355",
"0.5148631",
"0.51362646",
"0.51321995",
"0.5127492",
"0.51240927",
"0.51212466",
"0.51159346",
"0.51134956",
"0.5112626",
"0.51108885",
"0.5110808",
"0.51067156",
"0.510616",
"0.5096664",
"0.50916576",
"0.5083342",
"0.50831467",
"0.50831383",
"0.5069443",
"0.5058293",
"0.5057909",
"0.5053174",
"0.5053174",
"0.5053174",
"0.5053174",
"0.5053174",
"0.5051109",
"0.50505453",
"0.5045669",
"0.5041908",
"0.5041151",
"0.5040378",
"0.50301987",
"0.5029528",
"0.5026459",
"0.5023811",
"0.5023318",
"0.5020652",
"0.501606",
"0.5014186",
"0.5009627",
"0.500705",
"0.5005733",
"0.49959126",
"0.49911046"
] |
0.58755034
|
2
|
used in ActiveRecord validations
|
def save; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validation; end",
"def validation; end",
"def is_valid; end",
"def validator; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validated; end",
"def validated?; end",
"def valid; end",
"def literal_validation; end",
"def literal_validation; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def subclass_validations ; true ; end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def validate\r\n\r\n end",
"def validate\n \n \n end",
"def validate\n super \n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def validator=(_); end",
"def is_valid?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate!\n raise ActiveRecord::RecordInvalid.new(self) unless valid?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def model_valid?\n true\n end",
"def model_valid?\n true\n end",
"def valid_before; end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n\n end",
"def validations\n {}\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate_on_create; end",
"def _before_validation\n end",
"def extra_validations\n success\n end",
"def validate_on_create=(_arg0); end",
"def is_valid\n return true\n end",
"def invalid; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def pre_validation\n\n\n end",
"def validate\n super\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def run_validations\n true\n end",
"def validate\r\n @invalid=false\r\n end",
"def check_record; end",
"def validate!\n # pass\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def pre_validation\n\n end",
"def valid!\n raise ActiveRecord::RecordInvalid.new(self) if invalid?\n end",
"def validate\n true\n end",
"def validate\n @invalid=false\n end",
"def validate\n valid?\n end",
"def validate!\n true\n end",
"def valid_after; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validatable?\n true\n end",
"def validate\n # add errors if not validate\n end",
"def valid_params?; end",
"def value_valid?\n return true\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def add_validation_errors(value); end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def validate!\n super()\n self\n end",
"def validate(obj, type); end",
"def validations\n []\n end",
"def valid?\n true\n end",
"def setting_validations\n errors.add(:value, I18n.t(:blank, :scope => 'activerecord.errors.messages')) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:value, I18n.t(:inclusion, :scope => 'activerecord.errors.messages')) if valid_values && !valid_values.include?(self.value)\n errors.add(:value, I18n.t(:invalid, :scope => 'activerecord.errors.messages')) if validators['format'] && !(Regexp.new(validators['format']) =~ self.value)\n end",
"def your_attributes_valid\n do_validate_attributes('your')\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_type_code => self.treatment_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate!\n\t\t\t\treturn true\n\t\t\tend",
"def valid_attributes\n { }\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validation_default; true; end",
"def validation_default; true; end",
"def before_validation_callback\n end",
"def validate(vmode=nil)\n # Holding pattern. All models should use super, in principal\n end",
"def supports_validations?\n true\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:postal_address_type_code => self.postal_address_type_code},{:city => self.city},{:address1 => self.address1}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_postal_address\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate\r\n validate! rescue false\r\n end"
] |
[
"0.76639444",
"0.76639444",
"0.76526827",
"0.7540748",
"0.7377266",
"0.7377266",
"0.7377266",
"0.7377266",
"0.73440677",
"0.7305694",
"0.73024267",
"0.7234575",
"0.7234575",
"0.7190975",
"0.7190975",
"0.7190975",
"0.7190975",
"0.7190975",
"0.7168359",
"0.7121287",
"0.7121287",
"0.7121287",
"0.7103225",
"0.7103225",
"0.704599",
"0.7036334",
"0.6964181",
"0.69597656",
"0.69597656",
"0.6925167",
"0.6917227",
"0.69059145",
"0.6879561",
"0.6867856",
"0.6865279",
"0.6865279",
"0.68481404",
"0.68470234",
"0.68470234",
"0.68470234",
"0.6815378",
"0.68137395",
"0.6812096",
"0.6793592",
"0.6766573",
"0.67627126",
"0.67627126",
"0.67627126",
"0.6757452",
"0.6750532",
"0.674936",
"0.67397946",
"0.6727216",
"0.6691525",
"0.6690841",
"0.6690841",
"0.66761667",
"0.6650355",
"0.66379696",
"0.6632267",
"0.6622446",
"0.66177607",
"0.6606811",
"0.6606533",
"0.6606533",
"0.6606533",
"0.6606533",
"0.6587624",
"0.6557623",
"0.65511036",
"0.6550394",
"0.653975",
"0.65365505",
"0.6535992",
"0.6529028",
"0.64871794",
"0.6480345",
"0.64730585",
"0.64602643",
"0.6457869",
"0.6426946",
"0.64238626",
"0.64238626",
"0.64146936",
"0.6411468",
"0.6403727",
"0.63985467",
"0.6395067",
"0.6387785",
"0.6387565",
"0.638344",
"0.63612616",
"0.6322636",
"0.6315285",
"0.6307",
"0.6307",
"0.6301512",
"0.62854826",
"0.62816054",
"0.62735873",
"0.6271855"
] |
0.0
|
-1
|
Stops the master after recieving the kill signal is overriden from ProcessManager::Daemon::Child
|
def stop
if @prepare_run_done
@runner.graceful_shutdown
end
ProcessManager::Log.info('agent exiting now')
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stopKill\n self.stop_d\n return\n end",
"def kill\n active_slaves.each_value { |s| s.kill(join: false) }\n while has_active_slaves?\n finished_child = Process.waitpid2(-1)\n process_finished_slave(*finished_child)\n end\n rescue Errno::ECHILD\n end",
"def at_exit_to_master_child_fork\n at_exit do\n pid = BEANPICKER_FORK[:child_pid]\n if pid and pid > 0\n if Process.running?(pid)\n Process.kill \"TERM\", pid\n sleep 0.1\n if Process.running?(pid)\n sleep 2\n Process.kill \"KILL\", pid if Process.running?(pid)\n end\n end\n end\n Kernel.exit!\n end\n end",
"def shutdown\n @forks.each { |w| Process.kill('SIGINT', w[:pid].to_i) }\n Process.kill('SIGINT', @master)\n end",
"def stop\n control :kill\n self\n end",
"def stop_master\n @admin.stopMaster\n end",
"def shutdown\n unless @forks.empty?\n @forks.each { |w| Process.kill('SIGTERM', w[:pid].to_i) }\n end\n Process.kill('SIGTERM', @master)\n end",
"def server_stop\n Process.kill 'INT', 0\n end",
"def stop\n system(\"pkill -f #{DAEMON}\")\n end",
"def host_child_stop(id)\n send_req({act: :host_child_stop, child_id: id})\n end",
"def kill() end",
"def kill\n server.kill\n end",
"def kill\n send(:kill)\n end",
"def stop()\n @running = false # to avoid error message from termination\n # the \"minus\" terminates all processes with the group ID @pid\n # this ensures the child and all of its grandchildren are terminated\n # PROBLEM: the children are not terminated when the parent exits\n Process.kill(\"-TERM\", @pid)\n Timer.cancel(@name)\n @@inst[self.class].delete(@name)\n end",
"def stop\n if (pid = self.class.find_pid)\n puts \"Checking first if a deployment is already in progress\"\n ProcessManager::Log.info(\"Checking first if any deployment lifecycle event is in progress #{description(pid)}\")\n begin\n if(InstanceAgent::Plugins::CodeDeployPlugin::DeploymentCommandTracker.check_deployment_event_inprogress?)\n ProcessManager::Log.info(\"Master process (#{pid}) will not be shut down right now, as a deployment is already in progress\")\n raise \"A deployment is already in Progress\",DeploymentAlreadyInProgressException\n else\n puts \"Stopping #{description(pid)}\"\n ProcessManager::Log.info(\"Stopping #{description(pid)}\")\n end \n Process.kill('TERM', pid)\n rescue Errno::ESRCH\n end\n \n begin\n Timeout.timeout(ProcessManager::Config.config[:kill_agent_max_wait_time_seconds]) do \n loop do\n begin\n Process.kill(0, pid)\n sleep(1)\n rescue Errno::ESRCH\n break\n end\n end\n end\n rescue Timeout::Error\n puts \"Child processes still running. Master going down.\"\n ProcessManager::Log.warn(\"Master process (#{pid}) going down before terminating child\")\n end\n else\n puts \"Nothing running that could be stopped\"\n end\n end",
"def stop\n # use pid in controlling process, webrick in server process\n @webrick.shutdown if @webrick\n Process.kill('INT', @pid) if @pid\n end",
"def stop\n return if @status == :stopped\n begin\n Process::kill('-TERM', @pid)\n rescue Exception => e\n # nothing here\n ensure\n @status = :stopped\n end\n end",
"def stop\n if @current_pid\n send_child :quit\n sleep 0.05\n Process.kill 'QUIT', @current_pid\n Process.waitall\n @current_pid = nil\n true\n end\n end",
"def kill()\n System.run(\"kill\", \"-9\", @pid.to_s) if @pid\n end",
"def kill\n shutdown\n end",
"def kill_parent\n logger.debug \"Killing parent process #{Process.ppid}\"\n Process.kill('TERM', Process.ppid)\n end",
"def kill\n ck_valid\n Process.kill 9, @pid if running?\n\n invalidate\n end",
"def on_kill\n\n # Commit last changes\n commit(true)\n\n # Join to the delete worker and wait wile it is done\n @thr_del_worker.join unless @thr_del_worker.nil?\n\n $log.info(self) {'Shutting down...'}\n\n # Here the thread is almost shut down\n end",
"def stop \n logger.debug \"Instance stop method called for pid '#{pid}'\"\n if pid\n if @process\n @process.stop\n else\n Process.kill(\"KILL\", pid) rescue nil\n end\n\n Dir.chdir(@felix_home) do\n begin\n stop_process.start\n rescue\n\t#Forget about exceptions here because it is probably just the spec tests\n\t#FIXME actually handle this\n end\n end\n\n begin\n File.delete(pid_path)\n rescue\n end\n end\n end",
"def kill(port, sig = \"INT\")\n if sig.is_a?(Integer)\n sig = Signal.list.invert[sig]\n end\n \n Merb::BootLoader::BuildFramework.run\n\n # If we kill the master, then the workers should be reaped also.\n if %w(main master all).include?(port)\n # If a graceful exit is requested then send INT to the master process.\n #\n # Otherwise read pids from pid files and try to kill each process in turn.\n kill_pid(sig, pid_file(\"main\")) if sig == \"INT\"\n else\n kill_pid(sig, pid_file(port))\n end\n end",
"def kill\n sig :KILL\n end",
"def shutdown\n unless @forks.empty?\n @forks.each { |w| Process.kill('QUIT', w[:pid].to_i) }\n end\n Process.waitall\n Process.kill('SIGTERM', @master)\n end",
"def kill\n signal(\"KILL\", scope: :all)\n cleanup\n end",
"def interrupt()\n Process.kill \"TERM\", *(@@children.pids) rescue nil\n end",
"def stop\n daemon_workers.each do |pid, worker_threads|\n worker_threads.each(&:kill)\n worker_threads.clear\n end\n exit\n end",
"def stop_on(signal)\n Signal.trap(signal) {\n @multi_node.stop\n }\n self\n end",
"def kill!() end",
"def kill\n @executor.shutdownNow\n nil\n end",
"def stop\n if @pid\n kind_kill -@pid\n @pid = nil\n end\n end",
"def stop\n system(\"start-stop-daemon --stop --pidfile #{pidfile}\")\n end",
"def stop\n if @pid\n Process.kill('KILL', @pid)\n Process.wait @pid\n end\n @pid = nil\n if @pgid\n Process.kill('KILL', -(@pgid))\n end\n @pgid = nil\n end",
"def stop\n ck_valid\n Process.kill 15, @pid if running?\n\n invalidate\n end",
"def stop\n @mutex_after_fork.synchronize { stop_worker }\n end",
"def stop\n if @subprocess\n Herald.kill(@subprocess)\n end\n @subprocess = nil\n self\n end",
"def kill(pid)\n check_connection\n @protocol.kill_command pid\n self\n end",
"def interrupt_forked_worker_and_exit\n Process.kill('USR1', @forked_worker_pid) if @forked_worker_pid\n Process.waitall\n exit\n end",
"def interrupt_forked_worker_and_exit\n Process.kill('USR1', @forked_worker_pid) if @forked_worker_pid\n Process.waitall\n exit\n end",
"def kill\n unless pid.nil?\n WITH_PBS ? `qdel #{pid}` : Process.kill(\"TERM\", -pid.to_i)\n set_status! :m\n end\n end",
"def kill_process!\n ::Process.kill 9, ::Process.pid\n end",
"def stop\n @pid ? Process.kill('TERM', @pid) : close_connection\n end",
"def terminate\n @process.stop\n end",
"def daemon_stopped?; end",
"def die!\n @run = false\n @loop.kill if @loop and @loop.alive?\n\n kill_pid = nil\n if @fork_master\n kill_pid = @fork_master_pid\n elsif @fork_every\n kill_pid = @fork_every_pid\n end\n\n if kill_pid and kill_pid.is_a?(Integer) and Process.running?(kill_pid)\n debug \"Killing child with pid #{kill_pid}\"\n Process.kill \"TERM\", kill_pid\n end\n\n end",
"def kill\n return unless pid\n\n if Process.waitpid(pid, Process::WNOHANG)\n logger.debug \"Child #{pid} already quit.\"\n return\n end\n\n signal_child(\"TERM\", pid)\n signal_child(\"KILL\", pid) unless quit_gracefully?(pid)\n rescue SystemCallError\n logger.debug \"Child #{pid} already quit and reaped.\"\n end",
"def terminate(pid)\n process_kill(15, pid)\n end",
"def do_exit\n log \"caught signal, shutting down\"\n self.class.remove_pid_file\n exit 130\n end",
"def stopcmd\n end",
"def stop!\n logger.info \"stopping worker #{pid}\"\n process.stop(20) # Give worker some time to stop.\n # TODO: Move stop timeout to the config?\n end",
"def stop_server(pid = @pid, signal: :TERM)\n begin\n Process.kill signal, pid\n rescue Errno::ESRCH\n end\n begin\n Process.wait2 pid\n rescue Errno::ECHILD\n end\n end",
"def kill_action\n validate :signal, :shellsafe\n validate :pid, /^\\d+$/\n\n killpid(request[:signal], request[:pid].to_i)\n\n if reply.statuscode == 0\n reply[:killed] = 1\n else\n reply[:killed] = 0\n end\n end",
"def kill_parent\n debug \"Sending INT to parent -#{Process.ppid}\"\n Process.kill(\"INT\", Process.ppid) rescue nil\n end",
"def kill(pid)\n process_kill(9, pid) #SIGKILL\n @pids.delete(pid)\n\n end",
"def auto_stop\n at_exit { self.stop! if self.running? }\n end",
"def stop\n\t\treturn nil unless self.running?\n\t\tbegin\n\t\t\tProcess.kill 'TERM', @pid\n\t\t\tProcess.waitpid( @pid, 0 )\n\t\trescue SystemCallError => err\n\t\t\t$stderr.puts \"SystemCallError while stopping: #{err.message}\" if\n\t\t\t\t$DEBUG || $VERBOSE\n\t\tend\n\n\t\t@errlog = nil\n\t\t@custom_logs = {}\n\t\tObjectSpace.undefine_finalizer( self )\t\n\tend",
"def stop\n @stopping = true\n supervisor.terminate\n end",
"def stop\n @thread.kill\n self.send(:post_stop) if self.respond_to?(:post_stop, true)\n end",
"def stop\n info \"STOP!\"\n @worker.shutdown! if @worker\n end",
"def kill_term \n Process.kill('TERM', Process.pid) \n end",
"def down\n DRb.stop_service\n @status = :stopped\n @logger.info(\"slave stopped\")\n @logger.close\n end",
"def kill_children(signal=\"SIGTERM\")\n if Foreman.windows?\n @running.each do |pid, (process, index)|\n system \"sending #{signal} to #{name_for(pid)} at pid #{pid}\"\n begin\n Process.kill(signal, pid)\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n else\n begin\n pids = @running.keys.compact\n Process.kill signal, *pids unless pids.empty?\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n end",
"def server_stop(cf, https = false)\n pid = get_pid(cf, https)\n Process.kill('INT', pid) if pid > 0\n end",
"def kill!\n @kill = true\n end",
"def stop\n process.stop\n end",
"def terminate\n super\n listener = memoize(\"#{args[:bind]}-#{args[:port]}\", :global){ nil }\n if(listener && listener.running)\n listener.stop(:sync)\n end\n unmemoize(\"#{args[:bind]}-#{args[:port]}\", :global)\n unmemoize(\"#{args[:bind]}-#{args[:port]}-queues\", :global)\n end",
"def stop\n sig :TERM\n end",
"def quit # :nodoc:\n @master = @master.close if @master\n end",
"def stop_server\n\t\tif self.pid\n\t\t\tself.log.debug \"Stopping command server at PID %d\" % [ self.pid ]\n\t\t\tProcess.kill( :TERM, self.pid )\n\t\t\tProcess.wait( self.pid, Process::WNOHANG )\n\t\t\tself.pid = nil\n\t\tend\n\tend",
"def kill_agent(pid)\n if pid\n Process.kill(0, pid)\n Process.kill(15, pid)\n end\n rescue Errno::ESRCH\n # Not Running, Nothing to do!\n end",
"def kill\n process_actor_death\n super\n end",
"def stop_workers\n if @status == :stop # rubocop:disable Gitlab/ModuleWithInstanceVariables\n Gitlab::Cluster::LifecycleEvents.do_before_graceful_shutdown\n end\n\n super\n end",
"def stop config={}\n @config.update(config).update(load_config)\n # @config = (config.empty?) ? load_config : config\n yield(self) if block_given?\n __stop! if respond_to?(:__stop!)\n pidfile = get_pidfile(@config)\n log 'No such process' and exit unless pidfile.pid\n begin\n log \"Sending TERM signal to process #{pidfile.pid}\"\n Process.kill(\"TERM\", pidfile.pid)\n rescue\n log 'Could not find process'\n ensure\n pidfile.remove\n end\n \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 stop( timeout = 5 )\n return self unless running?\n @stop = true\n\n @cleanup.call\n ObjectSpace.undefine_finalizer(self)\n\n # the cleanup call sends SIGTERM to all the child processes\n # however, some might still be hanging around, so we are going to wait\n # for a timeout interval and then send a SIGKILL to any remaining child\n # processes\n nap_time = 0.05 * timeout # sleep for 5% of the timeout interval\n timeout = Time.now + timeout\n\n until @cids.empty?\n sleep nap_time\n unless Time.now < timeout\n @cids.kill 'KILL', :all\n @cids.clear\n @group.list.each {|t| t.kill}\n break\n end\n end\n\n self\n end",
"def stop\n puts \"== The Middleman is shutting down\"\n if !@options[:\"disable-watcher\"]\n Process.kill(::Middleman::WINDOWS ? :KILL : :TERM, @server_job)\n Process.wait @server_job\n @server_job = nil\n end\n end",
"def kill\n @alive = false\n end",
"def stop!\n @monitor.kill\n @logger.info({context: :monitor, action: :stop!})\n end",
"def kill_process(pid)\n cancel_after(5) do\n kill_and_await('TERM', pid)\n end\n rescue Polyphony::Cancel\n kill_and_await(-9, pid)\n end",
"def exit_child\n exit!\n end",
"def kill\n\n threads.each { |t| t.raise(KillSignal) }\n end",
"def kill(pid)\n `kill -9 #{pid}`\n end",
"def kill\n if TerminateJobObject(@job_handle, Process.pid) == 0\n raise Error, get_last_error\n end\n end",
"def stop\n\t\tC.glyr_signal_exit(to_native)\n\tend",
"def shutdown!\n _shutdown 'SIGKILL' unless dead?\n end",
"def stop(options = {})\n # set :stopping\n info \"stopping job\"\n unsubscribe\n kill if options[:force]\n end",
"def stop\n @builder.terminate\n @server.terminate\n end",
"def stop\n Agent.stop\n end",
"def stop\n STDERR.puts \"#{short_inspect} stopping\" if ENV['VERBOSE']\n @process_should_stop_mutex.synchronize do\n @process_should_stop = true\n end\n @process_monitor_thread && @process_monitor_thread.join\n raise ProcessStillRunning, \"#{short_inspect} failed to kill.\" if running?\n @process_monitor_thread = nil\n end",
"def stop\n UI.info \"Shutting down Rack...\"\n ::Process.kill(\"TERM\", @pid)\n ::Process.wait(@pid)\n @pid = nil\n true\n end",
"def stop\n managers.each { |manager| manager << :terminate! } if managers\n @managers = nil\n\n nil\n end",
"def stop\n return if done?\n _kill 15 # never negative!\n @stdout_handler.stop\n @stderr_handler.stop\n sleep 0.05\n @pid == waitpid\n close\n end",
"def stop_gracefully\n begin\n Process.kill 15, pid\n rescue Errno::ESRCH\n # already gone\n end\n end",
"def terminate\n run_chain(:before_stop)\n\n EventMachine.stop_event_loop\n\n run_chain(:after_stop)\n end",
"def terminate_process(pid)\n signals = %i[INT TERM KILL]\n counter = 0\n while process_running?(pid)\n self.exec!(\"kill -#{signals[counter]} #{pid}\")\n sleep(5)\n counter += 1 unless counter == 2\n end\n end",
"def kill\n return true if inline\n\n @thread.raise(Shutdown, \"Shutdown due to kill request for worker: #{name}\") if @thread.alive?\n end",
"def cancel\n # send the INT signal to all children\n Process.kill(\"INT\", -pid)\n end"
] |
[
"0.7369806",
"0.73476005",
"0.7270692",
"0.7102033",
"0.7041387",
"0.6980689",
"0.6954005",
"0.69472724",
"0.6921947",
"0.6895982",
"0.68725246",
"0.6864195",
"0.6854116",
"0.6827091",
"0.6826721",
"0.68165565",
"0.6812384",
"0.6803706",
"0.67988837",
"0.6767304",
"0.674254",
"0.6739432",
"0.67153853",
"0.6712982",
"0.6700348",
"0.66996956",
"0.66915786",
"0.66887",
"0.66799814",
"0.6660911",
"0.6649232",
"0.6620758",
"0.6611266",
"0.6606687",
"0.6593629",
"0.65802145",
"0.65776515",
"0.65721107",
"0.6566623",
"0.65548867",
"0.6542735",
"0.6542577",
"0.65395856",
"0.65390986",
"0.6516529",
"0.6508564",
"0.64910114",
"0.64772683",
"0.64727414",
"0.6462596",
"0.6437501",
"0.6431643",
"0.64294124",
"0.6406467",
"0.63925135",
"0.63896227",
"0.63797534",
"0.63797325",
"0.6339873",
"0.63362616",
"0.6335672",
"0.63082165",
"0.6300913",
"0.62945163",
"0.62786114",
"0.62760234",
"0.62724185",
"0.62695783",
"0.6258956",
"0.62517756",
"0.6238233",
"0.62312335",
"0.62077147",
"0.61979043",
"0.6184499",
"0.61821055",
"0.6179504",
"0.61718",
"0.6165103",
"0.61649686",
"0.61621827",
"0.6161605",
"0.6159274",
"0.6157364",
"0.6153978",
"0.61453515",
"0.614456",
"0.6141606",
"0.6139987",
"0.6134689",
"0.6128392",
"0.6125567",
"0.61252177",
"0.61241144",
"0.6123433",
"0.61122864",
"0.6109359",
"0.6104065",
"0.60941994",
"0.6091387"
] |
0.6238943
|
70
|
Catches the trap signals and does a default or custom action is overriden from ProcessManager::Daemon::Child
|
def trap_signals
[:INT, :QUIT, :TERM].each do |sig|
trap(sig) do
ProcessManager::Log.info "#{description}: Received #{sig} - setting internal shutting down flag and possibly finishing last run"
stop_thread = Thread.new {stop}
stop_thread.join
end
end
# make sure we do not handle children like the master process
trap(:CHLD, 'DEFAULT')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trap_signals\n # kill\n trap('INT') do\n puts('INT received')\n notify_subscribers('INT received')\n stop\n end\n\n # kill\n trap('TERM') do\n puts('TERM received')\n notify_subscribers('TERM received')\n stop\n end\n\n # graceful\n trap('QUIT') do\n puts('QUIT received')\n notify_subscribers('QUIT received')\n stop_soft\n end\n\n # reset things\n trap('HUP') do\n puts('HUP received')\n notify_subscribers('HUP received')\n reset\n end\n end",
"def install_signal_handlers\n trap 'TERM' do do_exit end\n trap 'INT' do do_exit end\n end",
"def trap_signals\n trap(\"TERM\") do\n\tself.fatal!(\"TERM received\",1)\n end\n\n trap(\"INT\") do\n\tself.fatal!(\"Interrupt signal received.\", 2)\n end\n end",
"def trap_signals\n trap(\"TERM\") do\n\tself.fatal!(\"TERM received\",1)\n end\n\n trap(\"INT\") do\n\tself.fatal!(\"Interrupt signal received.\", 2)\n end\n end",
"def register_signal_handlers\n # If we're the parent process, we mostly want to forward the signals on\n # to the child processes. It's just that sometimes we want to wait for\n # them and then exit\n trap('TERM') do\n contention_aware_handler { stop!('TERM', in_signal_handler=true); exit }\n end\n trap('INT') do\n contention_aware_handler { stop!('INT', in_signal_handler=true); exit }\n end\n safe_trap('HUP') { sighup_handler.call }\n safe_trap('QUIT') do\n contention_aware_handler { stop!('QUIT', in_signal_handler=true); exit }\n end\n safe_trap('USR1') do\n contention_aware_handler { stop!('KILL', in_signal_handler=true) }\n end\n begin\n trap('CONT') { stop('CONT', in_signal_handler=true) }\n trap('USR2') { stop('USR2', in_signal_handler=true) }\n rescue ArgumentError\n warn 'Signals USR2, and/or CONT not supported.'\n end\n end",
"def trap_signals\n old_signal_callbacks = {}\n signal_callback = Proc.new do |signal|\n old_signal_callbacks[signal].call if old_signal_callbacks[signal]\n exit\n end\n\n [:INT, :TERM].each do |sig|\n old_signal_callbacks[sig] = trap(sig) { signal_callback.call(sig) }\n end\n end",
"def handle_signals(sigs)\n sigs.each do |signal|\n trap(signal) { exit_child }\n end\n end",
"def supervise\n HANDLED_SIGNALS.each { |signal| trap_signal(signal) }\n end",
"def trap_signals\n debug \"Trapping signals...\"\n Signal.trap(\"INT\") do\n $core_runtime_exiting = 1\n Kernel.puts \"Interrupting...\"\n end\n Signal.trap(\"TERM\") do\n $core_runtime_exiting = 2\n Kernel.puts \"Terminating...\"\n end\n Signal.trap(\"USR1\") do\n dump_core\n end\n end",
"def trap_signals\n %w(TERM INT).each do |signal|\n trap(signal) { stop }\n end\n end",
"def daemon_install_signal_handler\n install_signal_handler(['TERM', 'INT', 'HUP'], :trap_msg => \"Caught trap signal. Shutdown workers...\") do\n $daemon[:worker_pids].each do |pid|\n begin\n Process.kill('TERM', pid)\n rescue => exception\n end\n end\n $daemon[:work] = false\n end\nend",
"def trap_signals\n Signal.trap(\"TERM\") { stop! }\n Signal.trap(\"INT\") { manual_stop! }\n end",
"def setup_traps\n\t\tSignal.trap(\"TERM\") { yield }\n\t\tSignal.trap(\"INT\") { yield }\n\tend",
"def handle_signal( signal )\n\t\tself.log.info \"Handling %p signal.\" % [ signal ]\n\t\tcase signal\n\t\twhen :INT, :TERM, :HUP\n\t\t\tself.stop\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end",
"def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end",
"def register_signals\n trap(:INT) { debug \"Recieved INT\"; exit!}\n end",
"def trap_signals\n Signal.trap('INT') do\n say \"\\nQuitting...\", :red\n Kernel.exit\n end\n end",
"def sigHandler\n Signal.trap(\"INT\") { stop }\n Signal.trap(\"TERM\") { stop }\n end",
"def trap_sigint(metabolizer, &block)\n trap 'SIGINT', proc {\n block.call if block\n metabolizer.stop\n }\nend",
"def register_signal_handlers\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n trap('QUIT') { shutdown }\n trap 'SIGHUP', 'IGNORE'\n end",
"def setup_signals\n trap(\"TERM\") { @log.info(\"SIGTERM, forced shutdown.\"); shutdown(force=true) }\n trap(\"INT\") { @log.info(\"SIGINT, graceful shutdown started.\"); shutdown }\n begin\n trap(\"HUP\") { @log.info(\"SIGHUP, graceful shutdown started.\"); shutdown }\n trap(\"USR2\") { @log.info(status_info) }\n rescue ArgumentError\n # Probably on Windows and these signals aren't supported\n nil\n end\n end",
"def do_exit\n log \"caught signal, shutting down\"\n self.class.remove_pid_file\n exit 130\n end",
"def handle_signal(sig)\n case sig\n when :TERM\n handle_term_signal\n when :INT\n handle_interrupt\n when :HUP\n handle_hangup\n when *HANDLED_SIGNALS\n handle_signal_forward(sig)\n else\n system \"unhandled signal #{sig}\"\n end\n end",
"def setup_signal_traps\n if Signal.list.include?(\"TRAP\")\n Signal.trap(\"TRAP\") do\n @level = case @level\n when :debug\n @previous_level || :info\n else\n @previous_level = @level\n :debug\n end\n end\n end\n if Signal.list.include?(\"USR2\")\n Signal.trap(\"USR2\") do\n if @reopen\n reopen(@reopen)\n end\n end\n end\n end",
"def set_signal_trap\n finalizer = Proc.new { finalize }\n Signal.trap(:INT, finalizer)\n end",
"def signal( sig )\n return if child?\n return unless alive?\n Process.kill(sig, @child_pid)\n end",
"def add_sigint_handler\n trap 'INT' do\n puts '\\nCancelled. Bye Bye!'\n exit!\n end\n end",
"def on_term_signal(&block)\n # trap(:TERM) {}\n warn \"Missing implementation 'on_term_signal'\"\n end",
"def register_signal_handlers!\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n end",
"def register_signal_handlers\r\n\t\t\ttrap('TERM') { shutdown! }\r\n\t\t\ttrap('INT') { shutdown! }\r\n\r\n\t\t\tbegin\r\n\t\t\t\ttrap('QUIT') { shutdown }\r\n\t\t\trescue ArgumentError\r\n\t\t\tend\r\n\t\tend",
"def reset_signal_handlers\n Signal.list_trappable.each_key do |signal|\n begin\n prev_handler = trap(signal, DEFAULT)\n if prev_handler != DEFAULT\n @previous_signal_handlers[signal] = prev_handler\n end\n rescue ArgumentError\n # Signal cannot be trapped; ignore it.\n end\n end\n trap('HUP', IGNORE)\n PhusionPassenger.call_event(:after_installing_signal_handlers)\n end",
"def process_signal(signal_name)\n if signal_name == 'TERM'\n if @shutdown\n logger.info \"TERM received again, exiting immediately\"\n Process.exit(1)\n else\n logger.info \"TERM received, starting graceful shutdown\"\n graceful_shutdown\n end\n elsif signal_name == 'USR1'\n logger.info \"USR1 received, hot restart in progress\"\n hot_restart\n end\n end",
"def kill_action\n validate :signal, :shellsafe\n validate :pid, /^\\d+$/\n\n killpid(request[:signal], request[:pid].to_i)\n\n if reply.statuscode == 0\n reply[:killed] = 1\n else\n reply[:killed] = 0\n end\n end",
"def setup_signals\n %w(INT TERM QUIT).each do |signal|\n trap(signal) do\n @reapers += 1\n\n unless @reapers > 1\n reap_workers\n exit(0)\n end\n end\n end\n\n trap \"USR2\" do\n # avoid re-execing in case a previous signal was already sent.\n unless @reexecing\n @reexecing = true\n reap_workers\n reexec\n end\n end\n end",
"def register_signal_handlers\n trap(\"QUIT\") { stop }\n trap(\"INT\") { @stop ? stop! : stop }\n trap(\"TERM\") { stop! }\n end",
"def entrapment\n # setup trap chain once.\n Base.trapped = true\n app = self\n\n # 'get' previous trap by replacing any existing trap with 'IGNORE'\n previous_trap = trap(:INT, 'IGNORE')\n\n # substitute our trap and chain it to previous by explicitly invoking\n # the previous trap. ruby makes this somewhat difficult and rack then\n # makes it even harder.\n trap(:INT) do\n begin\n # loggers may have closed file handles in a trap so disconnect any\n # loggers from multiplexer before continuing. even when they do not\n # raise exceptions they still appear to log nothing at this point\n # (not sure about syslog, definitely not file or console).\n if app.logger.respond_to?(:targets)\n # HACK: it is bad that Multiplexer#targets exposes its internal\n # array in a manner that allows us to clear it. it would be better\n # if to have a Multiplexer#reset method we could call instead.\n # to ensure that cleaning continues to work, check the result\n # afterward. note that we tried iterating targets and calling the\n # Multiplexer#remove method but that had no effect.\n app.logger.targets.clear\n fail 'Unexpected targets' unless app.logger.targets.empty?\n app.logger.warn('cannot log traps') # no exception raised\n end\n\n # interrupt any running app threads to resolve outstanding requests.\n #\n # note that Mutex#synchronize is not allowed inside a trap context.\n #\n # FIX: duplicating the set is slightly unsafe but not sure how else\n # to deal with data protected by critical section in a trap. we also\n # have logic in ensure block to avoid modifying set on interrupt.\n app.class.interrupted = true\n app_threads = app.class.app_threads.dup\n app_threads.each do |app_thread|\n if app_thread.alive?\n app_thread.raise(::Interrupt)\n app_thread.join\n end\n end\n\n # cleanup fixtures, if requested.\n app.cleanup\n if previous_trap && previous_trap.respond_to?(:call)\n previous_trap.call\n else\n exit\n end\n rescue ::Exception => e\n # loggers are unreliable so write any rescued error home.\n msg = ([e.class, e.message] + (e.backtrace || [])).join(\"\\n\")\n dir = ::ENV['HOME'] || ::Dir.pwd\n path = ::File.join(dir, 'might_api_rescued_error.txt')\n ::File.open(path, 'w') { |f| f.puts msg }\n exit 1\n end\n end\n true\n end",
"def setup_signals\n @trapped_count ||= 0\n\n stopper = proc do\n @trapped_count += 1\n stop!\n\n # Reset count after 5 seconds\n EM.add_timer(5) { @trapped_count = 0 }\n end\n\n trap('INT') do\n stopper.call\n abort \"Multiple INT signals trapped; aborting!\" if @trapped_count > 1\n end\n\n trap('TERM') { stopper.call }\n\n unless !!RUBY_PLATFORM =~ /mswin|mingw/\n trap('QUIT') { stop! }\n trap('HUP') { restart }\n end\n end",
"def exit_on_signals\n install_signal_handlers unless defined?(@_signal)\n\n if @_signal\n log \"Exiting due to SIG#{@_signal}\"\n exit(1)\n end\n end",
"def register_signal_handlers\n trap(\"TERM\") { shutdown }\n trap(\"INT\") { shutdown }\n trap('QUIT') { shutdown } unless defined? JRUBY_VERSION\n end",
"def process_signal(signal_name)\n if signal_name == 'TERM'\n if $shutdown\n logger.info \"TERM received again, exiting immediately\"\n Process.exit(1) if $shutdown\n else\n logger.info \"TERM received, starting graceful shutdown\"\n $shutdown = true\n graceful_shutdown\n end\n elsif signal_name == 'USR1'\n logger.info \"USR1 received, hot restart in progress\"\n hot_restart\n end\n end",
"def signal_child(signal, child)\n log \"Sending #{signal} signal to child #{child}\"\n Process.kill(signal, child)\n end",
"def quiet_traps\n trap(\"TERM\") do\n exit 1\n end\n\n trap(\"INT\") do\n exit 2\n end\n end",
"def register_signal_handlers\n trap('TERM') { shutdown! }\n trap('INT') { shutdown! }\n\n trap('QUIT') { shutdown }\n\n log.info \"Registered signals\"\n end",
"def initialize_sighandlers\n trap(:INT) do\n stop\n exit\n end\n end",
"def trap_signals\n [\"TERM\", \"INT\"].each do |signal|\n trap(signal) do\n @thin_server.stop! if @thin_server\n EM.stop\n end\n end\n end",
"def added_signal(child, info) # :nodoc:\n\t super\n invalidate_task_terminal_flag_if_needed(child)\n end",
"def signal_child(signal, child)\n logger.debug \"Sending #{signal} signal to child #{child}\"\n Process.kill(signal, child)\n end",
"def register_signal_handlers\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n\n begin\n trap('QUIT') { shutdown }\n trap('USR1') { pause_processing }\n trap('CONT') { unpause_processing }\n rescue ArgumentError\n warn \"Signals QUIT, USR1, USR2, and/or CONT not supported.\"\n end\n\n log! \"Registered signals\"\n end",
"def capture_signals\n %w[ TERM INT QUIT HUP ].each do |signal|\n Signal.trap(signal) { stop }\n end\n end",
"def signal_received=(_arg0); end",
"def register_signals\n trap(\"TERM\") { self.bunny.stop }\n trap(\"INT\") { self.bunny.stop }\n end",
"def signal; end",
"def signal; end",
"def __crash_handler__(actor, reason)\n if reason # is nil if the actor exits normally\n @lowdown_crash_conditions_mutex.synchronize do\n @lowdown_crash_conditions.each do |condition|\n condition.signal(reason)\n end\n end\n end\n super\n end",
"def trap_deferred(signal)\n trap(signal) do |sig_nr|\n if @waiting_for_reaper && [:INT, :TERM].include?(signal)\n log \"Recieved #{signal}: short circuiting QUIT waitpid\"\n raise QuitNowException\n end\n if sig_queue.size < SIG_QUEUE_MAX_SIZE\n sig_queue << signal\n awaken_master\n else\n log \"ignoring SIG#{signal}, queue=#{sig_queue.inspect}\"\n end\n end\n end",
"def on_process_notice_signal(event)\n info \"Received #{event[:signal]} system signal\"\n end",
"def register_signal_handlers\n HANDLED_SIGNALS.each do |sig|\n if ::Signal.list.include? sig.to_s\n trap(sig) { Thread.main[:signal_queue] << sig ; notice_signal }\n end\n end\n end",
"def handle_signal(sig)\n pids = @old_workers.keys.sort\n msg = \"received #{sig}, \"\n\n # Resque workers respond to a few different signals:\n # * TERM / INT - Immediately kill child then exit\n # * QUIT - Wait for child to finish processing then exit\n # * USR1 - Immediately kill child but don't exit\n # * USR2 - Don't start to process any new jobs\n # * CONT - Start to process new jobs again after a USR2\n case sig\n when 'TERM', 'INT' \n @logger.info msg << \"immediately kill all resque workers then exit:#{pids}\"\n @shutdown = true\n Process.kill(sig, *pids)\n when 'QUIT'\n @logger.info msg << \"wait for all resque workers to finish processing then exit:#{pids}\"\n @shutdown = true\n Process.kill(sig, *pids)\n when 'USR1'\n @logger.info msg << \"immediately kill the child of all resque workers:#{pids}\"\n Process.kill(sig, *pids)\n when 'USR2'\n @logger.info msg << \"don't start to process any new jobs:#{pids}\"\n Process.kill(sig, *pids)\n when 'CONT'\n @logger.info msg << \"start to process new jobs again after USR2:#{pids}\"\n Process.kill(sig, *pids)\n when 'TTIN'\n @num_workers += 1\n @logger.info msg << \"increment the number of resque workers:#{@num_workers}\"\n maintain_worker_count # ToDo: forking from a thread would be unsafe\n when 'TTOU'\n @num_workers -= 1 if @num_workers > 0\n @logger.info msg << \"decrement the number of resque workers:#{@num_workers}\"\n maintain_worker_count\n end\n rescue Errno::ESRCH\n rescue => e\n @logger.error(e)\n exit(1)\n end",
"def on_termination_signal( signo )\n\t\tself.log.warn \"Terminated (%p)\" % [ signo ]\n\t\tself.shutdown\n\tend",
"def signal_received; end",
"def added_signal(child, info) # :nodoc:\n super\n invalidate_task_terminal_flag_if_needed(child)\n end",
"def handle_signal( sig )\n\t\tself.log.debug \"Handling signal %s\" % [ sig ]\n\t\tcase sig\n\t\twhen :INT, :TERM\n\t\t\tself.on_termination_signal( sig )\n\n\t\twhen :HUP\n\t\t\tself.on_hangup_signal( sig )\n\n\t\twhen :USR1\n\t\t\tself.on_user1_signal( sig )\n\n\t\telse\n\t\t\tself.log.warn \"Unhandled signal %s\" % [ sig ]\n\t\tend\n\n\tend",
"def worker_install_signal_handler\n install_signal_handler(['TERM'], :trap_msg => \"Caught trap signal. Shutdown...\", :ignore_signals => ['HUP', 'INT']) do\n # Shutdown task_queue. Because of Ruby 2.0, we have to do this in a Thread to prevent \"can't be called from trap context\"-errors!\n Thread.new do\n $worker[:task_queue].update_attributes state: 'shutdown' if $worker[:task_queue]\n end\n $worker[:work] = false\n end\nend",
"def process_hook\n fail 'child class to implement'\n end",
"def untrap_info\n return unless Signal.list['INFO']\n\n trap 'INFO', 'DEFAULT'\n end",
"def register_signal_handlers\n trap('TERM') { shutdown! }\n trap('INT') { shutdown! }\n\n begin\n trap('QUIT') { shutdown }\n rescue ArgumentError\n warn \"Signals TERM and/or QUIT not supported.\"\n end\n\n log! \"Registered signals\"\n end",
"def setup_traps\n ['INT', 'TERM'].each do |sig|\n old = trap(sig) do\n un_register\n @amq.instance_variable_get('@connection').close do\n EM.stop\n old.call if old.is_a? Proc\n end\n end\n end\n true\n end",
"def agent_trap_state\n super\n end",
"def initialize\n @commands = []\n super\n\n trap(\"TERM\") do\n Backdat::Application.fatal!(\"SIGTERM received, stopping\", 1)\n end\n\n trap(\"INT\") do\n Backdat::Application.fatal!(\"SIGINT received, stopping\", 2)\n end\n\n trap(\"QUIT\") do\n Backdat::Log.info(\"SIGQUIT received, call stack:\\n \", caller.join(\"\\n \"))\n end\n\n trap(\"HUP\") do\n Backdat::Log.info(\"SIGHUP received, reconfiguring\")\n reconfigure\n end\n end",
"def interrupt()\n Process.kill \"TERM\", *(@@children.pids) rescue nil\n end",
"def setup_worker_signals\n %w(INT TERM QUIT).each do |signal|\n trap(signal) do\n # 1. updates the name so that an analysis tool can see that the signal\n # was received and the process is aware of its termination\n setup_name \"Worker #{@identifier} - terminating\"\n\n # 2. if the process is not currently processing any request, finish\n # immediately\n exit!(0) unless @busy\n\n # 3. if the process is currently processing a request, mark it as killed\n # so that the process can terminate when the processing is done.\n @killed = true\n end\n end\n end",
"def restore_default_signal_handlers\n HANDLED_SIGNALS.each do |sig|\n trap(sig, :DEFAULT) if ::Signal.list.include? sig.to_s\n end\n end",
"def on_signal(name, t1, t2)\n t1.kill\n t2.kill if t2\n cleanup name\n exit 1\n end",
"def fake_sig(sig) # :nodoc:\n old_cb = trap(sig, \"IGNORE\")\n old_cb.call\n ensure\n trap(sig, old_cb)\n end",
"def setup_signal_handlers\n Thread.abort_on_exception = true\n\n Signal.trap('INT') do\n @stop_server = true\n @stop_server_cv.broadcast\n end\n\n Signal.trap('TERM') do\n @stop_server = true\n @stop_server_cv.broadcast\n end\n end",
"def term_process_request(cgi)\n install_signal_handler('TERM',method(:busy_exit_handler).to_proc)\n Dispatcher.dispatch(cgi)\n rescue Exception => e # errors from CGI dispatch\n raise if SignalException === e\n dispatcher_error(e)\n ensure\n install_signal_handler('TERM', method(:exit_now_handler).to_proc)\n end",
"def signal_handle\n unless @context.ignore_sigint?\n print \"\\nabort!\\n\" if @context.verbose?\n exit\n end\n\n case @signal_status\n when :IN_INPUT\n print \"^C\\n\"\n raise RubyLex::TerminateLineInput\n when :IN_EVAL\n IRB.irb_abort(self)\n when :IN_LOAD\n IRB.irb_abort(self, LoadAbort)\n when :IN_IRB\n # ignore\n else\n # ignore other cases as well\n end\n end",
"def install_siginfo_handler\n return unless Signal.list.include? 'INFO'\n\n @old_siginfo = trap 'INFO' do\n puts @current if @current\n end\n end",
"def on_exit\n end",
"def signal\n end",
"def trap_signal(signal)\n trap(signal) do\n notice_signal(signal)\n (@callbacks[signal] || []).each(&:call)\n end\n end",
"def event_sighup()\n _load_registrations\n load_command_methods\n dispatch :log, \"SIG-HUP, controls.rb reloaded\"\nend",
"def handle_term_signal\n system \"SIGTERM received, starting shutdown\"\n @shutdown = true\n end",
"def isolate_signals=(_arg0); end",
"def on_interrupt(&block)\n trap(\"INT\") { yield \"SIGINT\" }\n trap(\"QUIT\") { yield \"SIGQUIT\" }\n trap(\"TERM\") { yield \"SIGTERM\" }\n end",
"def isolate_signals; end",
"def kill_children(signal=\"SIGTERM\")\n if Foreman.windows?\n @running.each do |pid, (process, index)|\n system \"sending #{signal} to #{name_for(pid)} at pid #{pid}\"\n begin\n Process.kill(signal, pid)\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n else\n begin\n pids = @running.keys.compact\n Process.kill signal, *pids unless pids.empty?\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n end",
"def trap(signal, &block)\n if Signal.list.include?(signal)\n Kernel.trap(signal, &block) unless Merb.disabled?(:signals)\n end\n end",
"def remove_siginfo_handler\n return unless Signal.list.key? 'INFO'\n\n handler = @old_siginfo || 'DEFAULT'\n\n trap 'INFO', handler\n end",
"def daemonized(&block)\n self.set_prerun_config_defaults\n self.set_process_name\n self.drop_privileges\n self.daemonize\n self.chroot\n self.clean_fd\n self.redirect_io\n\n yield\n end",
"def handle_old_mode\n disable_trap if @mode == Modes::SIGNAL\n end",
"def onCmdPanic(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip, :panic\n @watcher.cmdPanic\n end",
"def handle_interrupt\n system \"SIGINT received, starting shutdown\"\n @shutdown = true\n end",
"def signal_pid(signal, pid_file)\n run \"[[ -f #{ pid_file } ]] && (cat #{pid_file} | xargs kill -#{signal});true\"\nend",
"def on_process_notice_signal(event)\n info \"Received #{event[:signal]} system signal\"\n\n # We print backtrace only for ttin\n return unless event[:signal] == :SIGTTIN\n\n # Inspired by Sidekiq\n Thread.list.each do |thread|\n tid = (thread.object_id ^ ::Process.pid).to_s(36)\n\n warn \"Thread TID-#{tid} #{thread['label']}\"\n\n if thread.backtrace\n warn thread.backtrace.join(\"\\n\")\n else\n warn '<no backtrace available>'\n end\n end\n end",
"def subprocess_trap(io)\n trap('INT') do\n Process.kill('INT', io.pid)\n while (line = io.gets) do\n puts line\n end\n exit\n end\nend",
"def forward_signals_to(pid, signals = %w[INT])\n # Set up signal handlers\n logger.debug \"Setting up signal handlers for #{signals.inspect}\"\n signal_count = 0\n signals.each do |signal|\n Signal.trap(signal) do\n Process.kill signal, pid rescue nil\n\n # If this is the second time we've received and forwarded\n # on the signal, make sure next time we just give up.\n reset_handlers_for signals if ++signal_count >= 2\n end\n end\n\n # Run the block now that the signals are being forwarded\n yield\n ensure\n # Always good to make sure we clean up after ourselves\n reset_handlers_for signals\n end",
"def setup_signal_traps\n @signal_pipe_r, @signal_pipe_w = IO.pipe\n\n %w(TERM USR1).each do |signal_name|\n trap(signal_name) do\n @signal_pipe_w.puts(signal_name)\n end\n end\n end",
"def setup_signal_traps\n @signal_pipe_r, @signal_pipe_w = IO.pipe\n\n %w(TERM USR1).each do |signal_name|\n trap(signal_name) do\n @signal_pipe_w.puts(signal_name)\n end\n end\n @signal_pipe_r\n end"
] |
[
"0.7044149",
"0.70146704",
"0.6954334",
"0.6954334",
"0.6849687",
"0.68458784",
"0.6702279",
"0.67012864",
"0.6656735",
"0.665435",
"0.6638909",
"0.65601486",
"0.65405613",
"0.653179",
"0.64835334",
"0.64835334",
"0.63996255",
"0.6360999",
"0.63107574",
"0.63008964",
"0.6297262",
"0.62818795",
"0.6274308",
"0.6272802",
"0.6147684",
"0.6135995",
"0.6135701",
"0.6122493",
"0.6121359",
"0.61206925",
"0.608726",
"0.60741043",
"0.60672075",
"0.6035076",
"0.6031774",
"0.60257286",
"0.6023779",
"0.600428",
"0.599743",
"0.5993254",
"0.5989169",
"0.5955956",
"0.5944764",
"0.59080577",
"0.5890124",
"0.5875815",
"0.5873725",
"0.58699197",
"0.58580816",
"0.58546424",
"0.58518636",
"0.58375424",
"0.5831488",
"0.5831488",
"0.5829018",
"0.5823661",
"0.57758343",
"0.57659745",
"0.576077",
"0.5747807",
"0.57177943",
"0.5716252",
"0.5706856",
"0.56984115",
"0.5685235",
"0.5675548",
"0.5673755",
"0.56730634",
"0.5664552",
"0.5655818",
"0.56537396",
"0.563068",
"0.5622072",
"0.5620219",
"0.5605945",
"0.55922323",
"0.5590242",
"0.5579259",
"0.5568402",
"0.5555983",
"0.55531555",
"0.555184",
"0.55509317",
"0.554992",
"0.5549684",
"0.5546447",
"0.5545264",
"0.5537979",
"0.552513",
"0.54943866",
"0.5492123",
"0.549158",
"0.54907864",
"0.54849505",
"0.546777",
"0.5467547",
"0.5464776",
"0.5461731",
"0.545239",
"0.54502"
] |
0.76223844
|
0
|
Partner Help Email Notifications
|
def partner_help_notice(partner_help_id)
ActsAsTenant.current_tenant = nil
@partner_help = PartnerHelp.find(partner_help_id)
mail(subject: 'YesTrak Partner Help Form', to: @partner_help.email, bcc: "#{APP_CONFIG['admin_emails']}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <[email protected]>\",\n from: \"BaseRails <[email protected]>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end",
"def employeer_notification\n NotificationMailer.employeer_notification\n end",
"def help_new(help)\n @help = help\n\n mail to: \"[email protected]\",\n subject: \"Help Requested!!\"\n end",
"def instructor_help_email(student,admin)\n @admin = admin\n @student = student\n\n # carrier phone numbers:\n # T-Mobile: [email protected] max 140 char\n # Verizon: [email protected] max 160 char\n # Sprint: [email protected] max 160 char\n # AT&T: [email protected] max 160 char\n # Virgin Mobile: [email protected] max 125 char\n # phonenumber = 10-digit cell phone number, no dashes or spaces\n\n # Email to SMS Messaging is FREE to send. Recipient is charged for receipt\n # of SMS according to their plan.\n\n # Free Bulk SMS Messaging\n recipients = []\n\n for admin in @admin\n recipients.push(admin.phone + \"@\" + domain(admin.carrier)) if admin.receive_sms\n recipients.push(admin.email) if admin.receive_email\n end\n\n mail(:to => recipients,\n :subject => \"#{@student.name} wants coding help!\")\n\n end",
"def application_help\n UserMailer.application_help\n end",
"def help\n @greeting = \"Help me!\"\n # mail to: \"[email protected]\"\n mail to: \"[email protected]\"\n # mail to: \"[email protected]\"\n end",
"def sendAlertEmail\n QuestionMailer.question(self)\n end",
"def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end",
"def notify_manager_for_panel(emp_from, req, resume, emp_to, emp_array)\n subject 'Interview added for your requirement'\n recipients [ emp_to.email ]\n from [ \"[email protected]\" ]\n sent_on Time.now\n content_type 'text/html'\n body :emp_from => emp_from,\n :emp_to => emp_to,\n :emp_array => emp_array,\n :req => req,\n :resume => resume\n end",
"def notify(doctor ,recipient, subject, text)\n subject += \" sent to: #{recipient}, by: #{doctor.full_name}\" \n\t\tadmin_assists = AdminAssistant.all \n if admin_assists\n admin_assists.each do |adm|\n custom_email(adm, subject, text)\n end\n end\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def show_notfication\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notification_for(product)\n \t@product = product \n mail(:to => @product.user.email, :subject => \"Perishab.ly alert regarding your #{@product.name}\")\n end",
"def customer_support(question, email)\n new_ticket = Slack::Notifier.new ENV['slack_webhook_url'],\n channel: \"#customer-support\",\n username: self.username\n message = \"#{self.username} asks #{question}. Email: #{email}\"\n new_ticket.ping message\n\n message\n end",
"def funded_email_to_creator\n Pony.mail(:to => self.email, :from => '[email protected]', :subject => 'the gift you created is now funded!', :body => 'yay! some people owe you money.')\n end",
"def show_notfication\n UserMailer.show_notfication\n end",
"def notification(params)\n mail(params)\n end",
"def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <[email protected]>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end",
"def new_notification\n mail(to: \"[email protected]\", subject: 'New Notification', sent_on: Time.now)\n end",
"def support_enquiry_notifier(enquiry, title)\n @title = title\n @name = enquiry.name\n @email = enquiry.email\n @message = enquiry.message\n @topic = enquiry.topic\n subject = \"#{@name} - #{@topic} - #{@title}\"\n\n @stats = enquiry.stats['categories']\n\n mail_hash = {subject: subject}\n\n if enquiry.stats.sender_email.present?\n mail_hash.merge!({from: enquiry.stats.sender_email})\n end\n\n if enquiry.stats.recipient_email.present?\n mail_hash.merge!({to: default_params[:to],\n bcc: enquiry.stats['recipient_email'].split(\",\").map(&:strip)})\n end\n\n mail(mail_hash)\n end",
"def notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end",
"def feedback\n NotebookMailer.feedback\n end",
"def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notify\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_email_changed_notification; end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_notifications\n end",
"def email(defn, participant, assignment)\n defn[:body][:type] = \"Teammate Review\"\n participant = AssignmentParticipant.find(reviewee_id)\n topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)\n defn[:body][:obj_name] = assignment.name\n user = User.find(participant.user_id)\n defn[:body][:first_name] = user.fullname\n defn[:to] = user.email\n Mailer.sync_message(defn).deliver\n end",
"def follow_up_alert(email, name, body, body_part2, location_link)\n @name = name \n @body = body\n @body_part2 = body_part2\n @location_link = location_link\n\n mail to: email, subject: \"Follow-up info from Grapevine\", from: \"[email protected]\", reply_to: \n \"[email protected]\"\n\n end",
"def mailer; end",
"def notify_admin_about_newbie(user)\n @user = user\n mail \n end",
"def twiki_created_notification(person, options={})\n @person = person\n mail(:to=>[@person.personal_email],\n :subject=>options[:subject] || \"Twiki account information (\"[email protected]+\")\",\n :date=>Time.now)\n end",
"def send_email_changed_notification?; end",
"def send_notifications\n return if participant.nil?\n return unless participant.phone_number.length == 10\n\n # grab first 95 characters of description to serve as a preview\n description_preview = description[0...95]\n send_sms(participant.phone_number,\n \"An event in Binder has been assigned to you: #{description_preview}...\")\n end",
"def notify_host\n OrganisationMailer.notify_host\n end",
"def dispatch_to_default_with_helpdesk\n issue = receive_issue\n roles = issue.author.roles_for_project(issue.project)\n # add owner-email only if the author has assigned some role with\n # permission treat_user_as_supportclient enabled\n if roles.any? {|role| role.allowed_to?(:treat_user_as_supportclient) }\n sender_email = @email.from.first\n #XXX the email_details overrides bellow: there is subroutine call instead\n email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n\n custom_field = CustomField.find_by_name('cc-handling')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.project.id, custom_field.id).first\n\n if ([email protected]?) && (custom_value.value == '1')\n carbon_copy = @email[:cc].formatted.join(', ')\n email_details << \"Cc: \" + carbon_copy + \"\\n\"\n custom_field = CustomField.find_by_name('copy-to') \n\t custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).first\n custom_value.value = carbon_copy\n custom_value.save(:validate => false)\n else\n carbon_copy = nil\n end\n\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details = \"<pre>\\n\" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"</pre>\"\n\t email_details = compose_email_details()\n issue.description = email_details + issue.description\n issue.save\n custom_field = CustomField.find_by_name('owner-email')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).\n first\n custom_value.value = sender_email\n custom_value.save(:validate => false) # skip validation!\n \n # regular email sending to known users is done\n # on the first issue.save. So we need to send\n # the notification email to the supportclient\n # on our own.\n \n HelpdeskMailer.email_to_supportclient(issue, {:recipient => sender_email,\n :carbon_copy => carbon_copy} ).deliver\n # move issue's description onto the new (1-st) journal entry\n journal = Journal.new(:journalized_id => issue.id, :journalized_type => 'Issue', :user_id => issue.author.id, :notes => issue.description, :private_notes => false, :created_on => issue.created_on)\n journal.notify = false # regular email sending to known users is done so no need to notify one more time about this technical operation\n journal.save\n issue.description = ''\n issue.save\n\n end\n after_dispatch_to_default_hook issue\n return issue\n end",
"def notify_mail\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\", subject: \"[Localgarage]Printer_URL\"\n end",
"def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end",
"def cmd_notify_help\n\t\t\t\tputs \"Run notify_set_user, notify_set_webhook, and notify_set_source to setup Slack config. Then run notify_save to save them for later. Use notify_test to test your config and load it from the YAML file in the future. Finally, run notify_start when you have your listener setup.\"\n\t\t\tend",
"def admin_story_email\n NotificationsMailer.admin_story_email(Story.first)\n end",
"def get_help \n @booking = Booking.find(params[:id])\n owner = @booking.creator\n Notification.notify_admin(\"#{owner.first_name} #{owner.last_name} has asked for help choosing a presenter for their booking\", booking_path(@booking), :get_help)\n flash[:info] = \"An admin has been notified that you would like help choosing. They will be in contact with you shortly\"\n @booking.help_required = true\n @booking.save\n redirect_to booking_path(@booking)\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def new_notification(name,email,mobile,description)\n @name = name\n @email = email\n @mobile = mobile\n @description = description\n mail to: \"[email protected], [email protected] \", subject: \"Query From Super White Marble\"\n end",
"def course_notification\n @course = Course.first\n @teacher = @course.teachers.first\n @students = @course.students\n @title = \"一个好消息\"\n @content = \"今天不上课\\n大家好好休息\"\n NotificationMailer.course_notification @teacher, @course, @students, @title, @content\n end",
"def weekly_email\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_notification\n\n\n end",
"def notification\n BookingMailer.notification\n end",
"def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end",
"def chore_notification_email(assignment)\n @user = assignment.user\n @chore = assignment.chore\n @due_date = assignment.due_date.to_formatted_s(:long_ordinal)\n @url = complete_chore_url(assignment)\n sendgrid_category \"Chore Notification\"\n # sendgrid_unique_args :key2 => \"newvalue2\", :key3 => \"value3\"\n mail :to => @user.email, :subject => \"#{@user.name}. You've got a chore!\"\n end",
"def new_question(question, recepient)\n if recepient.privacy_setting.notify_on_new_question \n @question, @recepient = question, recepient\n mail(\n :subject => \"#{@question.user.name} just asked a new question.\",\n :from => \"[email protected]\",\n :to => recepient.email,\n :date => Time.now\n )\n end\n end",
"def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end",
"def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end",
"def review_notification(book,user)\n @greeting = \"Hi\"\n @book=book\n @user=user\n mail to: user.email\n end",
"def welcome_email(resource)\n \n @resource = resource\n\n mail :to => @resource.email, :from => \"[email protected]\", :subject => \"Subject line\"\n \n end",
"def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def event_mail\n NoticePlannerMailer.delay.notice_planner_email('[email protected]', 'test', 'cron-test', 'https://yahoo.co.jp')\n end",
"def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end",
"def ask_office_for_answer_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.ask_office_for_answer_mail(Petition.live.first)\n end",
"def feedback\n NewsletterMailer.feedback\n end",
"def notify\n send_email_notification if allow_email_notifications\n send_slack_notification if allow_slack_notifications\n end",
"def notification(inquiry)\n @inquiry = inquiry\n\n mail :to => @inquiry.email, :subject => \"New Inquiry\"\n end",
"def show\n # notification_email\n end",
"def say_hi(medium)\n @medium = medium\n\n mail(to: '[email protected]' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: '[email protected]' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: '[email protected]' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: '[email protected]' , subject: \"视频#{@medium.subject}更新通知\").deliver\n end",
"def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"[email protected]\"\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail\n end",
"def notify\n ActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :cc => \"[email protected]\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def text_notification(email)\n content = \"\"\n address = email\n phone = User.where(email: email).first.phone\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n if task.priority == 3\n content << \"#{task.title}\\n\"\n end\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n if subtask.priority == 3\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n end\n unless phone.nil?\n if content.empty? == false\n TWILIO_CLIENT.account.sms.messages.create(\n from: TWILIO_NUMBER,\n to: \"+#{phone}\",\n body: content\n )\n end\n end\n end",
"def important_message\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def sendeoreturnmail(emails, engineorder, user)\n \n @user = user\n\n @engineorder = engineorder\n\n mail to: emails, subject: \"【重要】R2システムからのエンジン返却登録完了の通知です。\"\n\n return self\n\n end",
"def receipt\n mail(\n to: \"[email protected]\",\n subject: \"New for review for your commute\"\n )\n end",
"def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\"\n end",
"def notify\n ReminderMailer.notify\n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def admin_alert(data, subject)\n #@claim_url = \"http://www.cleanjay.ca/claim-booking/#{job.profile.claim_id}\"\n @data = data\n sub = \"[Admin Alert] \" + subject.to_s\n\n mail(:to => \"[email protected]\", subject: sub)\n end",
"def product_back_in_inventory\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def meeting_confirmation\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_notice(type:,adjustment:,previous_data: nil, subject:,title:,email: '[email protected]')\n @type = type\n @adjustment = adjustment\n @previous_data = previous_data\n @title = title\n @link = inventory_adjustments_url\n mail :to => email, :subject => subject\n end",
"def withdraw_note(addresses, publication_title) \n #send note to publication creator that the pub has been withdrawn\n #they can checkout the comments to see if there is more info about the withdraw\n \n @publication_title= publication_title \n\n mail(:to => addresses, :subject => publication_title + \" has been withdrawn.\")\n \n end",
"def post_approve_email\n NotificationMailer.post_approve_email('[email protected]')\n end",
"def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def booked_not_confirmed\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_notification(mailFrom, mailTo, mailDomain, mailServer, noticeContent, debug)\n\n# Example Email Notification Template. Modify as needed. Sending HTML email by default because I like it.\n# Example Email Notification Template. Modify as needed. Sending HTML email by default because I like it.\nmessage = <<MESSAGE_END\nFrom: #{mailFrom} \nTo: #{mailTo}\nMIME-Version: 1.0\nContent-type: text/html\nSubject:#{noticeContent[:date]} - ISO IR Resolve - #{noticeContent[:vulnTitle]} (#{noticeContent[:ipAddress]})\n\n<h3>#{noticeContent[:date]} - ISO IR Resolve - #{noticeContent[:vulnTitle]} (#{noticeContent[:ipAddress]})</h3>\nLink to IDS or other system showing the vulnerability or compromise<br/>\nhttps://#{noticeContent[:console]}:#{noticeContent[:conPort]}/vulnerability/vuln-summary.jsp?vulnid=#{noticeContent[:vulnId]}&devid=#{noticeContent[:devId]}<br/>\n\n<p>\n<h3>Issue Summary:</h3>\nA recent scan of #{noticeContent[:ipAddress]} indicates a vulnerability on the system.<br/>\nThe following issue was detected: #{noticeContent[:vulnTitle]}\n<h3>Description of the issue:</h3>\n#{noticeContent[:description]}\n</p>\n\n<p>\n<h3>Event Type:</h3>\nVulnerable\n</p>\n<p>\n<h3>Host(s) Affected:</h3>\n#{noticeContent[:ipAddress]}:#{noticeContent[:port]} / #{noticeContent[:proto]}<br/>\nHostname: #{noticeContent[:hostName]}<br/>\n Detected Aliases: #{noticeContent[:otherNames]}<br/>\nMachine Address: #{noticeContent[:macAddress]}<br/>\n\n</p>\n<p>\nTime of Detection: #{noticeContent[:date]} <br/>\nLevel of Confidence: #{noticeContent[:confirmation]}<br/>\n</p>\n<h3>Evidence/Testing Results</h3>\n#{noticeContent[:proof]}\n#{noticeContent[:solText]}\n\n<br/>\n<i>#{noticeContent[:nexposeId]}</i>\n\n\nMESSAGE_END\n\n begin\n Net::SMTP.start(mailServer) do |smtp|\n smtp.send_message message, mailFrom, mailTo\n end\n\n rescue => err\n $stderr.puts(\"Fail: #{err}\")\n exit(1)\n end\nend",
"def mail; end",
"def notification(user,fname,grade, comment,labname)\n @grade = grade\n\t@fname = fname\n\t@comment = comment\n\t@lab_name = labname\n mail(to: user, subject: 'Lab Grade')\n end",
"def setup_admin_email(official)\n @recipients = Array.new\n @recipients << 'Jeremy Driscoll <[email protected]>'\n do_not_deliver! if @recipients.empty?\n @from = AppConfig.admin_email\n @subject = \"[Q2016] \"\n @sent_on = Time.now\n @body[:official] = official\n end",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def notify(data)\n puts data[:email]\n @body = data[:body]\n mail to: data[:email], subject: data[:subject]\n end",
"def mk_email\n ps = \"P.S. Jeg har vedhæftet relevante dokumenter, så som eksamensbevis og CV i mailen.\"\n ps += \"\\nP.P.S Denne email var genereret med, og sendt fra et Ruby script :)\" if @skills and @skills.include? \"Ruby\"\n \"#{mk_intro}\\n#{mk_body}#{mk_outro}#{mk_sender}#{ps}\"\n end",
"def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend",
"def send_admin_review_email\n Mailer.admin_review_email(user, content, business, rating).deliver\n end",
"def shift_notify(shift, employee)\n @shift_name = shift.employee.full_name\n @employee_name = employee.full_name\n @shift_time = shift.shift_day.strftime(\"%a-%d-%b\")\n @employee = employee.id\n @email = shift.employee.email\n\n mail(to: @email, subject:'Interested in your Shift')\n end",
"def post_edit_email\n NotificationMailer.post_edit_email('[email protected]')\n end",
"def approve\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_approve_email\n 'send_approve_email'\n end",
"def send_email_to_master\n\n\tend",
"def email_questions(email,corpo)\n\t\t@email = email\n\t\t@corpo = corpo\n\t\tmail(to: '[email protected]',from: email, subject: 'Mensagem do CurriculumXD')\n\t\t# mail = Mail.new do\n\t\t# from email\n\t\t# to '[email protected]'\n\t\t# subject 'Mensagem do CurriculumXD'\n\t\t# body corpo\n\t\t# end\n\t\t# mail.deliver!\n\tend",
"def weekly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"[email protected]\"\n end",
"def thanks(application)\n load_resources(application)\n @title = 'New Hire'\n mail( subject: 'Application Received', to: @application.email, track_opens: 'true' )\n end"
] |
[
"0.72000027",
"0.7042168",
"0.7041643",
"0.70263386",
"0.7017448",
"0.6923108",
"0.69135433",
"0.69115674",
"0.69050777",
"0.68997693",
"0.6859798",
"0.6828306",
"0.6801441",
"0.6798682",
"0.6778224",
"0.67755026",
"0.676906",
"0.67675793",
"0.6767118",
"0.6766415",
"0.6726367",
"0.6712902",
"0.6712204",
"0.6708659",
"0.66937274",
"0.66720134",
"0.66677463",
"0.66467726",
"0.66465676",
"0.66383874",
"0.66382486",
"0.6629441",
"0.66235113",
"0.66172034",
"0.6587329",
"0.65864146",
"0.6569673",
"0.6567928",
"0.65589756",
"0.6555365",
"0.65398425",
"0.65385747",
"0.65348965",
"0.6532744",
"0.65292317",
"0.6521679",
"0.6513666",
"0.65127593",
"0.64990383",
"0.649877",
"0.64893144",
"0.6484269",
"0.6476537",
"0.64751816",
"0.647086",
"0.6470811",
"0.64635336",
"0.6459495",
"0.64559674",
"0.6453311",
"0.6444297",
"0.6433838",
"0.64333934",
"0.6433222",
"0.6425579",
"0.64196265",
"0.6411726",
"0.64104784",
"0.63955253",
"0.6393419",
"0.6387895",
"0.6382784",
"0.63792616",
"0.6378322",
"0.6375622",
"0.63740945",
"0.63726467",
"0.636733",
"0.6362498",
"0.63591397",
"0.635882",
"0.6358071",
"0.6355125",
"0.63543034",
"0.63542855",
"0.63505316",
"0.6347257",
"0.6346001",
"0.6343961",
"0.63424873",
"0.63411057",
"0.6340512",
"0.6334217",
"0.63321096",
"0.63319683",
"0.632378",
"0.631537",
"0.6314868",
"0.6314303",
"0.6311846"
] |
0.77578235
|
0
|
Minutes are running low Notification
|
def minutes_running_low(tenant)
ActsAsTenant.current_tenant = nil
@tenant = tenant
@plan = tenant.plan_bid.to_s
@days = (tenant.next_due - Date.today).to_i
mail(subject: 'Minutes Running Low', to: @tenant.owner.email, bcc: APP_CONFIG['admin_emails'])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tock\n @minute += 1\n end",
"def today_minutes_active\n self[:min_active]\n end",
"def minimum_interval\n 500\n end",
"def minutes?\n @name == :minutely\n end",
"def watch_interval; end",
"def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end",
"def time_notification\n \"You have #{@time_to_answer / 60} min #{@time_to_answer % 60} sec left\"\n end",
"def monitoring_interval\n data[:monitoring_interval]\n end",
"def monitoring_interval\n data[:monitoring_interval]\n end",
"def threshold_for_offline\n 8.days\n end",
"def minutes\n _nudge[1]\n end",
"def next_alert_time\n false\n end",
"def today_minutes_playing\n self[:min_play]\n end",
"def get_time_required\n 0 # number of minutes\n end",
"def active_minutes\n return self.minutes_attended if self.started_at.nil?\n\n if self.active?\n # If we're active, we need to use the last known started_at as well as\n # adding any existing minutes_attended (in case they were stopped and then\n # restarted)\n self.minutes_attended + ((Time.now - self.started_at)/60).floor\n else\n self.minutes_attended\n end\n end",
"def min_interval\n MIN_INTERVAL\n end",
"def before_midnight(time)\n total_minutes = after_midnight(time)\n total_minutes == 0 ? 0 : 1440 - total_minutes\nend",
"def passcode_minutes_of_inactivity_before_lock\n return @passcode_minutes_of_inactivity_before_lock\n end",
"def timer_notification(ms_time)\n return self\n end",
"def game_played?\n minutes > 0\n end",
"def minutes; self * MINUTE; end",
"def minutes; self * MINUTE; end",
"def usage_interval\n\n end",
"def timer_update(event)\n if (event)\n tc = DateTime.now.to_i - event.created_at.to_i\n tu = DateTime.now.to_i - event.updated_at.to_i\n [tu, tc].min > 4\n end\n end",
"def today_minutes_resting\n self[:min_rest]\n end",
"def minutes() 60 * seconds end",
"def minutes ; self * 60 ; end",
"def getMinutes\r\n\t\t\t\t\treturn @minutes\r\n\t\t\t\tend",
"def peaktime\n time.change(hour: 17)\n end",
"def when_to_run\n time - @@REMINDER_TIME\n end",
"def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end",
"def monitored_now?\n tf = circuit.monitoring_setting.todays_monitoring_times\n return false unless tf \n \n from,to = tf.split('-').map { |e| (\"%02d%02d\" % _sh(e)).to_i }\n now = (\"%02d%02d\" % [Time.now.hour, Time.now.min]).to_i\n \n $stderr.puts \"#{from} #{to} - #{now}\"\n \n (from..to).include?(now)\n end",
"def water_status(minutes)\n if minutes < 7\n puts \"The water is not boiling yet.\"\n elsif minutes == 7\n puts \"It's just barely boiling\"\n elsif minutes == 8 \n puts \"It's boiling!\"\n else\n puts \"Hot! Hot! Hot!\"\n end\nend",
"def water_status(minutes)\n if minutes < 7\n puts \"The water is not boiling yet.\"\n elsif minutes == 7\n puts \"It's just barely boiling\"\n elsif minutes == 8\n puts \"It's boiling!\"\n else\n puts \"Hot! Hot! Hot!\"\n end\nend",
"def could_be_minute?(minute); end",
"def cutoff\n Time.now - (60 * 60 * HOURS)\n end",
"def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n end",
"def need_tick_tock?\n if @minute == 60\n @minute = 0\n tick_tock\n end\n end",
"def last_minute_activity\n self[:last_min_activity]\n end",
"def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end",
"def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end",
"def minutes\n self * SECONDS_IN_MINUTES\n end",
"def check_meter\n puts \"You have #{minutes_remaining} minutes remaining.\"\n end",
"def capture_holding_time(totem, waiting_since_hash_user_id)\n user_holding_time_in_seconds = Time.now.to_i - waiting_since_hash_user_id.to_i\n user_holding_time_in_minutes = user_holding_time_in_seconds / 60\n send_gauges_to_signalFX(\"totems:holding_time:#{totem}\",user_holding_time_in_minutes)\n end",
"def evaulate_schedule\n 5\n end",
"def interval; end",
"def interval; end",
"def set_notification_threshold(th,th_plus=th,i=0,asd=Hash.new,percent=th*0.25)\n asd[i] = {min: th_plus-percent,max: (th_plus+th)-percent}\n i == 3 ? (return asd) : (set_notification_threshold(th,th_plus*=2,i+=1,asd))\n end",
"def test_minute_set\n clock = Clock.new 0, -1\n alarm = AlarmClock.new 0, -1\n puts 'Wrong hour set' if clock.get_minute != 0\n puts 'Wrong hour set' if alarm.get_alarm_minute != 0\n clock.set_time 26, 0\n alarm.set_alarm 26, 0\n puts 'Wrong hour set' if clock.get_minute != 23\n puts 'Wrong hour set' if alarm.get_alarm_minute != 23\n end",
"def time_min; Time.now.min; end",
"def meter_maid_check\n if minutes_remaining < 0\n fine = minutes_remaining * -3\n \"Bummer! You got a $#{fine} ticket.\"\n else\n 'The meter maid came and went.'\n end\n end",
"def capture_waiting_time(totem, waiting_since_hash_next_user_id)\n user_waiting_time_in_seconds = Time.now.to_i - waiting_since_hash_next_user_id.to_i\n user_waiting_time_in_minutes = user_waiting_time_in_seconds / 60\n send_gauges_to_signalFX(\"totems:waiting_time:#{totem}\",user_waiting_time_in_minutes)\n end",
"def recalculate_stats_interval\n 30 # minutes\n end",
"def min_available_talks_time_in_a_day\n 6*60\n end",
"def minutes\n\t\treturn self * 60\n\tend",
"def minutes\n\t\treturn self * 60\n\tend",
"def grace_period_in_minutes\n return @grace_period_in_minutes\n end",
"def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end",
"def find_time_asleep\n @total_time_asleep = 0\n @wake_times.each_with_index do |wake_time, index|\n @total_time_asleep += ( wake_time - @sleep_times[index] )\n end\n end",
"def worker_check_interval(interval); end",
"def sleep_time\n 60\n end",
"def delay\n val = (self['min-time']/1000.0/60.0)\n val < 1 ? val.round(1) : val.round\n end",
"def work_profile_password_minutes_of_inactivity_before_screen_timeout\n return @work_profile_password_minutes_of_inactivity_before_screen_timeout\n end",
"def watch_interval=(_arg0); end",
"def on_timer_timeout\n #puts \"#on_timer_minute #{@timer_minute} #{@timer_minute_limit}\"\n @timer_minute += 1\n if @timer_minute > @timer_minute_limit\n change_wallpaper\n\n # Restart timer\n reset_timer_minute\n end\n end",
"def opening_hour\n 11\n end",
"def poll_every_n_minutes(send,n=1)\n\t\t\ttimer = Timers::Group.new\n\t\t\tevery_seconds = timer.every(60*n) { poll(send) }\n\t\t\tloop { timer.wait } \n\t\tend",
"def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend",
"def notification_level\n unless first_expiring_value.nil?\n return first_expiring_value.notification_level\n end\n return 0\n end",
"def min() time[1] end",
"def end_of_minute\n change(sec: 59.999)\n end",
"def need_tock?\n if @second == 60\n @second = 0\n tock\n end\n end",
"def scheduled_health_check_frequency\n frecuency = 1\n frecuency = organization.monitor_param.health_check_frequency if\n organization.has_monitor_params?\n \"*/#{frecuency} * * * *\"\n end",
"def get_owghat_range\n @now = (Time.now.hour-1) *60 + Time.now.min \n if @now <420 and @now>300\n return 1\n elsif @now>720 and @now<1140\n return 2\n elsif @now>1200 and @now<1440 \n return 4\n else \n return -1\n end\n end",
"def data_update_notification(user)\n @greeting = \"FREE PEPPERLUNCH@@!!!!!111111\"\n\n @lunch_count = user.lunches.count\n\n if @lunch_count > 15\n\n\n mail to: user.email\n end\nend",
"def schedule_to_close_timeout; Float::INFINITY; end",
"def min_out\n @min_out ||= time_out.min\n end",
"def minimum_time_passed_since_last_warning_email?\n return true if user.last_notif_email_sent.nil?\n hours_since_last_email >= MIN_HOURS_BETWEEN_EMAILS\n end",
"def passcode_minutes_of_inactivity_before_screen_timeout\n return @passcode_minutes_of_inactivity_before_screen_timeout\n end",
"def low_frequency\n log \"Updating event status\"\n M2mhub::Event.open_or_recently_closed.each(&:update_status!)\n log \"Finished\"\n true\n end",
"def heartbeat_timeout; Float::INFINITY; end",
"def getminute()\n\t\treturn @min\n\tend",
"def tired\t\n\tif $hours_asleep >= 8 then\n\t $hours_asleep = 0\n \t\treturn false\n \telse\n \t\t$hours_asleep += 1\n \t\treturn true\n \tend \t\t\nend",
"def setup_heartbeat_timer; end",
"def test_time_of_schedule_reminders\n @reminder.scheduled_reminders.each{|x| assert_equal x.run_at.hour, @reminder.fq_time.hour}\n @reminder.scheduled_reminders.each{|x| assert_equal x.run_at.min, @reminder.fq_time.min}\n end",
"def health_check_grace_period\n @group.health_check_grace_period\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def shutdown_less_emails_sent_than_defined_in_user_profile?\n notifications_delivered < notifications_for_shutdown\n end",
"def timer_checkpoints\n t = self.time_remaining\n if @timer_checkpoint_hash[30] < 3 && t <= 40\n @timer_checkpoint_hash[30] += 1\n tab; \"#{@time_remaining} seconds left.\\n\".typing\n elsif @timer_checkpoint_hash[120] == 0 && t.between?(60, 140)\n @timer_checkpoint_hash[120] += 1\n tab; \"Cutting it close, #{codename}\".typing\n elsif @timer_checkpoint_hash[180] == 0 && t.between?(140, 180)\n @timer_checkpoint_hash[180] += 1\n tab; \"3 minutes. Finish the job.\\n\".typing\n elsif @timer_checkpoint_hash[240] == 0 && t.between?(200, 240)\n @timer_checkpoint_hash[240] += 1\n tab; \"Doing good. 4 minutes left.\\n\".typing\n end\n end",
"def minutes ; Duration[self * 60] ; end",
"def dep_time_loc_minutes\n dep_minutes_since_midnight\n end",
"def votes_notification\n \ttype = 0\n\tcase self.total_votes\n\twhen 10\n\t\ttype = 310\n\twhen 25\n\t\ttype = 311\n\twhen 50\n\t\ttype = 312\n\twhen 100\n\t\ttype = 313\n\twhen 250\n\t\ttype = 314\n\twhen 500\n\t\ttype = 315\n\twhen 1000\n\t\ttype = 316\n\twhen 2500\n\t\ttype = 317\n\twhen 5000\n\t\ttype = 318\n\tend\n\tif type > 0\n\t\top_user_id = self.user_id\n\t\t# create activity \n\t\tcurrent_time = Time.now\n\t\tif Rails.env == 'production'\n\t\t\tRecentActivity.delay.add_activity(op_user_id, type.to_s, nil, nil, \"shout-votes-\"+self.total_votes.to_s+\"-\"+op_user_id.to_s+\"-\"+current_time.to_i.to_s, \"Shout\", self.id, 'You received ' + self.total_votes.to_s + ' votes on your shout \"'+self.body.truncate(23, separator: /\\s/)+'\"')\n\t\t\tWhisperNotification.delay.send_notification_330_level(op_user_id, type, self.total_votes, self.id)\n\t\tend\t\n\tend \n end",
"def schedule_updates\n schedule_update_in(48.hours)\n end",
"def time_interval(inter_val_num=15)\n\n require 'rubygems'\n require 'active_support'\n require 'active_support/time'\n\n cur_time = Time.now\n comp_time = cur_time - cur_time.sec - cur_time.min%15*60\n base_time = comp_time + 1.hour\n\n if comp_time < base_time\n comp_time = comp_time + inter_val_num.minutes\n end\n\n return comp_time.strftime(\"%M:%S\")\n\nend",
"def minute\n set_function_and_argument(:minute, nil)\n end",
"def report\n if data[:ping].nil?\n @fails += 1\n if @fails >= @alert_after\n alarm \"Miner #{@num} did not respond to status query\"\n end\n else\n @fails = 0\n if self[:mhs] < @min_speed*0.95 and upminutes > 5\n alarm \"Miner #{@num} performance is #{self[:mhs]}, should be #{@min_speed}\"\n elsif upminutes < 2\n alarm \"Miner #{@num} restarted\", \"Frog.aiff\"\n end\n end\n end",
"def daily_midnight\n logger.info \" daily_midnight\"\n PersistStatsJob.create({})\n Gift.send_expiration_reminders(5)\n Gift.send_expiration_reminders(3)\n Gift.send_expiration_reminders(1)\n end",
"def time_remaining\n\n end",
"def resendable?\n (self.sent_at + 15.minutes) < Time.current\n end"
] |
[
"0.64594555",
"0.63423747",
"0.6158274",
"0.61369705",
"0.61266404",
"0.612431",
"0.6118135",
"0.6117697",
"0.6117697",
"0.61174893",
"0.6075876",
"0.604616",
"0.6028172",
"0.5984806",
"0.59708345",
"0.5961126",
"0.59574467",
"0.5947727",
"0.5934222",
"0.59315395",
"0.59281945",
"0.59281945",
"0.5927242",
"0.59196377",
"0.5914371",
"0.5893386",
"0.5890099",
"0.587764",
"0.5870038",
"0.5860301",
"0.5857908",
"0.58565927",
"0.5856482",
"0.58406717",
"0.5836015",
"0.5830986",
"0.5796958",
"0.57835925",
"0.5782252",
"0.57812613",
"0.57812613",
"0.5768399",
"0.57667387",
"0.5757949",
"0.57566327",
"0.57484484",
"0.57484484",
"0.57417136",
"0.5739042",
"0.5738456",
"0.57341397",
"0.5731997",
"0.5720767",
"0.57095444",
"0.5692576",
"0.5692576",
"0.568844",
"0.5683665",
"0.56708217",
"0.5669132",
"0.56627035",
"0.5659148",
"0.5650878",
"0.564697",
"0.56450456",
"0.56444746",
"0.5624465",
"0.5618535",
"0.56090194",
"0.56032294",
"0.5601797",
"0.5593124",
"0.55833805",
"0.5580905",
"0.5575709",
"0.5565839",
"0.55646574",
"0.5559066",
"0.5556456",
"0.5552678",
"0.5549567",
"0.55336136",
"0.5513546",
"0.5507907",
"0.54931396",
"0.5487943",
"0.5486979",
"0.5486979",
"0.5486032",
"0.54846233",
"0.547926",
"0.54785985",
"0.5469693",
"0.54673976",
"0.54667974",
"0.54660857",
"0.5465834",
"0.5464282",
"0.54587305",
"0.5458181"
] |
0.6230205
|
2
|
call transaction log mailer
|
def call_transaction_mailer(tenant,gate)
ActsAsTenant.current_tenant = nil
@tenant = tenant
@gate = gate
mail(subject: 'Call Transaction', to: '[email protected]')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_transaction_alert\n ApplicationMailer.transaction_alert(self).deliver_now\n end",
"def transaction_complete\n NotificationsMailer.transaction_complete\n end",
"def create_sale_report\n mail = LogMailer.sale_report(self).deliver\n end",
"def transaction_complete\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def transaction_notification(trans)\n @trans = trans\n I18n.locale = @trans.stream.user ? @trans.stream.user.locale : 'fr'\n @app_root_url = \"http://#{Willstream::Config.user_home}/\"\n @subject = t('emailer.stream_txn.subject',\n :amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name),\n :business_name => @trans.merchant.business_name).html_safe\n @headline = t('emailer.stream_txn.headline').html_safe\n @welcome = t('emailer.hello').html_safe + (@trans.stream.user.first_name != nil ? @trans.stream.user.first_name : @trans.stream.user.username)\n @email_body = (@trans.stream.is_direct? ? \n t(\"emailer.stream_txn.#{@trans.merchant.username}.body_direct\",\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :default => t('emailer.stream_txn.body_direct',\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username)\n ).html_safe :\n t(\"emailer.stream_txn.#{@trans.merchant.username}.body_voucher\",\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :beneficiary_number => @trans.stream.beneficiary.phone_number,\n :business_name => @trans.merchant.business_name,\n :balance => help.number_to_currency(@trans.stream.balance_cents/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :default => t('emailer.stream_txn.body_voucher',\n :stream_code => @trans.stream.code,\n :txn_amount => help.number_to_currency(@trans.amount_cents.to_f/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :beneficiary_number => @trans.stream.beneficiary.phone_number,\n :business_name => @trans.merchant.business_name,\n :balance => help.number_to_currency(@trans.stream.balance_cents/100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s)\n ).html_safe) + \n t('emailer.stream_txn.action_table',\n :app_root_url => @app_root_url,\n :business_name => @trans.merchant.business_name,\n :business_url => @app_root_url + @trans.merchant.username,\n :city_search_url => @app_root_url + \"merchants?city=\" + @trans.merchant.city_name,\n :business_city => @trans.merchant.city_name,\n :invite_url => @trans.stream.user.get_promo_code).html_safe\n @goodbye = t('emailer.stream_txn.goodbye')\n\n mail_it_with_bcc(@trans.stream.user.email, Willstream::Config.outgoing_email, @subject, @@generic)\n if @trans.stream.category == Category.find_by_category_desc(\"Transport\")\n SMS.send(SMS.i18n_dest(@trans.stream.beneficiary.phone_number, Country.find(@trans.stream.payment.to_country)), \n t(\"sms.stream_txn.#{@trans.merchant.username}.redeem\", \n :business_name => @trans.merchant.business_name,\n :amount => help.number_to_currency(@trans.amount_cents / 100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :code => @trans.stream.code,\n :balance => help.number_to_currency(@trans.stream.balance, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :package_title => @trans.stream.stream_package.present? ? @trans.stream.stream_package.i18n_title : \"\",\n :default => t(\"sms.stream_txn.redeem\",\n :business_name => @trans.merchant.business_name,\n :amount => help.number_to_currency(@trans.amount_cents / 100, :unit => Currency.find_by_code(@trans.currency.upcase).name).to_s,\n :code => @trans.stream.code,\n :balance => help.number_to_currency(@trans.stream.balance, :unit => Currency.find_by_code(@trans.currency.upcase).name,\n :package_title => @trans.stream.stream_package.present? ? @trans.stream.stream_package.i18n_title : \"\").to_s)))\n end\n end",
"def mailer; end",
"def mail; end",
"def transaction_mail(title, from, to, content, sent_at = Time.now)\n @msg = content\n mail(to: to, bcc: '[email protected]', subject: title)\n end",
"def log_transaction\n repo.log_action(user_name: @user.user_name, context: @context.context, route_url: @context.route_url)\n end",
"def call(params)\n log_email(params[:logger], \"RESPONSE\", params[:response])\n end",
"def send_mail\n Email::HookCreator::SendTransactionalMail.new(\n receiver_entity_id: @manager_id,\n receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,\n template_name: GlobalConstant::PepoCampaigns.platform_secure_data_access_template,\n template_vars: {\n secure_data_access_token: CGI.escape(@secure_data_access_token),\n company_web_domain: CGI.escape(GlobalConstant::CompanyWeb.domain)\n }\n ).perform\n\n success\n end",
"def perform(task_hash)\n \tSiteMailer.reminder_notice(task_hash).deliver_now\n \tend",
"def mail\n @transaction = Transaction.find(params[:id])\n \n @transaction.steps.each do |step|\n StepMailer.deliver_uome_email(step) if step.to.email.present?\n end\n render :json => []\n end",
"def transaction_done\n puts \".........\" + self.class.name + \" has been notified\"\n end",
"def send_payment_receipt_by_mail(employee,file_path)\n\t\t\tbegin\n logger.info \"---BEGIN: send mail send_payment_receipt_by_mail---\"\n Mailer::deliver_send_payment_receipt(self,employee,file_path)\n logger.info \"---END: mail send successfull---\"\n rescue Exception => e\n logger.error \"---END: Error---\"\n\t\t \t\tlogger.error e\n logger.error \"------\"\n end\n\tend",
"def transmit\n tpl = Template.find(params[\"template_id\"])\n tpl.load(params[:id])\n \n tpl.object.status = InvoiceStatus.find_by_name('invoiced')\n tpl.object.save!\n \n #Notification.deliver_invoice_email(self, tpl)\n Notification.deliver_invoice_fax(self, tpl)\n \n log = SystemLog.create({ \n :log_type => SystemLogType.find_by_name('notification'),\n :loggable_id => params[:id],\n :loggable_type => 'Invoice',\n :subject => 'Invoice sent',\n :msg => 'Invoiced client', \n :created_by => self.current_user.account \n })\n \n action = RAction.new(\n :component_id => 'log_' + tpl.object.id.to_s,\n :msg => 'Inserted log',\n :verb => 'insert',\n :data => {:log => log.to_h},\n :success => true\n ) \n res = RResponse.new\n res.add_action(action)\n res.data[:status] = tpl.object.status.name \n res.success = true\n res.msg = 'Transmitted invoice ' + \" pdf2html success: \"\n respond(res) \n end",
"def perform(mailer, method, *args)\n mailer.send(method, *args).deliver\n #ex: LadybooMailer.atm_checkout_completed_successfully(order).deliver\n end",
"def send_post_commit_mail(revision)\n body = post_commit_html(revision)\n mail = Emailer.create_svn_mail(config.mails,revision.subject,revision.number,body,revision.patch)\n Emailer.deliver(mail)\nend",
"def send_routine_emails(log, device, mailer_klass = LogDeliveryMailer)\n return unless (log.channels || []).include?(\"email\")\n mailer_klass.log_digest(device).deliver_later(digest_wait_time)\n end",
"def send_force_commit_mail(body)\n mail = Emailer.create_foced_commit(config.force_commit_mails,body)\n Emailer.deliver(mail)\nend",
"def call_order\n NewsletterMailer.call_order\n end",
"def notification(params)\n mail(params)\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def send_notification\n AdminMailer.delay.new_report(self)\n end",
"def report_request\n @subject = report_request_params[:subject]\n @requester = report_request_params[:requester]\n @message = report_request_params[:message]\n\n SingleCellMailer.admin_notification(@subject, @requestor, @message).deliver_now\n end",
"def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], :callnumber => params[:callnumber], :status => params[:itemStatus] }, url_options, params)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def cost_analysis\n AdminMailer.cost_analysis.deliver_now\n end",
"def notify_translators(commit)\n @commit = commit\n\n mail to: Shuttle::Configuration.mailer.translators_list,\n subject: t('mailer.commit.notify_translators.subject'),\n cc: @commit.user.try!(:email)\n end",
"def send_email(company, member, log)\n\n begin\n mail_response = mail_message(company, member).deliver_now\n log_mail_response(log, mail_response, company, member)\n\n rescue => mailing_error\n # must pass in an Array of the email; when successful this is a Mail::AddressContainer\n @alert_logger.log_failure(company, member, error: mailing_error)\n end\n\n end",
"def order_received(order)\n@order=order\nmail(:to => order.email, :subject => 'Pragmatic Toy Shop Order Confirmation')\nend",
"def perform\n\n _perform do\n\n sanitize_event_data\n\n create_purchase_log_entry\n\n get_user_from_ethereum\n\n update_purchase_attribute_in_pepo_campaigns\n\n send_purchase_confirmation_email\n\n end\n\n end",
"def notify\n @transaction_id = params[:transaction_id]\n do_notify\n end",
"def execute\n puts \"*********************\"\n Tenant.all.each do |tenant|\n puts tenant.subdomain\n begin\n if PackageConfig::PAY_AS_YOU_GO.eql? tenant.plan_bid.to_s\n tenant_minutes = (tenant.call_minutes.to_i - tenant.credit_minutes.to_i)\n\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - tenant minutes - #{tenant_minutes}\")\n\n if tenant.tenant_notification.nil?\n tenant_notification = TenantNotification.new\n tenant_notification.tenant_id = tenant.id\n tenant_notification.pay_as_you_go = 0\n tenant_notification.save\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - tenant notification created - pay as you go\")\n else\n tenant_notification = tenant.tenant_notification\n tenant_notification.pay_as_you_go = 0\n tenant_notification.save\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - tenant notification updated - pay as you go\")\n end\n\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - not overage_transaction\")\n\n if tenant_minutes > 100\n overage_transaction(tenant, \"call minutes\", :call_minutes, 0)\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - overage_transaction\")\n end\n\n tenant_minutes = (tenant.call_minutes.to_i - tenant.credit_minutes.to_i)\n if (tenant_minutes >= 90 or tenant_minutes >= 350) && !tenant_notification.pay_as_you_go.present?\n ClientMailer.delay.minutes_running_low(tenant)\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - minutes running low - pay as you go\")\n end\n end\n\n if PackageConfig::MINUTE_200.eql? tenant.plan_bid.to_s\n if tenant.tenant_notification.nil?\n tenant_notification = TenantNotification.new\n tenant_notification.tenant_id = tenant.id\n tenant_notification.minutes200 = 0\n tenant_notification.save\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - tenant notification created - 200 minutes\")\n else\n tenant_notification = tenant.tenant_notification\n tenant_notification.minutes200 = 0\n tenant_notification.save\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - tenant notification updated - 200 minutes\")\n end\n\n tenant_minutes = (tenant.call_minutes.to_i - tenant.credit_minutes.to_i)\n if tenant_minutes >= 350 && !tenant_notification.minutes200.present?\n ClientMailer.delay.minutes_running_low(tenant)\n ClientMailer.delay.call_transaction_mailer(tenant,\"execute - minutes running low - 200 minutes\")\n end\n end\n\n #if tenant.menu_minutes > 100\n # overage_menu_minutes(tenant)\n # ClientMailer.delay.call_transaction_mailer(tenant,\"execute - overage_transaction - menu minutes\")\n #end\n #if tenant.mail_minutes > 100\n # overage_mail_minutes(tenant)\n # ClientMailer.delay.call_transaction_mailer(tenant,\"execute - overage_transaction - mail minutes\")\n #end\n rescue => e\n puts \"ERROR: #{e}\"\n end\n\n end\n end",
"def add_email_log\n @@logs[@logname].outputters << EmailOutputter.new('email_out', # TODO (8) Make GUI for these prefs\n :server=>'heltenkelt.se',\n :port=>25,\n :domain=>'heltenkelt.se',\n :from=>'[email protected]',\n :to=>'[email protected]',\n :subject=>'Report from iTunesFeeder')\n end",
"def log_delivery! (args)\n add_recipient(args)\n end",
"def tickets_purchased_mail\n UserMailer.tickets_purchased(self).deliver_now\n end",
"def event_mail\n NoticePlannerMailer.delay.notice_planner_email('[email protected]', 'test', 'cron-test', 'https://yahoo.co.jp')\n end",
"def send_purchase_confirmation_email_via_hooks\n\n Email::HookCreator::SendTransactionalMail.new(\n client_id: @client_id,\n email: @user.email,\n template_name: GlobalConstant::PepoCampaigns.purchase_confirmation,\n template_vars: {}\n ).perform\n end",
"def send_mail_on_creation(rent)\n RentMailer.success_rent_email(rent.id).deliver_later\n end",
"def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(link: \"/reports/#{@report.id}\")\n subject = \"[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end",
"def perform\n return if client_webhook_setting.blank?\n w_s_logs = fetch_logs(@lock_id)\n logs_data = process_webhook_logs(w_s_logs)\n send_admin_email(logs_data)\n end",
"def buyer_invoices\n logger.info(\"Will send email of BUYER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"[email protected]\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_buyer_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def perform(user)\n \t# Send report\n @user = user\n TransactionMailer.activity_report(@user).deliver_now\n end",
"def send_report_email(client_id, template_variables)\n admin_emails = GlobalConstant::Admin.get_all_admin_emails_for(\n client_id,\n GlobalConstant::Admin.billing_plan_notification_notification_type\n )\n\n (admin_emails + GlobalConstant::Email.default_billing_to).each do |to_email|\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: to_email,\n template_name: GlobalConstant::PepoCampaigns.billing_plan_notification_template,\n template_vars: template_variables\n ).perform\n end\n end",
"def seller_invoices\n logger.info(\"Will send email of SELLER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"[email protected]\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_seller_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def run\n # Your code here, eg: task execute: :environment do\n s = SavedSearchManager.new\n s.process\n \n # use log() for writing to scheduler daemon log\n log(\"Saved searches processed.\")\n ActionMailer::Base.mail(:from => \"[email protected]\", \n :to => system_process_completion_email_address(), \n :subject => \"Saved Searches processed.\", \n :body => \"Ran saved search process.\").deliver\n end",
"def send_email_to_master\n\n\tend",
"def run\n self.report_type = :daily_tasks\n self.failures = []\n\n EmailSubmission.where(\n created_at: Date.yesterday...Date.current\n ).joins(:c100_application).find_each(batch_size: 25) do |record|\n reference_code = record.c100_application.reference_code\n\n find_failures(record, reference_code, COURT_EMAIL_TYPE)\n\n # Only if the applicant chose to receive a confirmation, otherwise\n # these emails are not sent and there is no need to do any check.\n find_failures(record, reference_code, USER_EMAIL_TYPE) if record.c100_application.receipt_email?\n end\n\n send_email_report if failures.any?\n end",
"def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], :callnumber => params[:callnumber], :status => params[:itemStatus] }, url_options, params)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def run_and_email!(mailgun_url, target_emails)\n log 'Running report...'\n report_text = run()\n log 'Done.'\n log\n\n log \"Sending #{target_emails.size} emails...\"\n target_emails.each do |target_email|\n date_text = @time_now.beginning_of_day.strftime('%B %e, %Y')\n post_data = Net::HTTP.post_form(URI.parse(mailgun_url), {\n :from => \"Student Insights job <[email protected]>\",\n :to => target_email,\n :subject => \"#{PerDistrict.new.district_key} - Student Insights Usage Report for #{date_text}\",\n :html => \"<html><body><pre style='font: monospace; font-size: 12px;'>#{report_text}</pre>\"\n })\n log \" response status: #{post_data.code}\"\n end\n log 'Done.'\n end",
"def report target, author, action, opts\n @author = author\n @action = action\n @opts = opts\n\n mail to: target\n end",
"def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in PostTestEconomySetupJob'\n ).deliver if @failed_logs.present?\n end",
"def log(msg, level = :info)\n puts(\"ZapUpdater: \" + msg)\n RAILS_DEFAULT_LOGGER.info(\"ZapUpdater: \" + msg)\n @mail_log << msg + \"<br/>\\r\\n\" if level == :info\n end",
"def deposit\n UserMailer.deposit\n end",
"def transaction_created(user)\n @user = user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end",
"def send_email\n @costumer_id = params[:customer_id]\n @file_path = params[:file_path]\n @report_date=params[:report_date]\n @costumer = Customer.find(@costumer_id)\n EmailSender.eemail(@costumer.email, @file_path, @report_date).deliver\n CustomLogger.info(\"Se envia email a: #{@customer.inspect}, usuario: #{current_user.username}, #{Time.now}\")\n respond_to do |format|\n format.html {redirect_to delivery_report_products_path}\n format.json { head :no_content }\n end\n end",
"def atm_checkout_completed_successfully!\n self.update_column(:payment_status, \"order_placed_ATM\")\n publish(:pub_atm_checkout_completed_successfully, self) # to listener\n LadyboomailerJob.new.async.perform(LadybooMailer, :atm_checkout_completed_successfully, self) if @@sendmail\n LadyboomailerJob.new.async.perform(LadybooMailer, :order_placed, self) if @@sendmail\n #LadybooMailer.atm_checkout_completed_successfully(self).deliver if @@sendmail\n #LadybooMailer.order_placed(self).deliver if @@sendmail\n end",
"def order_in_progress\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n subject = \"[bootcamp] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end",
"def voucher_created(voucher)\n @voucher = voucher\n mail :to => voucher.email, :subject => \"Your Offer Code and Information\"\n end",
"def weekly_progress_report(user)\n @greeting = \"Hi\"\n \n user_email = @user.email\n\n mail to: user_email\n end",
"def update_transaction_log\n begin\n gateway = TransferredEventOrder.gateways.find{|g| g[:model] == self.class.to_s}\n log = self.event_order.transaction_logs.where(gateway_transaction_id: self.dd_number, status: TransactionLog.statuses['pending'], transaction_type: TransactionLog.transaction_types[:pay], gateway_name: gateway[:symbol]).last\n log.update(status: TransactionLog.statuses['success']) if log.present?\n rescue => e\n Rollbar.error(e)\n end\n errors.empty?\n end",
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def twiki_created_notification(person, options={})\n @person = person\n mail(:to=>[@person.personal_email],\n :subject=>options[:subject] || \"Twiki account information (\"[email protected]+\")\",\n :date=>Time.now)\n end",
"def sendmail\n puts \"send mail \"\n puts @manifest.code \n\n @company = @manifest.company\n\n ActionCorreo.st_email(@manifest).deliver_now \n end",
"def create_mail_log\n user_thread.schedule do\n self.mail_log = user.mail_logs.create(:message_id => message_id, :sha1 => sha1)\n end\n return true\n end",
"def order_received(order)\n@order = order\nmail :to => order.email, :subject => 'Sedin Online Store Order Confirmation'\nend",
"def daily_report(daily_stat)\n @daily_stat = daily_stat\n\n mail to: REPORT_EMAIL\n end",
"def alteration_email(user, trip)\n @trip=Trip.find_by(:id => trip)\n @user = User.find_by(:id => user)\n @fbo= Fbo.find_by(:id => @trip.fbo_id)\n @airport = Airport.find_by(:id => @fbo.airport_id)\n @url = 'http://chartair.us/trips'\n mail(to: @user.email, subject: 'Trip Alteration')\n end",
"def emailResults()\n obj = EmailHelper.new()\n emailSubject = \"Illumina Capture Stats : Flowcell \" + @fcBarcode.to_s\n emailFrom = \"[email protected]\" \n emailText = @captureResults.formatForSTDOUT()\n emailTo = obj.getCaptureResultRecepientEmailList()\n\n begin\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n rescue Exception => e\n puts e.message \n puts e.backtrace.inspect\n end\n end",
"def send_email\n AlertNotifier.delay.email_zero_inventory(self)\n end",
"def bar\n TestttMailer.bar\n end",
"def notify_business\n business.add_message_to_queue(\"Hey #{business.name}, we've just deposited #{amount} into your account! Thanks for being great!\")\n end",
"def trade_updates(date)\n @update_date = date\n mail to: \"[email protected]\", subject: \"Mise à jour des trades sur le serveur !\"\n end",
"def jobfail(log,msg)\n Rails.logger.error(\"#{log} #{self.id}\")\n self.update_attributes(:status =>'error',:errormsg => msg)\n user = User.find_by_email(self.email)\n UserMailer.job_failed(user,self).deliver \n UserMailer.admin_job_failed(self).deliver\n end",
"def run_and_email!(mailgun_url, target_emails)\n puts 'Running report...'\n report_text = run()\n puts 'Done.'\n puts\n puts 'Report output:'\n puts report_text\n puts\n\n puts 'Sending emails...'\n target_emails.each do |target_email|\n date_text = DateTime.now.beginning_of_day.strftime('%B %e, %Y')\n post_data = Net::HTTP.post_form(URI.parse(mailgun_url), {\n :from => \"Student Insights job <[email protected]>\",\n :to => target_email,\n :subject => \"Student Insights Usage Report for #{date_text}\",\n :html => \"<html><body><pre style='font: monospace; font-size: 12px;'>#{report_text}</pre>\"\n })\n puts \"to: #{target_email}\"\n puts \"code: #{post_data.code}\"\n puts \"body: #{post_data.body}\"\n puts\n end\n\n puts\n puts 'Done.'\n end",
"def test_scheduled_email(recipient)\n @fullname = recipient.fullname\n @email = recipient.email\n @password = recipient.password\n @company_name = \"A&S Designs\"\n @support_email = \"[email protected]\"\n @url = \"http://zdesign.codingsherpa.com\"\n \n logger.info \"AppLog: test_Scheudled_email \" + recipient.fullname\n \n mail(:to => recipient.email,\n :subject => \"Scheduled email from \" + @company_name + \"!\")\n end",
"def bearstor_request\n @params = params\n to = params[:staff_email]\n from = \"Barnard Remote Request Service <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"New BearStor request [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def send_new_listing_notification(merchant)\n @merchant = merchant\n mail to: \"[email protected]\", subject: \"A New Merchant has Subscribed!\"\n end",
"def send_report\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\", subject: \"Daily report for #{Time.now}\"\n end",
"def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n\n process_request(request, response) && response.deliver\n end\n rescue StandardError => e\n logger.fatal(\"SERVER ERROR\") { \"#{e.inspect}\\n\" + e.backtrace.join(\"\\n \") }\n raise\n end",
"def setup_log\r\n logfile = File.open(\"/home/englandk/rails_apps/reminders/log/auto_enquiry.log\", 'a')\r\n \r\n @log = AuditLogger.new(logfile)\r\n @log.level = Logger::INFO\r\n @log.debug \"Started auto response email run\"\r\n end",
"def email(cdn, e)\n data = JSON.load REDIS[cdn]\n link = \"http://logserver.flocasts.com/#{cdn.to_sym.object_id}\"\n\n tox = data['server_admins']\n from = '[email protected]'\n subj = '[ERROR] ' + cdn\n text = [link, \"\\n\", e.message, e.class, e.backtrace].join \"\\n\"\n\n Gmail.new from, 'flocastayo' do |gmail|\n gmail.deliver do\n to tox\n subject subj\n text_part { body text }\n end\n end\nend",
"def shop_mail\n OrderMailer.shop_mail\n end",
"def report_notifier(supplier)\n\t @supplier = supplier\n\t mail(:to => supplier.email,\n\t :subject => \"#{supplier.first_name} you just recieved a report on your local market-place\")\n end",
"def post_shipment_notifier(shipment)\n @shipment = shipment\n subject = \"WARNING: No InstaTrace Shipments Posted in 24 hours\" \n mail(:to => EMAIL_NOTIFY_POST_SHIPMENT_API, :subject => subject) if shipment.hawb && shipment.created_at\n end",
"def day_log(day)\n @url = url_for(:controller => 'worklogs', :action => 'index', :day => day)\n @all_users = User.status(\"1\").where(\"id > 1\") #.all - User.find(1)\n recipients = @all_users.collect(&:mail)\n \n @day = day || Date.today.to_s\n @worklogs = Worklog.where(\"status = 0\").where(\"typee = 0\").where(:day => @day)\n \n @sended_user_ids = @worklogs.collect(&:user_id).uniq\n # @no_need_users_ids = [1,61,55,46]\n @no_need_users_ids = Worklog.no_need_users_ids\n @need_user_ids = @all_users.collect(&:id) - @no_need_users_ids\n @unsended_users = User.find(@need_user_ids - @sended_user_ids)\n \n #recipients\n mail :to => recipients ,\n :cc => Setting.plugin_worklogs['WORKLOGS_MAIL_CC'],\n :subject => l(:mail_subject_worklog_day, day)\n end",
"def daily_reading\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def call_request\n client = Client.last\n ClientMailer.call_request(client)\n end",
"def send_ethos_mail\n TeaTimeMailer.delay(run_at: Time.now + 1.hour).ethos(self.user_id)\n end",
"def create\n @transaction = current_user.moneys_out.new(transaction_params)\n\n # Get recipient_id\n recipient = User.find_by_email_or_mobile(@transaction.recipient_key)\n if recipient\n # Set transaction attributes\n @transaction.attributes = {\n recipient_id: recipient.id,\n transaction_type: :transfer,\n happened_on: Time.zone.now\n }\n\n if @transaction.valid?\n # Save transaction\n if @transaction.save\n # Send notification to recipient\n # SendEmailJob.set(wait: 2.minutes).perform_later(@transaction)\n TransactionMailer.received_money_email(@transaction).deliver\n\n # Return to list of transactions\n flash[:notice] = \"<span class='text-uppercase'>#{@transaction.code}</span> confirmed. KES #{@transaction.amount} sent to #{@transaction.recipient.name}.\"\n redirect_to transactions_path\n else\n flash[:error] = @transaction.errors.full_messages.to_sentence\n end\n else\n flash[:error] = @transaction.errors.full_messages.to_sentence\n render new_transaction_path\n end\n else\n flash[:error] = \"WPESA couldn't find that recipient. Verify the mobile or email before trying again.\"\n render new_transaction_path\n end\n end",
"def track_transaction\n \"ga('ecommerce:send');\"\n end",
"def argument_daily_digest\n subscriptions = Subscription.find(:all , :conditions => ['status = 1 && daily_digest = 1 && argument_id is not null'])\n subscriptions.each do |sub|\n Mailers::Debate.deliver_send_subscription_email(\"\",sub.argument,sub,HOST_DOMAIN)\n end\n end",
"def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end",
"def send_notifications!\n NotificationMailer.job_notification(account_manager, self).deliver_later\n end",
"def perform(body:, name:)\n # Savon logger does a nice job of XML pretty print\n # Takes: message, list of filters, pretty print boolean\n AchClient::Logging.log_provider.send_logs(\n body: maybe_encrypt_message(\n message: Savon::LogMessage.new(\n body,\n AchClient::Logging.log_filters,\n true\n ).to_s\n ),\n name: name\n )\n end",
"def log_activity\n BgJob.enqueue(\n UserActivityLogJob,\n {\n client_id: @client_id,\n user_id: @user_kyc_detail.user_id,\n admin_id: @admin.id,\n action: GlobalConstant::UserActivityLog.update_ethereum_address,\n action_timestamp: Time.now.to_i,\n extra_data: {\n case_id: @case_id,\n old_encrypted_u_e_d_ethereum_address: @old_ethereum_address,\n old_md5_ethereum_address: @old_md5_ethereum_address\n }\n }\n )\n end",
"def print_transactions(transaction=nil)\n TransactionLogger.logger.error to_hash\n end"
] |
[
"0.7136187",
"0.66376984",
"0.6453176",
"0.63764864",
"0.632228",
"0.63097477",
"0.63049954",
"0.62806374",
"0.61297613",
"0.6079548",
"0.6079353",
"0.60256314",
"0.59959483",
"0.59696734",
"0.5952205",
"0.5918265",
"0.59001267",
"0.58947307",
"0.5894381",
"0.5886689",
"0.58862245",
"0.5872064",
"0.58712965",
"0.5866645",
"0.5845821",
"0.5844032",
"0.5837133",
"0.5836399",
"0.58224857",
"0.5812633",
"0.5807378",
"0.5796367",
"0.5792872",
"0.57905394",
"0.57868093",
"0.5782582",
"0.57631254",
"0.57608753",
"0.5760764",
"0.57596785",
"0.57494617",
"0.57442915",
"0.5740189",
"0.5730567",
"0.57243484",
"0.5714913",
"0.57116145",
"0.570735",
"0.5690035",
"0.5671364",
"0.5670837",
"0.5669613",
"0.5668025",
"0.5666355",
"0.566447",
"0.5652087",
"0.5644946",
"0.56377286",
"0.5624338",
"0.56194645",
"0.56175256",
"0.5607487",
"0.56032497",
"0.5590327",
"0.5589991",
"0.55897814",
"0.5589178",
"0.5586624",
"0.55752635",
"0.5574016",
"0.5562936",
"0.55611837",
"0.555748",
"0.5543492",
"0.5536248",
"0.55321175",
"0.5530984",
"0.5530517",
"0.5519049",
"0.5513223",
"0.5512784",
"0.5508892",
"0.5507118",
"0.5506397",
"0.55061597",
"0.5504935",
"0.5502474",
"0.5493848",
"0.5492252",
"0.54914814",
"0.54879284",
"0.54839134",
"0.54764307",
"0.547571",
"0.5474547",
"0.54732704",
"0.5470675",
"0.54678077",
"0.54602545",
"0.5459208"
] |
0.7177245
|
0
|
recursion 1 exp(b, 0) = 1 exp(b, n) = b exp(b, n 1)
|
def exponent(b, n)
return 1 if n == 0
if n > 0
b * exponent(b, n - 1)
else
1.0/b * exponent(b, n + 1)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exp1(b, n)\n return 1 if n == 0\n b * exp1(b, n - 1)\nend",
"def exp_1(b, n)\n return 1 if n == 0\n b * exp_1(b, n - 1)\nend",
"def exp1(b, n)\n return 1 if n == 0\n p b * exp1(b, n - 1)\nend",
"def exp(b,n)\n return 1 if n == 0\n b * exp(b,n-1)\nend",
"def exp1(b, n)\n n == 0 ? 1 : b * exp1(b, n - 1)\nend",
"def exp(b,n) #First method\n return 1 if n == 0\n if n > 0\n b * exp(b,n - 1)\n else\n (1.0/b) * exp(b,n + 1) \n end\nend",
"def exponentiation_1(b, n)\n return 1 if n == 0\n return b if n == 1\n b*exponentiation_1(b, n-1)\nend",
"def exponentiation_1(b, n)\n return 1 if n == 0\n return b if n == 1\n b * exponentiation_1(b, n - 1)\nend",
"def exp(b, n)\n return b if n <= 1\n b * exp(b, n-1)\nend",
"def exponentiation1(b,n)\n return 1 if n == 0 \n b * exponentiation1(b, n - 1)\nend",
"def exp(b, n)\n return b if n == 0 || n == 1\n \n return b * exp(b, n - 1)\nend",
"def exp1(base, n)\n return 1 if n == 0 \n\n base * exp1(base, n-1)\nend",
"def exp_1(b, num)\n return 1 if num == 0\n b * exp_1(b, num - 1)\nend",
"def exponent_v1(b, n)\n puts s += 1\n if n == 0\n return 1\n end\n b * exponent_v1(b, n-1)\nend",
"def exponent(b, n)\n return 1 if n == 0\n if n > 0\n b * exponent(b, n - 1)\n else\n 1.0/b * exponent(b, n + 1)\n end\nend",
"def exponent(b, n)\n return 1 if n == 0\n if n > 0\n b * exponent(b, n - 1)\n else\n 1.0/b * exponent(b, n + 1)\n end\nend",
"def exp(b, n)\n return b if n == 0 || n == 1\n \n if n.even?\n return exp(b, n / 2) ** 2\n else\n return b * exp(b, n - 1)\n end\nend",
"def exp(b,n)\n return 1 if n == 0\n return b if n == 1\n\n if n.even?\n num = exp(b, n / 2)\n num * num\n else\n num = exp(b, (n - 1) / 2)\n b * num * num\n end\nend",
"def exponentiation(b, n)\n return 1 if n == 0\n\n return exponentiation(b, n - 1) * b\nend",
"def exp1(b, e)\n return 1 if e == 0\n exp1(b, e - 1) * b\nend",
"def exp(a, b)\n if b == 0\n 1\n else\n a * exp(a, b - 1)\n end\nend",
"def exp_1(base, exp)\n return 1 if exp == 0\n\n base * exp_1(base, exp-1)\nend",
"def exp(b, n) # option 2\n return 1 if n == 0\n result = nil\n\n if n.even?\n result = exp(b, n / 2) ** 2\n else\n result = b * (exp(b, (n - 1) / 2) ** 2)\n end\n\n result\nend",
"def exponent(b, n)\n return b if n == 1\n return 1 if n == 0\n if n >= 0\n exponent(b, n-1) * b\n else\n (1.0/b) * exponent(b, n+1)\n end\n end",
"def exp2(b, n)\n return 1 if n == 0\n return b if n == 1\n if n.even?\n partial = exp2(b, n / 2)\n return partial * partial\n else\n partial = exp2(b, (n - 1) / 2)\n return b * (partial * partial)\n end\nend",
"def exp1(base, power)\n puts \"exp1\"\n return 1 if power == 0\n base * exp1(base, power - 1)\nend",
"def exp(b,n)\n return 1 if n == 0\n return b if n == 1\n case \n when n > 0 && n.even?\n exp(b,n/2) ** 2\n when n > 0 && n.odd?\n b * exp(b,(n-1)/2)**2\n when n < 0 && n.even?\n exp(1.0/b,n/2) ** 2\n when n < 0 && n.odd?\n 1.0/b * exp(b,(n+1)/2) **2\n end\nend",
"def recursive_exponent_1(base, exponent)\n puts \"#{__method__} called\"\n return 1 if exponent.zero?\n base * recursive_exponent_1(base, exponent - 1)\nend",
"def exp_2(b, n)\n return 1 if n == 0\n return b if n == 1\n\n even_rec = exp_2(b, n / 2) # if n.even?\n odd_rec = exp_2(b, (n - 1) / 2) # if n.odd?\n\n if n.even?\n even_rec * even_rec\n # exp(2, 8)\n # => [ exp(2, 4) ] * [ exp(2, 4) ]\n # => [ exp(2, 2) * exp(2, 2) ] * [ exp(2, 2) * exp(2, 2) ]\n # => [ exp(2, 1) * exp(2, 1) * exp(2, 1) * exp(2, 1) ] *[ exp(2, 1) * exp(2, 1) * exp(2, 1) * exp(2, 1) ]\n # => [ b * b * b * b * b * b * b * b ]\n else # n == odd\n b * odd_rec * odd_rec\n # => exp(2, 7)\n # => b * [ exp(2, 3) ] * [ exp(2, 3) ]\n # => b * [ b * exp(2, 1) * exp(2, 1) ] * [ b * exp(2, 1) * exp(2, 1) ]\n # => b * [ b * b * b ] * [ b * b * b ]\n end\n\nend",
"def exp1(base, power)\n return 1 if power == 0\n base * exp1(base, power - 1)\nend",
"def exp2(b, n)\n p \"exp2 #{b}, #{n}\"\n return 1 if n<=0\n return b if n==1\n if n.even?\n half_exp = exp2(b, n/2)\n return half_exp * half_exp\n else\n half_exp = exp2(b, (n-1)/2)\n return b*half_exp * half_exp\n end\nend",
"def exp1(base, power)\n return 1 if power == 0\n base * exp1(base, power - 1)\nend",
"def exp1(base, power)\n return 1 if power <= 0\n exp1(base, power - 1) * base\nend",
"def exponentiation_2(b, n)\n return 1 if n == 0\n return b if n == 1\n\n if n.even?\n exponentiation_2(b, n / 2) ** 2\n else\n b * (exponentiation_2(b, (n - 1) / 2) ** 2)\n end\nend",
"def exponentiation2(b, n)\n return 1 if n == 0\n return b if n == 1\n if n.even?\n exponentiation2(b, n / 2) ** 2\n else\n b * exponentiation2(b, (n - 1) / 2) ** 2\n end\nend",
"def exponentiation_one(base, exp)\n return nil if exp < 0\n return 1 if exp == 0\n return base if exp == 1\n\n base * exponentiation_one(base, exp - 1)\nend",
"def exp(base, power)\n return 1 if power == 0\n return base if power == 1\n base * exp(base, (power-1))\nend",
"def exponent_v2(b, n)\n puts s += 1\n if n == 0 \n return 1\n elsif n == 1 \n return b\n elsif n.even?\n rec = exponent_v2(b, n / 2)\n rec * rec\n else \n rec = exponent_v2(b, (n - 1) / 2)\n b * rec * rec\n end\nend",
"def exp1(base, num)\n return 1 if num == 0\n return base if num == 1\n expo = base * exp1(base, num-1)\nend",
"def exp1(num, exponent)\n return 1 if exponent == 0\n # return ( 1 / exp1(num, exponent - 1) )\n\n num * exp1(num, exponent - 1)\nend",
"def power(x,n)\n n == 0 ? (return 1) : x*power(x,n-1)\n\nend",
"def exp2(num, exponent)\n return 1 if exponent == 0\n exp_recursion = exp2(num, (exponent / 2))\n if exponent.even?\n exp2(num, (exponent / 2)) * exp2(num, (exponent / 2))\n else\n num * exp2(num, (exponent - 1) / 2) * exp2(num, (exponent - 1) / 2)\n end\n\n\nend",
"def exponent1(base, num)\n return 1 if num == 0\n return base if num == 1\n x = base * exponent1(base, num-1)\n\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == 1\n (n - 1) * gamma_fnc(n - 1)\nend",
"def gamma_fnc(n)\n return nil if n <= 0\n return 1 if n == 1\n (n - 1) * gamma_fnc(n - 1)\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == 1\n gamma_fnc(n - 1) * (n - 1)\n\n\n # n = (n - 1)!\n # n = 4\n # 3! = 3 * 2 * 1\n # 3 => 2 3-1 = 2\n # 2 => 1 2-1 = 1\n\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == 1\n return (n-1) * gamma_fnc(n-1)\nend",
"def exponentiation(base, exp)\n return nil if exp < 0\n return 1 if exp == 0\n return base if exp == 1\n\n if exp.even?\n (exponentiation(base, exp / 2)**2)\n else\n base * (exponentiation(base, (exp - 1) / 2)**2)\n end\nend",
"def exp_v_1(num, pow)\n return 1 if pow === 0\n return num * exp_v_1(num, pow - 1)\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def gamma_fnc(n)\n return nil if n < 1\n return 1 if n == 1\n (n-1) * gamma_fnc(n-1)\nend",
"def exp(base, exponent)\n return base if exponent == 1\n base * exp(base, exponent-1)\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n == (1 || 2)\n\n (n - 1) * gamma_fnc(n - 1)\nend",
"def power(n, exp)\n total = 1\n 1.upto(exp) do |num|\n total = multiply(n, total)\n end\n total\nend",
"def exp(base,exponent)\n p exponent\n return 1 if exponent == 0\n return base if exponent == 1\n if exponent.even?\n result = exp(base,exponent/2)\n result * result\n else\n result = exp(base,(exponent-1)/2)\n base * (result * result)\n end\n\n\nend",
"def gamma_fnc(n)\n return nil if n < 1\n return 1 if n == 1\n\n gamma_fnc(n-1) * (n - 1)\nend",
"def exp(base, exponent)\n return 1 if exponent.zero?\n\n base * exp(base, exponent - 1)\nend",
"def gamma_fnc(n)\r\n return nil if n <= 0\r\n return 1 if n <= 2\r\n (n - 1) * gamma_fnc(n-1)\r\n end",
"def exp2(n,e)\n return n if n == 0 || n == 1 || e == 1\n return 1 if e == 0\n if e % 2 == 0\n temp = exp2(n,(e / 2))\n return temp * temp\n else\n temp = exp2(n,((e - 1) / 2))\n return n * temp * temp\n end\nend",
"def exponent1(base, power)\n # if power equals zero , then 1 else (base * method(base,power - 1))\n if power == 0\n return 1\n else\n (base * exponent1(base, power - 1))\n end\nend",
"def gamma_fnc(n)\n return nil if n == 0\n return 1 if n <= 1\n (n-1)*gamma_fnc(n - 1)\nend",
"def exp2(base, power)\n puts \"exp2\"\n return 1 if power == 0\n return base if power == 1 #\n\n if power.even?\n exp2(base, power / 2) ** 2\n else\n base * ( exp2(base, (power - 1) / 2) ** 2 )\n end\nend",
"def factorial_recursive(n)\n return 1 if n == 0\n n * factorial_recursive(n-1)\nend",
"def power(num, n)\n return num if n == 1\n multiply(num, power(num, n - 1))\nend",
"def my_pow(x, n)\n return x if n == 1\n return x * x if n == 2\n return x / x if n == -2\n\n if n > 0\n x * my_pow(x, n - 1)\n else\n my_pow(x, n + 1)\n end\nend",
"def gamma_fnc(n)\n\treturn nil if n == 0\n\n\treturn 1 if n == 1\n\n\treturn (n - 1) * gamma_fnc(n - 1)\nend",
"def exp_r1 (base, exponent)\n if exponent == 0\n return 1\n else\n base * exp_r1(base, exponent - 1)\n end\nend",
"def factorial_recursive n\n return 1 if n == 0\n n * factorial_recursive(n-1)\nend",
"def rec_exp_1(base, power)\nend",
"def exp(n, i)\n n ** i\nend",
"def factorial_recursive(n)\n\tif (n==0)\n\t\treturn 1\n\telse\n\t\t\treturn n*factorial_recursive(n-1)\n\tend\nend",
"def factorial_recursive(n)\n n.zero? ? 1 : n * factorial_recursive(n - 1)\nend",
"def power(num, n)\n if n == 0\n 1\n elsif n > 0\n multiply(power(num, n - 1), num)\n else\n 1 / power(num, -n).to_f\n end\nend",
"def power_of_n(n, power)\n result = 1\n power.times {result = multiply(n, result)} # similar to recursion\n result\nend",
"def exponentiation(base, power)\n return 1 if power == 0\n base * exponentiation(base, power - 1)\nend",
"def factorial_recursive(n)\n if n == 0\n 1\n else\n n * factorial_recursive(n-1)\n end\nend",
"def factorial_recursive(n)\n if n == 0\n 1\n else\n n * factorial_recursive(n-1)\n end\nend",
"def exp_2(base, exp)\n return 1 if exp == 0\n return base if exp == 1\n\n if exp % 2 == 0\n even = exp_2(base, exp / 2)\n even * even\n else\n odd = exp_2(base, (exp - 1) / 2)\n base * odd * odd\n end\nend",
"def factorial_recursive(n)\n if n < 0\n \"Invalid input\"\n elsif n == 0\n 1\n else\n n *= factorial_recursive(n-1)\n end\nend",
"def factorial_recursive(n)\n\tif n == 0\n\t\treturn 1 # 0! = 1\n\telse\n\t\treturn n*factorial_recursive(n-1) #keep calling the function\n\tend\nend",
"def pow( x, n)\n if (n == 0)\n return (1)\n elsif (n % 2 == 0)\n value = pow(x, n / 2)\n return (value * value)\n else\n value = pow(x, n / 2)\n return (x * value * value)\n end\nend",
"def rec_factorial(n)\n if n==0\n return 1\n end\n return rec_factorial(n-1)*n\nend",
"def factorial_recursive(n)\n if n == 1\n return 1\n end\n return n * factorial_recursive(n-1)\nend",
"def fact_sig_exp(n)\n gamma_sig_exp(n + 1)\nend",
"def recursive_factorial(n)\n return 1 if n < 1\n\n n * recursive_factorial(n - 1)\nend",
"def factorial_recursive(n)\n\t\tif n == 1\n\t\t\treturn 1\n\t\telse\n\t\t\tn * factorial_recursive(n-1)\n\t\tend\n\tend",
"def pow(x, n)\n if n == 0\n return 1\n elsif n % 2 == 0\n return pow(x, n/2) * pow(x, n/2)\n else\n return x*pow(x, n-1)\n end\nend",
"def rec_exp_2(base, power)\nend",
"def general_power(n, x)\n multiply(n, 1)**(x)\nend",
"def gamma_fnc(num)\n return nil if num == 0\n return 1 if num == 1\n (num - 1) * gamma_fnc(num - 1)\nend",
"def power(n, e)\n if e == 0\n return 1\n elsif e == 1 \n return n\n else\n multiply(n, n**(e - 1))\n end\nend",
"def gamma_fnc(num)\n return nil if num < 1\n return 1 if num == 1\n (num - 1) * gamma_fnc(num - 1)\nend",
"def gamma_fnc(num)\n return nil if num < 1\n return 1 if num == 1\n\n (num - 1) * gamma_fnc(num - 1)\nend",
"def pow(base, exponent) #(3, 4) ==> 3 * 3 * 3 * 3 = \n return 1 if exponent == 0 \n #return base if exponent == 1\n base * pow(base, exponent - 1)\nend",
"def exponent1(base, power)\n\treturn 1 if power == 0\n\tbase * exponent1(base, power - 1)\nend",
"def exp2(base, num)\n return 1 if num == 0\n return base if num == 1\n if num % 2 == 0\n expo = exp(base, num/2)\n else\n expo = exp(base, (num-1)/2)\n end\nend",
"def exponent_v1(base, power)\n return 1 if power <= 0\n base * exponent_v1(base, power-1)\nend",
"def factorial(n)\n return 1 if n == 1 # base case (where the recursion stops/ the bottom)\n # no base case? program breaks because of stack overflow\n\n n * factorial(n - 1) # inductive step. if the logic works, it is scaleable\nend"
] |
[
"0.86539435",
"0.86359346",
"0.85930175",
"0.8509584",
"0.8494824",
"0.84863293",
"0.8315414",
"0.82662886",
"0.8263258",
"0.8256007",
"0.82111144",
"0.8204571",
"0.8113258",
"0.8008711",
"0.79113495",
"0.79113495",
"0.7906457",
"0.78841704",
"0.7869792",
"0.7828034",
"0.7767897",
"0.7729725",
"0.76982003",
"0.7680524",
"0.7675968",
"0.760561",
"0.75998616",
"0.75218105",
"0.74972427",
"0.74494326",
"0.7415045",
"0.73941624",
"0.7378496",
"0.73380417",
"0.7253188",
"0.72303736",
"0.71901363",
"0.71848804",
"0.7160773",
"0.71409523",
"0.71167594",
"0.7113677",
"0.70994353",
"0.7072641",
"0.7069636",
"0.7067047",
"0.70543504",
"0.70505977",
"0.7045773",
"0.7032526",
"0.7032526",
"0.7032526",
"0.70235384",
"0.6995164",
"0.69702655",
"0.69643295",
"0.6961404",
"0.6954934",
"0.6937125",
"0.6930681",
"0.690737",
"0.69057983",
"0.6882843",
"0.68810636",
"0.6858423",
"0.6844317",
"0.6833212",
"0.68208873",
"0.68003",
"0.67886245",
"0.67829907",
"0.67715776",
"0.67604536",
"0.67601466",
"0.67450243",
"0.67334366",
"0.6724726",
"0.6724394",
"0.6724394",
"0.6713406",
"0.6713277",
"0.66935885",
"0.6692212",
"0.667963",
"0.6665932",
"0.6659171",
"0.66541225",
"0.6622868",
"0.6618133",
"0.6599234",
"0.659431",
"0.6575825",
"0.65656585",
"0.65510696",
"0.655104",
"0.65488905",
"0.6521383",
"0.6495706",
"0.6481671",
"0.6474588"
] |
0.789177
|
17
|
p fibonacci(1) p fibonacci(2) p fibonacci(3) p fibonacci(4) p fibonacci(5) p fibonacci(6) p fibonacci(7) p fibonacci(8)
|
def subsets(arr)
return [[]] if arr.empty?
last_el = arr.last
results = []
subsets(arr[0..-2]).each do |el|
sub_arr = el << last_el
results << sub_arr
end
subsets(arr[0..-2]) + results
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fibonacci( n )\r\n fib_nums = []\r\n return n if n <= 1\r\n fib_nums << fibonacci( n - 1 )\r\n fib_nums << fibonacci( n - 2 )\r\n p \"#{fib_nums}\"\r\nend",
"def fibonacci\n\tresults, first, second, current = 0, 1, 2, 2\n\twhile current <= 4000000\n\t\tif current % 2 == 0\n\t\t\tresults += current\n\t\tend\n\t\tcurrent = first + second\n\t\tfirst, second = second, current\n\tend\n\treturn results\nend",
"def fibonacci(p2, p1, sum)\n next_number = p2 + p1\n return sum if next_number >= 4000000\n sum += next_number if next_number.even?\n fibonacci p1, next_number, sum\nend",
"def fibonacci(n)\n \nend",
"def fibonacci(n)\n \nend",
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n\n [fib(n-1),fib(n-2)].reduce(:+)\n\t\nend",
"def fibonacci(how_many_numbers)\n fibonacci_sequence = []\n count = 0\n while count < how_many_numbers\n if count == 0\n fibonacci_sequence << 0\n count += 1\n elsif count == 1\n fibonacci_sequence << 1\n count += 1\n else\n fibonacci_sequence << fibonacci_sequence[-1] + fibonacci_sequence[-2]\n count += 1\n end\n end\n fibonacci_sequence\nend",
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n \n\n fib(n - 1) + fib(n - 2)\nend",
"def fibs(n) ; PHI**n - PHA**n ; end",
"def fibonacci(n)\n if n == 0\n 0\n elsif n == 1\n 1\n else\n before_previous = 0\n previous = 1\n actual = nil\n (2..n).each do\n actual = previous + before_previous\n before_previous = previous\n previous = actual\n end\n actual\n end\nend",
"def fibonacci\n @sequence = [1,1]\n x = 0\n while (@sequence[x+1] < 4e+6)\n @sequence << @sequence[x] + @sequence[x+1]\n x += 1\n end\n even? x\nend",
"def fibonacci(num)\n (1..num).inject( [0,1] ) { |fib| fib << fib.last(2).inject(:+) }\n\nend",
"def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend",
"def fibonacci(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n else\r\n return fibonacci(n-1) + fibonacci(n-2)\r\n end\r\nend",
"def fibonacci(n)\n return 1 if n == 1\n return 1 if n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fib(n)\n fib_0 = 0\n fib_1 = 1\n (0...n).each do \n temp = fib_0\n fib_0 = fib_1\n fib_1 = temp + fib_1\n end\n return fib_1\nend",
"def fibonacci(num)\n fib_nums = []\n (0...num).each do |i|\n if i == 0 || i == 1\n fib_nums << 1\n next\n end\n fib_nums << fib_nums[i-2] + fib_nums[i-1]\n end\n return fib_nums\nend",
"def fibonacci(n)\n n = fibonacci( n - 1 ) + fibonacci( n - 2 ) if n > 1\n n\nend",
"def fibs(n)\nend",
"def fib(n)\n n.times.each_with_object([0,1]) { |_, results| results << results[-2] + results[-1] }\nend",
"def fib(n) \n if n == 0\n return 0\n else\n\tfib_0 = 0\n\tfib_1 = 1\n\t(1..(n-1)).each do \n\t\ttemp = fib_0\n\t\tfib_0 = fib_1\n\t\tfib_1 = temp + fib_1\n\t\t\n\tend\n\treturn fib_1\n end\nend",
"def fibonacci(n)\n\treturn 0 if n == 0\n\treturn 1 if n == 1\n\tfibonacci(n-1) + fibonacci(n-2)\nend",
"def fib(n)\n #if n > 4000000\n #\treturn puts n\n #end\n return n if (0..1).include? n\n fib(n-1) + fib(n-2) if n > 1\nend",
"def fibonacci(n)\n return 0 if n == 1\n return 1 if n == 2\n return fibonacci(n-1)+fibonacci(n-2)\nend",
"def fibonacci(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n fibonacci(n-2) + fibonacci(n-1)\n end\nend",
"def fibonaci(n)\n\tfi= [1, 1]\n\t(n-1).times do\n\t\tfi << fi[1]+fi.shift\n\tend\n\treturn fi[0]\nend",
"def fibonacci(n)\n ary = [0, 1]\n (n - 1).times { |_| ary << ary[-2] + ary[-1] }\n ary.pop\nend",
"def fibonacci(number)\n if number < 2\n puts \"if: #{number}\" #sum comes from here... 8 x 1\n number\n else\n puts \"else: #{number} ==> #{number-1} + #{number-2}\"\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def show_fib(n)\n return 0 if n == 0\n return 1 if n == 1\n show_fib(n-1) + show_fib(n-2)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 2) + fibonacci(n - 1)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n \n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibs (n) #Non-recursive\n\n\t# n = number of Fibonacci sequence members.\n\t# 0, 1, 1, 2, 3, 5, 8, 13, ..\t\n\tfib_seq = []\n\t(0..n).each do |i|\n\t\tif i == 0\n\t\t\tfib_seq << 0\n\t\telsif i == 1\n\t\t\tfib_seq << 1\n\t\telse\n\t\t\tfib_seq << fib_seq[i-2] + fib_seq[i-1]\n\t\tend\n\tend\n\tfib_seq\nend",
"def fibonacci(n)\n if n < 3\n 1\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend",
"def fib(n)\n n.times.each_with_object([0,1]) { |num, obj| obj << obj[-2]+obj[-1]}\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1 ) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n if n <= 2\n 1\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fibonacci(number)\r\n if number < 2\r\n number\r\n else\r\n fibonacci(number - 1) + fibonacci(number - 2)\r\n end\r\nend",
"def fib(number)\n if number == 0\n 0\n elsif number == 1\n 1\n else\n test= fib(number-1) + fib(number-2)\n puts \"adding number #{number-1} and #{number-2} = #{test}\"\n test\n end\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return 1 if n == 1 || n == 2\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n if n == 1 || n == 2\n 1\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend",
"def fibonacci(n)\n fib1 = 0\n fib2 = 0\n fib = 0\n\n (1..n).each do |num|\n if num <= 2\n fib = 1\n fib1 = 1\n fib2 = 1\n else\n fib1 = fib2\n fib2 = fib\n fib = fib1 + fib2\n end\n end\n\n fib\nend",
"def fibonacci( n )\n return n if n <= 1 \n fibonacci( n - 1 ) + fibonacci( n - 2 ) \nend",
"def fib(n)\n return 1 if n == 2\n return 0 if n == 1\n\n fib(n-1) + fib(n-2)\nend",
"def fib(x)\n fib_nums = [0,1]\n number = x - 2\n number.times do\n fib_nums << fib_nums[-2] + fib_nums[-1]\n end\n p fib_nums\nend",
"def fibonacci(nth)\n return 1 if nth <= 2\n\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend",
"def fibonacci (integer)\n\tfib_arr = [0, 1]\n\t(integer-2).times do |index|\n\t\tresult = fib_arr[index+1] + fib_arr[index]\n\t\tfib_arr << result\n\tend\n\t\np fib_arr\nend",
"def fibonacci(integer)\n return 1 if integer <= 2\n\n fibonacci(integer - 1) + fibonacci(integer - 2)\nend",
"def fibonacci(n)\n\tif n == 0 || n == 1\n\t\treturn 1\n\telse\n\t\treturn fibonacci(n-1) + fibonacci(n-2)\n\tend\nend",
"def fib (x)\n y = x-2\nfib_sequence = y.times.inject(%5B0,1%5D) do |a, idx|\n a << a[-2] + a[-1]\nend",
"def fibonacci n\n first = 0\n second = 1\n n.times do\n third = first + second\n first = second\n second = third\n end\n first\nend",
"def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(n)\n return [0,1].take(n) if n <= 2\n fib_seq = fibonacci(n-1)\n last_ele = fib_seq[-1] + fib_seq[-2]\n fib_seq << last_ele\nend",
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n\n return fib(n-1) + fib(n-2)\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibonacci(num)\n return 1 if num <= 2\n fibonacci(num - 1) + fibonacci(num -2)\nend",
"def fib(n)\n return 0 if n <= 0\n return 1 if n == 1\n\n fib(n - 1) + fib(n - 2)\nend",
"def fibonacci(n)\n answer = 0\n (1..n).each do |i|\n answer += i\n end\nend",
"def fib(n)\r\n if n == 1 then\r\n 10\r\n elsif n == 0 then\r\n 1\r\n else\r\n fib(n - 1) + fib(n - 2)\r\n end\r\nend",
"def fibonacci(n)\n if n<=2\n [0,1].take(n)\n else\n arr = fibonacci(n-1)\n arr << arr[-2]+arr[-1]\n end\nend",
"def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend",
"def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend",
"def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend",
"def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend",
"def fib(n)\n \nend",
"def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend",
"def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend",
"def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend",
"def fibonacci(number)\n $counter += 1\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fib(n)\n n.times.each_with_object([0,1]) { |num, obj| obj << obj[-2] + obj[-1] }\nend",
"def fibonacci(integer)\n fibs = [1, 1]\n (integer - 2).times do |num|\n fibs << fibs[num] + fibs[num + 1]\n end\n fibs.last\nend",
"def fibonacci(n)\n if n == 0 or n == 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fibonacci(number)\n return 1 if number == 1 || number == 2\n \n fib_array = [1, 1]\n\n 3.upto(number) do |num|\n fib_array << (fib_array[num-2] + fib_array[num-3]) \n end\n\n fib_array[number-2] + fib_array[number-3]\nend",
"def fibonacci(n)\n if n < 2\n n\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fibonacci_numbers\n fibonacci_snapshot = [1,2]\n fibonacci_results = []\n loop do\n return fibonacci_results if fibonacci_snapshot[1] > 4_000_000\n fibonacci_snapshot << fibonacci_snapshot.reduce(:+)\n fibonacci_results << fibonacci_snapshot[0]\n fibonacci_snapshot.shift\n end\nend",
"def fibonacci(n)\n fib_array = [0,1]\n\tfib = n - 2\n fib.times do |fib|\n fib_array << fib_array[-1] + fib_array[-2]\n end\n\n\tif fib_array.count < 20\n \tp fib_array\n else\n \tp fib_array.last \n end\t\nend",
"def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n return 1 if n == 2\n # return 2 if n == 3\n fib(n - 1) + fib(n - 2)\nend",
"def fib(number)\n sequence = [0,1]\n number.times {sequence << sequence[-1] + sequence[-2]}\n sequence[-1]\n return sequence\nend",
"def fibonacci (n)\r\n def calculation(n)\r\n a = 0\r\n b = 1\r\n\r\n # Compute Fibonacci number in the desired position.\r\n n.times do\r\n temp = a\r\n a = b\r\n # Add up previous two numbers in sequence.\r\n b = temp + b\r\n end\r\n\r\n return a\r\n\r\n end \r\n\r\n fib_results = []\r\n\r\n n.times do |n|\r\n\r\n result = calculation(n)\r\n fib_results << result\r\n end \r\n\r\n return fib_results\r\n\r\nend",
"def fib(n)\n current_value = 0\n next_value = 1\n\n n.times do |i|\n current_value, next_value = next_value, current_value + next_value\n end\n\n return current_value\nend",
"def fibonacci(n)\n return n unless n > 1\n fibonacci(n -1) + fibonacci(n -2)\nend",
"def fibonacci(nth)\n return 1 if nth < 3\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend",
"def naive_fib(number)\n return -1 if number < 0\n return 0 if number == 0# && (@operations += 1)\n return 1 if number == 1# && (@operations += 1)\n naive_fib(number-1) + naive_fib(number-2)\nend",
"def fibonacci(n)\n return n if n == 1 || n == 0 \n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibs(n)\n return n if n <= 1\n fibs(n - 1) + fibs(n - 2)\nend",
"def fibonacci n\n return n if n < 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def fibonacci(number)\n if number < 2\n number\n else\n fibonacci(number - 1) + fibonacci(number - 2)\n end\nend",
"def gen_fibs3\n fibs = [0,1]\n n = 10\n a,b = 0,1\n (n-1).times do\n a,b = b,a+b\n fibs << b\n end\n fibs\nend",
"def cool_fib(number)\n (0..number).inject([1,0]) {|i_arr| [i_arr.last, i_arr.first + i_arr.last]}.first\nend",
"def fibonacci(n)\n if n <= 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend",
"def fib(n)\n return 1 if n <= 2\n \n fib_index = 3\n a, b = 1, 1\n \n while fib_index <= n\n c = a + b\n a = b\n b = c\n fib_index += 1\n end\n \n c\nend"
] |
[
"0.820835",
"0.81469125",
"0.80928487",
"0.8072117",
"0.8063987",
"0.80615276",
"0.8056482",
"0.80351835",
"0.8023147",
"0.8000126",
"0.79788816",
"0.79749435",
"0.7973073",
"0.7972119",
"0.7970941",
"0.79605913",
"0.7949807",
"0.7943491",
"0.79315317",
"0.7931355",
"0.7924724",
"0.7921637",
"0.79142207",
"0.7910706",
"0.7899162",
"0.78977466",
"0.7891817",
"0.7890087",
"0.78893906",
"0.78770846",
"0.78706175",
"0.7866979",
"0.7855646",
"0.7851431",
"0.78505695",
"0.7847181",
"0.78418005",
"0.78405946",
"0.7831055",
"0.7829507",
"0.7829507",
"0.78293717",
"0.7827079",
"0.7823719",
"0.78206867",
"0.7819427",
"0.78185445",
"0.78145057",
"0.78118616",
"0.7811804",
"0.78099066",
"0.78073853",
"0.78069514",
"0.7806325",
"0.7806325",
"0.7803177",
"0.7799327",
"0.7796528",
"0.7796528",
"0.7796528",
"0.7796528",
"0.7796528",
"0.7787447",
"0.77861536",
"0.77848345",
"0.77803653",
"0.77777153",
"0.7776387",
"0.7776387",
"0.7776387",
"0.7776387",
"0.7776028",
"0.7775581",
"0.7775581",
"0.7775581",
"0.7771385",
"0.7758946",
"0.77580667",
"0.77576363",
"0.77555484",
"0.7753821",
"0.77511764",
"0.77511495",
"0.77503073",
"0.7748547",
"0.774548",
"0.7744362",
"0.77410567",
"0.77391016",
"0.77321273",
"0.77305794",
"0.7729549",
"0.7722358",
"0.7713138",
"0.7713138",
"0.7713138",
"0.7713138",
"0.7712722",
"0.77117735",
"0.7711619",
"0.77106875"
] |
0.0
|
-1
|
=> [[], [1]] p subsets([1, 2]) => [[], [1], [2], [1, 2]] p subsets([1, 2, 3])
|
def permutations(arr)
arr = arr.dup
return [arr] if arr.length == 1
last_el = arr.pop
base = permutations(arr) # [[1]]
results = []
base.each do |perm|
(perm.length + 1).times do |i|
result = perm[0...i] + [last_el] + perm[i..-1]
results << result
end
end
results
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def subsets(nums)\n result = []\n subsets_helper(nums, [], result, 0)\n result\nend",
"def subsets(nums)\n return [[]] if nums.empty?\n return [[],[nums.first]] if nums.size == 1\n [[], (0...nums.size).map {|x|\n [[nums[x]], subsets(nums[x + 1..-1]).map { |y| [nums[x]] + y }]\n }.flatten]\nend",
"def subsets(set)\n return [[]] if set == []\n \n res= [[]]\n \n 0.upto set.length-1 do |i|\n subsets(set[(i+1)..-1]).each do |subsubset|\n res << [set[i]] + subsubset\n end\n end\n \n res\nend",
"def subsets(arr)\n subsets_helper(result = [], temp = [], arr, 0)\nend",
"def subsets(set)\n return [[]] if set.empty?\n smaller_set = set.take(set.count-1)\n smaller_subsets = subsets(smaller_set)\n bigger_subsets = []\n smaller_subsets.each do |smaller_subset|\n bigger_subsets << smaller_subset + [set.last]\n end\n\n smaller_subsets + bigger_subsets\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(arr)\n return [arr] unless arr.is_a?(Array)\n return [arr] if arr.empty?\n\n # return [arr] if arr.length == 1\n # first = arr.shift\n # all_subsets << subsets(first)\n # all_subsets << subsets(arr)\n\n # [[],[1]] << [2],[1,2] [each, last] << [last] [each,last]\n # subsets(arr-1) << subsets(arr)[-1]\n all_subsets = [[]]\n\n arr.each { |ele| all_subsets << [ele] }\n\n (0...(arr.length - 1)).each do |idx1|\n # all_subsets << [arr[idx1]] unless all_subsets.include?(arr[idx1])\n (1...arr.length).each do |idx2|\n if idx2 > idx1 && !all_subsets.include?(arr[idx2])\n # all_subsets << [arr[idx2]]\n all_subsets << arr[idx1..idx2]\n end\n end\n end\n\n all_subsets\nend",
"def subsets(nums)\n return [[]] if nums.empty?\n first = nums[0]\n prev_subs = subsets(nums[1..-1])\n new_subs = prev_subs.map do |sub|\n sub + [first]\n end \n prev_subs + new_subs\nend",
"def subsets(array)\n return [[]] if array.empty?\n number = array.pop\n prev_subsets = subsets(array)\n new_subsets = []\n prev_subsets.each do |subset|\n new_subsets << ([number] + subset)\n end\n prev_subsets + new_subsets\nend",
"def subsets(arr)\n return [arr] if arr.empty?\nsubsets(arr[])\nend",
"def subsets(arr)\n return [arr] if arr.empty?\n # p arr\n # if arr.length == 1\n # return subsets(arr[0...0]) + [arr]\n # end\n\n arr.each {|ele| subsets(arr -[ele]) } + [arr]\nend",
"def subsets (arr)\n return [[]] if arr.length == 0\n\n interim = subsets(arr[0...-1])\n interim + interim.map do |el|\n el + [arr[-1]]\n end\nend",
"def subsets(arr)\n return [self] if arr.length == 1\n\n subs + subsets()\nend",
"def subsets_2(nums, results = [], solution = [], current_idx = 0)\n results << solution.clone\n return if current_idx >= nums.length\n\n current_idx.upto(nums.length - 1) do |i|\n solution << nums[i]\n subsets(nums, results, solution, i + 1)\n solution.pop\n end\n\n results\nend",
"def subsets(array) # [1, 2], [1]\n return [[]] if array.length == 0\n # return [[], array ] if array.length == 1\n\n except_last = subsets(array[0...-1]) #subsets([1]), subsets([])\n combination = except_last.map { |ele| ele += [array[-1]]} #map subsets([1]) + [2], \n\n except_last + combination\nend",
"def subsets(arr)\n return [[]] if arr.length == 0\n #return [arr] if arr.length == 1\n\n prev_set = subsets(arr[0..-2])\n new_subset = prev_set.map { |subarr| subarr + [arr[-1]] }\n\n prev_set + new_subset\nend",
"def subsets(array)\n return [[]] if array.empty?\n subs = array[0...-1]\n smaller_subs = subsets(subs)\n bigger_subs = []\n smaller_subs.each do |sub|\n bigger_subs << sub + [array[-1]]\n end\n smaller_subs + bigger_subs\nend",
"def subsets_with_dup(nums)\n result = []\n nums.sort!\n subsets_helper(nums, [], result, 0, {})\n result\nend",
"def subsets(arr)\r\n comb = [] #set up return array\r\n\r\n for x in 0..arr.length do # gives a value from 0 to arr.length to pass below\r\n arr.combination(x) {|y| comb << y} # pushes to the return all of the possible combinations of the array\r\n end # the x insures that all possible lengths of combinations are returned.\r\n\r\n comb # returns all combinations\r\nend",
"def subsets(arr)\n ans = [[]]\n arr.length.times do |id|\n id2 = id + 1\n ans << [arr[id]]\n while id2 < arr.length\n ans << arr[id..id2]\n id2 += 1\n end\n end\n ans\nend",
"def subsets(arr)\n return [arr] if arr.empty?\n prev = subsets(arr[0..-2]) \n next_one = []\n prev.each { |sub| next_one << sub + [arr[-1]] }\n return prev + next_one\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n s = subsets(arr - [arr.last])\n s + s.map { |el| el + [arr.last] }\nend",
"def subsets(arr)\n res = [] \n if arr.length == 1 \n res << [] \n res << [arr[0]]\n return res \n elsif arr.empty?\n return [[]]\n end\n \n last = arr.pop \n old_set = subsets(arr)\n res = old_set\n \n res += old_set.map{ |i| i + [last] }\nend",
"def subsets(array)\n if array.length <= 1\n return array\n end\n subset_array = []\n (0..array.length - 1).each do |i|\n subset_array << subsets(array[0...i]) << subsets(array[0...i]).concat([array[-1]])\n end\n return subset_array\nend",
"def find_subsets(nums)\n\tsorted_nums = nums.sort()\n\n\tsubsets = []\n\tsubsets.append([])\n\n\tstart_index, end_index = 0, 0\n\n\tfor i in 0..(nums.length - 1)\n\t\tstart_index = 0\n\t\t0\n\t\t0\n\t\tif i > 0 and nums[i] == nums[i - 1]\n\t\t\tstart_index = end_index + 1\n\t\tend\n\n\t\tend_index = subsets.length - 1\n\t\t0\n\t\t1\n\t\tfor j in start_index..end_index\n\t\t\tsubset1 = Array.new(subsets[j])\n\t\t\t[]\n\t\t\t[]\n\t\t\tsubset1.append(nums[i])\n\t\t\t[1]\n\t\t[3]\n\t\t\tsubsets.append(subset1)\n\t\t\t[[],[1],[3]]\n\t\tend\n\tend\n\n\treturn subsets\nend",
"def subsets(arr)\n return [arr] if arr.empty?\n out = []\n subsets(arr[1..-1]).each do |s|\n out << s\n out << [arr[0]] + s\n end\n out\nend",
"def subsets(arr)\n return [ [] ] if arr.empty?\n subs = subsets(arr.drop(1)) # [ [] ]\n return subs.concat(subs.map { |sub| [arr.first].concat(sub) })\nend",
"def subsets(array)\n if array.empty?\n return [[]]\n end\n\n el = array.shift[0]\n old_subsets = subsets(array)\n new_subsets = old_subsets.map { |old_subset| [el] + old_subset }\n new_subsets + old_subsets\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n # debugger\n # take - return first n elements\n\n subArr = arr.take(arr.count - 1)\n\n subs = subsets(subArr)\n\n # concat Appends the elements of other_ary to self.\n # tyle co +\n subArrays = subs.map { |sub| sub + [arr.last] }\n subs.concat(subArrays)\nend",
"def subsets(arr)\n #base case(s)\n p arr\n return [arr] if arr.empty?\n # return [[], arr] if arr.length == 1\n #inductive step\n remaining_arr = subsets(arr[0...-1])\n remaining_arr + remaining_arr.map { |ele| ele + [arr.last] }\n # subsets(arr) + subsets(arr[0...-1])\nend",
"def subsets(arr)\n return [[]] if arr == [] \n\n new_arr = []\n last = arr[-1]\n subset = subsets(arr[0..-2])\n\n subset.each do |suba|\n new_arr << suba + [last]\n end\n \n subset + new_arr\n\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n subs = subsets(array[0..-2])\n subs.concat(subs.map{|el| el += [array.last]})\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n subs = subsets(array[0..-2])\n subs.concat(subs.map{|el| el += [array.last]})\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n subsets_arr = []\n cur_el = arr[0]\n prior_subs = subsets(arr[1..-1])\n prior_subs.each do |subset|\n subsets_arr << subset.dup.push(cur_el)\n end\n subsets_arr + prior_subs\nend",
"def subsets_3(nums, results = [], solution = [], current_idx = 0)\n results << solution.clone\n return if current_idx == nums.length\n\n nums[current_idx..-1].each_with_index do |num, i|\n solution << num\n subsets(nums, results, solution, current_idx + i + 1)\n solution.pop\n end\n\n results\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n dupped = array.dup\n last = dupped.pop\n sets = subsets(dupped)\n\n subsets(dupped).each do |set|\n sets << (set << last)\n end\n\n sets\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n\n last_el = arr.last\n results = []\n\n\n subsets(arr[0..-2]).each do |el|\n sub_arr = el << last_el\n results << sub_arr\n end\n\n subsets(arr[0..-2]) + results\nend",
"def subsets_of(array)\n 0.upto(array.length).flat_map { |n| array.combination(n).to_a }\n end",
"def subsets(arr)\n return [[]] if arr.empty?\n\n val = arr[0]\n subs = subsets(arr.drop(1))\n new_subs = subs.map{ |sub| sub + val }\n\n subs + new_subs\nend",
"def subsets_iter(arr)\n new_arr = [[]]\n # byebug\n i = 0\n while i < arr.length\n# byebug\n ele1 = arr[i]\n new_arr << [ele1]\n\n if arr.length > 2\n sub_arr = [ele1]\n j = i + 1\n while j < arr.length\n # byebug\n ele2 = arr[j]\n sub_arr << ele2\n new_arr << sub_arr.dup\n sub_arr.pop\n j += 1\n end\n end\n i += 1\n end\n# byebug\n new_arr << arr unless arr.length < 2\n\n new_arr\nend",
"def subsets(array)\n return [[]] if array == []\n\n sets = subsets(array[0...-1])\n sets + sets.map { |el| el += [array.last] }\nend",
"def subsets(array)\n return [[]] if array.empty?\n\n val = array[0]\n subs = subsets(array.drop(1))\n new_subs = subs.map { |sub| sub + [val] }\n\n subs + new_subs\nend",
"def subsets(arr)\n # byebug\n return [arr] if arr.empty?\n\n if arr.length.odd?\n mid_idx = arr.length / 2\n else\n mid_idx = arr.length / 2 - 1\n end\n# byebug\n with_last = subsets(arr[1..-1])\n # byebug\n without_last = subsets(arr[0...-1])\n # byebug\n combined1 = subsets(arr[0...mid_idx] + arr[mid_idx + 1..-1])\n # combined2 = subsets(arr[0..mid_idx] + arr[mid_idx + 2..-1]) # this didn't work. still missing [1, 2, 4] with [1, 2, 3, 4] original input\n# byebug\n output = without_last + combined1 + with_last + [arr] # combined2\n output.uniq\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n\n # new_series = subsets(arr[0..-2]).each do |subarr|\n # subarr << arr[-1]\n # end\n # subsets(arr[0..-2]) + new_series\n\n prev = subsets(arr[0..-2])\n prev.concat( prev.map { |subarr| subarr + [arr.last] } )\n\nend",
"def subsets(ary)\n # base case\n return [[]] if ary.empty?\n\n # create subsets without the last element (smaller array)\n subs = subsets(ary.take(ary.length - 1))\n\n # adds the subs with the last element that was omitted.\n subs.concat( subs.map { |sub| sub + [ary.last] })\n\nend",
"def subsets(array)\n\n return [[]] if array == []\n all_but_last = subsets(array[0...array.length - 1].dup)\n last = array.last\n all_but_last.map { |el| el.dup } + all_but_last.map { |el| el << last }\nend",
"def subsets(array)\n return [[]] if array.empty?\n subs = subsets(array[0..-2])\n subs += subs.map { |el| el += [array.last] }\n end",
"def subsets(arr)\n # return an empty array (tech a subset of an empty array) - base case\n return [[]] if arr.empty?\n # take out the last el\n last = arr[-1]\n # take all the other els\n # find all subsets don't have the last element\n subsets_without_last = subsets(arr[0...-1])\n # create an array with a combo of s (the el) & the last ele in arr\n # find all subsets that have the last element\n subsets_with_last = subsets_without_last.map { |s| s.dup << last }\n # merge with prior subsets\n # all subsets of arr either have the last element, or they don't.\n subsets_without_last + subsets_with_last\nend",
"def subsets(arr, n = arr.size-1)\n #Heaps permutations\n @sol = [] if n == arr.size - 1\n\n if n == 0\n p arr\n @sol << arr\n return arr\n else\n (n+1).times do |i|\n p i\n subsets(arr,n-1)\n if( (n - 1) % 2 == 1)\n arr[1],arr[n] = arr[n],arr[1]\n else\n arr[i],arr[n] = arr[n],arr[i]\n end\n end\n end\nend",
"def array_subsets(array)\n return [array] if array.empty?\n \nend",
"def powerset(array)\n subsets = [[]]\n\n array.each do |elem|\n (1..subsets.length - 1).each do |i|\n current_subset = subsets[i]\n subsets.append(current_subset + [elem])\n end\n end\n\n return subsets\nend",
"def find_subsets_of_points(options={})\n puts \"Calculating subsets\"\n puts \"Set of #{@points_amount} points: 2^#{@points_amount} subsets = #{2**@points_amount} different subsets\"\n @points_subsets = Array.new(@points_amount) { Array.new }\n # amount of all subsets of a set 2^n-1 (-1, as we're excluding the empty set {})\n (1..2**@points.length-1).each { |i|\n p i if i%100000 == 0\n subset_size = subset_size(i)\n if (options[:with_first_point_only] != true) || (options[:with_first_point_only] == true and i % 2 == 1)\n @points_subsets[subset_size-1] << i\n end\n }\n\n (2..@points_amount).each do |subset_size|\n subsets = @points_subsets[subset_size-1]\n puts \"Subset size: \" + subset_size.to_s + \"; Subsets total: \" + subsets.size.to_s\n end\n\n puts \"Done calculating subsets\"\n end",
"def array_subsets(arr)\n return arr if arr.length == 0 || arr.length == 1\n new_arr = []\n new_arr << [arr[0]] + array_subsets(arr[1..-1])\n \n # length = 1\n # new_arr = [[]]\n # while length <= arr.length\n # arr.each do |el|\n # new_arr << Array.new(length) { el }\n # end\n # length += 1\n # end\nend",
"def powerset(array)\n subsets = [[]]\n array.each { |element|\n for i in 0..subsets.length - 1\n current_subset = subsets[i]\n subsets << (current_subset + [element])\n end\n }\n return subsets\nend",
"def subsets(arr)\n return [[]] if arr.empty?\n sub = subsets(arr[0...-1])\n newsub = sub.map { |ele| ele + [arr.last] } \n sub + newsub\n\n\n# sub + arr[-1]\nend",
"def recursive_subsets(arr)\n return [[]] if arr.empty?\n last_el = arr.pop\n p sub_arr = recursive_subsets(arr)\n p last_el\n sub_arr += sub_arr.map { |el| el + [last_el] }\nend",
"def array_subsets(arr)\n return [[]] if arr.empty?\n partial_subset = array_subsets(arr[0..-2])\n addition = partial_subset.map {|ele| ele + [arr[-1]]}\n partial_subset + addition\nend",
"def get_power_set_2(set)\n\treturn [[]] if set.empty?\n\n\tnum = set.pop\n\tprevious_subsets = get_power_set_2(set)\n\n\tprevious_subsets.map do |subset|\n\t\t[subset.dup.push(num), subset]\n\tend.flatten(1)\n\nend",
"def powerset(array, index = nil)\n if index.nil?\n index = array.length - 1\n elsif index < 0\n return [[]]\n end\n\n ele = array[index]\n subsets = power(array, index - 1)\n (0..subsets.length - 1).each do |i|\n current_subset = subsets[i]\n subsets.append(current_subset + [ele])\n end\n\n subsets\nend",
"def common_subsets(array_one, array_two)\n\nend",
"def find_subsets(arr, target_value)\n rec(arr, target_value, arr.length - 1)\nend",
"def powerset(array, idx = nil)\n if (idx == nil)\n idx = array.length - 1\n end\n if (idx < 0)\n return [[]]\n end\n element = array[idx]\n subsets = powerset(array, idx - 1)\n for i in 0..subsets.length - 1\n current_subset = subsets[i]\n subsets << current_subset + ([element])\n end\n return subsets\nend",
"def common_subsets(arr1, arr2)\n subsets(intersection3(arr1, arr2))\nend",
"def generate_n_sets(array, number_of_sets)\n\nend",
"def points_of_subset_simple subset\n subset = subset.to_s(2)\n (2 ... subset.length+1).find_all { |i| subset[-i,1] == '1' }\n end",
"def sub_sum(list) #quadratic\n subsets = []\n i = 0\n while i < list.length\n j = i\n while j < list.length\n subsets << list[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n subsets.sort.last\nend",
"def powerset(arr)\n arr.inject([Set.new].to_set) do |powerset, el|\n new_powerset = Set.new\n powerset.each do |subset|\n new_powerset << subset\n new_powerset << subset + [el]\n end\n new_powerset\n end\n end",
"def permutations(array)\n return [array] if array.length <= 1\n \n \n # Similar to the subsets problem, we observe that to get the permutations\n # of [1, 2, 3] we can look at the permutations of [1, 2] which are\n # [1, 2] and [2, 1] and add the last element to every possible index getting\n # [3, 1, 2], [1, 3, 2], [1, 2, 3], [3, 2, 1], [2, 3, 1]\n \n # pop off the last element\n first = array.shift\n # make the recursive call\n perms = permutations(array)\n # we will need an array to store all our different permutations\n total_permutations = []\n \n \n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n total_permutations\nend",
"def get_power_set_1(set)\n\t(0..set.length).map {|i| set.combination(i).to_a}.flatten(1)\nend",
"def subset\n { subset: @superset }\n end",
"def permutations(array)\n return [array] if array.length <= 1\n\n\n # Similar to the subsets problem, we observe that to get the permutations\n # of [1, 2, 3] we can look at the permutations of [1, 2] which are\n # [1, 2] and [2, 1] and add the last element to every possible index getting\n # [3, 1, 2], [1, 3, 2], [1, 2, 3], [3, 2, 1], [2, 3, 1]\n\n # pop off the last element\n first = array.shift\n # make the recursive call\n perms = permutations(array)\n # we will need an array to store all our different permutations\n total_permutations = []\n\n\n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n total_permutations\nend",
"def permutations(array)\n return [array] if array.length <= 1\n\n # Similar to the subsets problem, we observe that to get the permutations of \n # [1, 2, 3] we can look at the permutations of [1, 2] which are [1, 2] and \n # [2, 1] and add the last element to every possible index getting [3, 1, 2], \n # [1, 3, 2], [1, 2, 3], [3, 2, 1], [2, 3, 1], [2, 1, 3]\n\n # pop off the last element\n first = array.shift\n\n # make the recursive call\n perms = permutations(array)\n\n # we will need an array to store all our different permutations\n total_permutations = []\n\n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).to_a.each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n\n total_permutations\nend",
"def largest_contiguous_subsum(list)\n subsets = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n subsets << list[idx1..idx2]\n end\n end\n\n #orignial [1,2,3]\n\n #[1]\n #[1,2]\n #[1,2,3]\n #[2]\n #[2,3]\n #[3]\n\n\n largest = subsets[0].sum\n subsets.each do |subset|\n largest = subset.sum if subset.sum > largest\n end\n\n largest\nend",
"def largest_contiguous_subsum(arr)\n subsets = []\n\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n subsets << arr[idx1..idx2]\n end\n end \n\n largest_sum = subsets.first.sum\n\n subsets.each do |subset|\n if subset.sum > largest_sum\n largest_sum = subset.sum\n end\n end\n\n print subsets\nend",
"def subsequences(start, sub, last)\n to_test = []\n to_test << sub\n valid_combinations = 0\n while to_test.any?\n next_to_test = Set.new\n to_test\n .select { |subset| find_path(start, subset, last) }\n .tap { |subsets| valid_combinations += subsets.size }\n .each do |subset|\n subset.combination(subset.size - 1).to_a.each do |s|\n next_to_test << s\n end\n end\n to_test = next_to_test\n end\n valid_combinations\n end",
"def common_subsets(array_one, array_two)\n subsets(fast_intersection(array_one, array_two))\nend",
"def common_subset(arr1, arr2)\n i = intersection(arr1, arr2)\n subsets(i)\nend",
"def convex_sub_polygon\n subsets = []\n vertices.each_cons(3) do |p1, p2, p3|\n subsets << [p2, [p1, p2, p3]]\n end\n subsets.sort.first.last\n end",
"def recompute_recursive_subsets\n @recursive_subsets = subsets.inject(ValueSet.new) do |set, child|\n set.merge(child.recursive_subsets)\n end\n if parent\n parent.recompute_recursive_subsets\n end\n end",
"def multipleSet(n)\n return (n..99).step(n).to_a.to_set\nend",
"def common_subsets(array_one, array_two)\n common_array = fast_intersection(array_one, array_two)\n subsets(common_array)\nend",
"def subset_content\n self.class.subsets[subset.to_sym] if valid_subset? \n end",
"def getSet( s, x=1 )\n return [] if (x2 = x**2) > s\n return [[x]] if x2 == s\n getSet( s-x2, x+1 ).each { |a| a.unshift x }.concat getSet( s, x+1 )\nend",
"def sub_arrays\n result = []\n self.each_index do |i|\n self.each_index do |j|\n result << self[i..j] if j >= i\n end\n end\n result\n end",
"def subarray_bitwise_o_rs(a)\n result_set = Set.new()\n a.size.times do |i|\n (1..a.size-i).each do |length|\n subarray = a[i, length]\n #puts subarray.inspect\n result = subarray.reduce(0) do |bor, elem|\n bor | elem\n end\n #puts result\n result_set << result\n end\n end\n result_set.size\nend",
"def points_of_subset_fast subset, options={}\n points_of_subset = []\n lower_range_bound = options[:omit_first] ? 2 : 1\n power = 1; while (2**power <= subset) do power +=1 end\n\n (lower_range_bound .. power).each do |i|\n points_of_subset << i if (subset & 2**(i-1) == 2**(i-1))\n end\n points_of_subset\n end",
"def index\n @subsets = Subset.all\n end",
"def subset_in_array?(array, value)\n result = 1.upto(array.length).flat_map do |n|\n array.combination(n).to_a\n end\n result.include?(value)\nend",
"def nth_subset(n)\n # Ruby allows us to index integers as if they were arrays of bits,\n # so we can check if an element should be included in the result by testing if the ith bit of n is 1\n each_with_index.map { |e, i| e if n[i] == 1 }.compact\n end",
"def naive_non_divisible_subsets(s, k)\n modulos = s.map { |n| n % k }\n subsets = []\n \n i = 0\n while i < modulos.length\n subset = [modulos[i]]\n subsets_hash = Hash.new\n subsets_hash[modulos[i]] = true\n\n j = 0\n while j < modulos.length\n if i == j\n j += 1\n next\n else\n pair = k - modulos[j]\n if subsets_hash[pair].nil?\n subset << modulos[j]\n subsets_hash[modulos[j]] = true\n end\n j += 1\n end\n end\n\n subsets << subset\n i += 1\n end\n\n counts = subsets.map { |subset| subset.length }\n counts.max\nend",
"def club_sets\n super.uniq\n end",
"def subgraphs\n subs = []\n nodes_to_hit = @vertices.dup\n until nodes_to_hit.empty?\n subgraph = subgraph_with(nodes_to_hit.to_a.first)\n subs << subgraph\n nodes_to_hit -= subgraph.vertices\n end\n subs\n end",
"def group(list, subgroups)\n if subgroups.empty?\n [[]]\n else\n result = []\n combinations(list, subgroups.first).each do |c| \n group(list - c, subgroups[1..-1]).each do |g|\n result << [c] + g\n end\n end\n result\n end\nend",
"def non_divisible_subset(set, divisor)\n # key to the solution is a trick with number theory: the sum of two numbers A, B is divisible by divisor\n # k if A % k + B % k == k. So, for each pair of remainders that add up to the divisor, grab the largest\n # set. For remainders that are exactly half the divisor, you can only grab one, same with numbers that\n # are already evenly divisible (remainder 0).\n remainders = set.map { |x| x % divisor }.group_by { |x| x }\n remainders.reduce(0) do |acc, (r, rs)|\n acc + if divisor / 2.0 == r || r == 0\n 1\n elsif remainders[divisor - r].nil? || rs.length > remainders[divisor - r].length\n rs.length\n else\n 0\n end\n end\nend",
"def largest_contiguous_subsum(arr)\n subsets = [] \n\n (0...arr.length).each do |i| \n (i...arr.length).each do |j| \n subsets << arr[i..j]\n end \n end \n \n subsets.map {|sub| sub.sum}.max \nend",
"def subset(n, s)\n h = {}\n 1.upto(n) do |len|\n s.combination(len) do |a|\n sum = a.inject(0,:+)\n if h.key?(sum)\n u = h[sum].join(\" \")\n v = a.join(\" \")\n return \"#{u}\\n#{v}\"\n else\n h[sum] = a\n end\n end\n end\n return \"Impossible\"\nend",
"def each_subset(array)\n subsets_of(array).each {|subset| yield(subset)}\n end",
"def subset?(other_set)\n other_set.set.all? { |element| include?(element) }\n end",
"def set_subset\n @subset = Subset.find(params[:id])\n end"
] |
[
"0.8487025",
"0.823515",
"0.81840074",
"0.81755",
"0.8160179",
"0.8099356",
"0.8099356",
"0.8099356",
"0.80842894",
"0.80592185",
"0.8050087",
"0.8044357",
"0.7981963",
"0.7949653",
"0.7942235",
"0.7865244",
"0.78652006",
"0.78574306",
"0.78485876",
"0.7846706",
"0.7845733",
"0.7831226",
"0.78153825",
"0.7812602",
"0.7803624",
"0.7796584",
"0.7759198",
"0.77287745",
"0.77258456",
"0.7708801",
"0.76709676",
"0.7658034",
"0.7652664",
"0.76514703",
"0.76514703",
"0.76406544",
"0.76058125",
"0.7589581",
"0.7567535",
"0.7483827",
"0.7462305",
"0.7447514",
"0.74241245",
"0.7405463",
"0.73956114",
"0.73798496",
"0.7364949",
"0.73392946",
"0.7332233",
"0.73243314",
"0.72782755",
"0.72711587",
"0.7197506",
"0.70932585",
"0.7069874",
"0.7064924",
"0.70502687",
"0.704122",
"0.7036902",
"0.69087285",
"0.68991077",
"0.68176407",
"0.6738667",
"0.6735038",
"0.66167045",
"0.66153437",
"0.64872766",
"0.6409799",
"0.63942367",
"0.6389663",
"0.6352904",
"0.63123256",
"0.6253268",
"0.6169993",
"0.61691195",
"0.6162513",
"0.6159615",
"0.61519456",
"0.61235815",
"0.61170805",
"0.6107746",
"0.60886395",
"0.6065104",
"0.6033846",
"0.5975503",
"0.5969051",
"0.5962791",
"0.5947628",
"0.59405816",
"0.5929273",
"0.59065205",
"0.5880577",
"0.5873986",
"0.58638227",
"0.5815302",
"0.5812996",
"0.5773212",
"0.57618916",
"0.57528406",
"0.5730636",
"0.57267916"
] |
0.0
|
-1
|
this might actually be a helper
|
def current_round
self.rounds.last
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def private; end",
"def helper(*args, &block); end",
"def helper\n @helper\n end",
"def helper\n @helper\n end",
"def wrapper; end",
"def instance_helper\n\tend",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def define_helpers; end",
"def helper\n @helper ||= Helpers.new\n end",
"def custom; end",
"def custom; end",
"def weber; end",
"def helper_class=(_arg0); 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",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def helper\n @template\n end",
"def who_we_are\r\n end",
"def formation; end",
"def helpers\r\n Helper.instance\r\n end",
"def helpers &blk\n @helpers = blk\n end",
"def suivre; end",
"def schubert; end",
"def extra; end",
"def common\n \n end",
"def helpers_path=(_arg0); end",
"def helpers\n Helper.instance\n end",
"def helper_method(*methods); end",
"def processor; end",
"def probers; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def methods() end",
"def yield; end",
"def operations; end",
"def operations; end",
"def implementation; end",
"def implementation; end",
"def _prepare_context; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def refutal()\n end",
"def private_method\n end",
"def helpers\n ActionController::Base.helpers # you can also try @template.helpers OR self.class.helpers OR include ActionView::Helpers\n end",
"def helpers &blk\n class_eval(&blk) if block_given?\n end",
"def param; end",
"def param; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def helper(_method)\n ActionController::Base.helpers.method(_method)\n end",
"def handle; end",
"def content=(_); 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 do()\r\n\tend",
"def call() end",
"def text_help\n Helper.instance\nend",
"def dynamic?; end",
"def help\n Helper.instance\n end",
"def help\n Helper.instance\n end",
"def help\n Helper.instance\n end"
] |
[
"0.75946504",
"0.75946504",
"0.75946504",
"0.6645548",
"0.6580859",
"0.6484357",
"0.6484357",
"0.6386061",
"0.6287495",
"0.6279808",
"0.6279808",
"0.6279808",
"0.6279808",
"0.61679775",
"0.61545885",
"0.6140402",
"0.6140402",
"0.6136763",
"0.6022865",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.59852356",
"0.5950212",
"0.59471136",
"0.59075594",
"0.5879685",
"0.5863441",
"0.5852323",
"0.5851522",
"0.5796183",
"0.5763507",
"0.5734711",
"0.5716192",
"0.5687052",
"0.5683122",
"0.5678693",
"0.56755304",
"0.56755304",
"0.56755304",
"0.56755304",
"0.56755304",
"0.56755304",
"0.56755304",
"0.5632243",
"0.56218",
"0.55964506",
"0.55964506",
"0.5587657",
"0.5587657",
"0.5575108",
"0.5570047",
"0.5570047",
"0.5570047",
"0.5570047",
"0.5570047",
"0.5559391",
"0.55492437",
"0.55429834",
"0.55385983",
"0.553379",
"0.553379",
"0.55314493",
"0.55314493",
"0.55314493",
"0.5490521",
"0.54731214",
"0.54724616",
"0.54601556",
"0.54601556",
"0.54601556",
"0.54601556",
"0.54601556",
"0.54601556",
"0.54601556",
"0.54601556",
"0.5454066",
"0.544775",
"0.54476327",
"0.5446884",
"0.54453796",
"0.54453796",
"0.54453796"
] |
0.0
|
-1
|
Registers a callback handle that will be periodically run.
|
def periodically(timing, event_callback)
EventMachine.add_periodic_timer(timing) do
dispatch(event_callback.to_sym)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def register_update_handle_callback(&blk)\n @logger.debug(\"Register update handle callback with #{blk}\")\n @update_handle_callback = blk\n end",
"def register_callback(&proc)\n if ready?\n proc.call(sync)\n else\n @callbacks << proc\n end\n end",
"def register_callback(&callback)\n EM.schedule do\n if @stream.empty?\n @stream_callbacks << callback\n else\n callback.call(@stream.shift)\n end\n end\n end",
"def schedule_callback tick_count, &callback\n raise \"Callback has already been scheduled for tick #{tick_count}. If you meant to do this, execute $gtk.scheduled_callbacks.clear first.\" if @scheduled_callbacks[tick_count]\n @scheduled_callbacks[tick_count] = callback\n end",
"def register_callback(c_when, method)\n callbacks[c_when] << method\n end",
"def schedule(time, callback)\n\t\t\tflush!\n\t\t\t\n\t\t\thandle = Handle.new(time.to_f, callback)\n\t\t\t\n\t\t\t@queue << handle\n\t\t\t\n\t\t\treturn handle\n\t\tend",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_callback(&block)\n @_aclize_callback = block\n end",
"def register_completion_callback(callback)\n @duty_completion_callback = callback\n end",
"def set_handler(h, callback)\n\t\t@handler[h] = callback\n\tend",
"def add_internal_callback(handle=nil, &block)\n add_block_callback(HookR::InternalCallback, handle, &block)\n end",
"def watcher_callback\n @callback ||= Proc.new do |event|\n # Set new watcher\n watch\n # Rediscover\n discover\n end\n end",
"def definecallback(&b)\r\n\t\t\t@callback = b\r\n\t\tend",
"def add_internal_callback(handle=nil, &block)\n add_block_callback(Hookr::InternalCallback, handle, &block)\n end",
"def insert_callback(&block)\n @callbacks << block\n end",
"def callback(&block)\n @callbacks << block\n end",
"def add_basic_callback(handle=nil, &block)\n add_block_callback(HookR::BasicCallback, handle, &block)\n end",
"def periodically(timing, event_callback)\n callback = proc { self.dispatch event_callback.to_sym }\n EventMachine::add_periodic_timer(timing, &callback)\n end",
"def add_external_callback(hook_name, handle, block)\n fetch_or_create_hooks[hook_name].add_external_callback(handle, &block)\n end",
"def method_missing(callback_name, &block)\n @callbacks[callback_name] = block\n end",
"def add_external_callback(hook_name, handle, block)\n hooks[hook_name].add_external_callback(handle, &block)\n end",
"def add_callback(type, options, &block); end",
"def add_update_callback &cb\n\t\t\t@update_callbacks << cb\n\t\t\tcb\n\t\tend",
"def register(path, &block)\n EventHandlerSubscription.new(self, path, block).tap do |subscription|\n @callbacks[path] << subscription\n end\n end",
"def on(callback_name, &block)\n raise(ArgumentError, \"Argument 'callback_name' must be a String.\") unless callback_name.is_a?(String)\n raise(ArgumentError, \"Argument 'callback_name' can not be '#{callback_name}'.\") if @@reserved_callbacks.include?(callback_name)\n raise(ArgumentError, \"Must have a Proc.\") unless block_given?\n @procs_callback[callback_name] = block\n return self\nend",
"def on(what, &block)\n @callback_map[what] = block\n end",
"def add_callback(&block)\n @blocks << block\n end",
"def add_external_callback(handle=nil, &block)\n if block.arity > -1 && block.arity < params.size\n raise ArgumentError, \"Callback has incompatible arity\"\n end\n add_block_callback(HookR::ExternalCallback, handle, &block)\n end",
"def append_callback(callback_name, callback)\n callbacks[callback_name] = callback\n callbacks_queue << callback_name\n end",
"def add_periodic_timer(interval, callback=nil, &blk)\n @timers ||= {}\n timer = PeriodicTimer.new(interval,callback,&blk)\n timer.on(:cancelled) do\n @timers.delete(timer)\n end\n @timers[timer.object_id] = timer\n timer.object_id\n end",
"def add_external_callback(handle=nil, &block)\n if block.arity > -1 && block.arity < params.size\n raise ArgumentError, \"Callback has incompatible arity\"\n end\n add_block_callback(Hookr::ExternalCallback, handle, &block)\n end",
"def on_refresh(&block)\n @connection.on_refresh_cb = block\n end",
"def append_callback(callback_name, &callback)\n connection.append_callback(callback_name, callback)\n end",
"def callback(&block)\n return yield if closed?\n @callbacks << block\n end",
"def add_handler(type, callable=nil, &b)\n callable = callable(callable, b)\n regex = regex_for(type)\n sync do\n id = @handler_serial+=1\n handlers << [id, regex, callable]\n id\n end\n end",
"def add_refresh_signal(&block)\n @refresh_signals << block\n end",
"def callback\n\n end",
"def schedule(time, callback); end",
"def on_process(&callback)\n @callback = callback\n end",
"def setCB(callback)\n @callbackfn = callback\n end",
"def callback(&block)\n @callbacks ||= []\n @callbacks << block\n end",
"def callback_method\n run(\"on\", \"string\", \"callback\")\n end",
"def register_default(callback)\n @callbacks.add_default(callback)\n end",
"def add_oneshot(delay:, callback:)\n Logger.debug(klass: self.class, name: :add_oneshot, message: \"delay: #{delay}\")\n return nil unless callback\n\n timer = Timer.new(timers: self, delay: delay, callback: callback)\n add timer\n timer\n end",
"def let(callback_name, &block)\n raise ArgumentError, \"Incorrect callback `#{callback_name}'.\" unless [:uuid_scope, :push].include?(callback_name)\n @callbacks[callback_name] = block\n end",
"def handle(handler, *guards, &block)\n client.register_handler handler, *guards, &block\n end",
"def add_callback(hook_name, handle_or_method=nil, &block)\n if block\n add_block_callback(hook_name, handle_or_method, block)\n else\n add_method_callback(hook_name, handle_or_method)\n end\n end",
"def add_callback(hook_name, handle_or_method=nil, &block)\n if block\n add_block_callback(hook_name, handle_or_method, block)\n else\n add_method_callback(hook_name, handle_or_method)\n end\n end",
"def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end",
"def register(msg, callback)\n key = msg.kind_of?(Numeric) \\\n ? (\"%03d\" % msg) \\\n : msg.to_s.upcase\n @callbacks.add(key, callback)\n end",
"def add_handler(name, handler)\n subscribe(name)\n subscriptions[name].handlers << handler\n end",
"def add_wildcard_callback(handle=nil, &block)\n fetch_or_create_hooks[:__wildcard__].add_basic_callback(handle, &block)\n end",
"def on_notification(&block)\n @callback = block\n end",
"def register_handler\n @register_handler ||= Justdi::RegisterHandler\n end",
"def register(*args, &block)\n h = Unobservable.handler_for(*args, &block)\n @handlers << h\n return h\n end",
"def on name, &block\n (callbacks[name] ||= []) << block\n end",
"def once(type, &callback)\n add_listener(type, true, &callback)\n end",
"def on_start=(callback)\n weak = WeakRef.new(self)\n\n Dispatch::Queue.main.async do\n if weak\n callback.call unless weak.isCancelled\n end\n end\n end",
"def register_failure_callback(callback)\n @duty_failure_callback = callback\n end",
"def callback\n end",
"def initialize(interval, callback=nil, &blk)\n fire = proc {\n (callback || blk).call\n trigger(:fired)\n }\n @timer = NSTimer.scheduledTimerWithTimeInterval(interval,target: fire, selector: 'call:', userInfo: nil, repeats: false)\n end",
"def callback\n @callback ||= method(:push)\n end",
"def record_callback(on, *names)\n names.each do |name|\n on.on name do |*args|\n callback_recorded(name, args)\n end\n end\n end",
"def register(path)\n\t\t\t\tpath = path.to_sym\n\t\t\t\tif @@registry[path].nil?\n\t\t\t\t\tcallback = proc { |event| Actor[:zk_service].async.event_callback(path, event) }\n\t\t\t\t\t@@registry[path] = @@zk.register(path.to_s, &callback)\n\t\t\t\tend\n\t\t\t\t@@registry_count[path] = (@@registry_count[path] || 0) + 1\n\t\t\tend",
"def register_request_callback(&block)\n request_callbacks << block\n end",
"def register_callback(label)\n @callbacks << label unless @callbacks.include?(label) || label == 'application'\n end",
"def on_new_sensor &block\n\t\t\t@on_new_sensor = block\n\t\tend",
"def register_handler(handler)\n handler.handled_events.each do |event_type|\n (event_handlers[event_type] ||= []) << handler\n Twitch::Bot::Logger.debug \"Registered #{handler} for #{event_type}\"\n end\n end",
"def on_ready(&handler)\n @on_ready_handler = handler\n end",
"def add_oneshot_at exact_time, timer_proc\n return nil unless timer_proc\n\n timer = Timer.new :timers => self, :exact_time => exact_time, :periodical => false, :timer_proc => timer_proc\n add timer\n timer\n end",
"def add_handler(handler)\n @handlers << handler\n end",
"def add_block_callback(hook_name, handle, block)\n case block.arity\n when -1, 0\n fetch_or_create_hooks[hook_name].add_internal_callback(handle, &block)\n else\n add_external_callback(hook_name, handle, block)\n end\n end",
"def on_scheduled_reconnect &block\n @reconnect_callback = block\n end",
"def callback_handler_install(prompt = nil, &block)\n raise ArgumentError, 'block is required' unless block\n @rl_callback_handler = block\n rl_callback_handler_install(prompt, block)\n end",
"def callback(event, method, callback)\n reg_callback(event.to_sym, method.to_sym, callback.to_sym)\n end",
"def add_wildcard_callback(handle=nil, &block)\n hooks[:__wildcard__].add_external_callback(handle, &block)\n end",
"def callback(&blk)\n @blk=blk\n end",
"def add_timer(interval, callback=nil, &blk)\n @timers ||= {}\n timer = Timer.new(interval,callback,&blk)\n timer.on(:fired) do\n @timers.delete(timer.object_id)\n end\n timer.on(:cancelled) do\n @timers.delete(timer.object_id)\n end\n @timers[timer.object_id] = timer\n timer.object_id\n end",
"def add_handler(handler)\n h, options = *(handler.is_a?(Array) ? handler : [handler, {}])\n name = coerce_handler(h)\n global_opts = { output: @output, config: @config }\n opts = global_opts.merge(options)\n ready_handler = name.new(opts)\n @ready_handlers << ready_handler\n end",
"def add_callback(sym, func=nil, &block)\n init_callbacks unless @callback\n if func && block || !func && !block\n raise(ArgumentError,\n \"Either pass a block (block), or a Proc (func)\")\n end\n (@callback[sym] ||= []).push(func || block)\n end",
"def on_start(&block)\n @on_start << block\n end",
"def define_callback(callback_name)\n add_callback_setter(callback_name)\n add_callback_array_writer(callback_name)\n end",
"def register(procedure)\n lock.synchronize do\n if @last_pointer\n @last_pointer = @last_pointer.break procedure\n else\n @last_pointer = @first_pointer = procedure\n end\n if @remain_hook and not @remain_received\n @remain_received = true\n @remain_hook.call\n end\n end\n self\n end",
"def add_callback(sym, func=nil, &block)\n init_callbacks unless @callback\n if func && block || !func && !block\n raise(ArgumentError,\n \"Either pass a block (block), or a Proc (func)\")\n end\n (@callback[sym] ||= []).push(func || block)\n end",
"def definecallback(&b)\r\n\t$gamemode.definecallback(&b)\r\nend",
"def callback\n\tend",
"def handle\n @queue << \"handle\"\n end",
"def define_hook(name, *params)\n fetch_or_create_hooks << make_hook(name, nil, params)\n\n # We must use string evaluation in order to define a method that can\n # receive a block.\n instance_eval(<<-END)\n def #{name}(handle_or_method=nil, &block)\n add_callback(:#{name}, handle_or_method, &block)\n end\n END\n module_eval(<<-END)\n def #{name}(handle=nil, &block)\n add_external_callback(:#{name}, handle, block)\n end\n END\n end",
"def register_monitor_callbacks params\n on_monitor do |data|\n next if data.is_a?(Hash) && data.keys == [\"id\"]\n callback(params[\"channel\"], data)\n end\n end",
"def listen(&proc)\n @listeners << proc\n end",
"def timer(callback = nil, &blk)\n Timer.new(@loop, callback || blk)\n end",
"def define_hook(name, *params)\n hooks << make_hook(name, nil, params)\n\n # We must use string evaluation in order to define a method that can\n # receive a block.\n instance_eval(<<-END)\n def #{name}(handle_or_method=nil, &block)\n add_callback(:#{name}, handle_or_method, &block)\n end\n END\n module_eval(<<-END)\n def #{name}(handle=nil, &block)\n add_external_callback(:#{name}, handle, block)\n end\n END\n end",
"def create_callback!(host)\n self.secret_hash = Digest::SHA1.hexdigest(\"lighthouse#{self.id}#{rand(10000)}callback\")\n Lighthouse.create_callback(self.id, \"http://\" + host + \"/lighthouse_callbacks/#{self.id}/#{secret_hash}\", self.token.account, self.token.token)\n end",
"def callback\n self.class.callback\n end",
"def callback\n self.class.callback\n end",
"def callback\n @on_declare\n end",
"def run(&callback)\n require 'em-synchrony'\n raise(\"Already running\") if @open\n EM.synchrony do\n open\n callback.call\n timer = EM.add_periodic_timer(0.01) do\n if backlog == 0\n EM.cancel_timer(timer)\n EM.next_tick do\n close\n EM.stop\n end\n end\n end\n end\n end"
] |
[
"0.69045144",
"0.6677008",
"0.65314215",
"0.6359059",
"0.6311531",
"0.60619485",
"0.6040254",
"0.6040254",
"0.6040254",
"0.6040254",
"0.6019728",
"0.59898883",
"0.59188956",
"0.5911588",
"0.5892645",
"0.5882398",
"0.5872747",
"0.58179694",
"0.5804135",
"0.56763995",
"0.5661176",
"0.56378067",
"0.56303823",
"0.55811477",
"0.5547116",
"0.55160403",
"0.54894847",
"0.54828876",
"0.5482804",
"0.54814386",
"0.54632926",
"0.54558575",
"0.54240954",
"0.54116327",
"0.54042387",
"0.54040223",
"0.5400526",
"0.53622204",
"0.53536946",
"0.53534967",
"0.5347899",
"0.5343116",
"0.5321637",
"0.53162295",
"0.5306268",
"0.52971214",
"0.5286769",
"0.5275249",
"0.5264538",
"0.52546203",
"0.52546203",
"0.5251958",
"0.5236713",
"0.5230179",
"0.52295095",
"0.5229333",
"0.52226096",
"0.52110916",
"0.52085423",
"0.5207509",
"0.5196185",
"0.5194458",
"0.5183237",
"0.51824963",
"0.51703703",
"0.5170294",
"0.5168085",
"0.516599",
"0.51557565",
"0.51552594",
"0.5154217",
"0.514273",
"0.512297",
"0.5106573",
"0.51004934",
"0.50996053",
"0.50969803",
"0.50754327",
"0.50733256",
"0.50681955",
"0.5059939",
"0.5055362",
"0.50537336",
"0.50486493",
"0.5043685",
"0.50433683",
"0.5043227",
"0.5036514",
"0.5035716",
"0.5030925",
"0.5017079",
"0.5011424",
"0.50109464",
"0.49877548",
"0.49863663",
"0.4985431",
"0.498355",
"0.498355",
"0.49804735",
"0.49720296"
] |
0.55908346
|
23
|
==== NEW PLOTTING API ====
|
def begin_figure
@legend_keys = []
@legend_labels = []
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def plot; end",
"def draw_basic_plot(params) \n jitter = params[:jitter]\n grouplist = params[:grouplist]\n snp_list = params[:snp_list]\n x_start = params[:x_start]\n y_start = params[:y_start]\n stat_max = params[:stat_max]\n stat_min = params[:stat_min]\n data_key = params[:data_key]\n plot_labels = params[:plot_labels]\n title = params[:title]\n precision = params[:precision]\n rotate = params[:rotate] || false\n size_mult = params[:size_mult] || 1\n prefix_title = params[:prefix_title] || \"\"\n lci_key = params[:lci_key] || nil\n uci_key = params[:uci_key] || nil\n \n x = @box_size\n xmin = x\n ymin = 0\n ymax = @box_size*9 * size_mult\n y_interval = ymax-ymin\n # set stat_min to be zero\n stat_interval = stat_max - stat_min\n\n value_x = xmin * 0.7 + (@box_size * Math.sqrt(2)*0.25)/2\n \n fill_opacity = 0.9\n if Shape.get_grayscale\n fill_opacity = 1.0\n end\n \n # draw box (change to triangle) with correct color\n snp_list.included_snps.each do |snp_index|\n draw_separator = true\n snp = snp_list.snps[snp_index]\n \n #draw_separation(x_start, y_start, 0, ymax, value_x) unless lci_key\n\n # store points here for output\n points = Array.new\n lines = Array.new\n\n grouplist.groups.each do |group|\n if snp.results.has_key?(group.name)\n result = snp.results[group.name]\n if !result.values[data_key] or result.values[data_key] !~ /\\d/\n next\n end\n box_y_start = ((stat_max-result.values[data_key].to_f) / stat_interval) * y_interval\n\n if rotate\n box_y_start = y_interval - box_y_start\n end\n\n if !group.highlighted\n points << Circle.new(value_x, box_y_start, @box_size * Math.sqrt(2)*0.125, group.colorstr)\n else\n # create triangle here\n points << create_diamond(box_y_start, value_x, 1.0, group.colorstr)\n end\n \n # create a line if there is a confidence interval\n if result.values[uci_key]\n draw_separator = false\n uci_y = ((stat_max-result.values[uci_key].to_f) / stat_interval) * y_interval\n lci_y = ((stat_max-result.values[lci_key].to_f) / stat_interval) * y_interval\n if rotate\n uci_y = y_interval - uci_y\n lci_y = y_interval - lci_y\n end \n\n points.last.interval = Line.new([value_x,value_x], [lci_y,uci_y], group.colorstr)\n end\n \n end\n\n end\n draw_separation(x_start, y_start, 0, ymax, value_x)# if draw_separator\n # sort by y-midpoint\n points.sort! {|x,y| y.ymidpoint <=> x.ymidpoint}\n #lines.sort! {|x,y| y.ymidpoint <=> x.ymidpoint} unless lines.empty?\n\n # those points that overlap significantly\n if jitter\n adjust_horizontal(points, y_interval)\n end\n\n\t # iterate through points and draw all of them\n\t points.each do |point|\n if point.interval \n point.interval.xpoints[0] = point.interval.xpoints[1] = point.xmidpoint\n @canvas.g.translate(x_start,y_start) do |check|\n check.styles(:stroke_width=>2)\n point.interval.draw(check)\n end\n end \n \t end\n\n\t points.each do |point|\n \t @canvas.g.translate(x_start,y_start) do |check|\n \t check.styles(:stroke_width=>1, :fill_opacity=>fill_opacity)\n \t point.draw(check)\n \t end \n end\n \n value_x = label_step(value_x)\n end\n\n if plot_labels\n if rotate\n x_label_start = value_x + x_start+ @box_size * 0.4 \n else\n x_label_start = x_start \n end\n\n if size_mult >= 1\n write_plot_labels(x_label_start, y_start, ymax, stat_max, stat_min, y_interval, 0, prefix_title+title, false, precision, rotate)\n else\n write_plot_labels(x_label_start, y_start, ymax, stat_max, stat_min, y_interval, 0, prefix_title+title,\n false, precision, rotate, 5)\n end\n end\n end",
"def beanplot\n end",
"def configurePlot\n end",
"def draw_pvalue_plot(params)\n jitter = params[:jitter]\n no_triangles = params[:no_triangles]\n grouplist = params[:grouplist]\n snp_list = params[:snp_list]\n x_start = params[:x_start]\n y_start = params[:y_start]\n stat_max = params[:stat_max]\n stat_min = params[:stat_min]\n original_min = params[:original_min]\n first_plot = params[:first_plot]\n prefix_title = params[:prefix_title] || ''\n rotate = params[:rotate] || false\n clean_axis = params[:clean_axis] || false\n\t\tinteraction_shapes = params[:interaction_shapes] || false\n\t\t \n x = @box_size\n xmin = x\n ymin = 0\n ymax = @box_size*9\n y_interval = ymax-ymin\n\n check_max = false\n\n stat_max = get_neg_log(stat_min)\n top_max = get_neg_log(stat_min)\n\n # check to see if there is a cut-off imposed for the pvalue plot\n if stat_min.to_f > original_min.to_f\n check_max = true\n box_mult=1.8\n # calculate size of triangle (or circle) and adjust the p value plot max size\n y_vertical = @box_size*box_mult * Math.sqrt(2) *0.35\n y_fraction = 1- y_vertical / y_interval\n\n # adjust stat_max to be the value needed for a triangle to just touch top\n stat_max = top_max / y_fraction\n # if no cut-off imposed check for the use of a cleaner axis\n elsif clean_axis\n increment, stat_min, stat_max = calculate_increments(0, stat_max.to_f)\n end\n\n stat_min = 0\n\n # set stat_min to be zero\n if !check_max and stat_max - stat_max.floor > 0\n stat_max = stat_max.floor + 1\n end\n\t\t\n # store for later use based when adding features\n @functional_max = stat_max\n\n stat_interval = stat_max - stat_min\n value_x = xmin * 0.7 + (@box_size * Math.sqrt(2)*0.25)/2\n\t\t\n # draw box (change to triangle) with correct color\n snp_list.included_snps.each do |snp_index|\n snp = snp_list.snps[snp_index]\n draw_separation(x_start, y_start, 0, ymax, value_x)\n\n # store points here for outputting\n points = Array.new\n\n grouplist.groups.each do |group|\n if snp.results.has_key?(group.name)\n over_max = false\n box_mult=1\n result = snp.results[group.name]\n pvalue = get_neg_log(result.values['pvalue'].to_f)\n if pvalue > top_max\n over_max = true\n pvalue = top_max\n box_mult=1.8\n end\n\n box_y_start = ((stat_max-pvalue) / stat_interval) * y_interval\n\t if (!no_triangles and group.has_beta? and !interaction_shapes)\n\t if over_max and result.values['beta'].to_f <= 0\n \t box_y_start = 0\n\t end\n\n box_y_start = y_interval - box_y_start if rotate\n\n if (result.values['beta'].to_f > 0 and !rotate) or (result.values['beta'].to_f <= 0 and rotate)\n up_triangle = true\n else\n up_triangle = false\n end\n\n points << create_triangle(box_y_start, value_x, up_triangle, box_mult, group.colorstr)\n\t\t\t\t\telsif(interaction_shapes)\n\t\t\t\t\t\tbox_y_start = @box_size * box_mult * Math.sqrt(2)*0.125/2 if over_max\n\t\t\t\t\t\tbox_y_start = y_interval - box_y_start if rotate\n\t\t\t\t\t\tif(group.has_beta?)\n\t\t\t\t\t\t\tif(result.values['beta'].to_i==1)\n\t\t\t\t\t\t\t\t\tpoints << create_square(box_y_start, value_x, box_mult*0.4, group.colorstr)\n\t\t\t\t\t\t\telsif(result.values['beta'].to_i==2)\n\t\t\t\t\t\t\t\t\tpoints << create_triangle(box_y_start, value_x, true, box_mult*0.8, group.colorstr)\n\t\t\t\t\t\t\telsif(result.values['beta'].to_i==3)\n\t\t\t\t\t\t\t\t\tpoints << create_diamond(box_y_start, value_x, box_mult*0.5, group.colorstr,\n\t\t\t\t\t\t\t\t\t\t:on_side=>true)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t#circle\n\t\t\t\t\t\t\t\t\tpoints << Circle.new(value_x, box_y_start, @box_size * box_mult * Math.sqrt(2)*0.125, group.colorstr)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbox_y_start = @box_size * box_mult * Math.sqrt(2)*0.125/2 if over_max\n\t\t\t\t\t\t\tbox_y_start = y_interval - box_y_start if rotate\n\t\t\t\t\t\t\tpoints << Circle.new(value_x, box_y_start, @box_size * box_mult * Math.sqrt(2)*0.125, group.colorstr)\n\t\t\t\t\t\tend\n \t elsif !group.highlighted\n \t box_y_start = @box_size * box_mult * Math.sqrt(2)*0.125/2 if over_max\n box_y_start = y_interval - box_y_start if rotate\n \t points << Circle.new(value_x, box_y_start, @box_size * box_mult * Math.sqrt(2)*0.125, group.colorstr)\n \t else\n \t #draw diamond for highlighted group\n \t if over_max\n \t box_y_start = 0\n\t end\n\t if rotate\n box_y_start = y_interval - box_y_start\n end\n points << create_diamond(box_y_start, value_x, box_mult, group.colorstr)\n\t end\n end\n\n end\n\n # sort by y-midpoint\n points.sort! {|x,y| y.ymidpoint <=> x.ymidpoint}\n\n # when jitter selected check for overlap and offset horizontally\n # those points that overlap significantly\n if jitter\n adjust_horizontal(points, y_interval)\n end\n\n\t # iterate through points and draw all of them\n\t points.each do |point|\n \t @canvas.g.translate(x_start,y_start) do |check|\n check.styles(:stroke_width=>1, :fill_opacity=>0.9)\n \t point.draw(check)\n \t end\n \t end\n value_x = label_step(value_x)\n end\n\n # write labels on left side of stat box\n if first_plot\n if rotate\n x_label_start = value_x + x_start+ @box_size * 0.4\n else\n x_label_start = x_start\n end\n\n label_precision = 1\n\n write_plot_labels(x_label_start, y_start, ymax, stat_max, stat_min, y_interval, 0,\n prefix_title + '-log10(p value)', false, label_precision, rotate)\n end\n end",
"def render_data(data)\n # calculate quartiles for plot, use this as data\n @data_quartiles = DATA.collect { |row|\n data = quartiles(row[1])\n OpenStruct.new(\n :name => row[0],\n :q0 => data[0],\n :q1 => data[1],\n :q2 => data[2],\n :q3 => data[3],\n :q4 => data[4],\n :index => 0\n ) \n }\n # NOTE: need index to lay out coloumns horizontally\n @data_quartiles.each_with_index { |d, i|\n d.index = i\n }\n # find limits of data so we know where axes are\n data_min = @data_quartiles.collect { |col| col.q0 }.min()\n data_max = @data_quartiles.collect { |col| col.q4 }.max()\n bounds = bounds([data_min, data_max])\n plot_range = bounds[1] - bounds[0]\n\n \n # make area for plotting\n # left, etc. set padding so actual size is ht/wt + padding\n vis = pv.Panel.new()\n .width(@canvas_wt)\n .height(@canvas_ht)\n .margin(@margin)\n .left(30)\n .bottom(20)\n .top(10)\n .right(10)\n \n # adhoc guess at bar width\n bar_width = @plot_wt / @data_quartiles.size() * 0.8\n \n # scaling to position datapoints in plot\n vert = pv.Scale.linear(bounds[0], bounds[1]).range(0, @plot_ht)\n horiz = pv.Scale.linear(0, @data_quartiles.size()).range(0, @plot_wt)\n\n # where to draw labels on graph\n label_ticks = vert.ticks.each_slice(4).map(&:first)\n\n # make horizontal lines:\n # - what values are drawn\n # - where the bottom of it appears\n # - what color to make the line\n # - the width of the line\n # - antialias it?\n # - add a label\n # - where does label appear relative to line\n # - how is the text aligned in own space\n # - align text vertically (\"top\" looks like \"middle\")\n # - what appears in the label\n vis.add(pv.Rule)\n .data(vert.ticks()) \n .bottom(lambda {|d| vert.scale(d)}) \n .strokeStyle(lambda { |d| label_ticks.member?(d) ? \"black\" : \"lightblue\" })\n .line_width(lambda { |d| label_ticks.member?(d) ? 0.5 : 0.1 })\n .antialias(true)\n .add(pv.Label) \n .left(0) \n .textAlign(\"right\")\n .textBaseline(\"top\")\n .text(lambda {|d| label_ticks.member?(d) ? sprintf(\"%0.2f\", d) : '' }) \n \n # y (vertical) axis\n vis.add(pv.Rule)\n .data([0])\n .left(horiz.scale(0))\n .bottom(@margin)\n .strokeStyle(\"black\")\n \n # make the main body of boxplot\n vis.add(pv.Rule)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5) })\n .bottom(lambda {|d| vert.scale(d.q1)})\n .lineWidth(bar_width)\n .height(lambda {|d| vert.scale(d.q3) - vert.scale(d.q1)})\n .strokeStyle(@bar_clr)\n\n # add bottom labels\n vis.add(pv.Label)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5) })\n .bottom(0)\n .text_baseline(\"top\")\n .text_margin(15)\n .textAlign(\"center\")\n .text(lambda {|d| d.name })\n\n # make the whisker \n vis.add(pv.Rule)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5)})\n .bottom(lambda {|d| vert.scale(d.q0)})\n .lineWidth(1)\n .height(lambda {|d| vert.scale(d.q4) - vert.scale(d.q0)})\n .strokeStyle(@bar_clr)\n\n # make the median line \n vis.add(pv.Rule)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5)})\n .bottom(lambda {|d| vert.scale(d.q2)})\n .height(1)\n .lineWidth(bar_width)\n .strokeStyle(\"white\")\n \n vis.render()\n return vis.to_svg()\n end",
"def update_visualization(point)\n\t\t\n\tend",
"def update_visualization(point)\n\t\t\n\tend",
"def update_visualization(point)\n\t\t\n\tend",
"def update_visualization(point)\n\t\t\n\tend",
"def plot(points = [])\n Gnuplot.open do |gp|\n Gnuplot::Plot.new(gp) do |plot|\n plot.terminal \"pngcairo size 460,460\"\n plot.output @parameters[:fn]\n plot.key \"off\"\n x = []\n y = []\n points << (@parameters[:high]-@parameters[:low])*2+@parameters[:high] if points.empty?\n @arrows ||= []\n if @parameters[:horizontal]\n plot.xrange \"[#{@parameters[:low]}:#{@parameters[:high]}]\"\n plot.yrange \"[0:1]\"\n plot.border 1\n plot.xtics generate_tics\n plot.unset \"ytics\"\n points.each do |p|\n x << p\n y << 0\n end\n @arrows.each do |a|\n if a[3]\n plot.arrow \"from #{a[0]}, 0.05 to #{a[1]}, 0.05 filled lc rgb '#{a[2]}'\"\n else\n plot.arrow \"from #{a[0]}, 0.05 to #{a[1]}, 0.05 heads filled lc rgb '#{a[2]}'\"\n end\n end\n else\n plot.yzeroaxis \"lt -1\"\n plot.xrange \"[-1:1]\"\n plot.yrange \"[#{@parameters[:low]}:#{@parameters[:high]}]\"\n plot.border 0\n plot.ytics \"axis #{generate_tics}\"\n plot.unset \"xtics\"\n points.each do |p|\n x << 0\n y << p\n end\n @arrows.each do |a|\n if a[3]\n plot.arrow \"from 0.1, #{a[0]} to 0.1, #{a[1]} filled lc rgb '#{a[2]}'\"\n else\n plot.arrow \"from 0.1, #{a[0]} to 0.1, #{a[1]} heads filled lc rgb '#{a[2]}'\"\n end\n end\n end\n plot.data << Gnuplot::DataSet.new([x, y]) do |ds|\n ds.with = \"points pt 7 lc rgb '#{color}'\"\n ds.notitle\n end\n end\n end\n if @parameters[:horizontal]\n `convert #{@parameters[:fn]} -crop 460x100+0+360 +repage #{@parameters[:fn]}`\n else\n `convert #{@parameters[:fn]} -crop 100x460+180+0 +repage #{@parameters[:fn]}`\n end\n self\n end",
"def update_visualization(point)\n\t\t\t\t\n\t\t\tend",
"def plot_against e1, e2\n Flot.new('experiment_roc_plot') do |f|\n f.points\n f.grid :hoverable => true\n f.legend :position => \"se\"\n f.yaxis 1\n f.series \"#{e1.title} against #{e2.title}\", e1.aucs_against(e2), :points => {:show => true, :radius => 1.5}\n end\nend",
"def generatePlot( options={} )\n # Generate an array of the x hash values to easily find the minimum and maximum.\n x = Array.new\n @x_data.keys.each { |key|\n x.push(@x_data[key].to_f)\n }\n\n defaults = { :filename => \"data\",\n :numBins => 2,\n :x_label => \"X\",\n :y_label => \"Y\",\n :title => \"Title\",\n :min => x.min,\n :max => x.max,\n :logx => false,\n :logy => false,\n :linreg => false,\n :dataLabels => false,\n :doOutliers => false,\n :outlierK => 3,\n :addOutlierLabels => 0,\n :savePlot => false }\n\n options = defaults.merge(options)\n\n savePlot = options[:savePlot]\n filename = options[:filename]\n numBins = options[:numBins]\n x_label = options[:x_label]\n y_label = options[:y_label]\n title = options[:title]\n min = options[:min]\n max = options[:max]\n logx = options[:logx]\n logy = options[:logy]\n linreg = options[:linreg]\n outlierAnalysis = Array.[](options[:doOutliers],options[:outlierK])\n dataLabels = options[:dataLabels]\n addOutlierLabels = options[:addOutlierLabels]\n\n if (@plottype == :histogram)\n\n bw = (max.to_f - min.to_f) / numBins.to_f # Calculate bin width\n x_count = Array.new\n x_axis = Array.new\n\n histfile = File.new(filename + \".histo\", \"w\") # File that shows the keys that belong in each bin.\n\n # checks which values belong in each bin. Edgecases go to the lower bin.\n (1..numBins).each {|n|\n count = 0\n histfile.puts \"Values from #{(min.to_f + (n.to_f-1) * bw.to_f)} to #{min.to_f + n.to_f * bw.to_f}.\" # Label the bin in the file.\n\n if (min == x.min && n == 1) # To fix the issue with keys being left out if the bin minimum == data minimum(s)\n @x_data.keys.each {|key|\n if (@x_data[key] == x.min)\n histfile.puts key # Place a copy of the minimum(s) in the first bin\n count = count + 1 # Increment the first bin to reflect this\n end\n }\n end\n\n @x_data.keys.each {|v|\n if(((min.to_f + (n.to_f-1) * bw.to_f) < (@x_data[v].to_f)) and ((@x_data[v].to_f) <= (min.to_f + n.to_f * bw.to_f)))\n count = count + 1 # Add increment the bin counter if the key qualifies\n histfile.puts v # List the key in the bin if it qualifies\n end\n }\n\n x_count.push(count) # Add the bin count to the count array.\n }\n\n histfile.close\n\n # To check bin counts\n binSum = 0;\n (0..(numBins-1)).each { |index|\n binSum = x_count[index] + binSum\n puts \"Bin #{index} contains #{x_count[index]}\" if $verbose\n }\n puts \"There were #{binSum} samples in the plot.\" if $verbose\n\n # generates the x axis\n (1..numBins).each {|n|\n x_axis.push(min.to_f + (0.5*bw.to_f + bw.to_f * (n-1)))\n }\n\n Gnuplot.open do |gp|\n Gnuplot::Plot.new( gp ) do |plot|\n plot.title title\n plot.ylabel \"Frequency\"\n plot.xlabel x_label\n\n # Save the plot to a file\n if (savePlot == true)\n plot.terminal \"gif\"\n plot.output filename + \".gif\"\n end\n\n plot.arbitrary_lines << \"set xrange [\" + min.to_s + \":\" + max.to_s + \"]\" # Set x axis according to max and mins\n plot.arbitrary_lines << \"set yrange [0:#{x_count.max.to_f + x_count.max.to_f * 0.1}]\" # Make the y axis 110% of the highest count\n\n plot.data << Gnuplot::DataSet.new( [x_axis, x_count] ) do |ds|\n ds.with = \"boxes\"\n ds.notitle\n end\n end\n end\n end\n\n if (@plottype == :scatter)\n\n if(@x_data.length == @y_data.length)\n\n # generate a datafile to use in gnuplot\n datfile = filename + \".scatter\"\n\n newfile = File.new(datfile, \"w\")\n\n # pointCount tells how many points are on the graph\n pointCount = 0\n @x_data.keys.each { |i|\n newfile.puts \"#{@x_data[i]}\\t#{@y_data[i]}\"\n pointCount = pointCount + 1\n }\n\n puts \"There are #{pointCount} points on the plot.\" if $verbose\n\n newfile.close\n\n # plot data\n Gnuplot.open do |gp|\n Gnuplot::Plot.new( gp ) do |plot|\n\n # plot to a file\n if (savePlot == true)\n plot.terminal \"gif\"\n plot.output filename + \".gif\"\n end\n\n #apply title/labels\n plot.title title\n plot.ylabel y_label\n plot.xlabel x_label\n\n # check if graphs need to be logscaled\n if (logx)\n plot.arbitrary_lines << \"set logscale x\"\n end\n\n if (logy)\n plot.arbitrary_lines << \"set logscale y\"\n end\n\n # check if a linear regression is desired\n if (linreg)\n plot.arbitrary_lines << \"f(x) = m*x + b\"\n plot.arbitrary_lines << \"fit f(x) '\" + datfile + \"' using 1:2 via m,b\"\n end\n\n # perform outlier analysis\n if (outlierAnalysis[0])\n\n # generate array of slopes of data\n yDivX = Array.new\n @x_data.keys.each { |key|\n yDivX.push(@y_data[key].to_f / @x_data[key].to_f)\n }\n\n # apply the 5 number summary function\n summData = Array.new\n summData = yDivX.fiveNumSum # match to new function\n\n # Calculate slopes of minimum and maximum lines to show outliers\n maxline = summData[2] + outlierAnalysis[1] * (summData[3] - summData[1])\n minline = summData[2] - outlierAnalysis[1] * (summData[3] - summData[1])\n\n # Define the minline and maxline in gnuplot\n plot.arbitrary_lines << \"a(x) = #{minline}*x\"\n plot.arbitrary_lines << \"b(x) = #{maxline}*x\"\n\n end #outlier analysis\n\n\n # Generate a plot string\n plotString = \"plot '#{datfile}' notitle\"\n\n # add linear regression\n if (linreg)\n plotString = plotString + \", f(x) title 'Linear Fit'\"\n end\n\n # plot with outlier analysis\n if (outlierAnalysis[0])\n plotString = plotString + \", a(x) title 'Minimum', b(x) title 'Maximum'\"\n end\n # add data point names if desired\n if (dataLabels && addOutlierLabels == 0) # Won't label everything if outlier labeling is enabled\n @x_data.keys.each { |key|\n plot.arbitrary_lines << \"set label '#{key}' at #{@x_data[key].to_f}, #{@y_data[key].to_f}\"\n }\n end\n\n # add outlier data labels\n if ( addOutlierLabels > 0 )\n self.findOutliers( filename + \"ForLabels\", addOutlierLabels )\n @outlier_data.keys.each { |key|\n # add labels to each point where an outlier exists\n plot.arbitrary_lines << \"set label '#{key}' at #{@x_data[key].to_f}, #{@y_data[key].to_f}\"\n }\n puts \"Labeled #{@outlier_data.size} outliers.\" if $verbose\n end\n plot.arbitrary_lines << plotString\n end\n end\n\n # Regenerate the data file to add in key names.\n newfile = File.new(datfile+ \"WITHNAMES\", \"w\")\n \n newfile.puts \"Name\\tX\\tY\"\n\n @x_data.keys.each { |i|\n newfile.puts \"#{i}\\t#{@x_data[i]}\\t#{@y_data[i]}\"\n }\n\n newfile.close\n\n else\n puts \"X and Y are different sizes\"\n end # x y size check\n end # scatter\n\n end",
"def plot(points = [], points2 = [])\n Gnuplot.open do |gp|\n Gnuplot::Plot.new(gp) do |plot|\n \n min_x = (points + points2).min - 1\n max_x = (points + points2).max + 1\n\n plot.terminal \"pngcairo\"\n plot.output @parameters[:fn]\n\n plot.style \"data boxplot\"\n plot.unset \"xtics\"\n plot.grid \"y2tics lc rgb \\\"#888888\\\" lw 1 lt 0\"\n plot.yrange \"[#{min_x}:#{max_x}]\"\n plot.y2range \"[#{min_x}:#{max_x}]\"\n\n plot.xrange \"[0.6:2]\"\n plot.x2range \"[0.6:2]\"\n\n plot.y2tics \"center rotate by 90 font \\\",15\\\"\"\n plot.unset \"ytics\"\n\n x = []\n y = []\n\n (min_x..max_x).to_a.each do |current_x|\n points.grep(current_x).size.times do\n x << 1\n y << current_x\n end if points.grep(current_x).size\n end\n\n x2 = []\n y2 = []\n (min_x..max_x).to_a.each do |current_x|\n points2.grep(current_x).size.times do\n x2 << 1.6\n y2 << current_x\n end if points2.grep(current_x).size\n end\n \n plot.data = [\n Gnuplot::DataSet.new([x, y]) { |ds|\n ds.title = ''\n },\n\n Gnuplot::DataSet.new([x2, y2]) { |ds|\n ds.title = ''\n ds.linecolor = \"rgb \\\"red\\\"\"\n }\n ]\n\n label_index = 1\n @labels ||= []\n @labels.each do |l|\n plot.label \"#{label_index} '#{l[0]}' at #{l[1]}, #{l[2]} font 'Latin-Modern,#{l[3]}' tc rgb '#{l[4]}' rotate by 90 center\"\n label_index += 1\n end\n\n end\n end\n `convert -rotate 90 #{@parameters[:fn]} #{@parameters[:fn]}`\n @parameters[:fn]\n end",
"def plot_data data, series=nil, filename=nil, title=nil\n # stub method to enable documentation in yard\n\t\tend",
"def to_flot\n [\n { label: \"Pageviews\", data: pageviews },\n { label: \"Downloads\", data: downloads }\n ]\n end",
"def create\n @plot = Plot.new(plot_params)\n respond_to do |format|\n if @plot.save\n format.html { redirect_to @plot, notice: 'Plot was successfully created.' }\n format.json { render :show, status: :created, location: @plot }\n else\n format.html { render :new }\n format.json { render json: @plot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def plot_1d\n plotter = Plotter.new(:title => \"Signal: values vs. sample number\", :xtitle => \"sample number\", :ytitle => \"sample value\")\n plotter.plot_1d \"signal data\" => @data\n end",
"def _make_plots_evt(dataset,pars)\n cind = @canvases.length\n canvas = ::TCanvas.new(\"compare_canvas_#{cind}\",'',25 + 50*cind,\n\t\t\t 25,500,500)\n canvas.Divide(2,2) \n canvas.cd(1)\n dataset.read_in_amps(PWA::ParIDs.max_id,:acc)\n dname = dataset.name\n # data\n title,num_bins,min,max,bins = dataset.histo_bins(@kvs,pars,:unwtd,:data,@condition)\n h_data = TH2F.new(\"h_#{dataset.name}_data\",'data',num_bins[0],min[0],\n\t\t\tmax[0],num_bins[1],min[1],max[1])\n bins.each_index{|i| \n\tbins[i].each_index{|j| h_data.SetBinContent(i+1,j+1,bins[i][j])}\n }\n h_data.GetXaxis.SetTitle title[0]\n h_data.GetYaxis.SetTitle title[1]\n h_data.Draw 'colz'\n data_integral = h_data.Integral\n data_min = h_data.GetMinimum\n data_max = h_data.GetMaximum\n @histos.push h_data\n gPad.Update\n # acc \n canvas.cd(2)\n title,num_bins,min,max,bins = dataset.histo_bins(@kvs,pars,:unwtd,:acc,@condition)\n h_acc = TH2F.new(\"h_#{dataset.name}_acc\",'acc(unwtd)',num_bins[0],min[0],\n\t\t max[0],num_bins[1],min[1],max[1])\n bins.each_index{|i| \n\tbins[i].each_index{|j| h_acc.SetBinContent(i+1,j+1,bins[i][j])}\n }\n h_acc.GetXaxis.SetTitle title[0]\n h_acc.GetYaxis.SetTitle title[1]\n acc_integral = h_acc.Integral\n h_acc.Scale(data_integral/acc_integral) if(acc_integral > 0)\n h_acc.SetMinimum data_min\n h_acc.SetMaximum data_max\n h_acc.Draw 'colz' \n @histos.push h_acc\n gPad.Update\n # wtd acc\n canvas.cd 3\n dataset.read_in_norm(:acc)\n y = dataset.calc_yield(pars,'.',:acc)\n title,num_bins,min,max,bins = dataset.histo_bins(@kvs,pars,'.',:acc,@condition)\n h_acc_wt = TH2F.new(\"h_#{dataset.name}_acc_wt\",'acc(wtd)',num_bins[0],\n\t\t\t min[0],max[0],num_bins[1],min[1],max[1])\n bins.each_index{|i| \n\tbins[i].each_index{|j| h_acc_wt.SetBinContent(i+1,j+1,bins[i][j])}\n }\n h_acc_wt.GetXaxis.SetTitle title[0]\n h_acc_wt.GetYaxis.SetTitle title[1]\n acc_integral_wt = h_acc_wt.Integral\n h_acc_wt.Scale(y/acc_integral_wt) if(acc_integral_wt > 0)\n h_acc_wt.SetMinimum data_min\n h_acc_wt.SetMaximum data_max\n h_acc_wt.Draw 'colz' \n @histos.push h_acc_wt\n gPad.Update\n # chi^2 \n canvas.cd 4\n h_chi2 = TH2F.new(\"h_#{dataset.name}_chi2\",'#chi^{2}',num_bins[0],min[0],\n\t\t\tmax[0],num_bins[1],min[1],max[1])\n h_chi2.GetXaxis.SetTitle title[0]\n h_chi2.GetYaxis.SetTitle title[1]\n 1.upto(bins.length){|i|\n\t1.upto(bins[i-1].length){|j|\n\t data = h_data.GetBinContent(i,j)\n\t derr = h_data.GetBinError(i,j)\n\t acc = h_acc_wt.GetBinContent(i,j)\n\t aerr = h_acc_wt.GetBinError(i,j)\n\t if(aerr > 0 and derr > 0)\n\t chi2 = ((data-acc)**2)/(aerr**2 + derr**2)\n\t chi2 *= -1 if(acc > data)\n\t h_chi2.SetBinContent(i,j,chi2)\n\t end\n\t}\n }\n h_chi2.Draw 'colz' \n @histos.push h_chi2\n gPad.Update\n #\n canvas.cd\n @canvases.push canvas\n end",
"def plot!\n return plot if plot && plot.valid? && plot.file_exists?\n plot.destroy if (plot)\n f = ExtendedArgumentationFramework::Framework.new(graph_representation, auto_generate_nodes: true)\n file = ExtendedArgumentationFramework::Plotter.new(f, plot_acceptability: false, edges_style: 'dir=back style=dashed').to_png\n p=Plot.create(filename: \"#{Plot::BASE_URL}/#{file}\", object: self)\n p\n end",
"def getchart()\n # The (x, y, z) coordinates of the scattered data\n dataX = [0.5, 1.9, 4.9, 1.0, 8.9, 9.8, 5.9, 2.9, 6.8, 9.0, 0.0, 8.9, 1.9, 4.8,\n 2.4, 3.4, 7.9, 7.5, 4.8, 7.5, 9.5, 0.4, 8.9, 0.9, 5.4, 9.4, 2.9, 8.9, 0.9,\n 8.9, 10.0, 1.0, 6.8, 3.8, 9.0, 5.3, 6.4, 4.9, 4.5, 2.0, 5.4, 0.0, 10.0, 3.9,\n 5.4, 5.9, 5.8, 0.3, 4.4, 8.3]\n dataY = [3.3, 3.0, 0.7, 1.0, 9.3, 4.5, 8.4, 0.1, 0.8, 0.1, 9.3, 1.8, 4.3, 1.3,\n 2.3, 5.4, 6.9, 9.0, 9.8, 7.5, 1.8, 1.4, 4.5, 7.8, 3.8, 4.0, 2.9, 2.4, 3.9,\n 2.9, 2.3, 9.3, 2.0, 3.4, 4.8, 2.3, 3.4, 2.3, 1.5, 7.8, 4.5, 0.9, 6.3, 2.4,\n 6.9, 2.8, 1.3, 2.9, 6.4, 6.3]\n dataZ = [6.6, 12.5, 7.4, 6.2, 9.6, 13.6, 19.9, 2.2, 6.9, 3.4, 8.7, 8.4, 7.8, 8.0,\n 9.4, 11.9, 9.6, 15.7, 12.0, 13.3, 9.6, 6.4, 9.0, 6.9, 4.6, 9.7, 10.6, 9.2,\n 7.0, 6.9, 9.7, 8.6, 8.0, 13.6, 13.2, 5.9, 9.0, 3.2, 8.3, 9.7, 8.2, 6.1, 8.7,\n 5.6, 14.9, 9.8, 9.3, 5.1, 10.8, 9.8]\n\n # Create a XYChart object of size 450 x 540 pixels\n c = ChartDirector::XYChart.new(450, 540)\n\n # Add a title to the chart using 15 points Arial Italic font\n c.addTitle(\" Contour Chart with Scattered Data\", \"ariali.ttf\", 15)\n\n # Set the plotarea at (65, 40) and of size 360 x 360 pixels. Use semi-transparent\n # black (c0000000) for both horizontal and vertical grid lines\n c.setPlotArea(65, 40, 360, 360, -1, -1, -1, 0xc0000000, -1)\n\n # Set x-axis and y-axis title using 12 points Arial Bold Italic font\n c.xAxis().setTitle(\"X-Axis Title Place Holder\", \"arialbi.ttf\", 10)\n c.yAxis().setTitle(\"Y-Axis Title Place Holder\", \"arialbi.ttf\", 10)\n\n # Set x-axis and y-axis labels to use Arial Bold font\n c.xAxis().setLabelStyle(\"arialbd.ttf\")\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # When x-axis and y-axis color to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n\n # Add a scatter layer to the chart to show the position of the data points\n c.addScatterLayer(dataX, dataY, \"\", ChartDirector::Cross2Shape(0.2), 7, 0x000000)\n\n # Add a contour layer using the given data\n layer = c.addContourLayer(dataX, dataY, dataZ)\n\n # Move the grid lines in front of the contour layer\n c.getPlotArea().moveGridBefore(layer)\n\n # Add a color axis (the legend) in which the top center is anchored at (245, 455).\n # Set the length to 330 pixels and the labels on the top side.\n cAxis = layer.setColorAxis(245, 455, ChartDirector::TopCenter, 330,\n ChartDirector::Top)\n\n # Add a bounding box to the color axis using the default line color as border.\n cAxis.setBoundingBox(ChartDirector::Transparent, ChartDirector::LineColor)\n\n # Add a title to the color axis using 12 points Arial Bold Italic font\n cAxis.setTitle(\"Color Legend Title Place Holder\", \"arialbi.ttf\", 10)\n\n # Set color axis labels to use Arial Bold font\n cAxis.setLabelStyle(\"arialbd.ttf\")\n\n # Set the color axis range as 0 to 20, with a step every 2 units\n cAxis.setLinearScale(0, 20, 2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def getchart()\n # The (x, y, z) coordinates of the scattered data\n dataX = [0.5, 1.9, 4.9, 1.0, 8.9, 9.8, 5.9, 2.9, 6.8, 9.0, 0.0, 8.9, 1.9, 4.8,\n 2.4, 3.4, 7.9, 7.5, 4.8, 7.5, 9.5, 0.4, 8.9, 0.9, 5.4, 9.4, 2.9, 8.9, 0.9,\n 8.9, 10.0, 1.0, 6.8, 3.8, 9.0, 5.3, 6.4, 4.9, 4.5, 2.0, 5.4, 0.0, 10.0, 3.9,\n 5.4, 5.9, 5.8, 0.3, 4.4, 8.3]\n dataY = [3.3, 3.0, 0.7, 1.0, 9.3, 4.5, 8.4, 0.1, 0.8, 0.1, 9.3, 1.8, 4.3, 1.3,\n 2.3, 5.4, 6.9, 9.0, 9.8, 7.5, 1.8, 1.4, 4.5, 7.8, 3.8, 4.0, 2.9, 2.4, 3.9,\n 2.9, 2.3, 9.3, 2.0, 3.4, 4.8, 2.3, 3.4, 2.3, 1.5, 7.8, 4.5, 0.9, 6.3, 2.4,\n 6.9, 2.8, 1.3, 2.9, 6.4, 6.3]\n dataZ = [6.6, 12.5, 7.4, 6.2, 9.6, 13.6, 19.9, 2.2, 6.9, 3.4, 8.7, 8.4, 7.8, 8.0,\n 9.4, 11.9, 9.6, 15.7, 12.0, 13.3, 9.6, 6.4, 9.0, 6.9, 4.6, 9.7, 10.6, 9.2,\n 7.0, 6.9, 9.7, 8.6, 8.0, 13.6, 13.2, 5.9, 9.0, 3.2, 8.3, 9.7, 8.2, 6.1, 8.7,\n 5.6, 14.9, 9.8, 9.3, 5.1, 10.8, 9.8]\n\n # Create a SurfaceChart object of size 680 x 550 pixels. Set background to brushed\n # silver and border to grey (888888). Set the top-left and bottom-right corners to\n # rounded corners with 20 pixels radius.\n c = ChartDirector::SurfaceChart.new(680, 550, ChartDirector::brushedSilverColor(),\n 0x888888)\n c.setRoundedFrame(0xffffff, 20, 0, 20, 0)\n\n # Add a title to the chart using 20 points Times New Roman Italic font. Set\n # top/bottom margin to 8 pixels.\n title = c.addTitle(\"Surface Created Using Scattered Data Points\", \"timesi.ttf\", 20\n )\n title.setMargin2(0, 0, 8, 8)\n\n # Add a 2 pixel wide black (000000) separator line under the title\n c.addLine(10, title.getHeight(), c.getWidth() - 10, title.getHeight(), 0x000000, 2\n )\n\n # Set the center of the plot region at (290, 235), and set width x depth x height\n # to 360 x 360 x 180 pixels\n c.setPlotRegion(290, 235, 360, 360, 180)\n\n # Set the elevation and rotation angles to 45 and -45 degrees\n c.setViewAngle(45, -45)\n\n # Set the perspective level to 30\n c.setPerspective(30)\n\n # Set the data to use to plot the chart\n c.setData(dataX, dataY, dataZ)\n\n # Add a color axis (the legend) in which the top right corner is anchored at (660,\n # 80). Set the length to 200 pixels and the labels on the right side.\n cAxis = c.setColorAxis(660, 80, ChartDirector::TopRight, 200, ChartDirector::Right\n )\n\n # Set the color axis title with 12 points Arial Bold font\n cAxis.setTitle(\"Z Title Placeholder\", \"arialbd.ttf\", 12)\n\n # Add a bounding box with light grey (eeeeee) background and grey (888888) border.\n # Set the top-left and bottom-right corners to rounded corners of 10 pixels\n # radius.\n cAxis.setBoundingBox(0xeeeeee, 0x888888)\n cAxis.setRoundedCorners(10, 0, 10, 0)\n\n # Set surface grid lines to semi-transparent black (cc000000)\n c.setSurfaceAxisGrid(0xcc000000)\n\n # Set contour lines to semi-transparent white (80ffffff)\n c.setContourColor(0x80ffffff)\n\n # Set the walls to black in color\n c.setWallColor(0x000000)\n\n # Set the xyz major wall grid lines to white (ffffff), and minor wall grid lines\n # to grey (888888)\n c.setWallGrid(0xffffff, 0xffffff, 0xffffff, 0x888888, 0x888888, 0x888888)\n\n # Set the wall thickness to 0\n c.setWallThickness(0, 0, 0)\n\n # Show only the xy wall, and hide the yz and zx walls.\n c.setWallVisibility(true, false, false)\n\n # Set the x, y and z axis titles using 12 points Arial Bold font\n c.xAxis().setTitle(\"X Title\\nPlaceholder\", \"arialbd.ttf\", 12)\n c.yAxis().setTitle(\"Y Title\\nPlaceholder\", \"arialbd.ttf\", 12)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::JPG), :type => \"image/jpeg\",\n :disposition => \"inline\")\n end",
"def plot3dGeneric_old(title, label, index, baseName)\n index += 1;\n pathBase = \"#{@resultBaseDir}/#{baseName}\" ;\n begin\n gplot = Gnuplot.new(:gplot, pathBase) ;\n gplot.setTitle(title) ;\n gplot.setXYLabel(\"# of Savs (log)\", \"frequency (log)\") ;\n gplot.command(\"set ylabel rotate parallel\") ;\n gplot.command(\"set dgrid3d 100,100 spline\") ;\n gplot.command(\"set pm3d at b\") ;\n gplot.command(\"set cblabel \\\"#{label}\\\" offset -10\") ;\n gplot.command(\"set logscale xy\") ;\n gplot.command(\"set contour\") ;\n gplot.command(\"unset ztics\") ;\n gplot.command(\"set view 0,359.9999\") ; # to show y label at left.\n\n gplot.command(\"$MyData << EOD\") ;\n to_a.each{|analyzer|\n gplot.command(analyzer.genCsvRowSummary().join(\" \")) ;\n }\n gplot.command(\"EOD\") ;\n\n# gplot.command(\"splot $MyData u 1:2:#{index} w lines palette notitle\") ;\n gplot.command(\"splot $MyData u 1:2:#{index} w pm3d t '#{label}'\") ;\n\n gplot.close() ;\n\n #gplot = Gnuplot.new(\"qt\") ;\n gplot = Gnuplot.new(\"wxt\") ;\n gplot.command(\"load \\\"#{pathBase}.gpl\\\"\") ;\n gplot.setTerm(:tgif, \"#{pathBase}\") ;\n gplot.command(\"replot\") ;\n\n ensure\n gplot.close() ;\n end\n end",
"def create\n @plot = Plot.new(plot_params)\n\n respond_to do |format|\n if @plot.save\n format.html { redirect_to @plot, notice: \"Plot was successfully created.\" }\n format.json { render :show, status: :created, location: @plot }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @plot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def plot_data\n clear_lines\n @buffer.keys.each { |k| plot_data_line(k, @buffer[k]) }\n end",
"def plot_2d\n plotter = Plotter.new(:title => \"Signal: values vs. time\", :xtitle => \"time (sec)\", :ytitle => \"sample value\")\n \n data_vs_time = {}\n sp = 1.0 / @sample_rate\n @data.each_index do |i|\n data_vs_time[i * sp] = @data[i]\n end\n \n plotter.plot_2d \"signal data\" => data_vs_time\n end",
"def points; end",
"def scatter_plot\n validate(\n x_axis: [:optional, :security_default],\n y_axis: [:optional, :security_default],\n x_axis_type: [:optional, :security_default],\n y_axis_type: [:optional, :security_default],\n x_axis_notation: [:optional, :security_default],\n y_axis_notation: [:optional, :security_default],\n container_id: [:optional, :security_default]\n )\n if params[:x_axis].blank? or params[:y_axis].blank?\n render inline: \"\"\n else\n @chart = ScatterPlotChart.new(\n @experiment,\n params[:x_axis].to_s,\n params[:y_axis].to_s,\n params[:type_of_x],\n params[:type_of_y],\n x_axis_type: params[:x_axis_type].to_s,\n y_axis_type: params[:y_axis_type].to_s,\n x_axis_notation: params[:x_axis_notation].to_s,\n y_axis_notation: params[:y_axis_notation].to_s\n )\n Rails.logger.debug(\"ScatterPlotChart --- x axis: #{@chart.x_axis}, y axis: #{@chart.y_axis}\")\n @chart.prepare_chart_data\n @uuid = SecureRandom.uuid\n @container_id = params[:container_id] || \"bivariate_chart_#{@uuid}\"\n end\n end",
"def generateSeriesPlot(xyData, options={})\n plotOptions={:width=>200, :height=>100, :imagetype=> \"png\", :xlabel=> \"\", :ylabel=> \"\"}\n plotOptions=plotOptions.merge(options)\n Gnuplot.open do |gp|\n Gnuplot::Plot.new( gp ) do |plot|\n plot.terminal \"#{plotOptions[:imagetype]} small enhanced size #{plotOptions[:width]},#{plotOptions[:height]} crop\"\n plot.output Rails.root.to_s+\"/public/series.png\"\n plot.ylabel plotOptions[:ylabel]\n plot.xlabel plotOptions[:xlabel]\n plot.boxwidth 0.5\n plot.grid \"\"\n plot.data << Gnuplot::DataSet.new( xyData ) do |ds|\n ds.with = \"boxes fill solid 0.5\"\n ds.notitle\n end\n end\n end\n end",
"def plot(points = [])\n Gnuplot.open do |gp|\n Gnuplot::Plot.new(gp) do |plot|\n \n min_x = points.min - 1\n max_x = points.max + 1\n\n plot.terminal \"pngcairo\"\n plot.output @parameters[:fn]\n\n plot.style \"data boxplot\"\n plot.unset \"xtics\"\n plot.grid \"y2tics lc rgb \\\"#888888\\\" lw 1 lt 0\"\n plot.yrange \"[#{min_x}:#{max_x}]\"\n plot.y2range \"[#{min_x}:#{max_x}]\"\n plot.y2tics \"center rotate by 90 font \\\",15\\\"\"\n plot.unset \"ytics\"\n\n x = []\n y = []\n (min_x..max_x).to_a.each do |current_x|\n points.grep(current_x).size.times do\n x << 1\n y << current_x\n end if points.grep(current_x).size\n end\n plot.data << Gnuplot::DataSet.new([x, y]) do |ds|\n ds.title = ''\n end\n\n label_index = 1\n @labels ||= []\n @labels.each do |l|\n plot.label \"#{label_index} '#{l[0]}' at #{l[1]}, #{l[2]} font 'Latin-Modern,#{l[3]}' tc rgb '#{l[4]}' rotate by 90 center\"\n label_index += 1\n end\n\n end\n end\n `convert -rotate 90 #{@parameters[:fn]} #{@parameters[:fn]}`\n @parameters[:fn]\n end",
"def make_boxplot_graph(data, xlabels, min_temp, max_temp, title) \n num = data[data.keys.first].length\n # inset data\n data.keys.each do |k| \n data[k].unshift(-1)\n data[k].push(-1)\n end\n # inset labels\n xlabels.unshift(\"\")\n xlabels.push(\"\")\n # build url \n base = \"\"\n # url\n #base << next_chart_url \n base << \"/chart?\" \n \n # graph size\n base << \"chs=600x240&\"\n # graph title\n base << \"chtt=#{title}&\"\n # graph type\n base << \"cht=lc&\"\n # visible axes\n base << \"chxt=x,y&\"\n # axis ranges \n base << \"chxr=1,#{min_temp},#{max_temp},#{(max_temp-min_temp)/10.0}&\"\n # range for scaling data\n base << \"chds=#{min_temp},#{max_temp}&\"\n # axis labels\n base << \"chxl=0:|#{xlabels.join('|')}&\"\n # build series\n serieses = []\n serieses << data[:min].join(',')\n serieses << data[:q1].join(',')\n serieses << data[:q3].join(',')\n serieses << data[:max].join(',')\n serieses << data[:med].join(',')\n base << \"chd=t0:#{serieses.join('|')}&\" \n # build display\n display = []\n display << \"F,FF0000,0,1:#{num},40\"\n display << \"H,FF0000,0,1:#{num},1:20\"\n display << \"H,FF0000,3,1:#{num},1:20\"\n display << \"H,000000,4,1:#{num},1:40\"\n base << \"chm=#{display.join('|')}\"\n\n puts \"DEBUG: graph length = #{base.length}\"\n return base\n end",
"def basic_chart\n \n end",
"def plot(opts = {}, &block)\n\t\t\tdefault_opts = {:type => DOMAIN_COLORED_PLOT, :color => ChunkyPNG::Color::BLACK,\n\t\t\t\t:vert => DLINES, :horz => DLINES}\n\t\t\topts = default_opts.merge(opts)\n\t\t\tif opts[:type] == DOMAIN_COLORED_PLOT and @size > 0\n\t\t\t\twarn \"Warning in #{self.class}::plot: DOMAIN_COLORED_PLOT will overdraw existing #{@size} plots. Draw 1st for correct behavior.\"\n\t\t\tend\n\t\t\tcase opts[:type]\n\t\t\t\twhen DOMAIN_COLORED_PLOT then plotDCPlot(opts, &block)\n\t\t\t\twhen COMPLEX_CONTOUR_PLOT then plotCCPlot(opts, &block)\n\t\t\t\telse raise RangeError, \"Invalid plot type #{opts[:type]}.\"\n\t\t\tend\n\t\t\t@size += 1\n\t\tend",
"def draw_basic_or_plot(jitter, grouplist, snp_list, x_start, y_start, stat_max, stat_min, data_key, plot_labels, title,\n precision, large_sig=false, rotate=false, size_mult=1)\n x = @box_size\n xmin = x\n ymin = 0\n ymax = @box_size*9 * size_mult\n y_interval = ymax-ymin\n # set stat_min to be zero\n stat_interval = stat_max - stat_min\n\n value_x = xmin * 0.7 + (@box_size * Math.sqrt(2)*0.25)/2\n\n # draw box (change to triangle) with correct color\n snp_list.included_snps.each do |snp_index|\n snp = snp_list.snps[snp_index]\n draw_separation(x_start, y_start, 0, ymax, value_x)\n\n # store points here for output\n points = Array.new\n\n grouplist.groups.each do |group|\n if snp.results.has_key?(group.name)\n result = snp.results[group.name]\n if !result.values[data_key] or result.values[data_key] !~ /\\d/\n next\n end\n box_y_start = ((stat_max-result.values[data_key].to_f) / stat_interval) * y_interval\n\n if rotate\n box_y_start = y_interval - box_y_start\n end\n\n diameter = @box_size * Math.sqrt(2)*0.125\n if large_sig and ((result.values[data_key].to_f > 1.0 and result.values['lci'] == nil) or\n result.values['lci'].to_f > 1.0) or ((result.values[data_key].to_f < 1.0 and result.values['uci'] == nil) or\n result.values['uci'].to_f < 1.0)\n diameter *= 2\n end\n\n points << Circle.new(value_x, box_y_start, diameter, group.colorstr)\n end\n end\n\n # sort by y-midpoint\n points.sort! {|x,y| y.ymidpoint <=> x.ymidpoint}\n\n # those points that overlap significantly\n if jitter\n adjust_horizontal(points, y_interval)\n end\n\n\t # iterate through points and draw all of them\n\t points.each do |point|\n \t @canvas.g.translate(x_start,y_start) do |check|\n \t check.styles(:stroke_width=>1, :fill_opacity=>0.9)\n \t point.draw(check)\n \t end\n \t end\n\n value_x = label_step(value_x)\n end\n\n if plot_labels\n if rotate\n x_label_start = value_x + x_start+ @box_size * 0.4\n else\n x_label_start = x_start\n end\n if size_mult >= 1\n write_plot_labels(x_label_start, y_start, ymax, stat_max, stat_min, y_interval, 0, title, false, precision, rotate)\n else\n write_plot_labels(x_label_start, y_start, ymax, stat_max, stat_min, y_interval, 0, title,\n false, precision, rotate, 5)\n end\n end\n end",
"def axes\n end",
"def update_visualization(point)\n\t\tsuper(point)\n\tend",
"def xaxis\n end",
"def set_plot\n @plot = Plot.find(params[:id])\n end",
"def set_plot\n @plot = Plot.find(params[:id])\n end",
"def set_plot\n @plot = Plot.find(params[:id])\n end",
"def set_plot\n @plot = Plot.find(params[:id])\n end",
"def plot(*args)\n contents = parse_plot_args(PlotItem,args)\n _plot_splot(\"plot\",contents)\n nil\n end",
"def config\n PlotsConfig.instance\nend",
"def plot_points(points = [])\n x = []\n y = []\n points << [(@parameters[:xhigh]-@parameters[:xlow])*2 + @parameters[:xhigh],\n (@parameters[:yhigh]-@parameters[:xlow])*2 + @parameters[:xhigh]] if points.empty?\n points.each do |p|\n x << p[0]\n y << p[1]\n end\n\n plot_generic(x, y, \"points pt 7\")\n end",
"def getchart()\n # Use random table to generate a random series. The random table is set to 1 col x\n # 51 rows, with 9 as the seed\n rantable = ChartDirector::RanTable.new(9, 1, 51)\n\n # Set the 1st column to start from 100, with changes between rows from -5 to +5\n rantable.setCol(0, 100, -5, 5)\n\n # Get the 1st column of the random table as the data set\n data = rantable.getCol(0)\n\n # Create a XYChart object of size 600 x 300 pixels\n c = ChartDirector::XYChart.new(600, 300)\n\n # Set the plotarea at (50, 35) and of size 500 x 240 pixels. Enable both the\n # horizontal and vertical grids by setting their colors to grey (0xc0c0c0)\n c.setPlotArea(50, 35, 500, 240).setGridColor(0xc0c0c0, 0xc0c0c0)\n\n # Add a title to the chart using 18 point Times Bold Itatic font.\n c.addTitle(\"LOWESS Generic Curve Fitting Algorithm\", \"timesbi.ttf\", 18)\n\n # Set the y axis line width to 3 pixels\n c.yAxis().setWidth(3)\n\n # Add a title to the x axis using 12 pts Arial Bold Italic font\n c.xAxis().setTitle(\"Server Load (TPS)\", \"arialbi.ttf\", 12)\n\n # Set the x axis line width to 3 pixels\n c.xAxis().setWidth(3)\n\n # Set the x axis scale from 0 - 50, with major tick every 5 units and minor tick\n # every 1 unit\n c.xAxis().setLinearScale(0, 50, 5, 1)\n\n # Add a blue layer to the chart\n layer = c.addLineLayer2()\n\n # Add a red (0x80ff0000) data set to the chart with square symbols\n layer.addDataSet(data, 0x80ff0000).setDataSymbol(ChartDirector::SquareSymbol)\n\n # Set the line width to 2 pixels\n layer.setLineWidth(2)\n\n # Use lowess for curve fitting, and plot the fitted data using a spline layer with\n # line width set to 3 pixels\n c.addSplineLayer(ChartDirector::ArrayMath.new(data).lowess().result(), 0x0000ff\n ).setLineWidth(3)\n\n # Set zero affinity to 0 to make sure the line is displayed in the most detail\n # scale\n c.yAxis().setAutoScale(0, 0, 0)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def set_plot_point\n @plot_point = PlotPoint.find(params[:id])\n end",
"def set_plot\n @plot = Plot.friendly.find(params[:id])\n end",
"def generate_tweet_plot\n tweets = FeedEntry.mark_isolates(self.retweet_ids,self)\n \n Gnuplot.open do |gp|\n Gnuplot::Plot.new(gp) do |plot|\n plot.terminal \"svg\"\n plot.output id.to_s + \".svg\"\n plot.data = []\n r = Hash.new\n s = Hash.new\n i = Hash.new\n origin_date = DateTime.parse(FeedEntry.find(id).published_at.to_s)\n tweets.each do |tweet| \n hour_diff = (DateTime.parse(tweet[:published_at])-origin_date).hours.to_i\n if (person = Person.find_by_username(tweet[:person])) != nil\n if person.friends_ids.include?(self.person.twitter_id)\t\n r[hour_diff] == nil ? r[hour_diff] = tweet[:followers_count] : r[hour_diff] += tweet[:followers_count] \n elsif tweet[:isolate_status] == \"isolate\"\n i[hour_diff] == nil ? i[hour_diff] = tweet[:followers_count] : r[hour_diff] += tweet[:followers_count] \n else\n s[hour_diff] == nil ? s[hour_diff] = tweet[:followers_count] : s[hour_diff] += tweet[:followers_count] \n end\n end\n end\n x = []\n y = []\n x1 = []\n y1 = []\n x2 = []\n y2 = []\n total = 0\n values = {}\n i.sort.each do |e|\n if e[0] < 2*(x1.inject(0.0){|sum, el| sum + el }/x2.size) || x2.size < 5\n total += e[1]\n x2 << e[0]\n y2 << total\n end\n end\n s.sort.each do |e| \n if e[0] < 2*(x1.inject(0.0){|sum, el| sum + el }/x1.size) || x1.size < 5\n total += e[1]\n x1 << e[0]\n y1 << total\n end\n end\n r.sort.each do |e| \n if e[0] < 2*(x.inject(0.0){|sum, el| sum + el }/x.size) || x.size < 5\n total += e[1] \n x << e[0]\n y << total\n end\n end\n values[:ego_retweets] = [x,y]\n values[:ego2_retweets] = [x1,y1]\n values[:isolate_retweets] = [x2,y2]\n values.each do |k,v|\n plot.data << Gnuplot::DataSet.new([v[0],v[1]]){|ds|\n ds.with = \"linespoints\"\n ds.title = k\n }\n end\n end\n end \n end",
"def call\n r = (@identity[2].to_f / @identity[1].to_f).ceil\n c = (@identity[2] % @identity[1]).zero? ? @identity[1] : @identity[2] % @identity[1]\n @ymax = 1 - (1.to_f / @identity[0]) * (r - 1) - 0.095 / @identity[0]\n @ymin = 1 - (1.to_f / @identity[0]) * r + 0.095 / @identity[0]\n @xmin = (1.to_f / @identity[1]) * (c - 1) + 0.095 / @identity[1]\n @xmax = (1.to_f / @identity[1]) * c - 0.095 / @identity[1]\n\n @x_axis_padding = Math.log((@x_range[1] - @x_range[0]), 10).round\n @y_axis_padding = Math.log((@y_range[1] - @y_range[0]), 10).round\n\n @origin[0] = @x_range[0] - @x_axis_padding if @origin[0] == :default\n @origin[1] = @y_range[0] - @y_axis_padding if @origin[1] == :default\n\n SetViewPort.new(@xmin, @xmax, @ymin, @ymax).call\n SetWindow.new(@x_range[0] - @x_axis_padding, @x_range[1] + @x_axis_padding,\n @y_range[0] - @y_axis_padding, @y_range[1] + @y_axis_padding).call\n # Make sure that window is set bigger than range figure out how to manage it\n SetTextAlign.new(2, 0).call\n @text_font = :times_roman if @text_font == :default\n SetTextFontPrecision.new(GR_FONTS[@text_font],\n GR_FONT_PRECISION[:text_precision_string]).call\n SetCharHeight.new(0.012).call\n @y_tick_count = 10 if @y_tick_count == :default\n @x_tick_count = 10 if @x_tick_count == :default # 10 ticks by default\n SetLineColorIndex.new(hex_color_to_gr_color_index(COLOR_INDEX[:black])).call\n SetLineWidth.new(1).call\n SetLineType.new(GR_LINE_TYPES[:solid]).call\n Grid.new((@x_range[1] - @x_range[0]).to_f / @x_tick_count,\n (@y_range[1] - @y_range[0]).to_f / @y_tick_count,\n 0, 0, 1, 1).call\n Axes.new((@x_range[1] - @x_range[0]).to_f / @x_tick_count,\n (@y_range[1] - @y_range[0]).to_f / @y_tick_count,\n @origin[0], @origin[1], 1, 1, 0.01).call\n AxesTitles.new(@x_title, @y_title,'').call\n @tasks.each do |task|\n task.call() if task.plot_type == :robust\n task.call(self) if task.plot_type == :lazy\n end\n end",
"def replot(arg=nil)\n run \"replot #{arg}\", @last_data\n nil\n end",
"def show\n x = @plot.user.x\n y = @plot.user.y\n puts x\n puts y\n \n end",
"def getchart()\n # The XYZ points for the bubble chart\n dataX0 = [170, 300, 1000, 1700]\n dataY0 = [16, 69, 16, 75]\n dataZ0 = [52, 105, 88, 140]\n\n dataX1 = [500, 1000, 1300]\n dataY1 = [40, 58, 85]\n dataZ1 = [140, 202, 84]\n\n # Create a XYChart object of size 540 x 480 pixels\n c = ChartDirector::XYChart.new(540, 480)\n\n # Set the plotarea at (70, 65) and of size 400 x 350 pixels. Turn on both\n # horizontal and vertical grid lines with light grey color (0xc0c0c0)\n c.setPlotArea(70, 65, 400, 350, -1, -1, ChartDirector::Transparent, 0xc0c0c0, -1)\n\n # Add a legend box at (70, 30) (top of the chart) with horizontal layout. Use 12\n # pts Times Bold Italic font. Set the background and border color to Transparent.\n c.addLegend(70, 30, false, \"timesbi.ttf\", 12).setBackground(\n ChartDirector::Transparent)\n\n # Add a title to the chart using 18 pts Times Bold Itatic font.\n c.addTitle(\"Product Comparison Chart\", \"timesbi.ttf\", 18)\n\n # Add titles to the axes using 12 pts Arial Bold Italic font\n c.yAxis().setTitle(\"Capacity (tons)\", \"arialbi.ttf\", 12)\n c.xAxis().setTitle(\"Range (miles)\", \"arialbi.ttf\", 12)\n\n # Set the axes line width to 3 pixels\n c.xAxis().setWidth(3)\n c.yAxis().setWidth(3)\n\n # Add (dataX0, dataY0) as a scatter layer with red (ff3333) glass spheres, where\n # the sphere size is modulated by dataZ0. This creates a bubble effect.\n c.addScatterLayer(dataX0, dataY0, \"Technology AAA\",\n ChartDirector::GlassSphere2Shape, 15, 0xff3333).setSymbolScale(dataZ0)\n\n # Add (dataX1, dataY1) as a scatter layer with blue (0000ff) glass spheres, where\n # the sphere size is modulated by dataZ1. This creates a bubble effect.\n c.addScatterLayer(dataX1, dataY1, \"Technology BBB\",\n ChartDirector::GlassSphere2Shape, 15, 0x0000ff).setSymbolScale(dataZ1)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def create\n @plot = @user.plots.create(plot_params)\n redirect_to @plot\n # @plot = Plot.new(plot_params)\n\n # respond_to do |format|\n # if @plot.save\n # format.html { redirect_to @plot, notice: 'Plot was successfully created.' }\n # format.json { render :show, status: :created, location: @plot }\n # else\n # format.html { render :new }\n # format.json { render json: @plot.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @plot_point = PlotPoint.new(plot_point_params)\n\n respond_to do |format|\n if @plot_point.save\n format.html { redirect_to @plot_point, notice: 'Plot point was successfully created.' }\n format.json { render :show, status: :created, location: @plot_point }\n else\n format.html { render :new }\n format.json { render json: @plot_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scatter_plot\n print_csv_results\n FileUtils.mkdir_p(%w(gnuplot plots))\n erb(\"templates/scatter_plot.gp.erb\", \"gnuplot/scatter_plot.gp\", {:config => @config})\n system(\"#{@config[\"path_gnuplot\"] || \"gnuplot\"} gnuplot/scatter_plot.gp\")\n puts \"Draw a scatter_plot.#{@config[\"output_format\"] || \"png\"} in plots!\"\n FileUtils.rm_rf(%w(gnuplot data))\n end",
"def initialize( point_array )\n @datapoints ||= {}\n @count = count || 30\n \n point_array.each do |x_value, y_value|\n y_value = y_value.to_f\n @datapoints[x_value] = y_value\n end\n end",
"def makeChart(*options)\n\ndisplay = \"\n<div class='charts last'>\n\n<div class='left'>\n\n\n<div id='placeholder' style='width:400px;height:200px;'></div>\n<div id='overview' style='width:400px;height:50px'></div>\n<p id='overviewLegend' style='margin-left:10px'></p>\n\n<p> Try zooming. Click and drag to select a zone.</p>\n</div>\n\n<div class='right'>\n\nWeight Chart<br/>\n<div id='miniWeight' style='width:350px;height:100px;'></div>\nWater Chart<br/>\n<div id='miniWater' style='width:350px;height:100px;'></div>\n\n\nCalories Eaten<br/>\n<div id='miniCalorie' style='width:350px;height:100px;'></div>\nFitness (Calories burned not to include resting metabolism)<br/>\n<div id='miniFitness' style='width:350px;height:100px;'></div><br/>\n\nMeasurements (Total inches)<br/>\n<div id='miniMeasures' style='width:350px;height:100px;'></div>\n\n\n</div>\n\n\n\n\n<div class='last'></div>\n<script id='source' language='javascript' type='text/javascript'>\n\n\n$(function () {\nvar options = {\n xaxis: { mode: 'time' },\n selection: { mode: 'x' },\n legend: { \n show: true, \n container: $('#overviewLegend'),\n noColumns: 2,\n }\n};\n\nvar options_overview = {\n xaxis: { mode: 'time' },\n selection: { mode: 'x' },\n legend: { show: false}\n};\n\n\nvar plot = $.plot($('#placeholder'), \n[ #{@chartable.to_chart } ], options);\n\n\n\n\nvar overview = $.plot($('#overview'), \n[ #{@chartable.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\n\n\n\n\nvar overview_1 = $.plot($('#miniWeight'), \n[ #{@miniWeight.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_2 = $.plot($('#miniWater'), \n[ #{@miniWater.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_3 = $.plot($('#miniCalorie'), \n[ #{@miniCalorie.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_4 = $.plot($('#miniFitness'), \n[ #{@miniFitness.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_5 = $.plot($('#miniMeasures'), \n[ #{@miniMeasures.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\n// now connect the two\nvar internalSelection = false;\n\n$('#placeholder').bind('selected', function (event, area) {\n // do the zooming\n plot = $.plot($('#placeholder'), \n [#{@chartable.to_chart}],\n $.extend(true, {}, options, {\n xaxis: { min: area.x1, max: area.x2 }\n }));\n \n if (internalSelection)\n return; // prevent eternal loop\n internalSelection = true;\n overview.setSelection(area);\n internalSelection = false;\n});\n\n$('#overview').bind('selected', function (event, area) {\n if (internalSelection)\n return;\n internalSelection = true;\n plot.setSelection(area);\n internalSelection = false;\n});\n\n\n});\n</script>\n\"\n\nend",
"def getchart()\n # The data for the chart\n dataY0 = [4, 4.5, 5, 5.25, 5.75, 5.25, 5, 4.5, 4, 3, 2.5, 2.5]\n dataX0 = [Time.mktime(1997, 1, 1), Time.mktime(1998, 6, 25), Time.mktime(1999, 9,\n 6), Time.mktime(2000, 2, 6), Time.mktime(2000, 9, 21), Time.mktime(2001, 3, 4\n ), Time.mktime(2001, 6, 8), Time.mktime(2002, 2, 4), Time.mktime(2002, 5, 19),\n Time.mktime(2002, 8, 16), Time.mktime(2002, 12, 1), Time.mktime(2003, 1, 1)]\n\n dataY1 = [7, 6.5, 6, 5, 6.5, 7, 6, 5.5, 5, 4, 3.5, 3.5]\n dataX1 = [Time.mktime(1997, 1, 1), Time.mktime(1997, 7, 1), Time.mktime(1997, 12,\n 1), Time.mktime(1999, 1, 15), Time.mktime(1999, 6, 9), Time.mktime(2000, 3, 3\n ), Time.mktime(2000, 8, 13), Time.mktime(2001, 5, 5), Time.mktime(2001, 9, 16\n ), Time.mktime(2002, 3, 16), Time.mktime(2002, 6, 1), Time.mktime(2003, 1, 1)]\n\n # Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff)\n # background, black border, 1 pixel 3D border effect and rounded corners\n c = ChartDirector::XYChart.new(600, 300, 0xe0e0ff, 0x000000, 1)\n c.setRoundedFrame()\n\n # Set the plotarea at (55, 60) and of size 520 x 200 pixels, with white (ffffff)\n # background. Set horizontal and vertical grid lines to grey (cccccc).\n c.setPlotArea(50, 60, 525, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc)\n\n # Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9\n # pts Arial Bold font. Set the background and border color to Transparent.\n c.addLegend(55, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a title box to the chart using 15 pts Times Bold Italic font. The text is\n # white (ffffff) on a deep blue (000088) background, with soft lighting effect\n # from the right side.\n c.addTitle(\"Long Term Interest Rates\", \"timesbi.ttf\", 15, 0xffffff).setBackground(\n 0x000088, -1, ChartDirector::softLighting(ChartDirector::Right))\n\n # Set the y axis label format to display a percentage sign\n c.yAxis().setLabelFormat(\"{value}%\")\n\n # Add a red (ff0000) step line layer to the chart and set the line width to 2\n # pixels\n layer0 = c.addStepLineLayer(dataY0, 0xff0000, \"Country AAA\")\n layer0.setXData(dataX0)\n layer0.setLineWidth(2)\n\n # Add a blue (0000ff) step line layer to the chart and set the line width to 2\n # pixels\n layer1 = c.addStepLineLayer(dataY1, 0x0000ff, \"Country BBB\")\n layer1.setXData(dataX1)\n layer1.setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def plot_strategy(data,compare_data)\n your_color = ['#C7E6F2','#70D2E5', '#44BBDF']\n name = ['L1 Questions', 'L2 Questions', 'L3 Questions']\n comparison_color = ['#D9D9D9', '#B2B2B2', '#8C8C8C']\n @yours = PlotGraph::Graphs.percentage name, data, your_color, \"Strategy over the days\", \"No of questions attended\"\n @yours_compare = PlotGraph::Graphs.percentage name, data, your_color, 200, \"Strategy over the days\", \"No of questions attended\"\n @comparison = PlotGraph::Graphs.percentage name, compare_data, comparison_color, 200, \"Strategy over the days\", \"No of questions attended\"\n @comparison = [@yours_compare, @comparison]\n end",
"def to_flot\n [\n { label: \"Pageviews\", data: pageviews }\n ]\n end",
"def getchart()\n # Sample data for the Box-Whisker chart. Represents the minimum, 1st quartile,\n # medium, 3rd quartile and maximum values of some quantities\n q0Data = [40, 45, 35]\n q1Data = [55, 60, 50]\n q2Data = [62, 70, 60]\n q3Data = [70, 80, 65]\n q4Data = [80, 90, 75]\n\n # The labels for the chart\n labels = [\"<*img=robot1.png*><*br*>Bipedal Type\",\n \"<*img=robot2.png*><*br*>Wolf Type\", \"<*img=robot5.png*><*br*>Bird Type\"]\n\n # Create a XYChart object of size 540 x 320 pixels\n c = ChartDirector::XYChart.new(540, 320)\n\n # swap the x and y axes to create a horizontal box-whisker chart\n c.swapXY()\n\n # Set directory for loading images to current script directory\n c.setSearchPath(File.dirname(__FILE__))\n\n # Set the plotarea at (75, 25) and of size 440 x 270 pixels. Enable both\n # horizontal and vertical grids by setting their colors to grey (0xc0c0c0)\n c.setPlotArea(75, 25, 440, 270).setGridColor(0xc0c0c0, 0xc0c0c0)\n\n # Add a title to the chart\n c.addTitle(\" Robot Shooting Accuracy Scores\")\n\n # Set the labels on the x axis and the font to Arial Bold\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Disable x axis ticks by setting the length to 0\n c.xAxis().setTickLength(0)\n\n # Set the font for the y axis labels to Arial Bold\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a Box Whisker layer using light blue 0x9999ff as the fill color and blue\n # (0xcc) as the line color. Set the line width to 2 pixels\n c.addBoxWhiskerLayer2(q3Data, q1Data, q4Data, q0Data, q2Data).setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def old_plot xmax, xmin, ymax, ymin, xdiff, ydiff, iterations, old_points\n puts \"\\e[H\\e[2J\" # clear screen\n ymax.step(ymin, -ydiff) do |y|\n print_num y\n (xmin).step(xmax, xdiff) do |x|\n itr = mandelbrot(Complex(x,y), iterations)\n #color = itr ? itr/iterations.to_f : 1.0\n #print \"*\".grayscale(color)\n whiteness = itr ? itr/iterations.to_f : 1\n print \"*\".grayscale(whiteness)\n end\n puts\n end\n (-xmax).step(xmax, xdiff) do |x|\n print_num x\n end\nend",
"def create\n if user_signed_in?\n @user = User.find(current_user)\n end \n @cemetery = Cemetery.friendly.find(params[:cemetery_id])\n\n @plot = Plot.new(plot_params)\n @plot.cemetery_id = @cemetery.id\n\n respond_to do |format|\n if @plot.save\n format.html { redirect_to cemetery_plots_path, notice: 'Plot was successfully created.' }\n format.json { render :show, status: :created, location: @plot }\n else\n format.html { render :new }\n format.json { render json: @plot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def interpolate_points(measurements)\n points = []\n\n measurements.each_index do |i|\n point = { x: i * 60, y: measurements[i]['count'] } # use the 'count' metric\n # point = { x: i, y: measurements[i]['value'] } # use the 'value' metric\n points << point\n end \n\n points\nend",
"def plot(data=[], options={})\n plot_to_image(data, options).to_blob\n end",
"def plot_params\n params.require(:plot).permit(:farmer_id, :areaRai, :treeCount, :breed, :project, :certificate, :certificateDate, :harvestPeriod, :harvestQuantity, :price, :plotManagement, :fertilizeManagement, :waterManagement, :illnessManagement, :harvestManagement, :sellingChannel, :logistic, :addressNo, :addressMoo, :addressTambon, :addressAmphoe, :addressProvince, :addressZipcode, :lat, :long, :picture, :polygon)\n end",
"def yaxis\n end",
"def json_heartrate_big\n\n #get trackpoints that have a HR\n hr_trackpoints = trackpoints.select { |tp| (!tp.hr.nil? && tp.hr > 0) }.compact\n return nil if hr_trackpoints.first.nil?\n\n #Find first offset\n start_offset = hr_trackpoints.first.time - start_time\n\n #Find last offset\n end_offset = end_time - hr_trackpoints.last.time\n start_percent = start_offset / duration\n end_percent = end_offset / duration\n\n # we can't have more points than we have data. Scale down if needed\n number_points = 200 > hr_trackpoints.size ? hr_trackpoints.size : 200\n\n first_blanks = (number_points * start_percent).to_i\n end_blanks = (number_points * end_percent).to_i\n points = []\n\n # flot wants things in milliseconds. \n step = (duration * 1000 / number_points).to_i\n first_blanks.times { |i| points << [step * i, nil] }\n\n graphing_points = number_points - first_blanks - end_blanks\n factor = hr_trackpoints.size / graphing_points\n #factor = 1 if factor == 0\n graphing_points.times do |i| \n points << [step * (i+first_blanks), hr_trackpoints[i * factor].hr]\n end\n points\n end",
"def drawChart()\n # The moving average periods selected by the user.\n avgPeriod1 = 0\n avgPeriod1 = params[\"movAvg1\"].to_i\n avgPeriod2 = 0\n avgPeriod2 = params[\"movAvg2\"].to_i\n\n if avgPeriod1 < 0\n avgPeriod1 = 0\n elsif avgPeriod1 > 300\n avgPeriod1 = 300\n end\n\n if avgPeriod2 < 0\n avgPeriod2 = 0\n elsif avgPeriod2 > 300\n avgPeriod2 = 300\n end\n\n # We need extra leading data points in order to compute moving averages.\n extraPoints = 20\n if avgPeriod1 > extraPoints\n extraPoints = avgPeriod1\n end\n if avgPeriod2 > extraPoints\n extraPoints = avgPeriod2\n end\n\n # Get the data series to compare with, if any.\n compareKey = (params[\"CompareWith\"] || \"\").strip\n @compareData = nil\n if getData(compareKey, extraPoints)\n @compareData = @closeData\n end\n\n # The data series we want to get.\n tickerKey = (params[\"TickerSymbol\"] || \"\").strip\n if !getData(tickerKey, extraPoints)\n return errMsg(\"Please enter a valid ticker symbol\")\n end\n\n \n\n # Check if there is any valid data\n if extraPoints >= @timeStamps.length\n # No data - just display the no data message.\n return errMsg(\"No data available for the specified time period\")\n end\n\n # In some finance chart presentation style, even if the data for the latest day is\n # not fully available, the axis for the entire day will still be drawn, where no\n # data will appear near the end of the axis.\n # if @resolution < 86400\n # # Add extra points to the axis until it reaches the end of the day. The end of\n # # day is assumed to be 16:00 (it depends on the stock exchange).\n # lastTime = @timeStamps[@timeStamps.length - 1]\n # extraTrailingPoints = ((16 * 3600 - lastTime % 86400) / @resolution).to_i\n # 0.upto(extraTrailingPoints - 1) do |i|\n # @timeStamps.push(lastTime + @resolution * (i + 1))\n # end\n # end\n\n #\n # At this stage, all data are available. We can draw the chart as according to\n # user input.\n #\n\n #\n # Determine the chart size. In this demo, user can select 4 different chart sizes.\n # Default is the large chart size.\n #\n width = 780\n mainHeight = 255\n indicatorHeight = 80\n\n size = params[\"ChartSize\"]\n if size == \"S\"\n # Small chart size\n width = 450\n mainHeight = 160\n indicatorHeight = 60\n elsif size == \"M\"\n # Medium chart size\n width = 620\n mainHeight = 215\n indicatorHeight = 70\n elsif size == \"H\"\n # Huge chart size\n width = 1000\n mainHeight = 320\n indicatorHeight = 90\n end\n\n # Create the chart object using the selected size\n m = ChartDirector::FinanceChart.new(width)\n\n # Set the data into the chart object\n m.setData(@timeStamps, @highData, @lowData, @openData, @closeData, @volData,\n extraPoints)\n #debugger\n #\n # We configure the title of the chart. In this demo chart design, we put the\n # company name as the top line of the title with left alignment.\n #\n m.addPlotAreaTitle(ChartDirector::TopLeft, tickerKey)\n\n # We displays the current date as well as the data resolution on the next line.\n resolutionText = \"\"\n if @resolution == 30 * 86400\n resolutionText = \"Monthly\"\n elsif @resolution == 7 * 86400\n resolutionText = \"Weekly\"\n elsif @resolution == 86400\n resolutionText = \"Daily\"\n elsif @resolution == 900\n resolutionText = \"15-min\"\n end\n\n m.addPlotAreaTitle(ChartDirector::BottomLeft, sprintf(\n \"<*font=arial.ttf,size=8*>%s - %s chart\", m.formatValue(Time.new,\n \"mmm dd, yyyy\"), resolutionText))\n\n # A copyright message at the bottom left corner the title area\n m.addPlotAreaTitle(ChartDirector::BottomRight,\n \"<*font=arial.ttf,size=8*>(c) Advanced Software Engineering\")\n\n #\n # Add the first techical indicator according. In this demo, we draw the first\n # indicator on top of the main chart.\n #\n addIndicator(m, params[\"Indicator1\"], indicatorHeight)\n\n #\n # Add the main chart\n #\n m.addMainChart(mainHeight)\n\n #\n # Set log or linear scale according to user preference\n #\n if params[\"LogScale\"] == \"1\"\n m.setLogScale(true)\n end\n\n #\n # Set axis labels to show data values or percentage change to user preference\n #\n if params[\"PercentageScale\"] == \"1\"\n m.setPercentageAxis()\n end\n\n #\n # Draw any price line the user has selected\n #\n mainType = params[\"ChartType\"]\n if mainType == \"Close\"\n m.addCloseLine(0x000040)\n elsif mainType == \"TP\"\n m.addTypicalPrice(0x000040)\n elsif mainType == \"WC\"\n m.addWeightedClose(0x000040)\n elsif mainType == \"Median\"\n m.addMedianPrice(0x000040)\n end\n\n #\n # Add comparison line if there is data for comparison\n #\n if @compareData != nil\n if @compareData.length > extraPoints\n m.addComparison(@compareData, 0x0000ff, compareKey)\n end\n end\n\n #\n # Add moving average lines.\n #\n addMovingAvg(m, params[\"avgType1\"], avgPeriod1, 0x663300)\n addMovingAvg(m, params[\"avgType2\"], avgPeriod2, 0x9900ff)\n\n #\n # Draw candlesticks or OHLC symbols if the user has selected them.\n #\n if mainType == \"CandleStick\"\n m.addCandleStick(0x33ff33, 0xff3333)\n elsif mainType == \"OHLC\"\n m.addHLOC(0x008800, 0xcc0000)\n end\n\n #\n # Add parabolic SAR if necessary\n #\n if params[\"ParabolicSAR\"] == \"1\"\n m.addParabolicSAR(0.02, 0.02, 0.2, ChartDirector::DiamondShape, 5, 0x008800,\n 0x000000)\n end\n\n #\n # Add price band/channel/envelop to the chart according to user selection\n #\n bandType = params[\"Band\"]\n if bandType == \"BB\"\n m.addBollingerBand(20, 2, 0x9999ff, 0xc06666ff)\n elsif bandType == \"DC\"\n m.addDonchianChannel(20, 0x9999ff, 0xc06666ff)\n elsif bandType == \"Envelop\"\n m.addEnvelop(20, 0.1, 0x9999ff, 0xc06666ff)\n end\n\n #\n # Add volume bars to the main chart if necessary\n #\n if params[\"Volume\"] == \"1\"\n m.addVolBars(indicatorHeight, 0x99ff99, 0xff9999, 0xc0c0c0)\n end\n\n #\n # Add additional indicators as according to user selection.\n #\n addIndicator(m, params[\"Indicator2\"], indicatorHeight)\n addIndicator(m, params[\"Indicator3\"], indicatorHeight)\n addIndicator(m, params[\"Indicator4\"], indicatorHeight)\n\n return m\n end",
"def curve\n end",
"def curve\n end",
"def draw_line_graph(data,data_description,serie_name=\"\")\r\n # Validate the Data and DataDescription array */\n #TODO Add method fr validate_data_description\r\n data_description = self.validate_data_description(\"draw_line_graph\",data_description)\n self.validate_data(\"draw_line_graph\",data)\r\n graph_id= 0\r\n data_description[\"values\"].each do |col_name|\r\n id = 0\r\n data_description[\"description\"].each do |keyi,valui|\r\n color_id = id if ( keyi == col_name ) \n id=id+1 \n end\r\n if ( serie_name == \"\" || serie_name == col_name )\r\n xpos = @g_area_x1 + @g_area_offset\r\n xlast = -1\r\n data.each do |key|\r\n if ( !(key[col_name].nil?))\r\n value =key[col_name]\r\n ypos = @g_area_y2 - ((value-@vmin) * @division_ratio)\r\n #Save point into the image map if option activated */\r\n self.add_to_image_map(xpos-3,ypos-3,xpos+3,ypos+3,data_description[\"description\"][col_name],key[col_name],data_description[\"unit\"][\"y\"],\"line\") if ( @build_map )\r\n xlast = -1if (!((value).is_a?(Numeric)))\r\n \r\n self.draw_line(xlast,ylast,xpos,ypos,@palette[color_id][\"r\"],@palette[color_id][\"g\"],@palette[color_id][\"b\"],true) if ( xlast != -1 )\r\n\r\n xlast = xpos\r\n ylast = ypos\r\n xlast = -1 if (!((value).is_a?(Numeric))) \r\n end\r\n xpos = xpos + @division_width\r\n end\r\n graph_id=graph_id+1\r\n end\r\n end\r\n end",
"def plot hsh_or_ary, type, options = {}\n vis = begin\n if hsh_or_ary.is_a?(OpenStruct)\n plot_hash hsh_or_ary, type, options\n elsif hsh_or_ary.is_a?(Array)\n plot_array hsh_or_ary, type, options\n end\n end\n\n vis.render()\n require \"rsvg2\"\n svg = RSVG::Handle.new_from_data(vis.to_svg).tap { |s| s.close }\n SciRuby::Plotter.new svg\n end",
"def draw_scale(data,data_description,scale_mode,r,g,b,draw_ticks=true,angle=0,decimals=1,with_margin=false,skip_labels=1,right_scale=false)\n # Validate the Data and DataDescription array\n self.validate_data(\"draw_scale\",data)\n #c_text_color = allocate_color(@picture,r,g,b)\n c_text_color = GD2::Color.new(r,g,b)\n self.draw_line(@g_area_x1,@g_area_y1,@g_area_x1,@g_area_y2,r,g,b)\n self.draw_line(@g_area_x1,@g_area_y2,@g_area_x2,@g_area_y2,r,g,b)\n if(@vmin.nil? && @vmax.nil?)\n if (!data_description[\"values\"][0].nil?)\n @vmin =data[0][data_description[\"values\"][0]]\n @vmax =data[0][data_description[\"values\"][0]]\n else\n @vmin = 2147483647\n @vmax = -2147483647\n end\n\n# /* Compute Min and Max values */\n if(scale_mode == SCALE_NORMAL || scale_mode == SCALE_START0)\n @vmin = 0 if (scale_mode == SCALE_START0 )\n \n data.each do |key|\n data_description[\"values\"].each do |col_name|\n if(!key[col_name].nil?)\n value = key[col_name]\n if (value.is_a?(Numeric))\n @vmax = value if ( @vmax < value)\n @vmin = value if ( @vmin > value)\n end\n end\n end\n end\n elsif ( scale_mode == SCALE_ADDALL || scale_mode == SCALE_ADDALLSTART0 ) # Experimental\n @vmin = 0 if (scale_mode == SCALE_ADDALLSTART0)\n data.each do |key|\n sum = 0\n data_description[\"values\"].each do|col_name|\n if (!key[col_name].nil?)\n value =key[col_name]\n sum += value if ((value).is_a?(Numeric))\n end\n end\n @vmax = sum if (@vmax < sum)\n @vmin = sum if (@vmin > sum)\n end\n end\n\n if(@vmax.is_a?(String))\n @vmax = @vmax.gsub(/\\.[0-9]+/,'')+1 if (@vmax > @vmax.gsub(/\\.[0-9]+/,'') )\n end\n\n # If all values are the same */\n if ( @vmax == @vmin )\n if ( @vmax >= 0 )\n @vmax = @vmax+1\n else\n @vmin = @vmin-1\n end\n end\n\n data_range = @vmax - @vmin\n data_range = 0.1 if (data_range == 0 )\n\n #Compute automatic scaling */\n scale_ok = false\n factor = 1\n min_div_height = 25\n max_divs = (@g_area_y2 - @g_area_y1) / min_div_height\n\n if ( @vmin == 0 && @vmax == 0 )\n @vmin = 0\n @vmax = 2\n scale = 1\n divisions = 2\n elsif (max_divs > 1)\n while(!scale_ok)\n scale1 = ( @vmax - @vmin ) / factor\n scale2 = ( @vmax - @vmin ) /factor / 2\n scale4 = ( @vmax - @vmin ) / factor / 4\n\n if ( scale1 > 1 && scale1 <= max_divs && !scale_ok)\n scale_ok = true\n divisions = (scale1).floor\n scale = 1\n end\n if (scale2 > 1 && scale2 <= max_divs && !scale_ok)\n scale_ok = true\n divisions = (scale2).floor\n scale = 2\n end\n if (!scale_ok)\n factor = factor * 10 if ( scale2 > 1 )\n factor = factor / 10 if ( scale2 < 1 )\n end\n end # while end\n\n if ( (@vmax / scale / factor).floor != @vmax / scale / factor)\n\n grid_id = ( @vmax / scale / factor).floor + 1\n @vmax = grid_id * scale * factor\n divisions = divisions+1\n end\n\n if ((@vmin / scale / factor).floor != @vmin / scale / factor)\n\n grid_id = ( @vmin / scale / factor).floor\n @vmin = grid_id * scale * factor\n divisions = divisions+1\n end\n\n else #/* Can occurs for small graphs */\n scale = 1\n end\n divisions = 2 if ( divisions.nil? )\n\n divisions = divisions -1 if (scale == 1 && divisions%2 == 1)\n\n else\n divisions = @divisions\n end\n @division_count = divisions\n data_range = @vmax - @vmin\n data_range = 0.1 if (data_range == 0 )\n @division_height = ( @g_area_y2 - @g_area_y1 ) / divisions\n @division_ratio = ( @g_area_y2 - @g_area_y1 ) /data_range\n @g_area_x_offset = 0\n if ( data.count > 1 )\n if ( decimals == false)\n @division_width = ( @g_area_x2 - @g_area_x1 ) / (data).count-1\n else\n @division_width = ( @g_area_x2 - @g_area_x1 ) / (data).count\n @g_area_x_offset = @division_width / 2\n end\n else\n @division_width = @g_area_x2 - @g_area_x1\n @g_area_x_offset = @division_width / 2\n end\n @data_count = (data).count\n return(0) if (draw_ticks == false )\n ypos = @g_area_y2\n xmin = 0.0\n i =1\n while(i<=divisions+1)\n if (right_scale )\n self.draw_line(@g_area_x2,ypos,@g_area_x2+5,ypos,r,g,b)\n else\n self.draw_line(@g_area_x1,ypos,@g_area_x1-5,ypos,r,g,b)\n end\n value = @vmin + (i-1) * (( @vmax - @vmin ) / divisions)\n value = (value * (10**decimals)).round / (10**decimals)\n \n value = \"#{value}.#{data_description['unit']['y']}.to_f\" if ( data_description[\"format\"][\"y\"]== \"number\") \n value = self.to_time(value) if ( data_description[\"format\"][\"y\"] == \"time\" )\n value = self.to_date(value) if ( data_description[\"format\"][\"y\"] == \"date\" )\n value = self.to_metric(value) if ( data_description[\"format\"][\"Y\"] == \"metric\" )\n value = self.to_currency(value) if ( data_description[\"format\"][\"Y\"] == \"currency\" )\n position = image_ftb_box(@font_size,0,@font_name,value)\n \n text_width =position[:lower_right][0]-position[:lower_left][0]\n if ( right_scale )\n image_ttf_text(@picture,@font_size,0,@g_area_x2+10,ypos+(@font_size/2),c_text_color,@font_name,value)\n xmin = @g_area_x2+15+text_width if ( xmin < @g_area_x2+15+text_width || xmin.nil? )\n else\n image_ttf_text(@picture,@font_size,0,@g_area_x1-10-text_width,ypos+(@font_size/2),c_text_color,@font_name,value)\n xmin = @g_area_x1-10-text_width if ( xmin > @g_area_x1-10-text_width || xmin.nil? )\n end\n ypos = ypos - @division_height\n i = i+1\n end\n # Write the Y Axis caption if set */\n\n if ( !data_description[\"axis\"].nil?&&!data_description[\"axis\"][\"y\"].nil? )\n position = image_ftb_box(@font_size,90,@font_name,data_description[\"axis\"][\"y\"])\n text_height = (position[:lower_left][1]).abs+(position[:lower_right][1]).abs\n text_top = ((@g_area_y2 - @g_area_y1) / 2) + @g_area_y1 + (text_height/2)\n if ( right_scale )\n image_ttf_text(@picture,@font_size,90,xmin+@font_size,text_top,c_text_color,@font_name,data_description[\"axis\"][\"y\"])\n else\n image_ttf_text(@picture,@font_size,90,xmin-@font_size,text_top,c_text_color,@font_name,data_description[\"axis\"][\"y\"])\n end\n end \n # Horizontal Axis */\n xpos = @g_area_x1 + @g_area_x_offset\n id = 1\n ymax = nil\n data.each do |key|\n if ( id % skip_labels == 0 )\n self.draw_line((xpos).floor,@g_area_y2,(xpos).floor,@g_area_y2+5,r,g,b)\n value =key[data_description[\"position\"]]\n value = value.data_description[\"unit\"][\"x\"] if ( data_description[\"format\"][\"x\"] == \"number\" )\n value = self.to_time(value) if ( data_description[\"format\"][\"x\"] == \"time\" )\n value = self.to_date(value) if ( data_description[\"format\"][\"x\"] == \"date\" )\n value = self.to_metric(value) if ( data_description[\"format\"][\"x\"] == \"metric\" )\n value = self.to_currency(value) if ( data_description[\"format\"][\"x\"] == \"currency\" )\n position = image_ftb_box(@font_size,angle,@font_name,value.to_s)\n text_width = (position[:lower_right][0]).abs+(position[:lower_left][0]).abs\n text_height = (position[:lower_left][1]).abs+(position[:lower_right][1]).abs\n if ( angle == 0 )\n ypos = @g_area_y2+18\n image_ttf_text(@picture,@font_size,angle,(xpos).floor-(text_width/2).floor,ypos,c_text_color,@font_name,value.to_s)\n else\n ypos = @g_area_y2+10+$TextHeight\n if ( angle <= 90 )\n image_ttf_text(@picture,@font_size,angle,(xpos).floor-text_width+5,ypos,c_text_color,@font_name,value.to_s)\n else\n image_ttf_text(@picture,@font_size,angle,(xpos).floor+text_width+5,ypos,c_text_color,@font_name,value.to_s)\n end \n end\n ymax = ypos if (ymax.nil? ||(!ymax.nil? && ymax < ypos))\n end\n xpos = xpos + @division_width\n id = id+1\n end #loop ended\n #Write the X Axis caption if set */\n if ((!data_description[\"axis\"].nil? && !data_description[\"axis\"][\"x\"].nil?) )\n position = image_ftb_box(@font_size,90,@font_name,data_description[\"axis\"][\"x\"])\n text_width = (position[:lower_right][0]).abs+(position[:lower_right][0]).abs\n text_left = ((@g_area_x2 - @g_area_x1) / 2) + @g_area_x1 + (text_width/2)\n image_ttf_text(@picture,@font_size,0,text_left,ymax+@font_size+5,c_text_color,@font_name,data_description[\"axis\"][\"x\"].to_s)\n end\n end",
"def args\n plot_coordinates = []\n all_scenarios.each do |scenario|\n line = {\n x: all_years_sequenced,\n y: y_values_grouped_by_secnario_id_sequenced[scenario.id],\n name: scenario.name,\n hoverinfo: 'none',\n line: {color: scenario.colour.hex}\n }\n plot_coordinates << line\n end\n plot_coordinates\n end",
"def xy() @records.get_data(GRT_XY); end",
"def graphicsmagick?; end",
"def getchart()\n # The XYZ points for the bubble chart\n dataX0 = [150, 300, 1000, 1700]\n dataY0 = [12, 60, 25, 65]\n dataZ0 = [20, 50, 50, 85]\n\n dataX1 = [500, 1000, 1300]\n dataY1 = [35, 50, 75]\n dataZ1 = [30, 55, 95]\n\n # Create a XYChart object of size 450 x 420 pixels\n c = ChartDirector::XYChart.new(450, 420)\n\n # Set the plotarea at (55, 65) and of size 350 x 300 pixels, with a light grey\n # border (0xc0c0c0). Turn on both horizontal and vertical grid lines with light\n # grey color (0xc0c0c0)\n c.setPlotArea(55, 65, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1)\n\n # Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 12\n # pts Times Bold Italic font. Set the background and border color to Transparent.\n c.addLegend(50, 30, false, \"timesbi.ttf\", 12).setBackground(\n ChartDirector::Transparent)\n\n # Add a title to the chart using 18 pts Times Bold Itatic font.\n c.addTitle(\"Product Comparison Chart\", \"timesbi.ttf\", 18)\n\n # Add a title to the y axis using 12 pts Arial Bold Italic font\n c.yAxis().setTitle(\"Capacity (tons)\", \"arialbi.ttf\", 12)\n\n # Add a title to the x axis using 12 pts Arial Bold Italic font\n c.xAxis().setTitle(\"Range (miles)\", \"arialbi.ttf\", 12)\n\n # Set the axes line width to 3 pixels\n c.xAxis().setWidth(3)\n c.yAxis().setWidth(3)\n\n # Add (dataX0, dataY0) as a scatter layer with semi-transparent red (0x80ff3333)\n # circle symbols, where the circle size is modulated by dataZ0. This creates a\n # bubble effect.\n c.addScatterLayer(dataX0, dataY0, \"Technology AAA\", ChartDirector::CircleSymbol,\n 9, 0x80ff3333, 0x80ff3333).setSymbolScale(dataZ0)\n\n # Add (dataX1, dataY1) as a scatter layer with semi-transparent green (0x803333ff)\n # circle symbols, where the circle size is modulated by dataZ1. This creates a\n # bubble effect.\n c.addScatterLayer(dataX1, dataY1, \"Technology BBB\", ChartDirector::CircleSymbol,\n 9, 0x803333ff, 0x803333ff).setSymbolScale(dataZ1)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def plot_params\n params.require(:plot).permit(:plot,:first_name, :middle_name, :last_name, :rank, :birth_date, \n :death_date, :birth_location, :death_location, :cemetery_id, :created_by_id, :approved, \n :unit, :description, :spouse, :mother, :father, :find_a_grave, :scv_id, :fold_3_url, :rank, \n :enlistment_date,:service_end_date,:release_from_service,:ancestry_com_url,:disposition)\n end",
"def dmpXYPlot(k,x,y)\n if(@sustainedMode && @preValue[k])\n @workstrm[k] << x << \" \" << @preValue[k] << \"\\n\" ;\n end\n @workcount[k] += 1;\n @workstrm[k] << x << \" \" << y << \"\\n\" ;\n\n @preValue[k] = y ;\n end",
"def getchart()\n #\n # We use a random number generator to simulate the data from 9:30am to 4:30pm\n # with one data point every 4 minutes. The total number of points during that\n # period is 106. (7 hours x 15 points/hour + 1)\n #\n noOfPoints = 106\n\n # Assume we have not reached the end of the day yet, and only 85 points are\n # available. Create a random table object of 1 col x 85 rows, using 9 as seed.\n rantable = ChartDirector::RanTable.new(9, 1, 85)\n\n # Set the 1st column to start with 1800 and with random delta from -5 to 5.\n rantable.setCol(0, 1800, -5, 5)\n\n # Get the data as the 1st column of the random table\n data = rantable.getCol(0)\n\n # The x-axis labels for the chart\n labels = [\"-\", \"10am\", \"-\", \" \", \"-\", \"12am\", \"-\", \" \", \"-\", \"2pm\", \"-\", \" \", \"-\",\n \"4pm\", \"-\"]\n\n #\n # Now we obtain the data into arrays, we can start to draw the chart using\n # ChartDirector\n #\n\n # Create a XYChart object of size 180 x 180 pixels with a blue background\n # (0x9c9cce)\n c = ChartDirector::XYChart.new(180, 180, 0x9c9cce)\n\n # Add titles to the top and bottom of the chart using 7.5pt Arial font. The text\n # is white 0xffffff on a deep blue 0x31319C background.\n c.addTitle2(ChartDirector::Top, \"STAR TECH INDEX 2003-01-28\", \"arial.ttf\", 7.5,\n 0xffffff, 0x31319c)\n c.addTitle2(ChartDirector::Bottom, \"LATEST STI:1809.41 (+14.51)\", \"arial.ttf\",\n 7.5, 0xffffff, 0x31319c)\n\n # Set the plotarea at (31, 21) and of size 145 x 124 pixels, with a pale yellow\n # (0xffffc8) background.\n c.setPlotArea(31, 21, 145, 124, 0xffffc8)\n\n # Add custom text at (176, 21) (top right corner of plotarea) using 11pt Times\n # Bold Italic font/red (0xc09090) color\n c.addText(176, 21, \"Chart Demo\", \"timesbi.ttf\", 11, 0xc09090).setAlignment(\n ChartDirector::TopRight)\n\n # Use 7.5 pts Arial as the y axis label font\n c.yAxis().setLabelStyle(\"\", 7.5)\n\n # Set the labels on the x axis by spreading the labels evenly between the first\n # point (index = 0) and the last point (index = noOfPoints - 1)\n c.xAxis().setLinearScale(0, noOfPoints - 1, labels)\n\n # Use 7.5 pts Arial as the x axis label font\n c.xAxis().setLabelStyle(\"\", 7.5)\n\n # Add a deep blue (0x000080) line layer to the chart\n c.addLineLayer(data, 0x000080)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def getchart()\n # The XY data of the first data series\n dataX0 = [50, 55, 37, 24, 42, 49, 63, 72, 83, 59]\n dataY0 = [3.6, 2.8, 2.5, 2.3, 3.8, 3.0, 3.8, 5.0, 6.0, 3.3]\n\n # The XY data of the second data series\n dataX1 = [50, 55, 37, 24, 42, 49, 63, 72, 83, 59]\n dataY1 = [1.6, 1.8, 0.8, 0.5, 1.3, 1.5, 2.3, 2.4, 2.9, 1.5]\n\n # Create a XYChart object of size 450 x 420 pixels\n c = ChartDirector::XYChart.new(450, 420)\n\n # Set the plotarea at (55, 65) and of size 350 x 300 pixels, with white background\n # and a light grey border (0xc0c0c0). Turn on both horizontal and vertical grid\n # lines with light grey color (0xc0c0c0)\n c.setPlotArea(55, 65, 350, 300, 0xffffff, -1, 0xc0c0c0, 0xc0c0c0, -1)\n\n # Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 12\n # pts Times Bold Italic font. Set the background and border color to Transparent.\n c.addLegend(50, 30, false, \"timesbi.ttf\", 12).setBackground(\n ChartDirector::Transparent)\n\n # Add a title to the chart using 18 point Times Bold Itatic font.\n c.addTitle(\"Server Performance\", \"timesbi.ttf\", 18)\n\n # Add titles to the axes using 12 pts Arial Bold Italic font\n c.yAxis().setTitle(\"Response Time (sec)\", \"arialbi.ttf\", 12)\n c.xAxis().setTitle(\"Server Load (TPS)\", \"arialbi.ttf\", 12)\n\n # Set the axes line width to 3 pixels\n c.yAxis().setWidth(3)\n c.xAxis().setWidth(3)\n\n # Add a scatter layer using (dataX0, dataY0)\n c.addScatterLayer(dataX0, dataY0, \"Server AAA\", ChartDirector::DiamondSymbol, 11,\n 0x008000)\n\n # Add a trend line layer for (dataX0, dataY0)\n c.addTrendLayer2(dataX0, dataY0, 0x008000).setLineWidth(3)\n\n # Add a scatter layer for (dataX1, dataY1)\n c.addScatterLayer(dataX1, dataY1, \"Server BBB\", ChartDirector::TriangleSymbol, 9,\n 0x6666ff)\n\n # Add a trend line layer for (dataX1, dataY1)\n c.addTrendLayer2(dataX1, dataY1, 0x6666ff).setLineWidth(3)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def splot(*args)\n contents = parse_plot_args(SPlotItem,args)\n _plot_splot(\"splot\",contents)\n nil\n end",
"def getchart()\n # The data for the upper and lower bounding lines\n upperY = [60, 60, 100, 100, 60, 60]\n lowerY = [40, 40, 80, 80, 40, 40]\n zoneX = [0, 2.5, 3.5, 5.5, 6.5, 10]\n\n # The data for the spline curve\n curveY = [50, 44, 54, 48, 58, 50, 90, 85, 104, 82, 96, 90, 74, 52, 35, 58, 46, 54,\n 48, 52, 50]\n curveX = [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5,\n 9, 9.5, 10]\n\n # Create a XYChart object of size 600 x 300 pixels, with a light grey (cccccc)\n # background, black border, and 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(600, 300, 0xcccccc, 0x000000, 1)\n\n # Set directory for loading images to current script directory\n c.setSearchPath(File.dirname(__FILE__))\n\n # Set the plotarea at (55, 58) and of size 520 x 195 pixels, with white\n # background. Turn on both horizontal and vertical grid lines with light grey\n # color (cccccc)\n c.setPlotArea(55, 58, 520, 195, 0xffffff, -1, -1, 0xcccccc, 0xcccccc)\n\n # Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9\n # pts Arial Bold font. Set the background and border color to Transparent.\n c.addLegend(55, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a title box to the chart using 15 pts Times Bold Italic font. The title is\n # in CDML and includes embedded images for highlight. The text is white (ffffff)\n # on a black background, with a 1 pixel 3D border.\n c.addTitle(\n \"<*block,valign=absmiddle*><*img=star.png*><*img=star.png*> Performance \" \\\n \"Enhancer <*img=star.png*><*img=star.png*><*/*>\", \"timesbi.ttf\", 15, 0xffffff\n ).setBackground(0x000000, -1, 1)\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"Temperature\")\n\n # Add a title to the x axis using CMDL\n c.xAxis().setTitle(\n \"<*block,valign=absmiddle*><*img=clock.png*> Elapsed Time (hour)<*/*>\")\n\n # Set the axes width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Add a purple (800080) spline layer to the chart with a line width of 2 pixels\n splineLayer = c.addSplineLayer(curveY, 0x800080, \"Molecular Temperature\")\n splineLayer.setXData(curveX)\n splineLayer.setLineWidth(2)\n\n # Add a line layer to the chart with two dark green (338033) data sets, and a line\n # width of 2 pixels\n lineLayer = c.addLineLayer2()\n lineLayer.addDataSet(upperY, 0x338033, \"Target Zone\")\n lineLayer.addDataSet(lowerY, 0x338033)\n lineLayer.setXData(zoneX)\n lineLayer.setLineWidth(2)\n\n # Color the zone between the upper zone line and lower zone line as\n # semi-transparent light green (8099ff99)\n c.addInterLineLayer(lineLayer.getLine(0), lineLayer.getLine(1), 0x8099ff99,\n 0x8099ff99)\n\n # If the spline line gets above the upper zone line, color to area between the\n # lines red (ff0000)\n c.addInterLineLayer(splineLayer.getLine(0), lineLayer.getLine(0), 0xff0000,\n ChartDirector::Transparent)\n\n # If the spline line gets below the lower zone line, color to area between the\n # lines blue (0000ff)\n c.addInterLineLayer(splineLayer.getLine(0), lineLayer.getLine(1),\n ChartDirector::Transparent, 0x0000ff)\n\n # Add a custom CDML text at the bottom right of the plot area as the logo\n c.addText(575, 250,\n \"<*block,valign=absmiddle*><*img=small_molecule.png*> <*block*>\" \\\n \"<*font=timesbi.ttf,size=10,color=804040*>Molecular\\nEngineering<*/*>\"\n ).setAlignment(ChartDirector::BottomRight)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def plot(*args)\n\t\t\n\t\tdata = []\n\t\tall_plots = ''\n\t\twhile args.length > 0\n\t\t\t#\n\t\t\t# NEXT PLOT\n\t\t\t#\n\t\t\t# First two values are the (x,y) points.\n\t\t\tdata << args.shift\n\t\t\tdata << args.shift\n\t\t\t\n\t\t\t# - Get the settings for this plot.\n\t\t\t# - If 'args' is not empty, there is another plot.\n\t\t\tthis_plot, args = styles(args)\n\t\t\tall_plots << this_plot\n\t\t\tall_plots << ', ' if args.length > 0\n\t\tend\n\t\t\n\t\t# TODO:\n\t\t# - Check for both Array and NMatrix.\n\t\t# - But make sure the program works without NMatrix loaded.\n\t\t#\n\t\t\n\t\t#\n\t\t# Each plot needs a separate stream of data separated by 'e' (\"end\").\n\t\t#\n\t\tnstreams = data.length / 2\n\t\t\n\t\tstream = (1..nstreams).map { |s|\n\t\t\tx = data.shift\n\t\t\ty = data.shift\n\t\t\tn = x.is_a?(Array) ? x.length - 1 : x.shape[0] - 1\n\t\t\t\n\t\t\t(0..n).map { |i| \"#{x[i]}\t#{y[i]}\\n\" }.join + \"e\\n\"\n\t\t}.join\n\t\t\n\t\[email protected] \"plot #{all_plots} \\n#{stream}\"\n\tend",
"def create_graphics\n super\n draw_wanted_data\n end",
"def getchart()\n # Sample data for the Box-Whisker chart. Represents the minimum, 1st quartile,\n # medium, 3rd quartile and maximum values of some quantities\n q0Data = [40, 45, 40, 30, 20, 50, 25, 44]\n q1Data = [55, 60, 50, 40, 38, 60, 51, 60]\n q2Data = [62, 70, 60, 50, 48, 70, 62, 70]\n q3Data = [70, 80, 65, 60, 53, 78, 69, 76]\n q4Data = [80, 90, 75, 70, 60, 85, 80, 84]\n\n # The labels for the chart\n labels = [\"Group A\", \"Group B\", \"Group C\", \"Group D\", \"Group E\", \"Group F\",\n \"Group G\", \"Group H\"]\n\n # Create a XYChart object of size 550 x 250 pixels\n c = ChartDirector::XYChart.new(550, 250)\n\n # Set the plotarea at (50, 25) and of size 450 x 200 pixels. Enable both\n # horizontal and vertical grids by setting their colors to grey (0xc0c0c0)\n c.setPlotArea(50, 25, 450, 200).setGridColor(0xc0c0c0, 0xc0c0c0)\n\n # Add a title to the chart\n c.addTitle(\"Computer Vision Test Scores\")\n\n # Set the labels on the x axis and the font to Arial Bold\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Set the font for the y axis labels to Arial Bold\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a Box Whisker layer using light blue 0x9999ff as the fill color and blue\n # (0xcc) as the line color. Set the line width to 2 pixels\n c.addBoxWhiskerLayer(q3Data, q1Data, q4Data, q0Data, q2Data, 0x9999ff, 0x0000cc\n ).setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def update\n respond_to do |format|\n if @plot.update(plot_params)\n format.html { redirect_to @plot, notice: \"Plot was successfully updated.\" }\n format.json { render :show, status: :ok, location: @plot }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @plot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getchart()\n # The data for the chart\n data0 = [42, 49, ChartDirector::NoValue, 38, 64, 56, 29, 41, 44, 57]\n data1 = [65, 75, 47, 34, 42, 49, 73, ChartDirector::NoValue, 90, 69, 66, 78]\n data2 = [ChartDirector::NoValue, ChartDirector::NoValue, 25, 28, 38, 20, 22,\n ChartDirector::NoValue, 25, 33, 30, 24]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 600 x 360 pixels. Set background color to\n # brushed silver, with a 2 pixel 3D border. Use rounded corners.\n c = ChartDirector::XYChart.new(600, 360, ChartDirector::brushedSilverColor(),\n ChartDirector::Transparent, 2)\n c.setRoundedFrame()\n\n # Add a title using 18 pts Times New Roman Bold Italic font. #Set top/bottom\n # margins to 6 pixels.\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n title.setMargin2(0, 0, 6, 6)\n\n # Add a separator line just under the title\n c.addLine(10, title.getHeight(), c.getWidth() - 11, title.getHeight(),\n ChartDirector::LineColor)\n\n # Add a legend box where the top-center is anchored to the horizontal center of\n # the chart, just under the title. Use horizontal layout and 10 points Arial Bold\n # font, and transparent background and border.\n legendBox = c.addLegend(c.getWidth() / 2, title.getHeight(), false, \"arialbd.ttf\",\n 10)\n legendBox.setAlignment(ChartDirector::TopCenter)\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Tentatively set the plotarea at (70, 75) and of 460 x 240 pixels in size. Use\n # transparent border and black (000000) grid lines\n c.setPlotArea(70, 75, 460, 240, -1, -1, ChartDirector::Transparent, 0x000000, -1)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Show the same scale on the left and right y-axes\n c.syncYAxis()\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Set all axes to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n c.yAxis2().setColors(ChartDirector::Transparent)\n\n # Set the x-axis margins to 15 pixels, so that the horizontal grid lines can\n # extend beyond the leftmost and rightmost vertical grid lines\n c.xAxis().setMargin(15, 15)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis2().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Add axis title using 10pts Arial Bold Italic font\n c.yAxis().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n c.yAxis2().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n\n # Add the first line. The missing data will be represented as gaps in the line\n # (the default behaviour)\n layer0 = c.addLineLayer2()\n layer0.addDataSet(data0, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer0.setLineWidth(3)\n\n # Add the second line. The missing data will be represented by using dash lines to\n # bridge the gap\n layer1 = c.addLineLayer2()\n layer1.addDataSet(data1, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer1.setLineWidth(3)\n layer1.setGapColor(c.dashLineColor(0x00ff00))\n\n # Add the third line. The missing data will be ignored - just join the gap with\n # the original line style.\n layer2 = c.addLineLayer2()\n layer2.addDataSet(data2, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer2.setLineWidth(3)\n layer2.setGapColor(ChartDirector::SameAsMainColor)\n\n # layout the legend so we can get the height of the legend box\n c.layoutLegend()\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) is 15\n # pixels from the left edge, just under the legend box, 16 pixels from the right\n # edge, and 25 pixels from the bottom edge.\n c.packPlotArea(15, legendBox.getTopY() + legendBox.getHeight(), c.getWidth() - 16,\n c.getHeight() - 25)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::JPG), :type => \"image/jpeg\",\n :disposition => \"inline\")\n end",
"def build_performance_chart_area(maxcols)\n super\n change_structure_to_timeseries\n end",
"def getchart()\n # The data for the chart\n data0 = [90, 60, 85, 75, 55]\n data1 = [60, 80, 70, 80, 85]\n\n # The labels for the chart\n labels = [\"Speed\", \"Reliability\", \"Comfort\", \"Safety\", \"Efficiency\"]\n\n # Create a PolarChart object of size 480 x 380 pixels. Set background color to\n # gold, with 1 pixel 3D border effect\n c = ChartDirector::PolarChart.new(480, 380, ChartDirector::goldColor(), 0x000000,\n 1)\n\n # Add a title to the chart using 15 pts Times Bold Italic font. The title text is\n # white (ffffff) on a deep blue (000080) background\n c.addTitle(\"Space Travel Vehicles Compared\", \"timesbi.ttf\", 15, 0xffffff\n ).setBackground(0x000080)\n\n # Set plot area center at (240, 210), with 150 pixels radius, and a white (ffffff)\n # background.\n c.setPlotArea(240, 210, 150, 0xffffff)\n\n # Add a legend box at top right corner (470, 35) using 10 pts Arial Bold font. Set\n # the background to silver, with 1 pixel 3D border effect.\n b = c.addLegend(470, 35, true, \"arialbd.ttf\", 10)\n b.setAlignment(ChartDirector::TopRight)\n b.setBackground(ChartDirector::silverColor(), ChartDirector::Transparent, 1)\n\n # Add an area layer to the chart using semi-transparent blue (0x806666cc). Add a\n # blue (0x6666cc) line layer using the same data with 3 pixel line width to\n # highlight the border of the area.\n c.addAreaLayer(data0, 0x806666cc, \"Model Saturn\")\n c.addLineLayer(data0, 0x6666cc).setLineWidth(3)\n\n # Add an area layer to the chart using semi-transparent red (0x80cc6666). Add a\n # red (0xcc6666) line layer using the same data with 3 pixel line width to\n # highlight the border of the area.\n c.addAreaLayer(data1, 0x80cc6666, \"Model Jupiter\")\n c.addLineLayer(data1, 0xcc6666).setLineWidth(3)\n\n # Set the labels to the angular axis as spokes.\n c.angularAxis().setLabels(labels)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def test01() ;\n range = \"[0:10][-1:1]\" ;\n Gnuplot::directMultiPlot(3,range) {|gplot|\n gplot.dmpSetTitle(0,\"foo\") ;\n gplot.dmpSetTitle(1,\"bar\") ;\n gplot.dmpSetTitle(2,\"baz\") ;\n (0...100).each{|k|\n x = 0.1 * k ;\n gplot.dmpXYPlot(0,x,x*x) ;\n gplot.dmpXYPlot(1,x,Math::sin(x)) ;\n gplot.dmpXYPlot(2,x,Math::cos(x)) ;\n gplot.dmpFlush(range) ;\n sleep 0.1 ;\n }\n }\n end",
"def write(path = @path)\n \n gline = Gruff::Line.new(@size)\n @methods.each do |m, args|\n gline.send(\"#{m}=\", args)\n end\n @dataxy.each do |dxy| \n gline.dataxy(dxy[0], dxy[1], dxy[2]) \n end\n\n @filename ||= filename(@methods[:title])\n @filename ||= \"rbPlot\"\n gline.write(path + @filename + '.png')\n end",
"def points\n params = {}\n params[:col] = @color_by if @color_by\n params[:size] = @size_by if @size_by\n R.geom_point(E.aes(params))\n end",
"def view_data_file\n permitted = params.permit(:file_id, :data_set_id)\n blob = get_blob(@data_set, permitted[:file_id])\n @data_to_plot = ScatterData.new(:cols => [0,1])\n\n begin\n\n blob.open do |tempfile|\n\n @data_to_plot.file = tempfile\n @data_to_plot.filename = blob.filename\n\n if blob.filename.extension == \"sec\"\n @data_to_plot.is_subtracted = false\n @data_to_plot.read_sec_file\n @ymin = @data_to_plot.y_min # signif(@data_to_plot.y_min,3)\n @ymax = signif(@data_to_plot.y_max + (@data_to_plot.y_max*0.01).abs,3)\n else\n @data_to_plot.is_subtracted = @data_set.reciprocal_space_files.find_by(:id => permitted[:file_id]).sas_type\n @data_to_plot.read_contents\n @ymin_log = signif(@data_to_plot.y_min_log,3)\n @ymax_log = signif(@data_to_plot.y_max_log + (@data_to_plot.y_max_log*0.05).abs,3)\n\n puts \"min max log #{@ymin_log} #{@ymax_log} #{@data_to_plot.xy_max}\"\n\n @ymin = signif(@data_to_plot.y_min,3)\n @ymax = signif(@data_to_plot.y_max + (@data_to_plot.y_max*0.05).abs,3)\n\n if @data_to_plot.is_subtracted && @data_to_plot.xy_min > 0\n @data_to_plot.xy_min = 0\n end\n end\n end\n\n rescue StandardError => e\n puts \"RESCUING #{e}\"\n @data_set.errors.add(:base, e)\n end\n\n # ActiveStorage::Blob.service.send(:path_for, @data_set.files.find_by(:id => params[:file_id]))\n respond_to do |format|\n if @data_set.errors.any?\n format.html { redirect_to :add_datafile, :id => permitted[:data_set_id]}\n else\n # format.html { render :view_data_file }\n format.js\n end\n end\n\n end",
"def plot_timedistribution( your_data, compare_data )\n your_color = ['#C7E6F2','#70D2E5', '#44BBDF']\n name = ['Time L1 Questions', 'Time L2 Questions', 'Time L3 Questions']\n comparison_color = ['#D9D9D9', '#B2B2B2', '#8C8C8C']\n @yours = PlotGraph::Graphs.percentage name, your_data, your_color, \"Time distribution over the days\", \"No of questions attended\"\n @yours_compare = PlotGraph::Graphs.percentage name, your_data, your_color, 200, \"Time distribution over the days\", \"No of questions attended\"\n @comparison = PlotGraph::Graphs.percentage name, compare_data, comparison_color, 200, \"Time distribution over the days\", \"No of questions attended\"\n @comparison = [@yours_compare, @comparison]\n end",
"def hash\n [type, name, data_source_for_series_name, is_color_varied, inverted_solid_fill_color, smooth, plot_on_second_axis, order, invert_if_negative, explosion, marker, fill_format, effect_format, line_format, data_point_type, data_points, number_format_of_values, data_source_for_values, show_connector_lines, quartile_method, show_inner_points, show_mean_line, show_mean_markers, show_outlier_points].hash\n end",
"def explode_curve\n end",
"def explode_curve\n end",
"def draw_overlay_bar_graph(data,data_description,alpha=50)\r\n #Validate the Data and DataDescription array */\r\n data_description=self.validate_data_description(\"draw_overlay_bar_graph\",data_description)\r\n self.validate_data(\"draw_overlay_bar_graph\",data)\r\n layer_width =@g_area_x2-@g_area_x1\r\n layer_height =@g_area_y2-@g_area_y1\r\n graph_id = 0\n @layers = []\r\n data_description[\"values\"].each do |col_name|\r\n id = 0\r\n data_description[\"description\"].each do |keyi,valuei|\r\n color_id = id if (keyi == col_name ) \n id = id+1\n end\n \n \n \r\n @layers[graph_id] = image_create_true_color(layer_width,layer_height)\n c_white = GD2::Color.new(255,255,255)\r\n # c_graph = $this->AllocateColor(@layers[graph_id],@pallette[graph_id][\"r\"],@pallette[graph_id][\"g\"],@pallette[graph_id][\"b\"])\n #c_graph=self.allocate_color(@pallette[graph_id][\"r\"],@pallette[graph_id][\"g\"],@pallette[graph_id][\"b\"])\r\n image_filled_rectangle(@layers[graph_id],0,0,layer_width,layer_height,255,255,255)\r\n \n image_color_transparent(@layers[graph_id],255,255,255)\r\n\r\n xwidth = @division_width.to_f / 4\r\n xpos = @g_area_x_offset.to_f\r\n yzero = layer_height - (([email protected]_f) * @division_ratio.to_f)\r\n xlast = -1 \n points_count = 2\r\n data.each do |key|\r\n value = key[col_name] if ( !(key[col_name].nil?) )\r\n if ( (value).is_a?(Numeric) )\n \r\n ypos = layer_height - (([email protected]_f) * @division_ratio.to_f)\n \r\n image_filled_rectangle(@layers[graph_id],xpos-xwidth,ypos,xpos+xwidth,yzero,@palette[graph_id][\"r\"],@palette[graph_id][\"g\"],@palette[graph_id][\"b\"])\r\n\r\n x1 =(xpos - xwidth +@g_area_x1).floor\n y1 = (ypos+@g_area_y1).floor + 0.2\r\n x2 = (xpos + xwidth +@g_area_x1).floor\n y2 =@g_area_y2 - (([email protected]_f) * @division_ratio.to_f)\r\n x1 =@g_area_x1 + 1 if ( x1 <=@g_area_x1 ) \r\n x2 =@g_area_x2 - 1 if ( x2 >=@g_area_x2 )\r\n\r\n #/* Save point into the image map if option activated */\r\n if ( @build_map )\r\n self.add_to_image_map(x,[y1,y2].min,x2,[y1,y2].min,@data_description[\"description\"][col_name],key[col_name].data_description[\"unit\"][\"y\"],\"obar\")\r\n\r\n self.draw_line(x,y1,x2,y1,@palette[color_id][\"r\"],@palette[color_id][\"g\"],@palette[color_id][\"b\"],true)\r\n end\r\n end\r\n xpos = xpos +@division_width.to_f\r\n end #Do end\r\n \r\n graph_id = graph_id+1\n end #for loop\r\n i1=0\n while i1<=(graph_id-1)\r\n \n if !@layers[i1].nil?\n image_copy_merge(@picture,@layers[i1],@g_area_x1,@g_area_y1,0,0,layer_width,layer_height,alpha)\r\n # imagedestroy(@layers[$i])\n end \n i1= i1+1\r\n end\r\n end"
] |
[
"0.72804433",
"0.66865206",
"0.63143885",
"0.62144697",
"0.6196042",
"0.5990444",
"0.5977674",
"0.5977674",
"0.5977674",
"0.5977674",
"0.592123",
"0.59142095",
"0.5884148",
"0.58301854",
"0.5827838",
"0.5760075",
"0.57449",
"0.5727259",
"0.5723504",
"0.5707553",
"0.5701308",
"0.5701098",
"0.5701098",
"0.5690357",
"0.56820506",
"0.5674914",
"0.5658689",
"0.5644881",
"0.5632018",
"0.56277674",
"0.56269467",
"0.5621439",
"0.56065613",
"0.5573234",
"0.5572938",
"0.5564241",
"0.55425525",
"0.55363977",
"0.5534388",
"0.5534388",
"0.5534388",
"0.5534388",
"0.5516973",
"0.5501161",
"0.54747254",
"0.54643947",
"0.54478216",
"0.54293483",
"0.542883",
"0.54205316",
"0.54149455",
"0.53934073",
"0.53876656",
"0.5386394",
"0.5385764",
"0.53711736",
"0.53669065",
"0.53608227",
"0.5358377",
"0.53560036",
"0.5349592",
"0.5341686",
"0.5335269",
"0.5325213",
"0.5319165",
"0.53183645",
"0.53050816",
"0.53032595",
"0.5295542",
"0.5294479",
"0.5291997",
"0.5291997",
"0.5290211",
"0.52799916",
"0.527582",
"0.52753854",
"0.5269917",
"0.5259386",
"0.5237128",
"0.52353776",
"0.52335507",
"0.5233093",
"0.522172",
"0.5214242",
"0.5187846",
"0.5182579",
"0.51812744",
"0.51803046",
"0.5177154",
"0.51683444",
"0.5167485",
"0.51659286",
"0.51625067",
"0.5161957",
"0.51601803",
"0.51559514",
"0.51537985",
"0.5152432",
"0.5149772",
"0.5149772",
"0.5148382"
] |
0.0
|
-1
|
GET /order_detalis GET /order_detalis.json
|
def index
@order_detalis = OrderDetali.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def show\n @order_datail = OrderDatail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_datail }\n end\n end",
"def show\n\t\trespond_with @order\n\tend",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def show_order\n response = ApiOrdenCompra.getOrdenCompra(params[:id])\n render json: response\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order\n end",
"def index\n @order = Spree::Order.find(params[:order_id]) \n @diaries = @order.diaries\n \n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def set_order_detali\n @order_detali = OrderDetali.find(params[:id])\n end",
"def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end",
"def show\n order = Order.find(params[:id])\n render json: order\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_order }\n end\n end",
"def show\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.includes(:order_positions, :pizzeria => :pizzas).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @order_dishes = @order.order_dishes.includes(:dish).order(\"order_dishes.time\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.includes([:customer,:order_details => :product]).find(params[:id])\n \n if [email protected]?\n @order_detail = @order.order_details.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @order_item_extras = OrderItemExtra.all\n\n render json: @order_item_extras\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@order }\n end\n end",
"def fetch\n @order = Order.where(owner_id: current_user.branch.nodes.pluck(:id)).order('orders.quantity').last\n\n render json: {id: @order.id, quantity: @order.quantity,\n date: @order.created_at.strftime('%d/%m/%Y'),\n time: @order.created_at.strftime('%p %I:%M'),\n destination: \"#{t('fridge')} - #{@order.owner_id}\"\n }, status: :ok\n end",
"def show\n render json: @order_item_extra\n end",
"def show\n @order_detail = OrderDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @order_detail }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def listOrders()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n ret = []\n Order.find_each do |order|\n ret << {id: order.id, product_id: order.product_id, product_name: Product.find(order.product_id).name, user_id: order.user_id, quantity: order.quantity, price_per_unit: order.price_per_unit, int_status: order.order_status}\n end\n render json: {data: ret.to_json, reason: '', status: true}\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def repair_order_show\n @repair_order = current_repair_order\n render json: { repair_order: @repair_order.as_json(include: [\n :repair_items,\n :employee_users_repair_orders ] )},\n status: :ok\n end",
"def show\n @order = @transaction.order\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n\t\t@admin_order = Admin::Order.find(params[:id])\n\t\t@admin_client = @admin_order.client\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @admin_order }\n\t\tend\n\tend",
"def show\n @order = Order.includes(:order_items).find(params[:id])\n\n \n unless user_signed_in?\n sign_in @order.user\n end\n\n if @order.vendor.nil?\n @owner = @order.restaurant\n else\n @owner = @order.vendor \n end\n @menu = @owner.menu\n\n\n @items = Hash[@menu.items.map{|it| [it.id, it]}]\n @order_items = @order.order_items\n\n # @charge = Stripe::Charge.retrieve(params[:charge])\n\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @order }\n # end\n end",
"def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def get_orders\n orders\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def new\n @order_datail = OrderDatail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_datail }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @customer = @order.customer\n @address = @order.address\n @items = @order.items\n @ledgers = @order.ledgers\n @notes = @order.notes\n\n # Remaining balance\n @remaining_balance = @order.remaining_balance\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @orderdetails = Orderdetail.all\n end",
"def index\n @orderdetails = Orderdetail.all\n end",
"def customer_order\n order = current_user.restaurant.orders.find(params[:id])\n render json: order.as_json(include: [:customer, {order_details: {include: :meal}}]), status: :ok\n end",
"def show\n @order = Order.find(params[:id])\n @order_positions = @order.order_positions\n @address = Address.find(@order.address_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n render json: { status: 'SUCCESS', message: 'Loaded the post', data: @order }\n end",
"def show\n @order_item = OrderItem.find(params[:id])\n @order = @order_item.order\n @net_total = 0.00\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n render json: @order_line_item\n end",
"def show\n @order = Order.find(params[:id])\n\t @items = CartItem.where(:order_id=>@order.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @title = \"Order #{@order.id}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def destroy\n @order_detali.destroy\n respond_to do |format|\n format.html { redirect_to order_detalis_url, notice: 'Order detali was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def create\n @order_detali = OrderDetali.new(order_detali_params)\n\n respond_to do |format|\n if @order_detali.save\n format.html { redirect_to @order_detali, notice: 'Order detali was successfully created.' }\n format.json { render :show, status: :created, location: @order_detali }\n else\n format.html { render :new }\n format.json { render json: @order_detali.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def query_order(options)\n request :account, :get, 'order', options\n end",
"def show\n @manufacture_order = ManufactureOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @manufacture_order }\n end\n end",
"def show\n render json: @departamento\n end",
"def show\n render json: @power_order\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: custom_json_for_show(@order) }\n end\n end",
"def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend",
"def show\n @order = resource\n respond_with(@order)\n end",
"def show\n @delivery_order = DeliveryOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery_order }\n end\n end",
"def current_order\n order = current_user.customer.orders.last\n render json: order.as_json(include: [:restaurant, {order_details: {include: :meal}}]), status: :ok\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def new\n @item = OrderPosition.new\n @item.order = Order.includes(:pizzeria => :pizzas).find(params[:order_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def receive_order\n response = ApiOrdenCompra.recepcionarOrdenCompra(params[:_id])\n render json: response\n end",
"def show\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def show\n @order = Order.find(params[:id])\n @line_bundles = @order.line_bundles\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @order_infos = OrderInfo.all\n end",
"def index\n @productos_detalles = ProductoDetalle.all\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def new\n @admin_order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_order }\n end\n end",
"def show\n @mws_order = MwsOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mws_order }\n end\n end",
"def show\n @incomming_order = IncommingOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incomming_order }\n end\n end",
"def reports\n @orders_r = @branch.orders.where(:date=> Date.today).order(\"created_at desc\")\n @order_close = @branch.orders.find_by_mode_and_date(\"4\",Date.today)\n\n respond_to do |format|\n format.html\n format.json {render json: @order}\n end\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"def index\n @order_info = OrderInfo.all\n end"
] |
[
"0.67153955",
"0.67150676",
"0.67150676",
"0.66246796",
"0.655945",
"0.65387374",
"0.65387374",
"0.65375286",
"0.65274066",
"0.6521837",
"0.64866495",
"0.6439851",
"0.64285237",
"0.6416113",
"0.63549775",
"0.6340292",
"0.6329492",
"0.6325521",
"0.63116854",
"0.629744",
"0.6260558",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.61915743",
"0.6180955",
"0.6170479",
"0.6164602",
"0.6160329",
"0.6154522",
"0.6149605",
"0.614574",
"0.6137784",
"0.61342746",
"0.6112223",
"0.6107953",
"0.610052",
"0.6094901",
"0.6093587",
"0.6093301",
"0.6069507",
"0.60344565",
"0.6033504",
"0.60290134",
"0.6024129",
"0.6024129",
"0.60233355",
"0.6021439",
"0.60069245",
"0.60065526",
"0.60005164",
"0.5995007",
"0.5991942",
"0.59884346",
"0.5983319",
"0.5969749",
"0.5958813",
"0.59585917",
"0.595588",
"0.5944469",
"0.5943758",
"0.5943382",
"0.59411734",
"0.5930846",
"0.5929491",
"0.5926849",
"0.59174335",
"0.5913578",
"0.5913547",
"0.59123987",
"0.59112734",
"0.5907948",
"0.5901507",
"0.5899018",
"0.5889489",
"0.5881179",
"0.5880275",
"0.587082",
"0.5869614",
"0.58662426",
"0.58662426",
"0.5864071",
"0.5860907",
"0.58542204",
"0.5841422",
"0.58309156",
"0.5826473",
"0.5825059"
] |
0.73373497
|
0
|
GET /order_detalis/1 GET /order_detalis/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @order_detalis = OrderDetali.all\n end",
"def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end",
"def show\n @order_datail = OrderDatail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_datail }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end",
"def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end",
"def show_order\n response = ApiOrdenCompra.getOrdenCompra(params[:id])\n render json: response\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def show\n order = Order.find(params[:id])\n render json: order\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @order = Spree::Order.find(params[:order_id]) \n @diaries = @order.diaries\n \n end",
"def show\n\t\trespond_with @order\n\tend",
"def set_order_detali\n @order_detali = OrderDetali.find(params[:id])\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_order }\n end\n end",
"def show\n @order = Order.includes([:customer,:order_details => :product]).find(params[:id])\n \n if [email protected]?\n @order_detail = @order.order_details.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order_detail = OrderDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @order_detail }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end",
"def fetch\n @order = Order.where(owner_id: current_user.branch.nodes.pluck(:id)).order('orders.quantity').last\n\n render json: {id: @order.id, quantity: @order.quantity,\n date: @order.created_at.strftime('%d/%m/%Y'),\n time: @order.created_at.strftime('%p %I:%M'),\n destination: \"#{t('fridge')} - #{@order.owner_id}\"\n }, status: :ok\n end",
"def show\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order1 }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@order }\n end\n end",
"def show\n @order = Order.includes(:order_positions, :pizzeria => :pizzas).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @title = \"Order #{@order.id}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def show\n\t\t@admin_order = Admin::Order.find(params[:id])\n\t\t@admin_client = @admin_order.client\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @admin_order }\n\t\tend\n\tend",
"def show\n @order_item = OrderItem.find(params[:id])\n @order = @order_item.order\n @net_total = 0.00\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @order_dishes = @order.order_dishes.includes(:dish).order(\"order_dishes.time\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end",
"def show\n render json: @order_item_extra\n end",
"def index\n @order_item_extras = OrderItemExtra.all\n\n render json: @order_item_extras\n end",
"def new\n @order_datail = OrderDatail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_datail }\n end\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def get_order\n @order = Order.find(params[:id])\n end",
"def show\n @order = Order.find(params[:id])\n\t @items = CartItem.where(:order_id=>@order.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @customer = @order.customer\n @address = @order.address\n @items = @order.items\n @ledgers = @order.ledgers\n @notes = @order.notes\n\n # Remaining balance\n @remaining_balance = @order.remaining_balance\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n render json: @order_line_item\n end",
"def show\n @manufacture_order = ManufactureOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @manufacture_order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @line_bundles = @order.line_bundles\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @order_positions = @order.order_positions\n @address = Address.find(@order.address_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @item = OrderPosition.new\n @item.order = Order.includes(:pizzeria => :pizzas).find(params[:order_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def repair_order_show\n @repair_order = current_repair_order\n render json: { repair_order: @repair_order.as_json(include: [\n :repair_items,\n :employee_users_repair_orders ] )},\n status: :ok\n end",
"def show\n @delivery_order = DeliveryOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery_order }\n end\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def show\n @order = @transaction.order\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend",
"def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def find\n @purchaseorder = Purchaseorder.find_by_po_no(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: custom_json_for_show(@order) }\n end\n end",
"def show\n @order = Order.includes(:order_items).find(params[:id])\n\n \n unless user_signed_in?\n sign_in @order.user\n end\n\n if @order.vendor.nil?\n @owner = @order.restaurant\n else\n @owner = @order.vendor \n end\n @menu = @owner.menu\n\n\n @items = Hash[@menu.items.map{|it| [it.id, it]}]\n @order_items = @order.order_items\n\n # @charge = Stripe::Charge.retrieve(params[:charge])\n\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @order }\n # end\n end",
"def show\n @incomming_order = IncommingOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incomming_order }\n end\n end",
"def customer_order\n order = current_user.restaurant.orders.find(params[:id])\n render json: order.as_json(include: [:customer, {order_details: {include: :meal}}]), status: :ok\n end",
"def show\n @mws_order = MwsOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mws_order }\n end\n end",
"def current_order\n order = current_user.customer.orders.last\n render json: order.as_json(include: [:restaurant, {order_details: {include: :meal}}]), status: :ok\n end",
"def index\n @orderdetails = Orderdetail.all\n end",
"def index\n @orderdetails = Orderdetail.all\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def show\n @order = resource\n respond_with(@order)\n end",
"def new\n @admin_order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_order }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @sorder = Sorder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sorder }\n end\n end",
"def show\n render json: @power_order\n end",
"def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end",
"def show \n @order = Order.find(params[:order_id])\n @order_item = OrderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end",
"def new\n #@order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def new\n @order_detail = OrderDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @order_detail }\n end\n end",
"def show\n render json: { status: 'SUCCESS', message: 'Loaded the post', data: @order }\n end",
"def show\r\n @order_transaction = OrderTransaction.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @order_transaction }\r\n end\r\n end",
"def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end",
"def show\n @store_manager_order = Store::Manager::Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_order }\n end\n end",
"def show\n @counter_order = CounterOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @counter_order }\n end\n end",
"def order_detail_json_format\n sub_total = qty * price rescue 0\n\n {\n id: id,\n order_id: order_id,\n menu: {\n id: menu_id,\n name: menu_name,\n price: price\n },\n qty: qty,\n sub_total: sub_total,\n notes: notes,\n flag: flag,\n created_at: created_at,\n updated_at: updated_at\n }\n end",
"def show\n @order = Order.find(params[:id])\n @items_in_order = ItemsInCart.where(order_id: @order.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_line }\n end\n end",
"def receive_order\n response = ApiOrdenCompra.recepcionarOrdenCompra(params[:_id])\n render json: response\n end",
"def getorden\n @id = params['id']\n @orden = Orden.find(@id)\n @factura = Factura.where(:ordens_id => @id).first\n @monto= @factura.iva + @factura.costoTotal\n\n @historico = Orden.rutas(@id)\n\n respond_to do |format|\n # format.html # show.html.erb\n format.xml\n end\n end",
"def show\n\t\t@order = Order.find(params[:id])\n\tend",
"def show\n @order = Order.find(params[:id])\n end"
] |
[
"0.71183354",
"0.70629406",
"0.6908313",
"0.6824049",
"0.6765412",
"0.6765412",
"0.67271954",
"0.6723",
"0.6709088",
"0.6702399",
"0.6702399",
"0.664294",
"0.6637023",
"0.6616795",
"0.6595496",
"0.65941",
"0.6573095",
"0.65280414",
"0.65198445",
"0.6519484",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.6489724",
"0.64867866",
"0.64865816",
"0.6477869",
"0.6465145",
"0.64570683",
"0.6434097",
"0.64189875",
"0.64010966",
"0.6382166",
"0.6357978",
"0.63217425",
"0.63197756",
"0.63156104",
"0.62823755",
"0.62696207",
"0.62696207",
"0.6263145",
"0.6261599",
"0.6256652",
"0.62475055",
"0.6237052",
"0.6236151",
"0.6225711",
"0.6222775",
"0.620083",
"0.61997175",
"0.6199708",
"0.6193186",
"0.6188203",
"0.6179267",
"0.61682004",
"0.61652917",
"0.61546195",
"0.6153266",
"0.61532366",
"0.61492914",
"0.6148585",
"0.6145313",
"0.61404014",
"0.613394",
"0.613351",
"0.613351",
"0.6123883",
"0.6123117",
"0.6107369",
"0.6104194",
"0.60901344",
"0.6084516",
"0.60783345",
"0.6075922",
"0.6060865",
"0.6059834",
"0.6057428",
"0.60449386",
"0.6037975",
"0.6034868",
"0.6034185",
"0.60324806",
"0.6016753",
"0.6014617",
"0.6002809",
"0.5997105",
"0.5991535",
"0.59881395",
"0.5987795"
] |
0.0
|
-1
|
POST /order_detalis POST /order_detalis.json
|
def create
@order_detali = OrderDetali.new(order_detali_params)
respond_to do |format|
if @order_detali.save
format.html { redirect_to @order_detali, notice: 'Order detali was successfully created.' }
format.json { render :show, status: :created, location: @order_detali }
else
format.html { render :new }
format.json { render json: @order_detali.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @order = Order.new(order_params_create)\n\n respond_to do |format|\n if @order.save && @order.update(order_params_create_2)\n #Обновляем поля\n Ordered.all.each do |myord|\n if [email protected]\n Ordered.update(myord.id, :quantity => 1, :discount => 0)\n end\n end\n format.html { redirect_to @order, notice: 'Новый заказ был успешно оформлен.' } \n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_order = SalesOrder.new(sales_order_params)\n @sales_order.date = Time.now\n sodetails = @sales_order.sales_order_details\n sodetails.each do |sod|\n sod.pending_rg = sod.quantity\n sod.pending_cg = sod.quantity\n sod.pending_inv = sod.quantity\n end\n \n respond_to do |format|\n if @sales_order.save\n format.html {\n flash[:notice] = 'La Orden de Venta se creó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { render :show, status: :created, location: @sales_order }\n else\n format.html { \n flash[:error] = @sales_order.errors\n redirect_to new_sales_order_path\n }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_order_detali\n @order_detali = OrderDetali.find(params[:id])\n end",
"def create\n @order_datail = OrderDatail.new(params[:order_datail])\n\n respond_to do |format|\n if @order_datail.save\n format.html { redirect_to @order_datail, notice: 'Order datail was successfully created.' }\n format.json { render json: @order_datail, status: :created, location: @order_datail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_datail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_order = ServiceOrder.new(service_order_params)\n @products = params[:inputprod]\n @quantity = params[:inputcantidad]\n #@cita_id = Citation.where(:id => params[:citation_id])\n \n respond_to do |format|\n if @service_order.save\n cont =0\n @products.each do |p|\n detalle = ServiceOrderDetail.new(product_id: p, quantity: @quantity[cont], service_order_id:@service_order.id)\n detalle.save\n cont +=1\n end\n \n format.html { redirect_to @service_order, notice: 'Service order was successfully created.' }\n format.json { render :show, status: :created, location: @service_order }\n else\n format.html { render :new }\n format.json { render json: @service_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n\n @basket = ActiveSupport::JSON.decode(cookies[\"basket\"])\n p @basket\n @basket.each do |order_position|\n @order_detail = OrderDetail.create!(order: @order, product_id: order_position[0], qty: order_position[1])\n end\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_mov\n @order = Order.find(params[:id])\n #Cuando se crea una orden de tipo ajuste (entrada,salida) el campo atach queda vacio\n if @order.isclose == false\n @dif_ord = Order.find(@order.atach)\n end\n @total = 0\n @order.order_details.each do |prod|\n suma = prod.price * prod.quantity\n @total = @total + suma\n end\n respond_to do |format|\n format.html\n format.json {render json: @order}\n end\n end",
"def create\n @budget_for_order = BudgetForOrder.new(budget_for_order_params)\n @budget_for_order.total=0\n respond_to do |format|\n if @budget_for_order.save\n format.html { redirect_to budget_new_add_path(@budget_for_order.id), notice: 'Favor de agregar los detalles' }\n format.json { render :show, status: :created, location: @budget_for_order }\n else\n format.html { render :new }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'La commande a été créée avec succès.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # 前端傳回的資料,呼叫 order_params 過濾前端傳回來的資料,用 new 創出一個 Order 的物件 (此時還是 ruby 物件喔)\n @order = Order.new(order_params)\n\n respond_to do |format|\n # save 是指把該筆 物件裡的資料存入資料庫內\n if @order.save\n # 若儲存成功,就導回該筆資料的 show 頁面\n format.html { redirect_to order_path(@order), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n # 若儲存失敗,就導回新增的頁面重新填寫資料\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @drink = Drink.where(drink: @order.drink).first\n if @drink.nil?\n respond_to do |format|\n format.json { render json: {}, status: 404}\n end\n else\n respond_to do |format|\n if @order.save\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render json: response_json, status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n set_or_create_tariff(@order, order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Заказ успешно создан.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_path, notice: 'Order berhasil, tunggu untuk konfirmasi selanjutnya' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @order = Order.new(:drone_id => Drone.where('name = :dname', dname: 'No Drone Assigned').first.id, :person_id => params[:orderdetail][:person_id], :status => 1)\n if @order.save\n @orderdetail = Orderdetail.new(:product_id => params[:orderdetail][:product_id],:quantity => params[:orderdetail][:quantity],:order_id => @order.id)\n \n respond_to do |format|\n if @orderdetail.save\n format.html { redirect_to @orderdetail, notice: 'Orderdetail was successfully created.' }\n format.json { render :show, status: :created, location: @orderdetail }\n else\n format.html { render :new }\n format.json { render json: @orderdetail.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @order_detalis = OrderDetali.all\n end",
"def create\n if get_food_order_params == true\n @foods = Food.all.order(:name)\n @order = Order.new(order_params)\n flash[:error] = \"La orden no puede estar vacía\"\n render :new\n else\n if order_params.to_h[\"status\"] != \"Cancelado\"\n @order = Order.new(order_params)\n @food_order = get_food_order_params\n @food_order.each{ |food_order| @order.food_orders.build(food_order)}\n end\n\n\n respond_to do |format|\n if @order.save\n flash[:success] = 'La orden ' + @order.id.to_s + ' fue creada satisfactoriamente'\n format.html { redirect_to action: \"index\"}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n\n\n end",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def order_detali_params\n params.require(:order_detali).permit(:order_id, :book_id, :price)\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n @order.order_create\n format.html { redirect_to @order, notice: 'Замовлення успішно створено.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @spree_diary = @spree_order.diaries.new(spree_diary_params)\n \n\n\n respond_to do |format|\n if @spree_diary.save\n format.html { redirect_to admin_order_diaries_path, notice: 'Diary was successfully created.' }\n format.json { render :show, status: :created, location: @spree_diary }\n else\n format.html { render :new }\n format.json { render json: @diaries.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #current_cart.each do |item|\n # item['meal_id']\n # item['quantity']\n #end\n #curent_user\n #Order.order_meals.new(:meal_id, :quantity)\n #Order.user\n #Order.price cart_total_price\n #Order.Situation = 1 => pendente\n #Order.save\n \n #select_situation\n @order = Order.new\n\n @order.user = current_user\n @order.situation_id = Situation.first.id\n @order.price = params[:total_price].to_f\n @order.save\n current_cart.each do |item|\n @meal = Meal.find item['meal_id']\n OrderMeal.create(order: @order, meal: @meal, quantity: item['quantity'])\n end\n \n respond_to do |format|\n if @order.save\n #esvazia o carrinho\n session[:cart] = nil\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @orders_path }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to orders_url, notice: 'Dati commessa caricati.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @order = Order.new() \n total = 0\n \n @order = Order.new()\n for product in params[:_json]\n \n if (product[:quantity].nil? || product[:quantity].to_f < 1 || !isint(product[:quantity]))\n # Handle case when order invalid quantity\n render json: \"\", status: :bad_request\n return\n end\n\n @product = Product.find_by_name_and_size_id(product[:product], product[:size]) \n if @product.nil?\n # Handle case when order invalid products\n render json: \"\", status: :not_found\n return\n end \n total = total + @product.price * product[:quantity].to_f \n @order.orders_products << OrdersProduct.new(:product => @product, :hot => product[:hot], :quantity => product[:quantity]) \n end \n\n @order.total = total\n\n if @order.save\n render json: @order, status: :created, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def create\n @order = Order.new(params[:order])\n @order.editing = false\n @product = @order.product_type.downcase.pluralize\n respond_to do |format|\n if @order.save\n total_due = 0\n @order.parts.each do |part|\n total_due = part.cost + total_due\n end\n @order.client_needs.each do |client_need|\n total_due = client_need.cost + total_due\n end\n @order.update_attribute(:total_due, total_due)\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @order = Order.new(order_params)\r\n @order.status = false\r\n @order.order_state = true\r\n respond_to do |format|\r\n if @order.save\r\n format.html { redirect_to '/order_details/' + @order.id.to_s, notice: 'Órden creada correctamente' }\r\n format.json { render :show, status: :created, location: @order }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @order.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @orderdetail = Orderdetail.new(orderdetail_params)\n\n respond_to do |format|\n if @orderdetail.save\n format.html { redirect_to @orderdetail, notice: 'Orderdetail was successfully created.' }\n format.json { render :show, status: :created, location: @orderdetail }\n else\n format.html { render :new }\n format.json { render json: @orderdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n if @order.save\n render json: { status: 'SUCCESS', data: @order }\n else\n render json: { status: 'ERROR', data: @order.errors }\n end\n end",
"def create\n @order = Order.new\n @order.table_id = params[:table_id]\n params[:order_dishes].each do |id, qty|\n qty.to_i.times do\n OrderDish.create(dish_id: id, order: @order)\n end\n end\n authorize @order\n if @order.save!\n @totalprice = @order.order_dishes.reduce(0) { |sum, order_dish| sum + order_dish.dish.price }\n session = Stripe::Checkout::Session.create(\n payment_method_types: ['card'],\n line_items: [{\n name: \"Pladujoor\",\n images: [\"https://res.cloudinary.com/ds0cha29d/image/upload/v1598952947/Pladujoor/1200x_tlhokc.png\"],\n amount: @totalprice.fractional,\n currency: 'eur',\n quantity: 1\n }],\n success_url: table_order_url(@order.table, @order),\n cancel_url: edit_table_order_url(@order.table, @order)\n )\n @order.update(checkout_session_id: session.id)\n redirect_to confirmation_table_order_path(@order.table, @order)\n else\n render 'new'\n end\n end",
"def recibir\n #obtener la orden de compra con el id que nos envía el otro grupo.\n id = params[:id]\n id_store_reception = JSON.parse(request.body.read.to_s)\n id_store_reception = id_store_reception[\"id_store_reception\"]\n @result = HTTParty.get(OC_URI + 'obtener/' + id, :query => {}, :header => OPT)\n puts @result\n #Reviso si el id ingresado es valido para que oc no tire error\n if !@result[0]['created_at'].nil? then\n oc = @result[0]\n cliente = oc[\"cliente\"]\n cliente = IDS[cliente].to_s\n #una vez recibida la orden de compra hay que ver si la aceptamos o no\n #de momento no me preocuparía de ver si podemos comprar otras materias primas para producir y cumplir ordenes de comora\n if accept_general?(oc)\n accept(id, cliente)#esto le avisa a la api del profe y al otro grupo que aceptamos la oc\n @purchase_order = PurchaseOrder.new(oc) #si aceptamos la OC la guardamos en nuestro modelo.\n @purchase_order.save\n fact = createInvoice(oc[\"_id\"])\n #se le manda al grupo comprador la factura que acabamos de crear y nuestra cuenta de banco\n HTTParty.put(GURI + cliente + \".ing.puc.cl/invoices/\" + fact[0][\"_id\"], headers: GOPT, body:{\"bank_account\" => CTA})\n #poner en cola\n order = Order.new(oc:oc['_id'], total:Integer(oc['cantidad']), sku:oc['sku'], due_date:oc['fechaEntrega'], client:oc['cliente'], price:Integer(oc['precioUnitario']), destination: id_store_reception, state:\"accepted\")\n order.save\n render json: {'Message': \"Orden creada, aceptada y facturada\"}\n\n else\n reject(id, '', cliente)\n render json: {'Message': \"Orden rechazada\"}\n end\n else\n render status: 500, json:{\n Message: 'Declined: failed to process order, we need more details'\n }\n end\n end",
"def create\n\t\t@admin_order = Admin::Order.new(order_params)\n\n\t\trespond_to do |format|\n\t\t\tif @admin_order.save\n\t\t\t\tif params[:order_update].present?\n\t\t\t\t\tformat.html { redirect_to edit_admin_order_path(@admin_order), notice: 'Pedido criado com sucesso.'}\n\t\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @admin_order, notice: 'Pedido criado com sucesso.' }\n\t\t\t\t\tformat.json { render json: @admin_order, status: :created, location: @admin_order }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @admin_order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @order = Order.new(student_id:params[:student_id], tarifa:params[:tarifa])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to order_materias_path(@order), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provision\n @order = Order.new\n 1.times {@order.order_details.build}\n respond_to do |format|\n format.html # provision.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: { order_id: @order.id }, status: :ok }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @order = Order.new(order_params)\n @order.client_id=Client.where(email: params[:client_email]).last.id\n @order.zone=current_user.zone\n @order.distributor=current_user.creator\n @order.commerce=current_user.email\n @order.wholesaler=User.where(:email => current_user.creator).first.creator\n @[email protected]/Setting.last.exchange_rate\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'La transacción se ha efectuado satisfatoriamente' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new, :cliente => params[:client_email] }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @order_datail = OrderDatail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_datail }\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice=>\"Order was successfully created.\" }\n format.json { render :json=>@order, :status=>:created, :location=>@order }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@order.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"def cow_order\n @order = Order.new\n @order.lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @order = order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n @order.save_referer(session[:referer])\n\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n session[:referer] = nil\n Notifier.order_received(@order).deliver\n\n\n #if @order.line_items.find_all { |line_item| line_item.product.category.dealers_only == true }.size != 0\n # Notifier.order_dealer_send(@order).deliver\n #else\n # Notifier.order_send(@order).deliver\n #end\n\n Notifier.order_send(@order).deliver\n\n format.html { redirect_to('/content/happy', :notice => 'Пасибки за заказ') }\n format.xml { render :xml => @order, :status => :created,\n :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if request.xhr?\n \t\tcomps = params[:components]\n \t\tis_delivery = params[:delivery_type] == 'delivery'\n \t\tdelivery_address = params[:delivery_address]\n \t\tquantity = params[:quantity]\n \t\tuser_name = params[:user_name]\n \t\tuser_email = params[:user_email]\n \t\tuser_phone = params[:user_phone]\n \t\tuser_comment = params[:user_comment]\n \t\t\n @order = Order.create!( raisins: comps['raisins'] == 'true', chocolate_chips: comps['chocolate_chips'] == 'true', walnuts: comps['walnuts'] == 'true', flax_seeds: comps['flax seeds'], cinnamon: comps['cinnamon'],\n is_delivery: is_delivery, delivery_address: delivery_address, quantity: quantity, \n user_name: user_name, user_email: user_email, user_phone: user_phone, user_comment: user_comment)\n \n OrderMailer.email_order(@order)\n \n render :json => {order_id: @order.id, paypal_encrypted_str: @order.encrypt_paypal(thank_you_url, payment_notifications_url)}\n end\n end",
"def create\n @admin_order = Order.new(params[:admin_order])\n\n respond_to do |format|\n if @admin_order.save\n format.html { redirect_to @admin_order, notice: 'Order was successfully created.' }\n format.json { render json: @admin_order, status: :created, location: @admin_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def detalhe_params\n params.require(:detalhe).permit(:item_id_id, :quantidade)\n end",
"def destroy\n @order_detali.destroy\n respond_to do |format|\n format.html { redirect_to order_detalis_url, notice: 'Order detali was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @order = Order.new(params[:order])\n @order_sales = @order.sales\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @order = Order.new\n @order.ingredients.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @order = Order.create(order_params.except!(:order_detail))\n @order_status_detail = OrderStatusDetail.create(:status_id => 1, :order_id => @order.id)\n OrderDetail.process_order_details(@order,order_params[:order_detail])\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Orden creada exitosamente.' }\n else\n format.html { render :new }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:_id, :canal, :proveedor, :cliente, :sku, :cantidad, :cantidadDespachada,\n :precioUnitario, :fechaEntrega, :estado, :rechazo, :anulacion,\n :notas, :id_factura)\n end",
"def create\n @order = Order.new(params[:order])\n @order.order_status = Constant::ORDER_OPEN\n\n respond_to do |format|\n if @order.save\n @order.order_dishes.create(:dish_id => params[:order_dish][:dish_id])\n\n format.html { redirect_to \"/orders/#{@order.id}\", notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def repair_order_create\n\n @business_id = current_business_user.id\n @client_id = current_client.id\n @repair_order = current_vehicle.repair_orders.new(\n repair_order_number: params[:repair_order_number],\n client_id: @client_id,\n business_user_id: @business_id)\n if @repair_order.save\n render json: { repair_order: @repair_order.as_json(include: :client),\n vehicle: @repair_order.as_json(include: :vehicle) },\n status: :created\n else\n render json: { errors: @repair_order.errors.full_messages },\n status: :unprocessable_entity\n end\n end",
"def create\n @order_item_extra = OrderItemExtra.new(order_item_extra_params)\n\n if @order_item_extra.save\n render json: @order_item_extra, status: :created, location: @order_item_extra\n else\n render json: @order_item_extra.errors, status: :unprocessable_entity\n end\n end",
"def create\n @order = Order.new(params[:order])\n @addresses = Address.where(:user_id => current_user.id)\n @order.status = 0;\n @order.delivery_cost = @order.delivery.cost\n @order.user = current_user\n @order_positions = current_user.basket.order_positions\n @order.order_positions = @order_positions\n @order.value = sum_price(@order_positions)\n\n respond_to do |format|\n if @order.save\n @order_positions.each do |op|\n op.container = @order\n op.save\n p = op.product\n p.availability -= op.amount\n p.save\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @order = Order.new\n 1.times {@order.order_details.build}\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @order = Order.new :user_id => params[:user_id], :order_list => params[:order_list], :table_number => params[:table_number], :paid => params[:paid], :fb_user => params[:fb_user], :business_name => params[:business_name]\n @order.order_list = []\n @order.paid = false\n\n success_msg = {\n \"messages\": [\n {\"text\": \"Your order was created.\"},\n {\"text\": \"Thank you.\"}\n ]\n }\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :json => success_msg }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end",
"def new_for_order\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html\n format.json { render json: @cliente }\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @order_item = OrderItem.create\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Замовлення створено.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice => 'Order was successfully created.' }\n format.json { render :json => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:order_date, :student_id, :entree_quantity, :entree,\n :side, :dessert, :price, :notes)\n end",
"def create\n @cliente = Cliente.new id: '300', nome:'David', identificador:'14725836910', telefone:'8735334268', celular:'3698521472', email:'[email protected]', senha:'65423'\n @cliente.save\n @order = @cliente.orders.build(id: '800', menuTitle: 'Senor Froggy', street: 'Elm Street')\n @cliente.save\n #@adress = Adress.new(street: :street, block: :block, number: :number, additional_info: :additional_info, order_id: @order)\n @adress = @order.adresses.build(street: :street, block: :block, number: :number, additional_info: :additional_info, order_id: @order.id)\n respond_to do |format|\n if @adress.save\n format.html { redirect_to @adress, notice: 'Adress was successfully created.' }\n format.json { render :show, status: :created, location: @adress }\n else\n format.html { render :new }\n format.json { render json: @adress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @path = '/orders'\n @method = 'post'\n @order = Order.new\n @bundles = Bundle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @order = Order.new(params[:order])\n end",
"def create\n @producto_detalle = ProductoDetalle.new(producto_detalle_params)\n\n respond_to do |format|\n if @producto_detalle.save\n format.html { redirect_to @producto_detalle, notice: 'Producto detalle was successfully created.' }\n format.json { render :show, status: :created, location: @producto_detalle }\n else\n format.html { render :new }\n format.json { render json: @producto_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new JSON.parse request.body.read\n\n respond_to do |format|\n rescue_connection_failure do\n if @order.save\n format.html { redirect_to @order, notice: 'ORder was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully created.' } }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def create\n @organisme = Organisme.new(organisme_params)\n params[:departements] ||= []\n @organisme.departements.delete_all\n @dep_table = params[:departements]\n logger.debug \"Departements table sent : #@dep_table\"\n @dep_table.each do |depid|\n @organisme.departements << Departement.find(depid)\n end\n respond_to do |format|\n if @organisme.save\n format.html { redirect_to action: \"index\", notice: 'Organisme was successfully created.' }\n format.json { render :index, status: :created, location: @organisme }\n else\n format.html { render :new }\n format.json { render json: @organisme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order(options)\n request :account, :post, 'order', options\n end",
"def create\n puts params;\n @order = Order.new(order_params)\n @order.State = \"新建\"\n @order.CreateTime= Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n @order.CreateUser =\"陈晓雨\"\n # @items.append(@tmp)\n\n respond_to do |format|\n if @order.save\n for x in 1..10\n @tmp = params.require(\"itemline#{x}\").permit(:Item_id, :Sum, :GoDown_id)\n if (@tmp[:Item_id] !=\"\")\n puts @tmp\n @sub_order =SubOrder.new(:Item_id => @tmp[:Item_id], :Sum => @tmp[:Sum], :GoDown_id => @tmp[:GoDown_id])\n @sub_order.Order_id= @order.id\n @sub_order.save\n end\n end\n\n format.html { redirect_to @order, notice: '订单创建成功' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.cart = @cart\n OrderMailer.demandelocation(Order.first).deliver_now\n\n\n respond_to do |format|\n if @order.save\n session.delete(:cart_id)\n format.html { redirect_to order_validations_path}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:pub_id, :token, drinks: [[:id, :quantity]])\n end",
"def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end",
"def create\n @articles_order = ArticlesOrder.new(articles_order_params)\n\n respond_to do |format|\n if @articles_order.save\n #format.html { redirect_to @articles_order, notice: 'Articles order was successfully created.' }\n format.html { redirect_to new_articles_order_path }\n #format.json { render :show, status: :created, location: @articles_order }\n else\n #flash.now[:alert] = @articles_order.errors.full_messages.join(\"<br>\").html_safe\n #render action: \"new\"\n obtener_articulos\n @articles_orders = ArticlesOrder.where(\"orders_id = ?\", session[:id_compra_session])\n format.html { render :new }\n format.json { render json: @articles_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@order = Order.new(params[:order])\n\n cart = session[:cart]\n\n @order.add_line_items_to_order_from_cart(cart)\n\n @order.user = current_user\n\n respond_to do |format|\n if @order.save\n #Send an email to admin\n UserMailer.order_created_to_admin(@order).deliver\n #empty cart\n session.delete(:cart)\n \n format.html { redirect_to :dashboard, notice: \"L'ordine è stato creato correttamente.\" }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def confirmer_cart\n _user = current_client\n _confirmation = rand(36**10).to_s(36)\n _cart = Commande.new()\n _cart.client_id = _user.id\n if params[:addr_id] != '-1'\n _cart.adresse_id = params[:addr_id]\n else\n _cart.adresse_id = client_adresse.id \n end\n _cart.no_confirmation = _confirmation\n _cart.date_de_commande = params[:date_de_commande]\n _cart.heure_de_commande = params[:heure_de_commande]\n _cart.prix_total = params[:prix_total]\n _cart.status_pret = false\n _cart.save\n render json: _cart\n end",
"def create\n @order = Order.new(tl_params)\n\n if @order.save\n if params[:product]\n \[email protected]_order(params[:product])\n end\n render json: @order, status: :created\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def create\n @order = Order.create!(order_params)\n\t@users = User.order(:user_name)\n @restaurants = Restaurant.order(:rest_name)\n \n respond_to do |format|\n if @order.save\n \t@thispart = Participant.create!({:part_user => @order.order_organizer, :part_order => @order.id, :part_role => \"organizer\", :part_cost => 0.00})\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_ordem\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n\t@ordem = Ordem.new(:cliente_id => @cliente.id, :user_id => current_user.id)\n\tif @ordem.save\n\t\tformat.html { redirect_to @ordem, notice: 'O cliente foi adicionado com sucesso.' }\n\t\tformat.json { render json: @cliente, status: :created, location: @cliente }\n\telse\n\t\tformat.html { render action: \"index\" }\n \tformat.json { render json: @cliente.errors, status: :unprocessable_entity }\n\tend\n else\n format.html { render action: \"new_for_order\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pedido = Pedido.new(pedido_params)\n @pedido.pedido_hash = get_pedido_hash\n @pedido.estado_actual = PEDIDO_SOLICITADO\n\n #redirect_to '/pedidos'\n respond_to do |format|\n if @pedido.save\n\n params[:item_cantidad].each do |a, b|\n newitem_pedido = ItemPedido.new\n newitem_pedido.cantidad = b\n newitem_pedido.item_id = a\n item = Item.find(a)\n newitem_pedido.nombre = item.nombre\n newitem_pedido.valor = ItemProveedor.find_by_item_id_and_proveedor_id(item.id,Categorium.find(item.categorium_id).proveedor_id).precio\n newitem_pedido.pedido_id = @pedido.id\n newitem_pedido.estado_actual = ITEM_SOLICITADO\n newitem_pedido.proveedor_id = Categorium.find(item.categorium_id).proveedor_id\n newitem_pedido.disponible = true\n newitem_pedido.save\n\n end\n format.html { redirect_to @pedido, notice: 'Pedido was successfully created.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @order.uuid = SecureRandom.hex(8)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render 'show', status: :created, location: @order }\n else\n format.html { render 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n # @selectedItems.each do |selectedItem|\n # item = Item.new\n # item.menu = selectedItem.id\n # item.quantity = selectedItems.quantity\n # item.order = @order.id\n # item.save\n # end\n\n #@selectedItems = JSON.parse(params[:selectedItems])\n Rails.logger.debug(\"@selectedItems in create: #{@selectedItems}\")\n end",
"def new\n @order = Order.new\n @order.sales.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @order = Order.new(order_params)\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('app.orders.create.success') }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = current_member.orders.build(order_params)\n @line_items = current_member.line_items.where(\"id in (?)\", params[:line_items])\n @order.status = 'opening'\n @order.total_price = 0\n @line_items.each do |line_item|\n @order.total_price += (line_item.product.price * line_item.quantity)\n end\n @order.receivable = @order.total_price\n\n respond_to do |format|\n if @order.save\n @line_items.each do |line_item|\n line_item.order_id = @order.id\n line_item.save\n end\n format.html { redirect_to @order, notice: '你的订单已经生成,确认无误后可以支付!' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6508184",
"0.6442758",
"0.64053607",
"0.63741314",
"0.63610244",
"0.6346044",
"0.6313415",
"0.6306812",
"0.6279113",
"0.6247363",
"0.62337583",
"0.62293917",
"0.62262595",
"0.6224976",
"0.6207935",
"0.6155869",
"0.6148136",
"0.6131479",
"0.6130066",
"0.6125559",
"0.6124595",
"0.6109096",
"0.6082992",
"0.60508114",
"0.6050488",
"0.6039699",
"0.5986996",
"0.5956848",
"0.59491867",
"0.5931622",
"0.5925845",
"0.59256077",
"0.5915036",
"0.5909585",
"0.5900241",
"0.586595",
"0.58650357",
"0.5860409",
"0.586024",
"0.58594394",
"0.5853714",
"0.58473104",
"0.58340085",
"0.5833546",
"0.5830487",
"0.5822063",
"0.5820292",
"0.58154255",
"0.58062303",
"0.580068",
"0.57988036",
"0.5797401",
"0.57873297",
"0.5785608",
"0.5775753",
"0.5775424",
"0.5769648",
"0.5756835",
"0.5753781",
"0.5753781",
"0.5753781",
"0.5753781",
"0.57511514",
"0.57448703",
"0.57444113",
"0.57424146",
"0.5734004",
"0.57330275",
"0.57330275",
"0.5731335",
"0.57312363",
"0.57228374",
"0.5720269",
"0.5718309",
"0.5717509",
"0.57138765",
"0.5710277",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56995434",
"0.56985277",
"0.5696984",
"0.56956345",
"0.56914186",
"0.5690336",
"0.568885",
"0.56885743",
"0.56792414",
"0.56781447",
"0.5675077",
"0.5666295",
"0.56656647"
] |
0.71264327
|
0
|
PATCH/PUT /order_detalis/1 PATCH/PUT /order_detalis/1.json
|
def update
respond_to do |format|
if @order_detali.update(order_detali_params)
format.html { redirect_to @order_detali, notice: 'Order detali was successfully updated.' }
format.json { render :show, status: :ok, location: @order_detali }
else
format.html { render :edit }
format.json { render json: @order_detali.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'La commande a été créée avec succès.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.status == \"preparing\"\n format.json { render text: '', status: 409 }\n else\n if @order.update(order_params)\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, additions: @order.additions, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render text: response_json, status: :created, location: @order }\n \n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @order_detail = OrderDetail.find(params[:id])\n\n respond_to do |format|\n if @order_detail.update_attributes(params[:order_detail])\n format.html { redirect_to @order_detail, :notice => 'Line item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_update_params)\n format.html { redirect_to @order, notice: 'Замовлення обновлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Заявка была успешно обновлена.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('orders.creat')}\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_url, notice: 'Dati commessa modificati.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Замовлення поновлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Заказ успешно обновлен.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice=>\"Order was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@order.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'A comanda foi atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { render json:@order }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @order.update(order_params)\r\n format.html { redirect_to @order, notice: 'Órden editada correctamente' }\r\n format.json { render :show, status: :ok, location: @order }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @order.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @orderdetail.update(orderdetail_params)\n format.html { redirect_to @orderdetail}\n format.json { render :show, status: :ok, location: @orderdetail }\n else\n format.html { render :edit }\n format.json { render json: @orderdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if get_food_order_params_update == true\n @foods = Food.all.order(:name)\n @order = Order.new(order_params)\n flash[:error] = \"Debe agregar por lo menos un plato\"\n render :new\n else\n if order_params.to_h[\"status\"] != \"Cancelado\"\n @food_order = get_food_order_params\n @food_order.each{ |food_order| @order.food_orders.build(food_order)}\n end\n\n respond_to do |format|\n if @order.update(order_params)\n if @order.status == \"Cancelado\"\n flash[:error] = 'La orden ' + @order.id.to_s + ' fue cancelada'\n else\n flash[:success] = 'La orden ' + @order.id.to_s + ' fue actualizada satisfactoriamente'\n end\n format.html { redirect_to action: \"index\"}\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if order.update(order_params)\n format.html { redirect_to order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: order.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully updated.' } }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice => 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n set_groups\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n respond_to do |format|\n if @order.update(farm_order_params)\n format.html { redirect_to edit_farm_order_path, notice: 'Farm order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: '你的订单已经更新成功!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68504137",
"0.68477577",
"0.6833518",
"0.68226534",
"0.6822191",
"0.6819898",
"0.6815785",
"0.6807843",
"0.68026036",
"0.6768745",
"0.6768745",
"0.6754119",
"0.6734648",
"0.66957736",
"0.6686595",
"0.6684546",
"0.6683625",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.66705245",
"0.6667075",
"0.66560346",
"0.6655006",
"0.6628204",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.6627301",
"0.66189915",
"0.66184896",
"0.66171694",
"0.6610247",
"0.66087073",
"0.6603945",
"0.6593647",
"0.6593647",
"0.65931904",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739",
"0.6586739"
] |
0.69475025
|
0
|
DELETE /order_detalis/1 DELETE /order_detalis/1.json
|
def destroy
@order_detali.destroy
respond_to do |format|
format.html { redirect_to order_detalis_url, notice: 'Order detali was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @order_datail = OrderDatail.find(params[:id])\n @order_datail.destroy\n\n respond_to do |format|\n format.html { redirect_to order_datails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'La transacción se ha eliminado con exito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n render json: {success: true, status: :ok} \n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Информация о заказе была успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orderdetail.destroy\n respond_to do |format|\n format.html { redirect_to orderdetails_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Замовлення скасовано.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Заявка была успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'La demande a été supprimée' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Заказ успешно удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order1.destroy\n respond_to do |format|\n format.html { redirect_to order1s_url, notice: 'Order1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to farm_orders_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orderdetail.destroy\n @order = Order.find(@orderdetail.order_id)\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orderdetails_url, notice: 'Orderdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allorder.destroy\n respond_to do |format|\n format.html { redirect_to allorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Замовлення видалено.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: t('orders.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n # @order.destroy\n \n respond_to do |format|\n format.html { redirect_to @order, notice: 'Deletion of orders not allowed.' }\n format.json { render json: @order.errors, status: :method_not_allowed }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orderdetail.destroy\n respond_to do |format|\n format.html { redirect_to orderdetails_url, notice: 'Orderdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @updateallorder.destroy\n respond_to do |format|\n format.html { redirect_to updateallorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n head :no_content\n end",
"def destroy\n @order.destroy\n\n head :no_content\n end",
"def destroy\n @order_info.destroy\n respond_to do |format|\n format.html { redirect_to order_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @keyclientorder.destroy\n respond_to do |format|\n format.html { redirect_to keyclientorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:order_id])\n @order_item = @order.order_items.find(params[:id])\n @order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to order_order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordered.destroy\n respond_to do |format|\n format.html { redirect_to ordereds_url, notice: 'Ordered was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_order.destroy\n\n respond_to do |format|\n format.html { redirect_to service_orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.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 @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @id = params[:id]\n visit_order_details = OrderDetail.find(@id)\n visit_order_details.destroy\n #.destroy\n respond_to do |format|\n format.html { redirect_to visits_url, notice: 'Visit was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render 'delete_row', id: @id}\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url, notice: I18n.t('orders.successfully_deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabrication_order.destroy\n respond_to do |format|\n format.html { redirect_to fabrication_orders_url, notice: 'Fabrication order was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_cake_order.destroy\n respond_to do |format|\n format.html { redirect_to custom_cake_orders_url, notice: 'Custom cake order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_orders_url, notice: 'Ordem de serviço excluída com sucesso.' }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to circle_orders_path, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7318589",
"0.7300436",
"0.72904706",
"0.72790307",
"0.72659403",
"0.7234647",
"0.72334635",
"0.7226227",
"0.71964484",
"0.7172841",
"0.7155792",
"0.7150181",
"0.7118461",
"0.71173495",
"0.7095023",
"0.7089124",
"0.70787394",
"0.7072836",
"0.7051535",
"0.70460993",
"0.704023",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7030727",
"0.7027597",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7027009",
"0.7023211",
"0.70101196",
"0.70029265",
"0.70029265",
"0.70029265",
"0.70029265",
"0.70029265",
"0.7001192",
"0.699749",
"0.69967395",
"0.697114",
"0.69698936",
"0.6963463",
"0.69525796",
"0.69473654",
"0.69305557",
"0.6918218",
"0.69172007",
"0.69141424",
"0.6907105",
"0.6905389",
"0.6900342",
"0.68864316",
"0.6875099",
"0.6874316",
"0.68734604",
"0.68372035",
"0.68372035",
"0.68372035"
] |
0.7530425
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.